Debian Codegraph @

texmf-dist/source/latex/scale/scale.dtx

raw
1 %\iffalse
2 % This is file `scale.dtx'
3 %
4 % Please send error reports and suggestions for improvements to
5 % Soeren Sandmann ([email protected]).
6 %
7 % copyright (C) 1999 Soeren Sandmann Pedersen
8 %
9 % This program is free software; you can redistribute it and/or
10 % modify it under the terms of the GNU General Public License
11 % as published by the Free Software Foundation; either version 2
12 % of the License, or (at your option) any later version.
13 %
14 % This program is distributed in the hope that it will be useful,
15 % but WITHOUT ANY WARRANTY; without even the implied warranty of
16 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 % GNU General Public License for more details.
18 %
19 % You should have received a copy of the GNU General Public License
20 % along with this program; if not, write to the Free Software
21 % Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 %
23 %\fi
24 %% \CharacterTable
25 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
26 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
27 %% Digits \0\1\2\3\4\5\6\7\8\9
28 %% Exclamation \! Double quote \" Hash (number) \#
29 %% Dollar \$ Percent \% Ampersand \&
30 %% Acute accent \' Left paren \( Right paren \)
31 %% Asterisk \* Plus \+ Comma \,
32 %% Minus \- Point \. Solidus \/
33 %% Colon \: Semicolon \; Less than \<
34 %% Equals \= Greater than \> Question mark \?
35 %% Commercial at \@ Left bracket \[ Backslash \\
36 %% Right bracket \] Circumflex \^ Underscore \_
37 %% Grave accent \` Left brace \{ Vertical bar \|
38 %% Right brace \} Tilde \~}
39 %%
40 \def\fileversion{v1.1.2}
41 \def\filedate{1999/08/13}
42 % \CheckSum{43}
43 % \iffalse
44 %<package>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
45 %<package>\ProvidesPackage{scale}
46 %<package> [\filedate\space\fileversion]
47 %<*driver>
48 \documentclass{ltxdoc}
49 \begin{document}
50 \DocInput{scale.dtx}
51 \end{document}
52 %</driver>
53 % \fi
54 % \changes{v1.0}{1996/10/09}{Initial version}
55 % \changes{v1.1}{1998/11/02}{Added support for the magstep2 option. Thanks to
56 % Rolf Niepraschk ([email protected])}
57 % \changes{v1.1.1}{1999/05/13}{Released under the GPL}
58 % \changes{v1.1.2}{1999/08/13}{Fixed a bug that caused an error when running \TeX\ on scale.dtx}
59 % \title{The \textsf{scale} package\thanks{This file
60 % has version number \fileversion, last
61 % revised \filedate.}}
62 % \author{S\o ren Sandmann\\\texttt{[email protected]}}
63 % \date{\filedate}
64 %
65 % \maketitle
66 %
67 % \begin{abstract}
68 % This package scales an entire document by either 1.44~(|\magstep2|)
69 % or by~$\sqrt{2}$.
70 %
71 % It is useful if you are writing a document on
72 % e.g.\ A5 paper and
73 % want to print it on A4 paper to achieve better resolution.
74 % \end{abstract}
75 %
76 % \section{Introduction and usage}
77 % It is sometimes a good idea to scale a document by $\sqrt{2}$.
78 % This is the case if the output is to be photographically
79 % reduced. By scaling the document, you will achieve a resolution that is
80 % approximately $\sqrt{2}$ times better.
81 %
82 % Example: You are preparing a document for A5 paper, and your printer
83 % has a resolution that is 300\,dpi and uses A4 paper. If you use this
84 % package, your document will be scaled by $\sqrt{2}$. After
85 % photographical reduction, the resolution will be $\sqrt{2}\cdot
86 % 300\,\mathrm{dpi}\approx 424\,\mathrm{dpi}$. The package is not restricted
87 % to A5 paper; it will work with any paper format, simply scaling the
88 % document by $\sqrt{2}$.
89 %
90 % To use use the package, just include it in a |\usepackage{...}|
91 % statement. Your system must be able to scale your fonts arbitrarily,
92 % e.g.\ by making them on the fly or by using PostScript fonts.
93 %
94 % There is an option to scale the document by |\magstep2| instead of
95 % $\sqrt{2}$. You might want to use this as it, while not being as
96 % exact, avoids much of font generation.
97 %
98 % To use this feature use the option `magstep2', like this:
99 % \begin{quote}
100 % |\usepackage[magstep2]{scale}|
101 % \end{quote}
102 % Thanks to Rolf Niepraschk
103 % ([email protected]) for the code for the above option
104 % and for some additional cleanups.
105 %
106 % The default is to scale by $\sqrt{2}$
107 % \StopEventually{}
108 %
109 % \section{The implementation}
110 % All we need to do is to add a certain length to every margin and set
111 % |\mag=1414| og |\mag=\magstep2|:
112 % \begin{macrocode}
113 %<*package>
114 \newcommand\do@scale{}
115 \DeclareOption{sqrt2}{%
116 \renewcommand\do@scale{%
117 \typeout{*** scaling: sqrt(2) = 1.414 ***}
118 \setlength\@tempdima{0.292893219in}% (1-(1/sqrt(2)))in
119 \addtolength\oddsidemargin{\@tempdima}
120 \addtolength\evensidemargin{\@tempdima}
121 \addtolength\topmargin{\@tempdima}
122 \mag=1414}
123 }
124 % \end{macrocode}
125 %
126 % The magic number 0.292893219 is calculated the following way (using
127 % |\oddside|\-|margin| as example. Let $o$ be the old |\oddsidemargin|,
128 % let $h$ be the |\hoffset|, let $i$ be the initial offset (this is always
129 % $1\,\mathrm{in}$), and let $m$ be the real margin (the one we see on
130 % the paper). By the primed versions of the variables we mean the `new'
131 % one; i.e., $o'$ is the new |\oddsidemargin|. We define a function $f$ to
132 % stand for the application of |\mag=1414|. This function does \emph{not}
133 % change the initial offset $i$.
134 %
135 % The real margin $m$ is calculated as:
136 % \[m=i+h+o\]
137 % We want our new margin to be $\sqrt{2}$ times longer than the old one:
138 % \[m'=\sqrt{2}\,m=f(i+h'+o'),\]
139 % This implies (since $f$ doesn't change $i$) that
140 % \begin{eqnarray*}
141 % &\sqrt{2}\,m=i + \sqrt{2}\,h' + \sqrt{2}\,o'\\
142 % \Longrightarrow\;&o'=
143 % {\displaystyle\frac{\sqrt{2}\,m-\sqrt{2}\,h'-i}{\sqrt{2}}}
144 % =m-h'-{\displaystyle\frac{1}{\sqrt{2}}}i
145 % =i+o+h-h'-{\displaystyle\frac{1}{\sqrt{2}}}i
146 % \end{eqnarray*}
147 % We can just take $h'$ to be the same as $h$ and get
148 % \[o'=o+i-\frac{1}{\sqrt{2}}i\approx o+0.292893219\,\mathrm{in}.\]
149 %
150 % For the magstep2 option similar calculations give:
151 % \begin{macrocode}
152 \DeclareOption{magstep2}{%
153 \renewcommand\do@scale{%
154 \typeout{*** scaling: magstep2 = 1.440 (1.2^2) ***}
155 \setlength\@tempdima{0.305555555555556in}% (1-(1/1.2^2))in
156 \addtolength\oddsidemargin{\@tempdima}
157 \addtolength\evensidemargin{\@tempdima}
158 \addtolength\topmargin{\@tempdima}
159 \mag=\magstep2}
160 }
161 % \end{macrocode}
162 %
163 % All we need to do now is to make sqrt2 the default and execute
164 % |\do@scale| at the beginning of the document:
165 % \begin{macrocode}
166 \ExecuteOptions{sqrt2}
167 \ProcessOptions
168 \AtBeginDocument{\do@scale\global\let\do@scale\@empty}
169 %</package>
170 % \end{macrocode}
171 % \Finale
172 \endinput