% \iffalse
%
% This is file `scale.dtx'
% Copyright (C) 1996 Soeren Sandmann. All rights reserved.
%
% Please send error reports and suggestions for improvements to
% Soeren Sandmann (sandmann@daimi.aau.dk).
%
% IMPORTANT NOTICE:
% You are allowed to distribute this file under the condition that
% it is distributed together with all the files mentioned in `00readme'.
%
% If you receive only some of these files from someone, complain!
%
% You are not allowed to distribute this file alone.  You are not
% allowed to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
%
% \fi
%% \CharacterTable
%%  {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
%%   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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\def\fileversion{v1.0}
\def\filedate{1996/10/09}
% \CheckSum{11}
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%<package>\ProvidesPackage{scale}
%<package>         [\filedate\space\fileversion]
%<*driver>
\documentclass{ltxdoc}
\begin{document}
   \DocInput{scale.dtx}
\end{document}
%</driver>
% \fi
% \changes{v1.0}{1996/10/09}{Initial version}
% \title{The \textsf{scale} package\thanks{This file
%        has version number \fileversion, last
%        revised \filedate.}}
% \author{S\o ren Sandmann\\\texttt{sandmann@daimi.aau.dk}}
% \date{\filedate}
%
% \maketitle
%
% \begin{abstract}
% This package scales an entire document 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.
% \end{abstract}
%
% \section{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}\cdot
% 300\,\mathrm{dpi}\approx 424\,\mathrm{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.
%
% \StopEventually{}
%
% \section{The implementation}
% All we need to do is to add a certain length to every margin and set
% |\mag=1414|:
%    \begin{macrocode}
%<*package>
\def\do@scale{%
    \addtolength\oddsidemargin{0.292893219in}
    \addtolength\evensidemargin{0.292893219in}
    \addtolength\topmargin{0.292893219in}
    \mag=1414}
%    \end{macrocode}
% The ``magic'' number 0.292893219 is calculated the following way (using
% |\oddside|\-|margin| as example. Let $o$ be the old |\oddsidemargin|,
% let $h$ be the |\hoffset|, let $i$ be the initial offset (this is always
% $1\,\mathrm{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 \emph{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
%   \begin{eqnarray*}
%     &\sqrt{2}\,m=i + \sqrt{2}\,h' + \sqrt{2}\,o'\\
%     \Longrightarrow\;&o'=
%       {\displaystyle\frac{\sqrt{2}\,m-\sqrt{2}\,h'-i}{\sqrt{2}}}
%       =m-h'-{\displaystyle\frac{1}{\sqrt{2}}}i
%       =i+o+h-h'-{\displaystyle\frac{1}{\sqrt{2}}}i
%   \end{eqnarray*}
% We can just take $h'$ to be the same as $h$ and get
%    \[o'=o+i-\frac{1}{\sqrt{2}}i\approx o+0.292893219\,\mathrm{in}.\]
%
% All we need to do now is to execute |\do@scale| at the beginning of the
% document:
%    \begin{macrocode}
\AtBeginDocument{\do@scale}
%</package>
%    \end{macrocode}
% \Finale
\endinput
