[comp.text.tex] using dvips with \special

meadows@cslvax.weeg.uiowa.edu (01/29/91)

    I tried to incorporate a postscript figure in a LaTeX document today
using the \special{psfile="filename"} command. It ran through LaTeX and
DVIPS just fine, but when the output was printed, the figure was set in
the upper right hand corner of the page. It looks like it tried to use the
current position as coordinates 0,0 for the postscript figure. My question
is this: how can I reset the coordinates so the figure appears where I 
want it to?

Howard

***************************************************************************
* Howard Meadows       Sr. Systems Programmer     Weeg Computing Center   *
* University Of Iowa   Iowa City, Iowa  52242     Phone: 319-335-5519     *
* Internet : meadows@cslvax.weeg.uiowa.edu                                *
* BITnet   : meadowva@uiamvs.bitnet                                       *
***************************************************************************

moss@cs.umass.edu (Eliot Moss) (01/29/91)

Rather than using \special commands directly, may I suggest you use a package
such as psfig? It will scan the PostScript for bounding box information, allow
you to supply it in the \psfig command, supports scaling, etc. Think of psfig
as high level language and \special as assembly and you get the idea. psfig
works very nicely with Rokicki's dvips, too. Both are available on
labrea.stanford.edu.
--

		J. Eliot B. Moss, Assistant Professor
		Department of Computer and Information Science
		Lederle Graduate Research Center
		University of Massachusetts
		Amherst, MA  01003
		(413) 545-4206, 545-1249 (fax); Moss@cs.umass.edu

eln272v@monu1.cc.monash.oz ( r lang) (01/30/91)

In article <4197@ns-mx.uiowa.edu>, meadows@cslvax.weeg.uiowa.edu writes:
>     I tried to incorporate a postscript figure in a LaTeX document today
> using the \special{psfile="filename"} command. It ran through LaTeX and
> DVIPS just fine, but when the output was printed, the figure was set in
> the upper right hand corner of the page. It looks like it tried to use the
> current position as coordinates 0,0 for the postscript figure. 
It sure did!
Read the dvips documentation on the \special command - there are
hoffset and voffset keywords.  Since you will need to work out values
for hoffset and voffset, you may as well generate a %%BoundingBox 
for your file.
A much better way to handle your problem is to use the \epsffile macro.
Again, read the dvips documentation.  

The following is extracted from dvips.tex

If the document lacks a bounding box altogether, one can be easily added.
Simply print the file.  Now, take a ruler, and make the following measurements.
All measurements should be in PostScript units, so measure it in inches and
multiply by 72.

From the left edge of the paper to the leftmost mark on the paper is
{\it llx}, the first number.  From the bottom edge of the paper to the
bottommost mark on the paper is {\it lly}, the second number.  From
the left edge of the paper to the rightmost mark on the paper is
{\it urx}, the third number.  The fourth and final number, {\it ury}, is
the distance from the bottom of the page to the uppermost mark on the
paper.

Now, add a comment of the following form as the second line of the document.
(The first line should already be a line starting with the two
characters `{\tt \%!}'; if it is not, the file probably isn't PostScript.)
\cmd{\%\%BoundingBox:\ {\it llx lly urx ury}}
\noindent
Or, if you don't want to modify the file, you can simply write these
numbers down in a convenient place and use them when you import the
graphic.

If the document does not have such a bounding box, or if the bounding box
is given at the end of the document, please complain to the authors of the
software package that generated the file; without such a line, including
PostScript graphics can be tedious.
-- 
Russell Lang   Email: rjl@monu1.cc.monash.edu.au   Phone: (03) 565 3460
Department of Electrical and Computer Systems Engineering
Monash University, Australia