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 .\"
brown@vidiot.UUCP (Vidiot) (04/09/91)
In article <5353@ns-mx.uiowa.edu> papalacharla@icaen.uiowa.edu (Paparao Palacharla) writes:
<Does anyone know how to include postscript files in troff files? If so
<how and where can I get the software.
You don't say which troff you are using. If it is a troff text processor that
provides output for the C/A/T phototypesetter, then the answer is you can't.
Not easily anyway. The old troff produces very specialized output that can't
contain any kind of special code that can be sent to the post processor that
converts C/A/T output to PostScript.
But, if you are using a post-processor, like the pscat program from the Adobe
TranScript package, you can put a special keyword into the text. You can then
find that keyword in the PostScript output and manually edit in the PostScript.
The keyword is just some normal text that will never be in the document, some
unique word in caps will do. Normal 10pt text is preferred, since that will
keep if from being kerned. The complete PostScript line that contains the
keyword will be replaced with your PostScript data. You must surround the
included text with the following:
% Modified PB procedure to place origin at upper left corner
/MB{save /psv exch def 6.0 -6.0 scale
3 -16 translate 0 0 moveto}def
/PE{psv restore}def
This goes into the Adobe TranScript pscat.pro file, or you can add it right
before your text. If you add it to the dictionary, you can easily use the
two procedures anywhere in the PostScript output. Use the `MB' procedure
right before your inclusion and the `PE' after the inclusion. NOTE: The MB
sets the origin to the upper left corner, so that any kind of paper will work.
If your included input uses the lower left corner, change the `-6.0 scale' to
`6.0 scale' and `0 moveto' to `-792 moveto'.
If you are using ditroff, then the Adobe TranScript program psdit can be used
to include PostScript files. See the psdit man page for details. If you are
not using Adobe TranScript, then I have no idea what your post-processor will
allow you to do. You'll have to check your man pages.
To make all of this easier, get the groff text handling package. It has
PostScript inclusion built in.
Needless to say, but I have included PostScript stuff into old troff and
Adobe pscat, ditroff with Adobe psdit and groff.
--
harvard\ att!nicmad\ spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot ucbvax!uwvax..........!astroatc!vidiot!brown
rutgers/ decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu
clewis@ferret.ocunix.on.ca (Chris Lewis) (04/10/91)
In article <5353@ns-mx.uiowa.edu> papalacharla@icaen.uiowa.edu (Paparao Palacharla) writes: >Does anyone know how to include postscript files in troff files? If so >how and where can I get the software. The best solution is "psfig" - which was posted in comp.sources.unix, and available from uunet amongst other places. It wants to see EPS files, but it ain't terribly picky, so you can probably munge just about anything to work without too much trouble. 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. -- 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, current patchlevel is *7*.
clewis@ferret.ocunix.on.ca (Chris Lewis) (04/12/91)
In article <1595@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes: >In article <5353@ns-mx.uiowa.edu> papalacharla@icaen.uiowa.edu (Paparao Palacharla) writes: ><Does anyone know how to include postscript files in troff files? If so ><how and where can I get the software. >You don't say which troff you are using. If it is a troff text processor that >provides output for the C/A/T phototypesetter, then the answer is you can't. You lie beagle breath! ;-) ;-) Well, you can't if you're driving a C/A/T phototypesetter, which wouldn't make any sense because it ain't postscript. In order to use that old version of troff, you need a CAT to <something> converter (postscript in this case). Such as psroff, thack or pscat (from Transcript). >Not easily anyway. The old troff produces very specialized output that can't >contain any kind of special code that can be sent to the post processor that >converts C/A/T output to PostScript. Psroff (1.0 thru 3.0) can do this with CAT troff when driving Postscript. It even works with psfig in psroff 3.0. I don't think any of the other CAT troff to (anything) converters can do this - though you imply that pscat might be able to. (psroff 3.0 does this by faking \X''). >But, if you are using a post-processor, like the pscat program from the Adobe >TranScript package, you can put a special keyword into the text. You can then >find that keyword in the PostScript output and manually edit in the PostScript. >The keyword is just some normal text that will never be in the document, some >unique word in caps will do. Normal 10pt text is preferred, since that will >keep if from being kerned. The complete PostScript line that contains the >keyword will be replaced with your PostScript data. You must surround the >included text with the following: This is a useful approach if you have a "dumb" filter. The reason you want it at 10 point is not because of kerning, but is because you want to have the pointsize at an integral multiple of the width table "unitwidth" parameter. Otherwise, ditroff's integer width calculations may have a off-by-1 error, and some optimizers (such as the one in psroff) will break the word into more than one hunk. Other things that can go wrong is that the token might get hyphenated, and it requires that you understand the Postscript that the driver emits so that you can figger out how to insert the code. Many ditroff-to-<something> converters have support for \X'f...' and \X'p...' (or similar). Where these are converted into file includes and raw postscript passthru. This is what psfig uses, and psroff supports it, along with later versions of psdit (which is what comes in Transcript I think). Versions of tpscript can support this too. There are other conventions for this, so you may have to consult your manuals. The best solution is to use psfig. Psfig works with EPS (you really only need a BoundingBox comment, and that's easy if you are writing the postscript yourself) and knows how to scale and place the item according to what you want, and takes pains to ensure that the inclusion doesn't bugger up the postscript and tells troff how big a space to leave for it. Using your method, or the other \! approach, or using \X directly requires you to do a lot more about allocating space in troff, scaling/placing the object, and making sure you don't blow up the "imaging model" that the postscript driver is trying to use. (Eg: scales/rotates/translates buggering up subsequent troff output). >To make all of this easier, get the groff text handling package. It has >PostScript inclusion built in. Psroff 3.0 has it built in for both CAT troff and ditroff, and is a bit easier to get into a machine than groff. It also has a lot of other interesting "side" mechanisms. Also does a pretty good job with Laserjets. -- 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!
brown@vidiot.UUCP (Vidiot) (04/14/91)
In article <1383@ecicrl.ocunix.on.ca> clewis@ferret.ocunix.on.ca (Chris Lewis) writes: <In article <1595@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes: <>In article <5353@ns-mx.uiowa.edu> papalacharla@icaen.uiowa.edu (Paparao Palacharla) writes: <><Does anyone know how to include postscript files in troff files? If so <><how and where can I get the software. < <>You don't say which troff you are using. If it is a troff text processor that <>provides output for the C/A/T phototypesetter, then the answer is you can't. < <You lie beagle breath! ;-) ;-) Well, you can't if you're driving a C/A/T <phototypesetter, which wouldn't make any sense because it ain't postscript. <In order to use that old version of troff, you need a CAT to <something> <converter (postscript in this case). Such as psroff, thack or pscat (from <Transcript). < <>Not easily anyway. The old troff produces very specialized output that can't <>contain any kind of special code that can be sent to the post processor that <>converts C/A/T output to PostScript. < <Psroff (1.0 thru 3.0) can do this with CAT troff when driving Postscript. <It even works with psfig in psroff 3.0. I don't think any of the other CAT <troff to (anything) converters can do this - though you imply that pscat <might be able to. (psroff 3.0 does this by faking \X''). All the troff books that I have read say that C/A/T troff output cannot contain any special codes. Because it cannot contain anything that a postprocessor can use, how can it possibly pass information that can be used by a program like psroff (non-Adobe)? I was not implying that pscat can. I'm saying that it can't, which is why I ended up playing the games that I did to get it to do what I did. <>But, if you are using a post-processor, like the pscat program from the Adobe <>TranScript package, you can put a special keyword into the text. You can then <>find that keyword in the PostScript output and manually edit in the PostScript. <>The keyword is just some normal text that will never be in the document, some <>unique word in caps will do. Normal 10pt text is preferred, since that will <>keep if from being kerned. The complete PostScript line that contains the <>keyword will be replaced with your PostScript data. You must surround the <>included text with the following: < <Many ditroff-to-<something> converters have support for \X'f...' and <\X'p...' (or similar). Where these are converted into file includes and <raw postscript passthru. This is what psfig uses, and psroff supports <it, along with later versions of psdit (which is what comes in Transcript <I think). Versions of tpscript can support this too. There are other <conventions for this, so you may have to consult your manuals. There must be something that I am missing. Is your psroff a troff replacement or a postprocessor of troff output? If it is a troff replacement, this is a whole different story, making CAT troff discussion moot. If psroff is a post-processor to CAT troff, then how the Hell can psroff be told to include PostScript since things like \! and \X do not work. Is there something in troff that I don't know about? Is there a game that you are playing. <Using your method, or the other \! approach, or using \X directly requires <you to do a lot more about allocating space in troff, scaling/placing the <object, and making sure you don't blow up the "imaging model" that the <postscript driver is trying to use. (Eg: scales/rotates/translates buggering <up subsequent troff output). If the original poster is using ditroff, then things like \! and \X can be made to work, since the output of ditroff is totally different than CAT troff. The "imaging model" is secured by the MB and PE procedures that I had in the reply that I did. <>To make all of this easier, get the groff text handling package. It has <>PostScript inclusion built in. < <Psroff 3.0 has it built in for both CAT troff and ditroff, and is a bit <easier to get into a machine than groff. It also has a lot of other <interesting "side" mechanisms. Also does a pretty good job with Laserjets. Like I asked above, how can CAT troff be told to do something that it wasn't built to do? I replied with the information that I had and the software that I have been using. -- harvard\ att!nicmad\ spool.cs.wisc.edu!astroatc!vidiot!brown Vidiot ucbvax!uwvax..........!astroatc!vidiot!brown rutgers/ decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu
stefan@shiva.systemware.de (Stefan Stapelberg) (04/14/91)
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>
clewis@ferret.ocunix.on.ca (Chris Lewis) (04/17/91)
[Sorry for the rearrangement, but the context is more or less correct] In article <1612@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes: >In article <1383@ecicrl.ocunix.on.ca> clewis@ferret.ocunix.on.ca (Chris Lewis) writes: >>In article <1595@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes: >>>You don't say which troff you are using. If it is a troff text processor that >>>provides output for the C/A/T phototypesetter, then the answer is you can't. >>Psroff (1.0 thru 3.0) can do this with CAT troff when driving Postscript. >>It even works with psfig in psroff 3.0. I don't think any of the other CAT >>troff to (anything) converters can do this - though you imply that pscat >>might be able to. (psroff 3.0 does this by faking \X''). >There must be something that I am missing. Is your psroff a troff replacement >or a postprocessor of troff output? If it is a troff replacement, this is a >whole different story, making CAT troff discussion moot. If psroff is a >post-processor to CAT troff, then how the Hell can psroff be told to include >PostScript since things like \! and \X do not work. Is there something in >troff that I don't know about? Is there a game that you are playing. Psroff is a postprocessor for both CAT troff and ditroff. It can generate HPPCL with incremental downloading, Postscript and ditroff (eg: X windows previewing). It's been tested with literally dozens of different imaging devices and systems (DPS, xtroff, xditview, LJIII builtin fonts, Pageview etc.) Two games actually. Game #1 (simplified): - There is no CAT code corresponding to the letter 'M'. Eg: in CAT output, 0115 can never occur. - So, you put this in your CAT troff input: .tm "Mhello there" - And you use troff thusly: (troff -t ... 2>&1) | cat-2-whatever - Inside the cat-2-whatever, you then catch the 'M', and following that, you get "hello there" in ascii terminated by a newline. So, you just have to define your back-end command convention. Such as font mounts, file inclusion, passthru, character extensions, ".sy" emulation etc. - This stuff is wrapped in a variety of macros so you don't lose normal operation of .tm (ie: macro error messages) etc. - Problems: this forces a break no matter what you do. For ".fp" assists and raw postscript inclusions this is not a problem. It's also hard to see troff errors because there isn't a way to disambiguate them from CAT codes. Given source code to the CAT-2-whatever tool, game #1 is easy to implement. (But I expect royalties. Just kidding) Game #2 (simplied): In the cat-2-whatever converter, implement a finite automaton (state machine) to recognize certain sequences and extract the backend commands from them. The sequence psroff uses is roughly this: \ka\o'\(bs\(bs'<command>\(bs\h'\nau' (mark current horizontal position in "a", overstrike two bs's, copy the command, terminate with \(bs, and reposition to beginning). I use a perl script to convert \X'...', \D'...' and non-CAT \(xx characters into the equivalent \(bs sequences. The command comes thru in CAT flash codes that have to be converted back to ASCII. As it turns out, the code for both of these mechanisms has a lot in common. At present, the FA can't always perfectly reliably intercept the sequences, but it works well enough on everything except complicated pic output. Doing game #2 is complicated by the fact that CAT troff prints "bidirectionally" (because the CAT is a mechanical device), and that in psroff, it's in between several layers of buffering and output optimizer (Psroff's output postscript is very fast - close to rated PPM even on old AppleWriters) With CAT troff and psroff, you not only get \X'...' emulation, but \D'...', ".sy" and an extended character set and a few other things I can't think of at the moment. With the optimizer, you can also use the "sed the postscript output and mangle at suitable places" approach. Your approach will work with CAT troff & psroff too. Or, at least it should (given that your Postscript code is modified as necessary to take into account psroff's imaging model). ><Using your method, or the other \! approach, or using \X directly requires ><you to do a lot more about allocating space in troff, scaling/placing the ><object, and making sure you don't blow up the "imaging model" that the ><postscript driver is trying to use. (Eg: scales/rotates/translates buggering ><up subsequent troff output). >If the original poster is using ditroff, then things like \! and \X can be >made to work, since the output of ditroff is totally different than CAT troff. >The "imaging model" is secured by the MB and PE procedures that I had in the >reply that I did. "Can be made to work" is rather different than "everything's automatic" in psfig. Given EPS's, psfig is trivial to use. You say (roughly) to psfig: .F+ 2i file such-and-so .F- And everything's done for you - page placement, space allocation, scaling and all. No need to know postscript or even raw troff. >Like I asked above, how can CAT troff be told to do something that it wasn't >built to do? Genius wins out ;-) >I replied with the information that I had and the software that I have been >using. I know that. Just letting people know that there are alternatives that eliminate these restrictions. -- 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!
brown@vidiot.UUCP (Vidiot) (04/18/91)
In article <1407@ecicrl.ocunix.on.ca> clewis@ferret.ocunix.on.ca (Chris Lewis) writes:
<
<Game #1 (simplified):
< - There is no CAT code corresponding to the letter 'M'. Eg: in
< CAT output, 0115 can never occur.
< - So, you put this in your CAT troff input:
< .tm "Mhello there"
< - And you use troff thusly:
< (troff -t ... 2>&1) | cat-2-whatever
I can't find my docs on the CAT output. In any event, there obviously has
to be a letter M, otherwise there would have been many screwed up documents.
I have to assume that you mean the octal code 115 is not used in the CAT
output codes. This happens to correspond to the letter M. Therefore, if
that code appears in the CAT output (actually it doesn't), then it means
something special to the post-processor.
Neat little trick.
The PostScript inclusion files that I have have fixed positions in the
PostScript file and they are not meant to be positioned by the troff itself.
It is meant to be positioned with PostScript code. That way the troff source
doesn't have to worry about where the characters are positioned. But, there
are obviously many situations where this does have to happen.
Thanks for the info. I will keep it handy. Boy, the games people play to
get around problems. :-)
--
harvard\ att!nicmad\ spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot ucbvax!uwvax..........!astroatc!vidiot!brown
rutgers/ decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu
clewis@ferret.ocunix.on.ca (Chris Lewis) (04/19/91)
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!
stefan@shiva.systemware.de (Stefan Stapelberg) (04/20/91)
In article <1412@ecicrl.ocunix.on.ca> clewis@ferret.ocunix.on.ca (Chris Lewis) writes: |Sounds like a psfig replacement. Have you looked at psfig? You'd probably |get some good ideas from it. Need a beta tester? No, unfortunately I don't know psfig. Thanks for your offer to test pspic. [I have changed the name from 'tpic' to 'pspic' since there already exists a program called tpic. Thanks to James Clark for pointing this out.] I wrote: |> ** 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. In one of the first trial versions, I used a .sp instruction to set a current position, emitting an unpaddable space ('\ ') on a line by itself and finally spacing one line back. Since this trick always caused a line break, I changed this to emit the x-pos/y-pos directly in Postscript. Your solution is much better (it didn't came to my mind to use \h and \v and to emit just one "faked" character). |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. Unfortunately I have no source code. Maybe I can convince my vendor to install this patch (I am still using DWB 2.0 and it's very unlikely that newer versions will become available for my system). |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. If there is no bounding box, the width and height of the picture must be specified to the .PI-macro (the traditional way :-). pspic can arbitrarily size the picture by scaling it to fit in a given frame. In this case there must exist a bounding box, the width (or height) must be specified, and the option "zoom" has to be set for the picture. Regards, Stefan __ Stefan Stapelberg, <stefan@systemware.de>
clewis@ferret.ocunix.on.ca (Chris Lewis) (04/23/91)
In article <1634@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes: >In article <1407@ecicrl.ocunix.on.ca> clewis@ferret.ocunix.on.ca (Chris Lewis) writes: ><Game #1 (simplified): >< - There is no CAT code corresponding to the letter 'M'. Eg: in >< CAT output, 0115 can never occur. >< - So, you put this in your CAT troff input: >< .tm "Mhello there" >< - And you use troff thusly: >< (troff -t ... 2>&1) | cat-2-whatever >I can't find my docs on the CAT output. In any event, there obviously has >to be a letter M, otherwise there would have been many screwed up documents. >I have to assume that you mean the octal code 115 is not used in the CAT >output codes. This happens to correspond to the letter M. Therefore, if >that code appears in the CAT output (actually it doesn't), then it means >something special to the post-processor. Sorry about that - I'll rephrase: according to cat.5 (mine is written by Henry Spencer...) the octet 0115 is not valid in the output of CAT troff. Ie: an unused opcode. In ASCII "M" is 0115, but CAT output does not contain ASCII codes for characters. Except when you merge ".tm" output into the CAT codes... (consider yourself lucky that one of the unused codes in CAT language is a 7-bit ascii character that can be uttered into the input of CAT troff. If the unused ones were all 8-bit on, we'd probably have been out of luck) >Neat little trick. Thanks... >The PostScript inclusion files that I have have fixed positions in the >PostScript file and they are not meant to be positioned by the troff itself. >It is meant to be positioned with PostScript code. That way the troff source >doesn't have to worry about where the characters are positioned. But, there >are obviously many situations where this does have to happen. The basic mechanism (file inclusion, passthru) doesn't do the positioning. Without other measures (psfig, current point etc.) the postscript would be of necessity absolute positioning. The ".tm Mf" and ".tm Mp" are merely kludgey renditions of \X'f..' and \X'p..' and, by themselves, don't do anything fancier than file inclusion and passthru. Psroff contains samples of both - "form" overlay (letterhead drawing via inclusion of "absolute" postscript.), and use with psfig is an example of floating scalable pictures with a consistent (with the rest of the troff family of software) interface. Use of Psfig (either with psroff (CAT/ditroff) or any ditroff to postscript converter) gives you both. >Thanks for the info. I will keep it handy. Boy, the games people play to >get around problems. :-) No kidding! -- Chris Lewis, Phone: (613) 832-0541, Domain: clewis@ferret.ocunix.on.ca UUCP: ...!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!