🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #5346

Re: including postscript files in troff files

#5346
From: Stefan Stapelberg
Date: Sun, 14 Apr 1991 15:22
66 lines
3407 bytes
In article <1378@ecicrl.ocunix.on.ca> clewis@ferret.ocunix.on.ca (Chris Lewis) writes:
>You might want to see whether you can get the following directives to
>work in your troff:
>	\X'f<filename>'
>and
>	\X'p<token>'
>The former *should* include <filename> in the postscript output, and
>the latter will emit the token as-is in the postscript.

If this directives don't work with your troff, there may be a change that
the troff2ps converter will accept the undocumented escape sequence '!'
which passes through the rest of the line unmodified (that works at least
for tpscript, dpost and eps). In this case you can use use the instruction
`\!!pscode' to include postscript commands in troff documents.

For a book project I am currently working on a troff picture preprocessor
called `tpic', which may also of interest to you if your troff knows the
`\X' directives.  tpic includes any postscript file (not only EPS) into
the troff source surrounding it with instructions to align and draw the
picture and to fill text into the remaining space.

tpic makes three assumptions about troff and its postprocessor:
	1) tpic must be able to pass through raw ps-code (\!! or \X).
	2) tpic uses the postscript functions `X' and `Y' (which are
	   defined by the postprocessor) to position the picture.**
	3) tpic uses the function `pt' (convert number to points) to
	   restore the 1:1 scaling in a device-independent manner.

  ** This is not a very good idea, but so far I have not been able to
     force troff to output a new position command if there is no text
     immediately following the vertical/horizontal space instruction.
     Any hints?

For example, to include a ps file with tpic in the current text, you use
the "macro" `.PI filename' (picture include), which will be replaced by
troff/postscript-instructions (the width and height of the picture will
be taken from the %%BoundingBox: comment, if present):

	tpic input		troff input

	some text		some text
	.PI file.ps		<troff instructions to calculate
	some more text		 xpos and ypos of the picture>
				\!! <xpos> X
				\!! <ypos> Y
				\!!%%BeginDocument: file.ps
				\!!save
				\!!currentpoint translate
				\!!1 pt 1 div dup scale
				<content of file.ps comes here, each
				 line preceeded by '\!!' and a space>
				\!!%%EndDocument
				\!!restore
				<troff instructions to fill text,
				 optionally print a label, cleanup>
				some more text

tpic isn't completely finnished yet, so it may last some time until I will
make it publicly available. I have finnished a manual with many examples
for including ps files, but it is in german language (however, the man page
will be written in bad english :-).  If you are interested in preliminary
information about tpic, contact me.

regards, Stefan
_
Stefan Stapelberg, <stefan@systemware.de>
Technical Details
Message-ID: <1472@shiva.systemware.de>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!unidui!unido!mikros!shiva!stefan
References: <5353@ns-mx.uiowa.edu> <1378@ecicrl.ocunix.on.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!unidui!unido!mikros!shiva!stefan
From: stefan@shiva.systemware.de (Stefan Stapelberg)
Newsgroups: comp.lang.postscript
Subject: Re: including postscript files in troff files
Message-ID: <1472@shiva.systemware.de>
Date: 14 Apr 91 15:22:31 GMT
References: <5353@ns-mx.uiowa.edu> <1378@ecicrl.ocunix.on.ca>
Reply-To: stefan@systemware.de (Stefan Stapelberg)
Organization: MIKROS Systemware, Lohr/Germany
Lines: 66