[comp.text] Using Postscript in TeX

wheeler@symcom.math.uiuc.EDU (04/16/88)

/* Written 11:15 am  Apr  5, 1988 by wheeler@symcom.math.uiuc.EDU in symcom:uiuc.tex */
/* ---------- "Using Postscript in TeX" ---------- */

How exactly do I place a postcript document in a plain TeX file?

I have a postcript file of a small contour that I made from a
demo version of Framemaker.  I would like to place this figure
centered in a plain TeX file.  I naively tried to put the
postcript in a \special but this alone didn't seem to work.

This is my first attempt of putting any graphics in a TeX file.
Any suggestions would be greatly appreciated.

Ferrell Wheeler
Department of Mathematics
University of Illinois at Urbana-Champaign
.
 
/* End of text from symcom:uiuc.tex */

halvers@iraq.steinmetz (peter c halverson) (04/18/88)

In article <18600001@symcom> wheeler@symcom.math.uiuc.EDU writes:
>
>How exactly do I place a postcript document in a plain TeX file?
>
>I have a postcript file of a small contour that I made from a
>demo version of Framemaker.  I would like to place this figure
>centered in a plain TeX file.  I naively tried to put the
>postcript in a \special but this alone didn't seem to work.
>

We've got a number of semi-kludges that provide for just this kind of
capability, since we've got people who want to include FrameMaker,
Interleaf WPS, Macintosh, and several other sources of graphic images into
(in our case) LaTeX documents --- I'm sure the equivalent plain TeX
solution is similar.  The exact solution depends a great deal on how the
PostScript is structured, and to a lesser degree on how your particular
device driver implements the \special command.  In general, however, you
usually need to hack the PostScript file to change the following:

  o remove any "showpage" operators, so TeX can finish the page properly.
  o add a "currentpoint translate" command, to properly position the
    output on the page.  You can also add a scaling command here as well.
  o save the VM before including your file, and restore it when done, to
    minimize interference with the TeX/LaTeX environment
  o Seek and eliminate anything else that your PostScript's doing that
    would screw up the TeX page :-(

We have a number of awk(1) scripts that do this.  Obviously, this is
extremely dependent on the source and version of your graphic --- i.e.,
between the three versions of FrameMaker that I've seen around here, the
PostScript they generate is in totally different formats.

Once you've "normalized" your PostScript, you can include it into your text
with the \special command.  The exact syntax for including a file is
dependent on the device driver you use.  You'll need to explicitly specify the
amount of vertical space the figure will use --- whether the vspace should
come before or after your \special command depends, again, on the source of
your graphic: for FrameMaker or Macintosh stuff, the space must be added
before the figure is included; for Interleaf, it must come after the
figure. 

As an example, we use the following setup to include a "normalized"
FrameMaker file in a LaTeX document, using ArborText's DVIPS PostScript
driver: 

   \begin{figure}
      \vspace{3.0in}
      \special{ps: plotfile myfile.ps global}
      \caption{Sample Figure}
   \end{figure}

In general this seems to work fairly well, but whether the process of
creating the graphic, normalizing it to work with TeX, and setting up the
right TeX commands isn't more trouble than manual cut 'n' paste is still up
for debate.  The PostScript that some of these systems generate gets pretty
hairy sometimes, and tends to interact with the TeX PostScript in nastily
mysterious ways.


~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Pete Halverson                       ARPA: halverson@ge-crd.ARPA
GE Corporate R&D Center	             UUCP: uunet!steinmetz!iraq!halvers
Schenectady, NY				   halvers@iraq.steinmetz.UUCP

"Inconceivable!"
"You use that word a lot.  I don't think it means what you think it does."

las@msudoc.ee.mich-state.edu (Larry A. Sheilds {runs Lunapark}) (04/18/88)

You ned the psfigtex macros and a compatible dvi program such as
dvips both of which are available or my bbs as well as else where.

==larry

---------------------------
LARRY SHIELDS                        UUCP: ...!ihnp4!msudoc!lunapark!larry
P.O. Box 6159                        BIX:  lshields
E. Lansing, MI 48826                 Compuserve: 70277, 3677

BBS: lunapark 1200/2400 8-1-N  24hrs 7 days a week  (517) 337-3844 login: bbs

ekrell@hector.UUCP (Eduardo Krell) (04/18/88)

It all depends on whether your DVI -> PostScript translator supports
the \special hook to include postscript files. Some of them do, but
the syntax is different in all the ones I've seen (and some are more
powerful than others). For instance, the one I'm using right now (called
dvips) uses:

		\special{psfile="filename"[,key=value]*}

     possible keys are:

     hoffset			   The horizontal offset
     voffset			   The vertical	offset
     hsize			   The horizontal clipping size
     vsize			   The vertical	clipping size
     hscale			   The horizontal scaling factor
     vscale			   The vertical	scaling	factor
     rotate			   The rotation
    
    Eduardo Krell                   AT&T Bell Laboratories, Murray Hill, NJ

    UUCP: {ihnp4,ucbvax}!ulysses!ekrell		ARPA: ekrell@ulysses.att.com