3 .\" .EPS file.eps [L|R|C|indents] [width] [height]
5 . ds eps.tmp /tmp/.eps.\n($$
6 . \" obtaing the bounding box
8 . sy cat "@$1" | sed -n '/%%BoundingBox: \([-0123456789]\{1,10\}\) \([-0123456789]\{1,10\}\) \([-0123456789]\{1,10\}\) \([-0123456789]\{1,10\}\)/{s//.nr llx 0+\1p,.nr lly 0+\2p,.nr urx 0+\3p,.nr ury 0+\4p/p; q; }' | tr ',' '\\n' >@*[eps.tmp]
13 . ie '\\$3'' .nr eps.scale 100
14 . el .nr eps.scale ((\\$3)*100/(\\n[urx]-\\n[llx]))
15 . if !'\\$4'' .if \\n[eps.scale]>(((\\$4)*100/(\\n[ury]-\\n[lly]))) \
16 . nr eps.scale ((\\$4)*100/(\\n[ury]-\\n[lly]))
17 . nr eps.w (\\n[urx]-\\n[llx])*\\n[eps.scale]/100
18 . nr eps.h (\\n[ury]-\\n[lly])*\\n[eps.scale]/100
20 . ie '\\$2'' .nr eps.in 0
21 . el .nr eps.in (\\$2)
22 . if '\\$2'L' .nr eps.in 0
23 . if '\\$2'C' .nr eps.in (\\n(.l-\\n(.i-\\n[eps.w])/2
24 . if '\\$2'R' .nr eps.in (\\n(.l-\\n(.i-\\n[eps.w])
25 . \" printing the image
29 \h'|\\n[eps.in]u'\\X'eps "\\$1" \\n[eps.w]'\h'\\n[eps.w]u'