The scale package^{∗}

Søren Sandmann

                  sandmann@daimi.au.dk

1998/11/02

Abstract

This package scales an entire document by either 1.44 (\magstep2) or by \sqrt{2}.

It is useful if you are writing a document on e.g. A5 paper and want to print it on A4 paper to achieve better resolution.

1 Introduction and usage

It is sometimes a good idea to scale a document by \sqrt{2}. This is the case if the output is to be photographically reduced. By scaling the document, you will achieve a resolution that is approximately \sqrt{2} times better.

Example: You are preparing a document for A5 paper, and your printer has a resolution that is 300 dpi and uses A4 paper. If you use this package, your document will be scaled by \sqrt{2}. After photographical reduction, the resolution will be \sqrt{2} · 300 dpi ≈ 424 dpi. The package is not restricted to A5 paper; it will work with any paper format, simply scaling the document by \sqrt{2}.

To use use the package, just include it in a \usepackage{...} statement. Your system must be able to scale your fonts arbitrarily, e.g. by making them on the fly or by using PostScript fonts.

There is an option to scale the document by \magstep2 instead of \sqrt{2}. You might want to use this as it, while not being as exact, avoids much of font generation.

To use this feature use the option ‘magstep2’, like this:

     \usepackage[magstep2]{scale}

Thanks to Rolf Niepraschk (niepraschk@ChbRB.Berlin.PTB.De) for the code for the above option and for some additional cleanups.

The default is to scale by \sqrt{2}

2 The implementation

All we need to do is to add a certain length to every margin and set \mag=1414

og \mag=\magstep2:

1 ⟨∗package⟩

∗This file has version number v1.1.1, last revised 1998/11/02.

 2 \newcommand\do@scale{}
 3 \DeclareOption{sqrt2}{%
 4 \renewcommand\do@scale{%
 5  \typeout{*** scaling: sqrt(2) = 1.414 ***}
 6  \setlength\@tempdima{0.292893219in}%      (1-(1/sqrt(2)))in
 7  \addtolength\oddsidemargin{\@tempdima}
 8  \addtolength\evensidemargin{\@tempdima}
 9  \addtolength\topmargin{\@tempdima}
10  \mag=1414}

11 }

The ‘magic’ number 0.292893219 is calculated the following way (using \oddsidemargin as example. Let o be the old \oddsidemargin, let h be the \hoffset, let i be the initial offset (this is always 1 in), and let m be the real margin (the one we see on the paper). By the primed versions of the variables we mean the ‘new’ one; i.e., o′ is the new \oddsidemargin. We define a function f to stand for the application of \mag=1414. This function does not change the initial offset i.

The real margin m is calculated as:

m = i + h + o

We want our new margin to be \sqrt{2} times longer than the old one:

m′ = \sqrt{2} m = f(i + h′ + o′),

This implies (since f doesn’t change i) that

\sqrt{2} m = i + \sqrt{2} h′ + \sqrt{2} o′
⟹ o′ = \frac{\sqrt{2} m − \sqrt{2} h′ − i}{\sqrt{2}} = m − h′ − \frac{1}{\sqrt{2}}i = i + o + h − h′ − \frac{1}{\sqrt{2}}i

We can just take h′ to be the same as h and get

o′ = o + i − \frac{1}{\sqrt{2}}i ≈ o + 0.292893219 in.

For the magstep2 option similar calculations give:

12 \DeclareOption{magstep2}{%
13 \renewcommand\do@scale{%
14  \typeout{*** scaling: magstep2 = 1.440 (1.2^2) ***}
15  \setlength\@tempdima{0.305555555555556in}% (1-(1/1.2^2))in
16  \addtolength\oddsidemargin{\@tempdima}
17  \addtolength\evensidemargin{\@tempdima}
18  \addtolength\topmargin{\@tempdima}
19  \mag=\magstep2}

20 }

All we need to do now is to make sqrt2 the default and execute \do@scale at the beginning of the document:

21 \ExecuteOptions{sqrt2}
22 \ProcessOptions
23 \AtBeginDocument{\do@scale\global\let\do@scale\@empty}

24 ⟨/package⟩