Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!mauxci!eci386!ecicrl!clewis From: clewis@ferret.ocunix.on.ca (Chris Lewis) Newsgroups: comp.lang.postscript Subject: Re: including postscript files in troff files Message-ID: <1412@ecicrl.ocunix.on.ca> Date: 19 Apr 91 03:14:31 GMT References: <5353@ns-mx.uiowa.edu> <1378@ecicrl.ocunix.on.ca> <1472@shiva.systemware.de> Organization: Elegant Communications Inc., Ottawa, Canada Lines: 65 In article <1472@shiva.systemware.de> stefan@systemware.de (Stefan Stapelberg) writes: >>[re \X'f...' and \X'p...'] >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. troff2ps does support "\!" but only on ditroff input (tpscript, dpost and I presume eps are just ditroff to Postscript converters). Old troff doesn't support \!. (Gawd, I've give my left ... for a real \! or \X in CAT troff, but it's too late. The ditroff to cat troff converter kludges in support for \X, but I should make sure it does \! too) >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. Sounds like a psfig replacement. Have you looked at psfig? You'd probably get some good ideas from it. Need a beta tester? >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.** Like you said, this isn't a good idea, for it makes you dependent on the "language" that the dit2ps is emitting. Troff2ps uses an X and Y, but not the arguments you expect. In fact, troff2ps's output doesn't *have* functions to do this at all. See the hint below. > 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? Yes. Psfig does this: .tr \(ts Then, it use the \h and \v to set a current position and then emits \(ts, then follows with all of the \X stuff to do the postscript inclusion. Since \(ts has been aliased to "space", you'll get the positioning, but not the glyph itself. This works well with both CAT troff (via psroff's \X support) and ditroff. Psfig comes with a patch to ditroff to "sync" the X and Y coordinate when an \X is being emitted - an H and V ditroff code will be emitted. The patch shows some context from that portion of the code, and it's clear that not emitting the current X & Y position was an oversight. If you can apply this patch, you don't have to use the \(ts kludge. Nils-Peter? Have you fixed this in DWB 3.x? Please? Your sample doesn't make it clear that tpic can arbitrarily size the picture, nor is it clear it can find out how much space to reserve in troff if there's no bounding box. -- Chris Lewis, Phone: (613) 832-0541, Internet: clewis@ferret.ocunix.on.ca UUCP: uunet!mitel!cunews!latour!ecicrl!clewis; Ferret Mailing List: ferret-request@eci386; Psroff (not Adobe Transcript) enquiries: psroff-request@eci386 or Canada 416-832-0541. Psroff 3.0 in c.s.u soon!