Using PostScript and DviPS Even if you plan to have your files professionally typeset,4 you should make proofs on a local printer. If you do not have a PostScript printer, you can use Ghostscript, a public domain PostScript interpreter, to print your PostScript files on an arbitrary printer. Ghostscript can also `print' to the screen (see Subsections 6.2.6 and 6.2.5).
PostScript support for TeX is provided by DviPS, written by T. Rokicki. This
program generates PostScript output from a .dvi
file, and offers mechanisms to
include PostScript graphics in a TeX document and to use scalable PostScript
fonts.
We shall first explain how you can make use of PostScript graphics and PostScript fonts in your documents; then we describe the command line interface and configuration of DviPS.
6.2.1 Including PostScript graphics
Encapsulated PostScript (file type .eps
) is a restricted PostScript format suitable
for inclusion in other PostScript files, and is widely used as a graphics file
format. Many word-processing and DTP programs support .eps
graphics for
a PostScript target printer simply by passing the code on to the printer,
without trying to interpret it themselves. DviPS basically follows the same
approach. DviScr won't display a .eps
graphic; but you can run DviPS and
then use Ghostscript or GSview for previewing the PostScript file. As can
be seen in Section 6.6, Ghostscript can be selected as a viewer type within
4TeX.
If you want to include a .eps
graphic, you'll need a macro package. Section 7.4.5
describes how to use the style files psfig
and figures
. An alternative is epsf
, which
is from the same author as DviPS. LaTeX users can include epsf
as a `package', e.g.,
\documentclass{report} \usepackage{epsf} |
\input epsf |
To include a graphic file picture.eps
at its `natural' size, at the current position, use a
statement5
\epsfbox{picture.eps} |
\epsfxsize=2in\epsfysize=1.5in\epsfbox{picture.eps} |
\
epsfxsize
sets the width,
\
epsfysize
the height. If you specify only one
dimension, then the other dimension will be computed automatically, preserving the
original aspect ratio.
The DviPS manual describes additional scaling options. Other topics not covered here include PostScript header files and color support.
LaTeX users are advised to use the graphics or the graphicx package to include any kind of graphic picture. Here is some sample code:
\documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics[width=50mm]{mypict.eps} \end{document} |
6.2.2 PostScript fonts
Another attraction of PostScript printers is that it gives you access to Adobe Type 1 scalable fonts. These fonts can be scaled to any size: different sizes don't need to be loaded separately.6 Mostly, you'll make use of the set of 35 internal scalable fonts,7 but there is also a huge collection available of external fonts, both commercial and public domain that can be used if you want to give your documents a more individual touch. You can use these fonts side-by-side with the bitmapped TeX font libraries.
LaTeX users have a very easy job of accessing internal PostScript fonts in their documents: they only need to specify the appropriate font package. E.g., specifying:
\documentclass{report} \usepackage[times]{psnfss} |
\documentclass{report} \usepackage{times} |
palatino
for Palatino and many others; browse the
?:
\
emtex
\
latex
\
psnfss
directory for other font options. Another interesting option
is mathptm
. It works like the Times options, but it also attemps to replace all
Computer Modern fonts used in mathematics by Times and other PostScript
fonts.
If you use plain TeX, or if you want to use external fonts, you'll have define
fonts yourself. First, consult the file c:
\
texfiles
\
4system
\
psfonts.map
for
a list of available fonts. A typical entry for a resident font may look like
* DVIPS style: rpagk AvantGarde-Book * PSNFSS style: pagk8r AvantGarde-Book "TeXBase1Encoding ReEncodeFont " <8r.enc |
r
in rpagk
, which stands for `raw' as opposed to
`cooked'. These terms will be explained later on. An entry for a non-resident or
external font named Optima might look like
rpopr Optima <popr.pfb |
<
' sign. There
should be no spaces between the `<
' sign and the font file name.
In your TeX file you make AvantGarde-Book available at a point size of, say, 20pt, with a line
\font\avantgarde=pagk8r at 20pt |
r
is not used. This line will allow you to use AvantGarde at
20 points with, e.g.,
{\avantgarde This line is typeset in AvantGarde at 20 points} |
r
either.
The low-down on PostScript fonts
The use of PostScript fonts requires three or four pieces of information, depending on whether it is an internal or an external font:
popr.pfb
from the Optima entry in psfonts.map
. Ex-
ternal fonts are stored as outlines called `Postscript Font Binary' (PFB) or
`Postscript Font Ascii' (PFA). PFB's and PFA's contain identical informa-
tion in binary (ascii 0-255) or ascii (ascii 32-127) format. PFB can be trans-
lated into PFA and vice versa by PostScript utility programs. DviPS en-
sures that these files are downloaded to the printer,8
which will scale the fonts as needed.
rpagk.tfm
for ITC Avant Garde
and rpopr.tfm
for the external Optima font. Note the initial r
. This file is
a direct conversion of the original .afm
font metric file, which came with
the font. With these font metrics, the font is considered `raw'. Conversion
from .afm
to .tfm
can be performed by two program: FontInst and
Afm2Tfm. The first is a TeX program that usually gives better results
than the latter. Afm2Tfm runs much faster and is suitable for a quick
and almost perfect installation. See Section 4.13 and 4.14 for more details.
pagk.vf
and popr.vf
(vf
for
virtual font). Without this mapping, ordinary characters would come out
as expected, but special characters such as ligatures and accented letters
might not.
pagk.tfm
and popr.tfm
respectively. This file will be read by the TeX compiler. With this metric
and the above remapping, the font is considered `cooked' and digestible.config.ps
(see Section 6.2.4) tells DviPS where it can find all
these files.
If you have Type 1 fonts of your own that you want to use in a TeX document, the
on-line documentation of DviPS will tell you how to generate the required .tfm
and
.vf
files. The documentation can be found in the directory ?:
\
emtex
\
doc
\
programs
.
6.2.3 DviPS command line
The syntax of DviPS is
DVIPS32 [options] <input file> |
Calling the program without options or parameters produces a brief summary of its syntax.
The principal options are
.ps
for <input file>.dvi
textext.dvi
and writes mytext.ps
which can be sent to a PostScript
printer. -D 300
specifies that the target printer has a 300 dpi resolution; -t
a4
specifies a paper size A4; -M
prevents automatic generation of missing
fonts.
Note that the syntax does not conform to emTeX conventions.
Options can also be entered via the environment variable POST_OPTION
.
4TeX uses
dvips32.exe
and dvihps32.exe
The program DviHPS32 is an extension
of DviPS that can handle `HyperDVI'-files, generating `HyperPS' output. See
Section 4.2, DviPS documentation and `hyperref' documentation for more details.
This version supports the extra option -z
to run in `hyper' mode. Because otherwise
these two programs are identical, in 4TeX dvihps32.exe
is renamed to dvips32.exe
and is used for all purposes.
6.2.4 DviPS configuration
Most configuration is done in config.ps
in the PS
subdirectory of the
TeX directory. This file contains several paths, among other things. If DviPS
appears unable to find fonts, the real reason may be that it can't find this
configuration file. Try setting the environment variable TEXCONFIG
to the directory of
config.ps
:
\
emtex\
ps
TEXCONFIG
to direct DviPS to a version of config.ps
of your own.
See the on-line documentation for a description of config.ps
and for the full story
on configuring DviPS. Watch the syntax of config.ps
carefully: it differs
from emTeX conventions. 4TeX uses the file config.ps
for all the general
PostScript settings and certain .cfg
files for additional printer type specific
settings.
6.2.5 Ghostscript as printer and viewer
The syntax of Ghostscript is as follows:
gs[386] [-sDEVICE=devicename] [switches] [file1.ps file2.ps ...] |
gs386.exe
only runs on computers equipped with a 80386 CPU or
higher, the program gs.exe
runs on any computer.
Available devicenames are:
vga | ega | svga16 | atiw | tseng | tvga | deskjet | djet500 |
laserjet | ljetplus | ljet2p | ljet3 | ljet4 | cdeskjet | cdjcolor | cdjmono |
cdj550 | pj | pjxl | pjxl300 | epson | eps9high | ibmpro | bj10e |
bj200 | bjc600 | bjc800 | pcxmono | pcxgray | pcx16 | pcx256 | pcx24b |
pcxcmyk | tiffcrle | tiffg3 | tiffg32d | tiffg4 | tifflzw | tiffpack | bmpmono |
bmp16 | bmp256 | bmp16m | tiff12nc | tiff24nc | psmono | psgray | bit |
bitrgb | bitcmyk | jpeg | jpeggray | pdfwrite | nullpage |
Most frequently used switches are: (you can use `#' in stead of `=')
-d<name>[=<token>] | define name as token, or true if no token given |
-dNOPAUSE | don't pause between pages |
-g<width>x<height> | set width and height (`geometry'), in pixels |
-q | `quiet' mode, suppress most messages |
-r<res> | set resolution, in pixels per inch |
-s<name>=<string> | define name as string |
-sDEVICE=<devicename> | select initial device |
-sOutputFile=<file> | select output file: embed %d or %ld for page #, |
- means stdout, use | command to pipe |
|
- | read from (redirected) stdin non-interactively |
For more information, see the file ?:
\
emtex
\
utils
\
gstools
\
gs
\
use.doc
.
To print on a laserjet printer the file book.ps one can use the command:
gs[386] -sDEVICE=ljet3 -dNOPAUSE -sOUTPUTFILE=LPT1 4texdoc.ps quit.ps
6.2.6 Ghostscript as previewer
Ghostscript can be used as previewer under MS-Dos or under MS-Windows 95 or NT. In the latter case 4TeX uses the program 32 bits Windows program GSview.
When using Ghostscript as previewer under MS-Dos 4TeX will load an extra
PostScript program called ps_view.ps
, written by written by P. Pianowski and
B. Jackowski, and extended by the authors of 4TeX. This file will enables several keys
that make it easy to browse through a PostScript file.
The following keys can be used:
[Home] | goto first page | [F7] | zoom out |
[End] | goto last page | [F8] | zoom in |
[PgDn] | goto next page | [F10] | redraw current picture |
[PgUp] | goto previous page | [F12] | view whole picture |
[¬] | shift left | [Q][Enter] | draw grid |
[®] | shift right | [V][Enter] | view picture |
[] | shift up | [V][f][Enter] | flip vertically |
[¯] | shift down | [H][f][Enter] | flip horizontally |
[Q][Enter] | quit | [F][r][Enter] | show frame |
[Esc] | quit | [Del] | undo previous picture |
[Alt][X] | quit | [Ins] | redo undone picture |
[F1] | display predefined keys | ||
(press [x][Enter] | |||
to return to your document) |
You can set the magnification factor by typing a number and then pressing [M]
and [Enter]
You can go to a specified page by typing the number of that page and then pressing
[F4]
You can set the shift factor by typing a number and then pressing [S] and
[Enter]
You can shift the picture by typing the horizontal shift, a space, the vertical shift
and then pressing [Tab]
You can rotate a page by typing the rotating agle (abs(STEP)*90) and then typing
[R][O] and [Enter].
Note: These keys only work correctly if the the PostScript file contains the standard page markup comments.
When running 4TeX on Windows 95 or NT 4TeX can start GSview, a true 32 bits Windows program, as a previewer. This program explains itself quite well, so we will not discuss it here in detail. Note, however, that unlike any other previewer, [PgUp] and [PgDn] do not work as you would expect. Click on the [-] and [+] Windows buttons instead.