Go to the first, previous, next, last section, table of contents.

3. Invoking Dvips

Dvips reads a DVI file as output by (for example) TeX, and converts it to PostScript, taking care of builtin or downloaded PostScript fonts, font reencoding, color, etc. These features are described in other chapters in this document.

There many ways to control Dvips' behavior: configuration files, environment variables, and command-line options.

3.1 Basic usage of Dvips

To use Dvips at its simplest, simply type

dvips foo

where `foo.dvi' is the output of TeX that you want to print. If Dvips has been installed correctly, the document will probably roll out of your default printer.

If you use fonts that have not been used on your system before, they may be automatically generated; this process can take a few minutes, so progress reports appear by default. The next time that document is printed, these fonts will have been saved in the proper directories, so printing will go much faster. (If Dvips tries to endlessly generate the same fonts over and over again, it hasn't been installed properly. See section `Unable to generate fonts' in Kpathsea.)

Many options are available (see the next section). For a brief summary of available options, just type

dvips --help

3.2 Command-line options

Dvips has a plethora of command line options. Reading through this section will give a good idea of the capabilities of the driver.

3.2.1 Option summary

Here is a handy summary of the options; it is printed out when you run Dvips with no arguments or with the standard `--help' option.

Usage: dvips [OPTION]... FILENAME[.dvi]
  Translate the given DVI file to PostScript.

a*  Conserve memory, not time      A   Print only odd (TeX) pages
b # Page copies, e.g., for posters B   Print only even (TeX) pages
c # Uncollated copies              C # Collated copies
d # Debugging                      D # Resolution
e # Maxdrift value                 E*  Create minimal EPSF
f*  Run as filter                  F*  Send control-D at end
h f Add header file f              H f Same as h
i*  Separate file per section
j*  Partially download Type 1's
k*  Print crop marks               K*  Pull comments from inclusions
l # Last page
m*  Manual feed                    M*  Don't make fonts
n # Maximum number of pages        N*  No structured comments
o f Output file                    O c Set/change paper offset
p # First page                     P s Load config.$s
q*  Run quietly
r*  Reverse order of pages         R   Run securely
s*  Enclose output in save/restore S # Max section size in pages
t s Paper format                   T c Specify desired page size
                                   U*  Disable string param trick
                                   V*  Send downloadable PS fonts as PK
x # Override dvi magnification     X # Horizontal resolution
y # Multiply by dvi magnification  Y # Vertical resolution
z*  Hyperdvi to HyperPostScript    Z*  Compress bitmap fonts
-   Query interactively for options
pp #-# First-last page
mode s Set mode to s

    # = number   f = file   s = string   * = suffix, 0 to turn off
    c = comma-separated dimension pair (e.g., 3.1in,-41.5cm)

Email bug reports to tex-k@mail.tug.org.

3.2.2 Option details

Many of the parameterless options listed here can be turned off by suffixing the option with a zero (`0'); for instance, to turn off page reversal, use `-r0'. Such options are marked with a trailing `*'.

Read additional options from standard input after processing the command line.
Print a usage message and exit.
Print the version number and exit.
Conserve memory by making three passes over the DVI file instead of two and only loading those characters actually used. Generally only useful on machines with a very limited amount of memory, like some PCs.
Print only the odd pages. This option uses TeX page numbers, not physical page numbers.
`-b num'
Generate num copies of each page, but duplicating the page body rather than using the `/#copies' PostScript variable. This can be useful in conjunction with a header file setting `bop-hook' to do color separations or other neat tricks.
Print only the even pages. This option uses TeX page numbers, not physical page numbers.
`-c num'
Generate num consecutive copies of every page, i.e., the output is uncollated. This merely sets the builtin PostScript variable `/#copies'.
`-C num'
Generate num copies, but collated (by replicating the data in the PostScript file). Slower than the `-c' option, but easier on the hands, and faster than resubmitting the same PostScript file multiple times.
`-d num'
Set the debug flags, showing what Dvips (thinks it) is doing. This will work unless Dvips has been compiled without the `DEBUG' option (not recommended). See section 2.4.1 Debug options, for the possible values of num. Use `-d -1' as the first option for maximum output.
`-D num'
Set both the horizontal and vertical resolution to num, given in dpi (dots per inch). This affects the choice of bitmap fonts that are loaded and also the positioning of letters in resident PostScript fonts. Must be between 10 and 10000. This affects both the horizontal and vertical resolution. If a high resolution (something greater than 400 dpi, say) is selected, the `-Z' flag should probably also be used. If you are using fonts made with Metafont, such as Computer Modern, `mktexpk' needs to know about the value for num that you use or Metafont will fail. See the file ftp://ftp.tug.org/tex/modes.mf for a list of resolutions and mode names for most devices.
`-e num'
Maximum drift in pixels of each character from its `true' resolution-independent position on the page. The default value of this parameter is resolution dependent (it is the number of entries in the list [100, 200, 300, 400, 500, 600, 800, 1000, 1200, 1600, 2000, 2400, 2800, 3200, ...] that are less than or equal to the resolution in dots per inch). Allowing individual characters to `drift' from their correctly rounded positions by a few pixels, while regaining the true position at the beginning of each new word, improves the spacing of letters in words.
Generate an EPSF file with a tight bounding box. This only looks at marks made by characters and rules, not by any included graphics. In addition, it gets the glyph metrics from the TFM file, so characters that print outside their enclosing TFM box may confuse it. In addition, the bounding box might be a bit too loose if the character glyph has significant left or right side bearings. Nonetheless, this option works well enough for creating small EPSF files for equations or tables or the like. (Of course, Dvips output, especially when using bitmap fonts, is resolution-dependent and thus does not make very good EPSF files, especially if the images are to be scaled; use these EPSF files with care.) For multiple page input files, also specify `-i' to get each page as a separate EPSF file; otherwise, all the pages are overlaid in the single output file.
Run as a filter. Read the DVI file from standard input and write the PostScript to standard output. The standard input must be seekable, so it cannot be a pipe. If your input must be a pipe, write a shell script that copies the pipe output to a temporary file and then points Dvips at this file. This option also disables the automatic reading of the PRINTER environment variable; use `-P$PRINTER' after the `-f' to read it anyway. It also turns off the automatic sending of control-D if it was turned on with the `-F' option or in the configuration file; use `-F' after the `-f' to send it anyway.
Write control-D (ASCII code 4) as the very last character of the PostScript file. This is useful when Dvips is driving the printer directly instead of working through a spooler, as is common on personal systems. On systems shared by more than one person, this is not recommended.
`-h name'
Prepend name as an additional header file, or, if name is `-', suppress all header files. Any definitions in the header file get added to the PostScript `userdict'.
Make each section be a separate file; a section is a part of the document processed independently, most often created to avoid memory overflow. The filenames are created replacing the suffix of the supplied output file name by a three-digit sequence number. This option is most often used in conjunction with the `-S' option which sets the maximum section length in pages; if `-i' is specified and `-S' is not, each page is output as a separate file. For instance, some phototypesetters cannot print more than ten or so consecutive pages before running out of steam; these options can be used to automatically split a book into ten-page sections, each to its own file.
Download only needed characters from Type 1 fonts. This is the default in the current release. Some debugging flags trace this operation (see section 2.4.1 Debug options). You can also control partial downloading on a per-font basis (see section 6.4 `psfonts.map': PostScript font catalog).
Print crop marks. This option increases the paper size (which should be specified, either with a paper size special or with the `-T' option) by a half inch in each dimension. It translates each page by a quarter inch and draws cross-style crop marks. It is mostly useful with typesetters that can set the page size automatically. This works by downloading `crop.pro'.
Remove comments in included PostScript graphics, font files, and headers; only necessary to get around bugs in spoolers or PostScript post-processing programs. Specifically, the `%%Page' comments, when left in, often cause difficulties. Use of this flag can cause other graphics to fail, however, since the PostScript header macros from some software packages read portion the input stream line by line, searching for a particular comment.
`-l [=]num'
The last page printed will be the first one numbered num. Default is the last page in the document. If num is prefixed by an equals sign, then it (and the argument to the `-p' option, if specified) is treated as a physical (absolute) page number, rather than a value to compare with the TeX `\count0' values stored in the DVI file. Thus, using `-l =9' will end with the ninth page of the document, no matter what the pages are actually numbered.
Specify manual feed, if supported by the output device.
`-mode mode'
Use mode as the Metafont device name for path searching and font generation. This overrides any value from configuration files. With the default paths, explicitly specifying the mode also makes the program assume the fonts are in a subdirectory named mode. See section `TeX directory structure' in Kpathsea. If Metafont does not understand the mode name, see section `Unable to generate fonts' in Kpathsea.
Turns off automatic font generation (`mktexpk'). If mktexpk, the invocation is appended to a file `missfont.log' (by default) in the current directory. You can then execute the log file to create the missing files after fixing the problem. If the current directory is not writable and the environment variable or configuration file value `TEXMFOUTPUT' is set, its value is used. Otherwise, nothing is written. The name `missfont.log' is overridden by the `MISSFONT_LOG' environment variable or configuration file value.
`-n num'
Print at most num pages. Default is 100000.
Turns off generation of structured comments such as `%%Page'; this may be necessary on some systems that try to interpret PostScript comments in weird ways, or on some PostScript printers. Old versions of TranScript in particular cannot handle modern Encapsulated PostScript. Beware: This also disables page movement, etc., in PostScript viewers such as Ghostview.
`-o name'
Send output to the file name. If `-o' is specified without name, the default is `file.ps' where the input DVI file was `file.dvi'. If `-o' isn't given at all, the configuration file default is used. If name is `-', output goes to standard output. If the first character of name is `!' or `|', then the remainder will be used as an argument to popen; thus, specifying `|lpr' as the output file will automatically queue the file for printing as usual. (The MS-DOS version will print to the local printer device `PRN' when name is `|lpr' and a program by that name cannot be found.) `-o' disables the automatic reading of the PRINTER environment variable, and turns off the automatic sending of control-D. See the `-f' option for how to override this.
`-O x-offset,y-offset'
Move the origin by x-offset,y-offset, a comma-separated pair of dimensions such as `.1in,-.3cm' (see section 4.1 `papersize' special). The origin of the page is shifted from the default position (of one inch down, one inch to the right from the upper left corner of the paper) by this amount. This is usually best specified in the printer-specific configuration file. This is useful for a printer that consistently offsets output pages by a certain amount. You can use the file `testpage.tex' to determine the correct value for your printer. Be sure to do several runs with the same O value--some printers vary widely from run to run. If your printer offsets every other page consistently, instead of every page, your best recourse is to use `bop-hook' (see section 5.3.4 PostScript hooks).
`-p [=]num'
The first page printed will be the first one numbered num. Default is the first page in the document. If num is prefixed by an equals sign, then it (and the argument to the `-l' option, if specified) is treated as a physical (absolute) page number, rather than a value to compare with the TeX `\count0' values stored in the DVI file. Thus, using `-p =3' will start with the third page of the document, no matter what the pages are actually numbered.
`-pp first-last'
Print pages first through last; equivalent to `-p first -l last', except that multiple `-pp' options accumulate, unlike `-p' and `-l'. The `-' separator can also be `:'.
`-P printer'
Read the configuration file `config.printer' (`printer.cfg' on MS-DOS), which can set the output name (most likely `o |lpr -Pprinter'), resolution, Metafont mode, and perhaps font paths and other printer-specific defaults. It works best to put sitewide defaults in the one master `config.ps' file and only things that vary printer to printer in the `config.printer' files; `config.ps' is read before `config.printer'. If no `-P' or `-o' is given, the environment variable PRINTER is checked. If that variable exists, and a corresponding `config.printer' (`printer.cfg' on MS-DOS) file exists, it is read. See section 3.4.1 Configuration file searching.
Run quietly. Don't chatter about pages converted, etc. to standard output; report no warnings (only errors) to standard error.
Output pages in reverse order. By default, page 1 is output first.
Run securely. This disables shell command execution in \special (via ``', see section 5.1.4 Dynamic creation of PostScript graphics files) and config files (via the `E' option, see section 3.4.2 Configuration file commands), pipes as output files, and opening of any absolute filenames.
Enclose the output in a global save/restore pair. This causes the file to not be truly conformant, and is thus not recommended, but is useful if you are driving a deficient printer directly and thus don't care too much about the portability of the output to other environments.
`-S num'
Set the maximum number of pages in each `section'. This option is most commonly used with the `-i' option; see its description above for more information.
`-t papertype'
Set the paper type to papertype, usually defined in one of the configuration files, along with the appropriate PostScript code to select it (see section 4.2 Configuration file paper size command). You can also specify a papertype of `landscape', which rotates a document by 90 degrees. To rotate a document whose paper type is not the default, you can use the `-t' option twice, once for the paper type, and once for `landscape'.
`-T hsize,vsize'
Set the paper size to (hsize,vsize), a comma-separated pair of dimensions such as `.1in,-.3cm' (see section 4.1 `papersize' special). It overrides any paper size special in the DVI file.
Disable a PostScript virtual memory-saving optimization that stores the character metric information in the same string that is used to store the bitmap information. This is only necessary when driving the Xerox 4045 PostScript interpreter, which has a bug that puts garbage on the bottom of each character. Not recommended unless you must drive this printer.
Download non-resident PostScript fonts as bitmaps. This requires use of mtpk or gsftopk or pstopk or some combination thereof to generate the required bitmap fonts; these programs are supplied with Dvips. The bitmap must be put into `psfonts.map' as the downloadable file for that font. This is useful only for those fonts for which you do not have real outlines, being downloaded to printers that have no resident fonts, i.e., very rarely.
`-x num'
Set the x magnification ratio to num/1000. Overrides the magnification specified in the DVI file. Must be between 10 and 100000. It is recommended that you use standard magstep values (1095, 1200, 1440, 1728, 2074, 2488, 2986, and so on) to help reduce the total number of PK files generated. num may be a real number, not an integer, for increased precision.
`-X num'
Set the horizontal resolution in dots per inch to num.
`-y num'
Set the y magnification ratio to num/1000. See `-x' above.
`-Y num'
Set the vertical resolution in dots per inch to num.
Pass `html' hyperdvi specials through to the output for eventual distillation into PDF. This is not enabled by default to avoid including the header files unnecessarily, and use of temporary files in creating the output. See section 5.4 HyperTeXt.
Compress bitmap fonts in the output file, thereby reducing the size of what gets downloaded. Especially useful at high resolutions or when very large fonts are used. May slow down printing, especially on early 68000-based PostScript printers. Generally recommend today, and can be enabled in the configuration file (see section 3.4.2 Configuration file commands).

3.3 Environment variables

Dvips looks for many environment variables, to define search paths and other things. The path variables are read as needed, after all configuration files are read, so they override values in the configuration files. (Except for TEXCONFIG, which defines where the configuration files themselves are found.)

See section `Path specifications' in Kpathsea, for details of interpretation of path and other environment variables common to all Kpathsea-using programs. Only the environment variables specific to Dvips are mentioned here.

Default path to search for all fonts. Overrides all the font path config file options and other environment variables (see section `Supported file formats' in Kpathsea).
Default path to search for PostScript header files. Overrides the `H' config file option (see section 3.4.2 Configuration file commands).
Overrides `mktexpk' as the name of the program to invoke to create missing PK fonts. You can change the arguments passed to the mktexpk program with the MAKETEXPK environment variable; see section `MakeTeX script arguments' in Kpathsea.
Specifies the name of the startup file (see section 3.4.1 Configuration file searching) which is read after `config.ps' but before any printer-specific configuration files.
Last-resort sizes for scaling of unfound fonts. Overrides the `R' definition in config files (see section 3.4.2 Configuration file commands).
Determine the default printer configuration file. (Dvips itself does not use PRINTER to determine the output destination in any way.)
Path to search for Dvips' `config.printer' configuration files, including the base `config.ps'. Using this single environment variable, you can override everything else. (The printer-specific configuration files are called `printer.cfg' on MS-DOS, but `config.ps' is called by that name on all platforms.)
Path to search for included graphics files. Overrides the `S' config file option (see section 3.4.2 Configuration file commands). If not set, TEXINPUTS is looked for. See section `Supported file formats' in Kpathsea.

3.4 Dvips configuration files

This section describes in detail the Dvips-specific `config.*' device configuration files (called `*.cfg' on MS-DOS), which override the `texmf.cnf' configuration files generic to Kpathsea which Dvips also reads (see section `Config files' in Kpathsea).

For information about installing these files, including a prototype file you can copy, see section 2.1 `config.ps' installation.

3.4.1 Configuration file searching

The Dvips program loads many different configuration files, so that parameters can be set globally across the system, on a per-device basis, or individually by each user.

  1. Dvips first reads (if it exists) `config.ps'; it is searched for along the path for Dvips configuration files, as described in section `Supported file formats' in Kpathsea.
  2. A user-specific startup file is loaded, so individual users can override any options set in the global file. The environment variable DVIPSRC, if defined, is used as the specification of the startup file. If this variable is undefined, Dvips uses a platform-specific default name. On Unix Dvips looks for the default startup file under the name `$HOME/.dvipsrc', which is in the user's home directory. On MS-DOS and MS-Windows, where users generally don't have their private directories, the startup file is called `dvips.ini' and it is searched for along the path for Dvips configuration files (as described in section `Supported file formats' in Kpathsea.); users are expected to set this path as they see fit for their taste.
  3. The command line is read and parsed: if the `-Pdevice' option is encountered, at that point `config.device' is loaded. Thus, the printer configuration file can override anything in the site-wide or user configuration file, and it can also override options in the command line up to the point that the `-P' option was encountered. (On MS-DOS, the printer configuration files are called `device.cfg', since DOS doesn't allow more than 3 characters after the dot in filenames.)
  4. If no `-P' option was specified, and also the `-o' and `-f' command line options were not used, Dvips checks the environment variable PRINTER. If it exists, then `config.$PRINTER' (`$PRINTER.cfg' on MS-DOS) is loaded (if it exists).

Because the `.dvipsrc' file is read before the printer-specific configuration files, individual users cannot override settings in the latter. On the other hand, the TEXCONFIG path usually includes the current directory, and can in any case be set to anything, so the users can always define their own printer-specific configuration files to be found before the system's.

A few command-line options are treated specially, in that they are not overridden by configuration files:

As well as setting the resolution, this unsets the mode, if the mode was previously set from a configuration file. If `config.$PRINTER' is read, however, any `D' or `M' lines from there will take effect.
This overrides any mode setting (`M' line) in configuration files. `-mode' does not affect the resolution.
This overrides any output setting (`o' line) in configuration files.

The purpose of these special cases is to (1) minimize the chance of having a mismatched mode and resolution (which `mktexpk' cannot resolve), and (2) let command-line options override config files where possible.

3.4.2 Configuration file commands

Most of the configuration file commands are similar to corresponding command line options, but there are a few exceptions. When they are the same, we omit the description here.

As with command line options, many may be turned off by suffixing the letter with a zero (`0').

Within a configuration file, empty lines, and lines starting with a space, asterisk, equal sign, percent sign, or pound sign are ignored. There is no provision for continuation lines.

`@ name hsize vsize'
Define paper sizes. See section 4.2 Configuration file paper size command.
Memory conservation. Same as `-a', see section 3.2.2 Option details.
`b #copies'
Multiple copies. Same as `-b', see section 3.2.2 Option details.
`D dpi'
Output resolution. Same as `-D', see section 3.2.2 Option details.
`e num'
Max drift. Same as `-e', see section 3.2.2 Option details.
`E command'
Executes the command listed with system(3); can be used to get the current date into a header file for inclusion, for instance. Possibly dangerous; this may be disabled, in which case a warning will be printed if the option is used (and warnings are not suppressed).
Run as a filter. Same as `-f', see section 3.2.2 Option details.
`h header'
Prepend header to output. Same as `h-', see section 3.2.2 Option details.
`H path'
Use path to search for PostScript header files. The environment variable DVIPSHEADERS overrides this.
`i n'
Make multiple output files. Same as `-i -S n', see section 3.2.2 Option details.
Partially download Type 1 fonts. Same as `-j', see section 3.2.2 Option details.
Remove comments from included PostScript files. Same as `-K', see section 3.2.2 Option details.
`m num'
Declare num as the memory available for fonts and strings in the printer. Default is 180000. This value must be accurate if memory conservation and document splitting is to work correctly. To determine this value, send the following file to the printer:
%! Hey, we're PostScript
/Times-Roman findfont 30 scalefont setfont 144 432 moveto
vmstatus exch sub 40 string cvs show pop showpage
The number printed by this file is the total memory free; it is usually best to tell Dvips that the printer has slightly less memory, because many programs download permanent macros that can reduce the memory in the printer. Some systems or printers can dynamically increase the memory available to a PostScript interpreter, in which case this file might return a ridiculously low number; for example, the NeXT computer and Ghostscript. In these cases, a value of one million works fine.
`M mode'
Metafont mode. Same as `-mode', see section 3.2.2 Option details.
Disable structured comments. Beware: This also turns off displaying page numbers or changing to specific pagenumbers in PostScript viewers. Same as `-N', see section 3.2.2 Option details.
`o name'
Send output to name. Same as `-', see section 3.2.2 Option details. In the file `config.foo', a setting like this is probably appropriate:
o |lpr -Pfoo
The MS-DOS version will emulate spooling to lpr by printing to the local printer device `PRN' if it doesn't find an executable program by that name in the current directory or along the PATH.
`O xoff,yoff'
Origin offset. Same as `-O', see section 3.2.2 Option details.
`p [+]name'
Examine name for PostScript font aliases. Default is `psfonts.map'. This option allows you to specify different resident fonts that different printers may have. If name starts with a `+' character, then the rest of the name (after any leading spaces) is used as an additional map file; thus, it is possible to have local map files pointed to by local configuration files that append to the global map file. This can be used for font families.
`P path'
Use path to search for bitmap PK font files is path. The PKFONTS, TEXPKS, GLYPHFONTS, and TEXFONTS environment variables override this. See section `Supported file formats' in Kpathsea.
Run quietly. Same as `-q', see section 3.2.2 Option details.
Page reversal. Same as `-r', see section 3.2.2 Option details.
`R num1 num2 ...'
Define the list of default resolutions for PK fonts. If a font size actually used in a document is not available and cannot be created, Dvips will scale the font found at the closest of these resolutions to the requested size, using PostScript scaling. The resulting output may be ugly, and thus a warning is issued. To turn this last-resort scaling off, use a line with just the `R' and no numbers. The given numbers must be sorted in increasing order; any number smaller than the preceding one is ignored. This is because it is better to scale a font up than down; scaling down can obliterate small features in the character shape. The environment and config file values `DVIPSSIZES' or `TEXSIZES' override this configuration file setting. If no `R' settings or environment variables are specified, a list compiled in during installation is used. This default list is defined by the Makefile variable `default_texsizes', defined in the file `make/paths.make'.
Output global save/restore. Same as `-s', see section 3.2.2 Option details.
`S path'
Use path to search for special illustrations (Encapsulated PostScript files or psfiles). The TEXPICTS and then TEXINPUTS environment variables override this.
`T path'
Use path to search for TFM files. The TFMFONTS and then TEXFONTS environment variables overrides this. This path is used for resident fonts and fonts that can't otherwise be found.
Work around bug in Xerox 4045 printer. Same as `-U', see section 3.2.2 Option details.
`V path'
Use path to search for virtual font files. This may be device-dependent if you use virtual fonts to simulate actual fonts on different devices.
`W [string]'
If string is supplied, write it to standard error after reading all the configuration files; with no string, cancel any previous `W' message. This is useful in the default configuration file to remind users to specify a printer, for instance, or to notify users about special characteristics of a particular printer.
`X num'
Horizontal resolution. Same as `-X', see section 3.2.2 Option details.
`Y num'
Vertical resolution. Same as `-Y', see section 3.2.2 Option details.
Compress bitmap fonts. Same as `-Z', see section 3.2.2 Option details.

Go to the first, previous, next, last section, table of contents.