Log Initiated for user Jeff Kuo (hkuo@M66-080-13.MIT.EDU [0]).
    [Sun 29-Apr-90  4:45pm]

Topic:          latex

Question:
How can I include a postscript file, e.g. graph produced by rs1, in latex?
___________________________________________________________

--- Question grabbed by consultant lwvanels@COPILOT.MIT.EDU [0].
    [Sun 29-Apr-90  4:47pm]

*** Reply from consultant lwvanels@COPILOT.MIT.EDU [0].
    [Sun 29-Apr-90  4:47pm]
Postscript files CAN be included into LaTeX Documents, and it becomes quite easy
if you take a bit of time and do it step by step:

1)  Include the following line before the \begin{document}.
Most of the magic is needed so that LaTeX knows how big the document is,
so that it can reserve space for the postscript figure for things like
centering.

\newcommand{\PSbox}[3]{\mbox{\rule{0in}{#3}\special{psfile=#1}\hspace{#2}}}

2)  If possible, generate the postscript file such that the picture is
flush against the lower-left-hand corner.  (For example, if idraw is
being used, group the entire picture and move it to the lower-left-hand
corner of the page.  If it is a raw postscript file, add an appropriate
translate command, if you know how.)  When you do this, the left most
1/4" of the document may not be printed, since although (0,0) is at the
lower-left hand corner of the page, on some printers the left most 1/4"
part of the page isn't part of the image area.  Don't worry about it.

3) Print out the postscript file.  There are two reasons for doing
this.  The first is to make sure that there aren't any errors in the
postscript.  The second reason is to get the dimensions of the picture
and where it is located on the page.  Measure the height and the width
of the graphic.  Also, if the graphic is not located in the
lower-left-hand corner, measure the (x,y) distance from the
lower-left-hand corder of the page to lower-left-hand corner of the
graphic IN INCHES.

4) Edit the postscript file to remove the "showpage" command.  It is
usually at the end of the file, but using emacs's search feature is the
fastest way to remove it.  Note that after you do this, the postscript
file will no longer print as a stand-alone document.  If you are using
idraw, idraw will have no problems reading in the modified postscript
file, but it will replace the "showpage" when it writes out the file.

4a)  If the postscript file has the image in the lower-left-hand corner
of the page, it's really easy.  At the point where you want the picture
to be included, just use the following command:

\PSbox{/mit/tytso/tex-macros/myname.PS}{1.7in}{0.25in}
Where the first argument is the filename of the postscript file, the
second is the width of the graphic, and the third argument is the height
of the graphic.  The dimensions can be specified in any format that
LaTeX accepts.  So, for example, a dimension such as "4cm" will also
work.

This "PSbox" can be centered, included in a figure, or anything else you
want!

4b)  If you were unfortunate enough as to be unable to get the graphic
in the lower-left-hand corner, all is not lost.  However, you will need
to do a bit more work.  Take the distance from the left-hand side of the
page (which you measured in inches, right?) and multiply by -72.  Call
this number the "$hoffset".  Take the distance form the bottom of the
page to the bottom of the graphic (also measured inches), multiply it by
-72, and call it the "$voffset".  Then the PSbox command should be
modified to be:

\PSbox{$filename hoffset=$hoffset voffset=$voffset}{$width}{$length}

For example, to include a file which is 4 inches high and 5 inches wide,
which is located 3 inches from the bottom of the page and 2 inches from
the left side of the page, the PSbox would be:

\PSbox{xmath.PS hoffset=-144 voffset=-216}{5in}{4in}

--- User hkuo read reply.
    [Sun 29-Apr-90  4:47pm]


--- Message from consultant Chee Chew (web@NAVIGATOR.MIT.EDU [1]).
    [Sun 29-Apr-90  8:31pm]
I don't believe psfig is a predefined command...  normally it's done in
\special{psfile=whatever.PS hsize=...}

90 rotate will rotate it 90 degrees around the bottom left corner..
becareful how you rotate and where things end up..

.5 .5 scale
