% mya4.sty for those who don't have any a4.sty on their engine
\def\fileversion{1.2}
\def\filedate{26 Feb 90}
\def\docdate {26 Feb 90}
%
%% \CheckSum{134}
%% \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         \%}
%%
%
%\iffalse
% Style option `A4' to be used with LaTeX V2.09
%
% Please report errors to: J.L. Braams
%                          JL_Braams@pttrnl.nl (Braams@hlsdnl5.bitnet)
%                      or: N.A.F.M. Poppelier
%                          Poppelier@hutruu53.bitnet}
%
% \changes{v1.0}{10 Jan 90}{Changed the margins for one-sided printing}
% \changes{v1.1}{23 Jan 90}{Added \WideMargins macros}
% \changes{v1.2}{26 Feb 90}{Consolidated setting of \marginparwidth}
%
%\fi
%
% \title{A style option to adapt the standard \LaTeX\ document
%        styles to A4 paper\thanks{This file
%        has version number \fileversion --
%        last revision \filedate, documentation dated \docdate.}}
%
% \author{Nico Poppelier}
% \address{\TeX nique         \\
%          Washingtondreef 153\\
%          3564 KD Utrecht}
% \netaddress{Poppelier@hutruu53.bitnet}
% \author{Johannes Braams}
% \address{PTT Research Neher Laboratories\\
%          P.O. Box 421\\
%          2260 AK Leidschendam}
% \netaddress{JL_Braams@pttrnl.nl}
%
% \date{Printed \today}
%
% \maketitle
%
% \begin{abstract}
%   This article describes a new style option that can be used with the
%   document styles that are distributed with the \LaTeX\ distributions.
%   It modifies the page layout to conform to the paper format most
%   commonly used in Europe, portrait A4.
% \end{abstract}
%
% \section{Introduction}
%
% This file is based on the document style options \verb+A4.sty+ and
% \verb+A4wide.sty+, which can be found in the Rochester style archive.
% The original style option \verb+A4.sty+ we started from was written by
% John Pavel, and is dated May 1987. This option only changes the vertical
% size of the text somewhat, by increasing the number of lines on a page.
% The style option \verb+A4wide.sty+ was written by Jean-Francois Lamy,
% and is dated July 1986. This option only increases the width of the text.
%
% \section{Goals and design decisions}
%
% As many people before us, we found the page layout as implemented in the
% standard \LaTeX\ document styles too much geared towards the
% American-sized paper, which is somewhat wider than A4 paper, but also
% noticeably less high.
%
% Our goal was to get a page layout that was suitable for A4 paper, and
% produced legible texts. There are a number of layout parameters that
% influence the legibility of a text. A parameter of major importance is
% the number of words (or characters) on a line. The maximum number of
% words per line is ten to twelve for optimal legibility, a rule-of-thumb
% that can be found in typographic literature (we used%\cite{treebus}).
% This results in a number of characters per line which lies somewhere
% between sixty and seventy.
%
% Another important parameter is the amount of white space surrounding the
% text. Here we have to distinguish between texts that are printed
% one-sided and texts that are printed two-sided (back to back). In the
% first case the margins on odd and even pages should be equal; in the
% latter case care should be taken that the texts on both sides of the
% paper overlap.
% Also a printed document is likely to be bound some way or another, so
% there should be enough white space in the `inner' margin\footnote{For
% two-sided printing, this is the left margin on odd-numbered pages and the
% right margin on even-numbered ones; for one-sided printing, this is
% always the left margin.} of the text to allow this.
%
% There is yet one more thing to take into account when designing a page
% layout. \LaTeX\ offers the possibility of using marginal notes and if
% someone wants to use marginal notes, they should of course fit on
% the paper.
%
% So, we have the following goals:
% \begin{enumerate}
% \item Choose the text width such that there will be sixty to seventy
%       characters on a line;
% \item See to it that in documents that are printed two-sided, the
%       texts which end up on two sides of one sheet of paper overlap;
% \item Leave enough white space in the `inner' margin to allow for
%       the binding of the document;
% \item Leave enough white space in the `outer' margin
%       for marginal notes if they are going to be used.
% \end{enumerate}
%
%
% \section{The implementation}
%
% \subsection{The starting point}
%
% Thus we set out to modify some of the design decisions in the standard
% document styles. Because we knew that we were not the first to tackle
% the problem, we started by having a look at what was already available.
% We came up with the two options mentioned earlier, which are publicly
% available. Undoubtedly there will exist many more such files, some of
% them maybe modifications of those two files.
%
% We had a look at the layout produced by both options and were not
% satisfied with it. For one thing, both of the original options \verb+A4+
% and \verb+A4wide+ modify only one aspect of the page layout. The first
% thing to do was to put these two files together. This resulted in a
% layout which was still unsatisfactory, since for the 10-point and
% 11-point options lines in the text contained on the average eighty
% characters or more.
%
% \subsection{What else?}
%
% \DescribeMacro\textwidth
% \DescribeMacro\marginparwidth
% Because the result so far gave us lines that contained too many
% characters, we decreased the \verb+\textwidth+ to get lines that
% contain about sixty to seventy characters for all three size options.
% Still more work had to be done. As it turned out, using our new
% \verb+A4.sty+ together with the option \verb+twosided+ had a drawback:
% when the document was printed two-sided the texts on both side of one
% piece of paper overlapped only partly, which does not look good. We
% solved this by modifying the width of the margins for two-sided
% printing. At the same time we modified the \verb+\marginparwidth+ so
% that if someone uses a marginal note it would completely fit on the
% paper instead of falling off the page, which obviously would render
% the note unreadable.
%
% \DescribeMacro\WideMargins
% The decisions described above allow for marginal notes to be printed
% along with the normal text, but if someone makes heavy use of marginal
% notes, the resultant layout will not be very satisfactory, because if
% the full width of the marginal notes is used, they will take up too
% much space in the `outer' margin. For this case we provide the macro
% \verb+\WideMargins+. This macro modifies the page-layout parameters in
% such a way that the width reserved for marginal notes becomes 1.5
% inches. To achieve this the width of the main body of the text is
% decreased. This macro is meant to be used only in the preamble of the
% document.
%
%\StopEventually{
% \section{Conclusion}
%
% We have presented a new approach to adapt the page layout of the
% document styles that are part of the standard \LaTeX\ distributions to
% the dimensions of A4 paper. The width of marginal notes has been taken
% into account and a means to get wider marginal notes at the cost of
% shorter lines in the main body of the text has been provided.
%
% \begin{thebibliography}{9}
%   \bibitem{treebus} K.F. Treebus.
%   {\em Tekstwijzer, een gids voor het grafisch verwerken van tekst.}
%   SDU Uitgeverij ('s-Gravenhage, 1988). A Dutch book on layout
%   design and typography.
% \end{thebibliography}
%
% \makesignature
% }
%
% \subsection{The code}
%
% We begin by identifying the version of this file on the terminal and
% in the transcript file.
%    \begin{macrocode}
\typeout{Style option `A4' \fileversion\space<\filedate> (NP and JLB)}
% \typeout{English documentation\space\space\space<\docdate> (JLB)}
%    \end{macrocode}
%
% \begin{macro}{\topmargin}
% First, we redefine the \verb+\textheight+ and \verb+\topmargin+. The
% \verb+\topmargin+ is the distance from the reference point on the page
% to the top of the page of text. In most cases extra white space is not
% necessary since one inch of white space at the top of the page suffices.
%    \begin{macrocode}
\topmargin 0pt
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\textheight}
% The dimension parameter \verb+\textheight+ gives the total height of the
% text, including footnotes and figures, excluding the running head and
% foot. This height is given as an integral number times the
% \verb+\baselineskip+, which results in an integral number of lines on a
% page.
%
% \noindent
% We have to include definitions of all relevant dimension parameters for
% each of the cases 10-point, 11-point and 12-point. We do this with a
% case statement:
%
%    \begin{macrocode}
\ifcase \@ptsize
    \textheight 53\baselineskip
%    \end{macrocode}
% \noindent
% which modifies the height of the text for texts to be produced
% with the ten-point typeface:
%    \begin{macrocode}
\or
    \textheight 46\baselineskip
%    \end{macrocode}
% \noindent
% the same for eleven point:
%    \begin{macrocode}
\or
    \textheight 42\baselineskip
%    \end{macrocode}
% \noindent
% and for twelve point. Finally we close the \verb+\ifcase+ statement:
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \noindent
% The only thing left to be done is to add the \verb+\topskip+ to
% the \verb+\textheight+.
% The value of \verb+\topskip+ appears always to be 10pt.
%
%    \begin{macrocode}
\advance\textheight by \topskip
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\textwidth}
% \begin{macro}{\oddsidemargin}
% \begin{macro}{\evensidemargin}
% That was the `vertical part' of the work. Now we have some work to do
% to get things right horizontally. Again we have to distinguish between
% the various character sizes because sixty eleven-point characters take
% up more space than sixty ten-point characters. But there's more to
% take into account. If documents are printed two-sided, the texts on
% both sides of the paper should overlap completely. This can be done be
% assigning appropriate values to \verb+\oddsidemargin+ and
% \verb+\evensidemargin+, the parameters that define the left margins on
% odd and even pages respectively.
%
% \noindent
% First we start a case statement to distinguish between the various
% typeface sizes.
%    \begin{macrocode}
\ifcase \@ptsize
%    \end{macrocode}
% Then we specify the width of the text.
%    \begin{macrocode}
    \textwidth      5.00in
%    \end{macrocode}
% \noindent
% Also specify the width of marginal notes. They must have a
% reasonable width to be of any use, and this should be the same for
% either one-sided or two-sided printing.
%    \begin{macrocode}
    \marginparwidth 1.00in
%    \end{macrocode}
% \noindent
% Here we need an if statement to test whether the option \verb+twosided+
% has been specified.
%    \begin{macrocode}
  \if@twoside
%    \end{macrocode}
% \noindent
% If it was, assign appropriate values to the margin parameters
%    \begin{macrocode}
    \oddsidemargin  0.55in
    \evensidemargin 0.75in
  \else
%    \end{macrocode}
% \noindent
% If the option \verb+twosided+ was not used, both margin parameters
% must have the same value, for texts on consecutive pages have to
% be put in the same place on the paper.
%    \begin{macrocode}
    \oddsidemargin  0.55in
    \evensidemargin 0.55in
%    \end{macrocode}
% \noindent
% Now we close the if statement.
%    \begin{macrocode}
  \fi
%    \end{macrocode}
% \noindent
% We are ready with the modifications for the ten-point typeface size, so
% now we do something similar for the eleven-point typeface.
%    \begin{macrocode}
\or
    \textwidth      5.20in
    \marginparwidth 1.00in
  \if@twoside
    \oddsidemargin  0.45in
    \evensidemargin 0.65in
  \else
    \oddsidemargin  0.45in
    \evensidemargin 0.45in
  \fi
%    \end{macrocode}
% \noindent
% One more time, now for the twelve-point typeface.
%    \begin{macrocode}
\or
    \textwidth      5.70in
    \marginparwidth 0.80in
  \if@twoside
    \oddsidemargin  0.20in
    \evensidemargin 0.40in
  \else
    \oddsidemargin  0.20in
    \evensidemargin 0.20in
  \fi
%    \end{macrocode}
% \noindent
% Finally we close the case statement.
%    \begin{macrocode}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\WideMargins}
%    This macro is somewhat tricky: it has to find out
%    which typeface size is used, whether the document should be printed
%    two-sided, and whether the \verb+\reversemarginpar+ is in effect.
%    \verb+\reversemarginpar+ makes the marginal notes appear in the
%    margin on the opposite side of the normal placement.
%    \begin{macrocode}
\def\WideMargins{%
%    \end{macrocode}
% \noindent
%    Because for each typeface size the changes to the parameters that
%    need to be made are similar, the macro \verb+\WideMargins+
%    uses an internal macro \verb+\@widemargins+.
%
% \begin{macro}{\ExtraWidth}
%    In order to store the amount of extra width needed for the marginal
%    notes an extra dimension parameter is defined.
%
%    \begin{macrocode}
  \newdimen\ExtraWidth
%    \end{macrocode}
% \end{macro}
%
% \noindent
%    First find out about the point size, then call \verb+\@widemargins+ to
%    modify the margin widths by the amount given in \verb+\ExtraWidth+.
%    \begin{macrocode}
  \ifcase \@ptsize
%    \end{macrocode}
%
% \noindent
%    For both 10-point and 11-point texts the width for marginal notes is
%    already 1 inch, so we increase it by half an inch. We subtract half an
%    inch from the text width and modify the margins appropriately.
%
%    \begin{macrocode}
    \ExtraWidth = 0.5in
    \@widemargins
  \or
    \ExtraWidth = 0.5in
    \@widemargins
  \or
%    \end{macrocode}
%
% \noindent
%    For 12-point texts the marginal notes are only 0.8 inch wide, so
%    now we have to add 0.7 inch to get them 1.5 inch wide.
%
%    \begin{macrocode}
    \ExtraWidth = 0.7in
    \@widemargins
%    \end{macrocode}
%
% \noindent
%    This macro should only be called once, during the preamble of a
%    document, so we \verb+\let+ it be equal to \verb+\relax+ as soon
%    as the work is done.
%    \begin{macrocode}
  \fi\let\WideMargins\relax\let\@widemargins\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@preamblecmds}
%    We add \verb+\WideMargins+ to \verb+\@preamblecmds+, which is a
%    list of commands to be used only in the preamble of a document.
%
%    \begin{macrocode}
{\def\do{\noexpand\do\noexpand}
 \xdef\@preamblecmds{\@preamblecmds \do\WideMargins}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@widemargins}
%    This macro modifies the margin parameters. To do this it uses
%    the dimension variable \verb+\ExtraWidth+, which was defined by
%    \verb+\WideMargins+.
%
% \noindent
%    First the \verb+\ExtraWidth+ is subtracted from the \verb+\textwidth+
%    and added to the \verb+\marginparwidth+.
%    \begin{macrocode}
\def\@widemargins{%
    \global\advance\textwidth by -\ExtraWidth
    \global\advance\marginparwidth by \ExtraWidth
%    \end{macrocode}
%
% \noindent
%    Then we modify the margins, but the value of the switch
%    \verb+\if@twoside+ has to be taken into account. Because
%    we have to test another switch (\verb+\if@reversemargin+)
%    we add another level of macros to modify the margin parameters%
%
%    \begin{macrocode}
    \if@twoside
      \tw@sidedwidemargins
    \else
      \@nesidedwidemargins
    \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tw@sidedwidemargins}
%    Normally the marginal notes are printed in the `outer' margins, so
%    we have to increase the \verb+\evensidemargin+ to keep the text
%    balanced on both sides of the paper, but if \verb+\reversemarginpar+
%    is in effect we have to increase the \verb+\oddsidemargin+ and
%    decrease the \verb+\evensidemargin+ accordingly.
%
%    \begin{macrocode}
\def\tw@sidedwidemargins{%
    \if@reversemargin
%    \end{macrocode}
%
% \noindent
%    Notice that for documents printed two-sided, the
%    \verb+\evensidemargin+ is wider than the \verb+\oddsidemargin+;
%    this difference in width is transferred to the other margin.
%
%    \begin{macrocode}
      \@tempdima=\evensidemargin
      \advance\@tempdima by -\oddsidemargin
      \advance\oddsidemargin by \ExtraWidth
      \advance\oddsidemargin by \@tempdima
      \advance\evensidemargin by -\@tempdima
    \else
%    \end{macrocode}
%
% \noindent
%    If the marginal notes go on the normal side of the paper, only the
%    \verb+\evensidemargin+ has to be increased.
%
%    \begin{macrocode}
      \advance\evensidemargin by \ExtraWidth
    \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@nesidedwidemargins}
%    For documents that are printed one-sided, both margins have the same
%    width. The default placement for the marginal notes is in the right
%    margin, so if \verb+\reversemarginpar+ is {\em not\/} in effect the
%    margin parameters need not be modified. If it is in effect, both the
%    \verb+\oddsidemargin+ and the \verb+\evensidemargin+ need to be
%    increased.
%
%    \begin{macrocode}
\def\@nesidedwidemargins{%
    \if@reversemargin
      \advance\oddsidemargin by \ExtraWidth
      \advance\evensidemargin by \ExtraWidth
    \fi}
%    \end{macrocode}
%    \end{macro}
%
% \Finale
\endinput
