Documentation for 2up.tex: Two-up printing for Generic TeX

Timothy Van Zandt^{∗} tvz@Princeton.EDU Version 1.2 January 28, 1993

2up.tex/2up.sty allows one to print a document two-up, with considerable flexibility as to paper size and layout. It produces a standard dvi file, and does not involve an additional dvi or PostScript filter. It should work with most TEX macro packages. Usage: Input 2up.tex, or include 2up as a LaTeX style option. There is a good chance you will get the desired layout. (But you will probably need to generate new font bitmaps to get high quality output.) See the rest of this documentation for detailed information on controlling 2up.tex.

Contents

1 Comparison with other methods 1 2 A warning about fonts 1 3 Usage 1 4 Defaults 3 5 True Dimensions 4 6 Page Cross-References 5 7 Booklets 6 8 Using dvidvi 6 9 Compatibility 7 10 Changes 7

∗The documentation was put into L^{A}TEX format by David Todd.

1 Comparison with other methods

There are other tools for two-up printing:

PostScript filters These work well as long as you only use PostScript fonts (as opposed to the usual Metafont fonts). Otherwise, the PostScript filter scales bitmapped fonts, and the quality is lower than with 2up.tex.

Rokicki’s dvidvi dvidvi is a versatil tool that does much more than 2up printing. However, if only rearranges the pages, and does not adjust the magnification to ensure that the pages fit properly in a two-up format. It also adds one more step to the TEX-dvi-printer cycle. 2up.tex, on the other hand, combines the changes to TEX’s magnification and page layout with the rearranging of the pages, all with an easy-to-use interface and from within your TEX document. (See Section 8 on using both 2up.tex and dvidvi together.)

2 A warning about fonts

Two-up printing generally involves reducing a document, and thus using fonts sizes that are not typically found on your system. If you are using bitmapped fonts (standard for TEX users), and you do not have and cannot generate the extra fonts bitmaps, you will find 2up.sty (and any other method of two-up printing) to give very poor quality output.

If you are using a program like Rokicki’s dvips that can generate extra font bitmaps as needed, you will find that it takes a long time to print your 2up document the first few times, as dvips is busy making the extra fonts. This problem will go away. Be thankful you have such an easy way to get extra font bitmaps.

3 Usage

Input 2up.tex. L^{A}TEX users can include 2up as a style option.

Then set the target and source layout:

\source{mag}{width}{height} \target{mag}{width}{height} • The “source” layout is the layout of your document the way it is usually

printed. The “target” layout is the layout when it is printed two-up.

• width and height are the true width and height of the paper, when looking at the output right-side-up.

• mag refers to the source and target magnification. It should be an integer, equal to 1000 times the magnification factor. There are also some magic magnification numbers:

\magstepn for a magnification of 1.2^{n} (n=0,...,5), or

\magstepminusn for a magnification of 1.2^{−n} (n=0,...,5).

Using these magnification values will make best use of the available fonts on your system.

2up.tex takes each source page, and centers in half a target page. To get the pages to fit, the magnification of the document typically has to be reduced. If you find that the pages are too crowded, try reducing the target magnification. If they are too lonely, try increasing the target magnification. If you want to adjust the positioning of the scaled pages, try changing the

values of \hoffset or \voffset with \advance or L^{A}TEX’s \addtolength.

Don’t change the magnification of your document after using the \target command, as you will override the settings made by 2up.tex. You can also specify some options:

     \targetlayout{options}

where options is a comma separated list with no spaces. Valid options are:

topbottom The two source pages are printed one on top of the other.

twosided Odd pages are always printed on the right or the bottom.

booklet Pages are printed like a booklet. See Section 7.

Booklet Like booklet, but for two-sided printers/copiers.

dvidvi For arranging in two-up layout with dvidvi. See Section 8.

The only other changes you might want to make to your document are the following:

• You have to see to it that the target output is printed with the correct orientation (landscape or portrait). See the documentation for your dvi driver for details.

• 2up.tex will inserts a line between pages if you change the following dimensions:

\pagesepwidth Thickness of line. (Default 0pt) \pageseplength Length of line. (Default 6.5in) \pagesepoffset Distance from bottom of page to bottom of line, or

(with topbottom layout) from side of page to beginning of line. (Default 1in)

• You can, but do not need to, use the following commands:

\twoupemptypage inserts a completely blank half page in the tar-

get.

\twoupclearpage L^{A}TEX users: ejects a complete target page. \twoupeject Plain TEXusers: ejects a complete target page.

4 Defaults

The following commands set the parameters for some common sources and targets. The definitions of these commands are also useful examples. For A4 paper, just replace 8.5in and 11in in the definitions below by the width and height of A4 paper.

\twouparticle This is the default for L^{A}TEX.

Source: A portrait document on 8.5x11 inch paper with wide margins

as used in L^{A}TEX’s article style, and without marginal notes.

Target: A landscape document on the same size paper, with the

source pages printed side by side.

Definition:

             \target{\magstepminus1}{11in}{8.5in}
             \source{\magstep0}{8.5in}{11in}}

If you use narrower side margins, or if you use marginal notes, then you will need to use \twoupplain or

     \twouplegaltarget, defined below.

\twoupplain This is the default for non-L^{A}TEX.

It is the same as \twouparticle, but for source documents with narrower margins.

Definition:

\target{\magstepminus2}{11in}{8.5in}
\source{\magstep0}{8.5in}{11in}

\twouplegaltarget Source: A portrait document on 8.5x11 inch paper with just about any margins and perhaps with marginal notes.

Target: A landscape document on legal size paper (8.5x14 inches), with the source pages printed side by side.

Definition:

\target{\magstepminus1}{14in}{8.5in}
\source{\magstep0}{8.5in}{11in}

\twouplandscape

Source: A landscape document on 8.5x11 inch paper with just about any margins.

Target: A portrait document on the same size paper, with the source pages stacked vertically.

Definition:

\target{\magstepminus2}{8.5in}{11in}
\source{\magstep0}{11in}{8.5in}
\targetlayout{topbottom}

5 True Dimensions

TEX lets you use ‘true’ dimensions, as in

\topmargin 1truein
\setlength{\topmargin}{1truein}

This sets the length to 1 inch as it appears on the page, no matter what the magnification.

Once you use ‘true’ dimensions, it is impossible to change the magnification of your document, and hence it is almost impossible to use 2up.tex. You will get an error like:

    ! Incompatible magnification (833);
      the previous value will be retained (2000).

The use of ‘true’ dimensions might be hiding in macros or style files you are using. For example, Plain TEX’s \magnification command uses true dimensions; use \mag instead, and then set \hsize and \vsize appropriately scaled. If you can’t find the culprit ‘true’ dimension in your document or input files, try putting this on the (very) first line of your document:

    \mag 143 \voffset 1truein \mag 1000

You will get the error listed above wherever true dimensions are used (and in some other places as well).

6 Page Cross-References

Page cross-references (e.g., in an index or table of contents) will not be accurate with 2up.tex, because finished pages are not immediately shipped out. This can also cause problems with some special L^{A}TEX styles that have multiple .aux files (e.g., for each chapter). To get better, but not perfect, page cross-references, try putting the command

    \TwoupWrites

at the beginning of your document, after inputting 2up.tex. This is good for drafts, and may fix problems with L^{A}TEX styles that have multiple .aux files.

\TwoupWrites makes \write and \read\immediate, if you know what that

means. It might cause problems of its own, but try it and see. To get accurate page cross-references:

1. Run the job without 2up.tex, until all cross-references are properly resolved. Run any index utility at this point.

2. Run the job ONE MORE TIME with 2up.tex; it will use the correct cross-references from the previous runs. (In L^{A}TEX documents, it is useful at this point to include the \nofiles command, so that the correct cross-references are preserved.)

7 Booklets

Here are some special considerations for making booklets:

• Use the booklet target layout if your printer or copier cannot print two sides directly. 2up.tex prints out the “tops” of the pages, and then the “bottoms”, so that you can copy or print on both sides by doing one side, flipping the output over, and doing the other side.

• Use Booklet if your printer or copier can print directly on two sides.

• You must have enough memory and box registers to hold all the pages in the document. A BigTEX should be able to handle at least a 32-page booklet.

• Sometimes booklet printing is part of the design of a document, rather than an afterthought. In this case, you should set up the margins for the target half-page rather than using 2up.tex to scale the document. For example, if using L^{A}TEX, 8.5x11 inch paper, L^{A}TEX’s twoside style option, and headings, try the following page parameter changes:

    \setlength{\oddsidemargin}{-0.2in}
    \setlength{\evensidemargin}{-0.5in}
    \setlength{\textwidth}{4.2in}
    \setlength{\textheight}{6.5in}
    \setlength{\topmargin}{-.4in}

If you do this, 2up.tex isn’t adjusting margins or scaling the document. You coould therefore get by without 2up.tex by using dvidvi.

8 Using dvidvi

With the dvidvi layout option, 2up.tex takes care of adjusting the margins, and you then use dvidvi to arrange the pages in a two-up format. The advantage is that cross referencing comes out right. The disadvantage is that it involves one more step. Start by TEXing your document with 2up.tex and the dvidvi layout option. Then run the dvi file through dvidvi. Specify the offsets for dvidvi at the middle of the page. E.g., for a side-by-side layout on 8.5x11in paper, use

dvidvi '2:0,1(5.5in,0in)' foo bar

For other paper sizes, replace 5.5in by half the target paper width. For the topbottom layout, reverse the dimensions, e.g., (0in,5.5in). For booklet printing, see the the documentation for dvidvi.

9 Compatibility

These macros should work with most TEX macro packages, except for the following possible but unlikely compatibility problems:

• If you use a macro package other than L^{A}TEX that does unusual things to end a document and/or that modifies the definition of \end, you may find that the last page is nor printed or that an extra page with headings is inserted at the end of the document. This is fixable on a case-by-case basis. See the redefinition of \end in 2up.tex.

• 2up.tex might not work if you meddle with TEX’s \shipout primitive after loading 2up.tex.

• If the first page of the source document is not on the first two-up target page (possible, for example, with two-sided printing and the booklet option, but generally unlikely), \special’s that come at the beginning of the document also do not get onto the first page of output. This can mess up \special’s for landscape printing or including a PostScript header file. In this case, you have to specify these things as command line options when using your dvi driver.

10 Changes

V0.9a Everything redone. Too many differences to point out.

V0.9b Interface redone again. booklet option added.

V0.9c Pages ship out a little earlier. A few bugs fixed.

   Parameters \pageseplength and \pagesepthickness added.
V0.9d Fixed bug with \twoupclearpage and \twoupeject.

V0.9e Made pages be counted (from dvi driver’s viewpoint) by the physical page number.

V0.9f Parameter \pagesepoffset added, and \pagesepthickness
        changed to \pagesepwidth.

V1.0 None. Just seemed seemed like it was time to call it 1.0 V1.1 Added Booklet and dvidvi target layouts.

\hoffset and \voffset in source document now have expected effect.

V1.2 Fixed incompatibility problem with AmS-TEX/AmS-L^{A}TEX. Added \TwoupWrites command.