\special
command (or the \PSbox
macro below) to include a
file.22
If you are using a program which generates Encapsulated PostScript Files,
you can simply use the epsf
package, and then say
\epsfbox{filename.eps}at the place where you want the figure. This automatically reserves space for the PostScript picture based on the size stored in it. See the
dvips
man page or one of the LATEX books for more details.
To include a non-Encapsulated PostScript file (i.e. one written by hand or by certain drawing programs):
\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 proper
placement and spacing.
\newcommand{\PSbox}[3]{\mbox{\special{psfile=#1}\hspace{#2}\rule{0pt}{#3}}}
\PSbox{/mit/username/filename.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 included in a figure, or anything else you want!
\PSbox{/mit/username/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{/mit/username/filename.PS hoffset=-144 voffset=-216}{5in}{4in}
NOTE: xdvi
cannot show included PostScript figures; instead, it leaves
a blank space of the correct size. Xdvi
will also print a
warning that says `xdvi: special ``filename'' not implemented'
every time you preview a page with a PostScript figure on it. This is
nothing to worry about--it's just reminding you that it can't preview
the PostScript figure--it should still print out without any problems. The
version of xdvi
currently installed in the sipb
and
newtex
lockers can preview PostScript figures, either using
the native Display PostScriptfeatures (default), or by rendering the image through
another program first (the ``-nodps
'' option). This feature
still has some problems, and in some circumstances X server bugs could
caused you to be logged out without warning. As always, we recommend
that you save your files early and often.
If you want to see where the PostScript picture will appear, you can
change the \mbox
in the definition of \PSbox
to
\fbox
. In other words, you'd change the line
\newcommand{\PSbox}[3]{\mbox{\special{psfile=#1}\hspace{#2}\rule{0pt}{#3}}}
in your document to be:
\newcommand{\PSbox}[3]{\fbox{\special{psfile=#1}\hspace{#2}\rule{0pt}{#3}}}Assuming that you have specified the arguments to
\PSbox
correctly, this
will result in a box being drawn around the area where the PostScript
image will appear. However, when you print your LATEX document, the box
will appear on the printed output as well. You will need to change the
\fbox
back to \mbox
and run LATEX again on your file
to make the box go away when you want to print your final copy.