dvips.
In general, this section applies to any TeX or LaTeX document
which mixes text and graphics. teTeX, like most other TeX
distributions, is configured to request Computer Modern fonts by
default. When printing documents with Type 1 scalable fonts or
graphics, font and graphics imaging is the job of
dvips. dvips can use either Computer
Modern bit mapped fonts or Type 1 scalable fonts, or any
combination of the two. First, let's concentrate on printing and
previewing some graphics.
You will probably want to follow this procedure any time a LaTeX source document has the statement
\includepackage{graphics}
in the document preamble. This statement tells LaTeX to
include the text of the graphics.sty package in the
source document. There are other commands to perform graphics
operations, and the statements in plain-TeX documents may not clue
you in whether you need to use dvips. The difference
will be apparent in the output, though, when the document is
printed with missing figures and other graphics.
So, for now, we'll concentrate on printing documents which use
the LaTeX graphics.sty package. You might want to
take a look at the original TeX input. It isn't included in the
teTeX distribution, but it is available at
~CTAN/macros/latex/packages/graphics/grfguide.tex.What the teTeX distribution does include is the
.dvi output file, and it is already TeXed for you.
There is a reason for this, and it has to do with the necessity of
including Type 1 fonts in the output in order for the document to
print properly. If you want to LaTeX grfguide.tex, see
the next section. For now, however, we'll work on getting usable
output using dvips.
The file grfguide.dvi is located in the directory
texmf/doc/latex/graphicsThe first step in outputting
grfguide.dvi is to
translate it to Postscript. The program dvips is used
for this. It does just exactly what its name implies. There are
many options available for invoking dvips, but the
simplest (nearly) form is
dvips -f -r <grfguide.dvi >grfguide.psThe
-f command switch tells dvips
to operate as a filter, reading from standard input and writing to
standard output. dvips output can be configured so its
output defaults to lpr.
If you can print Postscript directly to your printer via
lpr, you can simply type
dvips -r grfguide.dviThe
-r option tells dvips to output the pages in
reverse order so they stack correctly when they exit a printer. Use
it or not, as appropriate for your output device.
Depending on whether you still have the fonts that
dvilj2 generated from the last document,
dvips and metafont may or may not need to create new
fonts needed by grfguide.dvi. Eventually, though,
dvips will output a list of the pages translated to
Postscript, and you will have your Postscript output ready to be
rendered on whatever output device you have available.
If you're lucky (and rich), then you have a Postscript-capable
printer already and will be able to print
grfguide.ps directly. You can either spool the
output to the printer using lpr. If for some reason
your printer software doesn't work right with Postscript files,
you can, in a pinch, simply dump the file to printer, with
cat grfguide.ps >/dev/lp0or whichever port your printer is attached to, though this is not recommended for everyday use.
If you want or need to invoke Ghostscript manually, this is the standard procedure for its operation. The first thing you want to do is invoke Ghostscript to view its command line arguments, like this:
gs -help | lessYou'll see a list of supported output devices and sundry other commands. Pick the output device which most nearly matches your printer. I generally produce black-and-white text and use the
cdjmono driver, which drives a color Deskjet in
monochrome (black and white) mode.
The command line I would use is:
gs -dNOPAUSE -sDEVICE=cdjmono -sOutputFile=/tmp/gs.out grfguide.ps -c quitThis will produce my HP-compatible output in the
/tmp directory. It's a good idea to use a directory
like /tmp, because gs can be particular
about access permissions, and you can't (and shouldn't) always
count on being logged in as root to perform these
steps. Now you can print the file:
lpr /tmp/gs.outObviously, this can all go into a shell script. On my system, I have two simple scripts written,
pv and
pr, which simply outputs the Postscript file either to
the display or the printer. Screen previewing is possible without
X, but it's far from ideal. So, it's definitely worth the effort to
install XFree86 to view the output on the screen..
The order of commands in a gs command line is
significant, because some of the options tell Ghostscript to look
for pieces of Postscript code from its library.
The important thing to remember is that grfguide.dvi
makes requests for both Computer Modern bit mapped and Type 1
scaled fonts. If you can mix scalable and bit mapped fonts in a
document, you're well on the way to becoming a TeXpert.
The teTeX distribution comes with only a limited selection of DVI
output drivers: dvips, drivers for Hewlett Packard
LaserJets, and nothing else. You have two options if you have a
printer which isn't LaserJet-compatible: You can use
dvips and Ghostscript, which I would recommend
anyway, for reasons already mentioned, or you can investigate
other dviware sources.
A limited number of DVI drivers have been ported to Linux and are available as pre-built binaries. They are located in the Linux archives at ftp://sunsite.unc.edu/pub/Linux/apps/tex/dvi/.
The master dviware libraries are maintained at the University of Utah archives. If you can't find a DVI driver there that supports your printer, chances are that it doesn't exist. You can also write your own DVI driver using the templates available there. The library's URL is ftp://ftp.math.utah.edu/pub/tex/dvi/.