Duplex printing |
Some printers have the capability to print on both sides of the paper. You can put instructions in a PostScript file to signal the printer to print that file double-sided. (A printer that is not capable of duplex printing should ignore such instructions.) The clumsy but effective brute force way to do this is to edit the PostScript file manually. If you open a PostScript file in your text editor, you will see that the file starts with some comment lines beginning with percent signs. To make the file print double-sided, you can insert the line
<< /Duplex true >> setpagedevice
at an appropriate point near the end of the comments. You may
need to experiment to determine what an "appropriate point" is.
If, after saving the edited PostScript file, you can
successfully preview the file with ghostview
, then the
file should print properly. If, on the other hand, you get a
message from ghostview
about an interpreter error, then
you guessed wrong about where to insert the setpagedevice
instruction: try again.
(If for some reason you need to print to an old printer that
does not understand Level 2 PostScript, then you can use the
PostScript instruction
statusdict begin true setduplexmode end
as an alternate means to enable duplex
printing.)
A related special effect is to print the back of each page upside down. You might want to do this, for instance, if you were going to bind a report along the top edge instead of along the side. A suitable PostScript instruction to turn on duplex printing with alternate pages flipped is the following:
<< /Duplex true /Tumble true >> setpagedevice
Warning. Be cautious in editing PostScript files, and
make a backup file before you begin. Since PostScript is an
interpreted language, introducing one small error near the
beginning can render the entire file useless. In particular, be
careful not to change the first line of the file. Often the
printer recognizes a file as being PostScript by checking that
the
first four characters in the file are %!PS
. If you
change one of these characters, or if you introduce a spurious
blank line at the beginning, then your printer may spew out
pages and pages of junk.
A more elegant approach to duplex printing of LaTeX files is
to instruct dvips
to incorporate the
setpagedevice
command into the PostScript file
automatically. To do this on a standard Unix system, create a file
containing the single line
<< /Duplex true >> setpagedevice
and save the file under the name duplex. Now the command dvips -h duplex moebius.dvi will create the file moebius.ps with the PostScript command for double-sided printing built in. The advantage of this method is that you do not have to edit the PostScript file by hand.
If you use this second method, then you may need to tell
dvips
where to find the header file duplex. If
you have stored the file duplex in your home directory,
but you are executing the command dvips in a
subdirectory, then dvips
may complain about being unable
to find a header file. One solution is to add to the
.cshrc file in your home directory a line like
setenv DVIPSHEADERS .::{$HOME}
which tells dvips
to search for header files first in the
current directory, then in the system default location, and then
in your home directory. (This is not actually the solution I use
currently. My set-up is configured with a private subdirectory
where I keep custom files related to LaTeX, and I run the
command texhash whenever I add files to that subdirectory.)
If you are printing LaTeX documents double-sided, then you
may want to use the twoside
document-class option. That
is, start your LaTeX source file with something like this:
\documentclass[12pt,twoside]{article}
When the twoside
option is in effect, LaTeX
will attempt to adjust the margins so that the printed areas on
the front and back sides of the paper line up. If you are not
satisfied with the alignment produced by the
twoside
option, then you can use the \setlength
command to adjust the parameters \oddsidemargin
and
\evensidemargin
by hand.
Duplex printing |