When Emmanuel asked me for a way to print a previously LaTeX prepared document reduced, so that two pages would fit on one sheet of paper, I had first to studied the PostScript header that dvips prepends to every file. Here are some guesses:

Meaning of some DVIPS-generated PostScript macros

Name Type Usage
N fn Short for def
SI var Used to store the state at the beginning of a page (but after bop-hook), and restore it at the end.
V fn Do nothing ?

Note that, like many programs producing PostScript code, the files aren't indented and the names used are very short (to save communication time with the printer ? The header is tiny with respect to the data to be printed, anyway). This doesn't make them very readable, but we have to live with that.

Two pages by page (???)

By the way, you might be interested in the result. To use it, just type

dvips -h twobypage your-file.dvi > your-file.ps
(Assuming you saved it under the name "twobypage"). The header works by defining the functions /bop-hook, /eop-hook and /end-hook, that are called by the dvips generated program at the beginning of each page, the end of each page and end of the file, respectively. The only trouble is that /eop-hook is called after the showpage, the PostScript instruction that provokes the printing of the page and resets the graphics state. But twobypage needs to execute code in place of the showpage, since printing is called only after every two pages. The work around is to redefine the showpage instruction. Not every interpreter may be happy with this, so you'll have to try.

I wrote this for dvips 5.516.


Related Topics: PostScript


Christophe Tronche, ch@tronche.com