papalacharla@icaen.uiowa.edu (Paparao Palacharla) (04/08/91)
Does anyone know how to include postscript files in troff files? If so how and where can I get the software. thanx rao
wjh+@andrew.cmu.edu (Fred Hansen) (04/09/91)
The Andrew Toolkit supports embedding PostScript in text with the PB,PE macros given below. With these macros the PostScript code can be embedded in a line of text which can be left-justified, centered, or right-justified. The top of the image is aligned with the top of the text. The PostScript origin for the image is in the lower left corner and units are the standard PostScript point. The trick is to split the line into two lines so the PostScript can be flushed into the buffer at the proper point. This trick often fails if more than one PostScript inclusion is on one line. The code even works on non-postscript printers, in which case it prints an empty rectangle. Fred Hansen The PostScript code has to be wrapped in six lines of stuff. Note that the width and height of the PostScript insertion, in points, appears three places. For this example, the width is 432 PostScript points and the height 130. 'PB 432 130 'if \n(zT \{\ \!%! \! 432 troffadjust 130 neg translate (the PostScript code goes here; each line starts with "\!") \! \} 'PE 432 130 Here are the macros (formatted for inclusion in a tmac library): .\" Begin of the PSmacros, courtesy of Fred Hansen .\" .nr zT 0 '\" CCH added next line for post printer type .if "\*(.T"post" 'nr zT 1 .if "\*(.T"postscript" 'nr zT 1 .if "\*(.T"psc" 'nr zT 1 .de PB 'ne \\$2p 'nr zw \\n(.l-\\n(.k-1m-\\$1p 'nr zH \\n(.k 'nr zV \\n(.d 'if \\n(zT \\{\\ 'ie !\\n(zw \\{\\ 'nr zx \\n(.l-\\$1p-10m 'nr zV \\n(zV+1v .sp 0 \\v'-.75v'\\ \\v'+.75v'\\c\\} 'el \\{\\ 'nr zx \\n(zw-10m \\v'-.75v'\\ \\v'+.75v'\\c\\} .sp |\\n(zVu 'if ((\\n(zx<=0)&(\\$2p>0.75v)) \\x'\\$2p-0.75v'\\c \\!% \\!%! \\! PB 'if \\n(.j=3 \\{\\ \\! /troffadjust { neg 2 idiv } def 'ss\\} 'if \\n(.j=5 \\{\\ \\! /troffadjust { neg } def 'ss\\} 'if \\n(.j<3 \\{\\ \\! /troffadjust { pop 0 } def 'ss\\}\\} .. .de PE 'if \\n(zT \\{\\ \\! PE \\!. 'ie \\n(zx \\{\\ 'if (\\$2p>0.75v) \\x'\\$2p-0.75v'\\c \\h'-\\n(.ku+\\n(zHu+\\$1p'\\c\\} 'el .br\\} 'if !\\n(zT \\{\\ 'if !\\n(zw \\{\\ \\h'-\\n(.k'\\ \\h'-\\n(.w'\\c .sp -1\\} \\x'\\$2p-0.75v'\\v'-.75v'\\D'l \\$1p \ 0.0i'\\D'l 0.0i \\$2p'\\D'l -\\$1p 0.0i'\\D'l 0.0i \ -\\$2p'\\v'+.75v'\\h'\\$1p'\\c\\} .. .\" .\" End of PSmacros .\"