% This is LAYOUT.STY from Kent McPherson, SLI Avionic Systems Corp.
%
% Eingetippt von S. Rimmelspacher am 27.05.88
% Geaendert und lauffaehig gemacht von Dietmar Heinrich
% und Harald Meyer, Uni Karlsruhe; 07. Juli 1988
 
% Define \bs if it is undefined, redefine
% it if it is already defined.
 
\@ifundefined{bs}{\newcommand\bs{\char '134 }}%
  {\renewcommand\bs{\char '134 }}
\newcount\hofset
\newcount\vofset
\newcount\hofref
\newcount\vofref
\newcount\omargin
\newcount\omarginref
\newcount\emargin
\newcount\emarginref
\newcount\marginref
\newcount\tmargin
\newcount\hheight
\newcount\hsep
\newcount\theight
\newcount\twidth
\newcount\mparsep
\newcount\mparwidth
\newcount\fskip
\newcount\fheight
\newcount\headref
\newcount\bodyref
\newcount\footref
\newcount\margnoteref
\newcount\oneinch
\newcount\eighthalfinch
\newcount\teninch
\newcount\eleveninch
\newcount\xworka        % hi
\newcount\yworka        %   lf
\newcount\xworkb        %     sv
\newcount\yworkb        %       ar
\newcount\xworkz        %         ia
\newcount\yworkz        %           bl
\newcount\xworkv        %             en
\newcount\yworkv        %               !!
%
%
% Constants
%
\oneinch=72
\eighthalfinch=615
\teninch=723
\eleveninch=795
%
% Define the calculations macro
%
\def\layout{
%
% \newpage % neue seite
%
% Convert dimensions to scalar values
% for use in the picture environment
\hofset=\hoffset
  \divide\hofset by 65536
\hofref=\hofset
\advance\hofset by \oneinch
\vofset=\voffset
  \divide\vofset by 65536
\vofref=\vofset
\vofset=\teninch
  \advance\vofset by -\vofref
%
\tmargin=\topmargin
  \divide\tmargin   by 65536
%
\hheight=\headheight
  \divide\hheight   by 65536
\headref=\teninch
  \advance\headref by -\vofref
\advance\headref by -\tmargin
  \advance\headref by -\hheight
%
\hsep=\headsep
  \divide\hsep      by 65536
%
\theight=\textheight
  \divide\theight   by 65536
\bodyref=\headref
  \advance\bodyref by -\hsep
  \advance\bodyref by -\theight
%
\fskip=\footskip
  \divide\fskip     by 65536
%
\fheight=\footheight
  \divide\fheight   by 65536
\footref=\bodyref
  \advance\footref by -\fskip
%
\omargin=\oddsidemargin
  \divide\omargin   by 65536
%\omarginref=\omargin
  \advance\omarginref by \oneinch
%\advance\omarginref by \hofref
%
\emargin=\evensidemargin
  \divide\emargin   by 65536
%\emarginref=\emargin
  \advance\emarginref by \oneinch
%\advance\emarginref by \hofset
%
\twidth=\textwidth
  \divide\twidth    by 65536
%
\mparsep=\marginparsep
  \divide\mparsep   by 65536
%
\mparwidth=\marginparwidth
  \divide\mparwidth   by 65536
%
\if@twoside
    \ifodd\count\z@
%
%Twosided, odd page
%
  \typeout{Two-sided document
    style, odd page.}
  \margnoteref=\oneinch
    \advance\margnoteref by \hofref
  \advance\margnoteref by \omargin
  \marginref\margnoteref
  \advance\margnoteref by \twidth
  \advance\margnoteref by \mparsep
 
    \else
%
% Twosided, even page
%
  \typeout{Two-sided document
    style, even page.}
  \margnoteref=\oneinch
    \advance\margnoteref by \hofref
  \advance\margnoteref by \emargin
  \marginref\margnoteref
  \advance\margnoteref by -\mparsep
  \advance\margnoteref by -\mparwidth
 
    \fi
\else
%
% Not twosided, do odd page
%
\typeout{One-sided document style.}
\margnoteref=\oneinch
  \advance\margnoteref by \hofref
\advance\margnoteref by \omargin
\marginref\margnoteref
\advance\margnoteref by \twidth
\advance\margnoteref by \mparsep
\fi
Gestrichelte Linien sollen
{\tt \bs hoffset} und
{\tt \bs voffset} verdeutlichen.
 
\medskip 
%
%
%Define the picture to be drawn
\setlength{\unitlength}{.5pt}
\begin{picture}(\eighthalfinch,\eleveninch)
\centering
\thicklines
%
% Pagebox and reference lines
%
\put(0,0){\framebox(\eighthalfinch,\eleveninch){\mbox{}}}
\put(0,\vofset){\dashbox{10}(\eighthalfinch,0){\mbox{}}}
\put(\hofset,0){\dashbox{10}(0,\eleveninch){\mbox{}}}
%
% Header 
%
\put(\marginref,\headref){\framebox
  (\twidth,\hheight){\footnotesize Header}}
%
% Body
%
\put(\marginref,\bodyref){\framebox
  (\twidth,\theight){Body}}
%
% zeichne \textwidth
\thinlines
\xworkz = \twidth                       % berechne die...
\divide\xworkz by 2                     % x-koordinate des...
\advance\xworkz by \marginref           % pfeilzentrums
\yworkz = \bodyref                      % pfeil liegt 25 pt ueber..
\advance\yworkz by 50                   % dem unteren ende der body-box
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 8}}
\xworkv = \twidth                       % berechne die...
\divide\xworkv by 2                     % laenge des..
\advance\xworkv by -10                  % pfeils
\advance\xworkz by -10                  % pfeilanfang
\put(\xworkz,\yworkz){\vector(-1,0){\xworkv}}
\advance\xworkz by 20                   % pfeilanfang
\put(\xworkz,\yworkz){\vector(+1,0){\xworkv}}
%
% zeichne \textheight
\yworkz = \theight                      % berechne die...
\divide\yworkz by 2                     % y-koordinate des...
\advance\yworkz by \bodyref             % pfeilzentrums
\xworkz = \marginref                    % pfeil teilt die box im..
\xworka = \twidth                       % verhaeltnis..
\divide\xworka by 5                     % 1:4
\advance\xworkz by \twidth              %
\advance\xworkz by -\xworka             %
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 7}}
\yworkv = \theight                      % berechne die...
\divide\yworkv by 2                     % laenge des..
\advance\yworkv by -10                  % pfeils
\advance\yworkz by -10                  % pfeilanfang
\put(\xworkz,\yworkz){\vector(0,-1){\yworkv}}
\advance\yworkz by 20                   % pfeilanfang
\put(\xworkz,\yworkz){\vector(0,+1){\yworkv}}
%
%
% zeichne \hoffset
\yworkz = \footref                      % y-koordinate des pfeilzentrums
\xworkz = \hofset                       % berechne die x-koordinate..
\divide\xworkz by 2                     % des pfeilzentrums
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 1}}
\xworkv = \hofset                       % berechne die...
\divide\xworkv by 2                     % laenge des..
\advance\xworkv by -10                  % pfeils
\advance\xworkz by -10                  % pfeilanfang
\put(\xworkz,\yworkz){\vector(-1,0){\xworkv}}
\advance\xworkz by 20                   % pfeilanfang
\put(\xworkz,\yworkz){\vector(+1,0){\xworkv}}
%
%
% zeichne \oddsidemargin bzw. \evensidemargin
\advance\yworkz by \fheight             % y-koordinate
\xworkz = \marginref                    % berechne die..
\advance\xworkz by \hofset              % x-koordinate
\divide\xworkz by 2                     % des pfeilzentrums
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 3}}
\xworkv = \marginref                    % berechne..
\advance\xworkv by -\hofset             % die..
\divide\xworkv by 2                     % pfeil-..
\advance\xworkv by -10                  % laenge
\advance\xworkz by -10                  % pfeilanfang
\put(\xworkz,\yworkz){\vector(-1,0){\xworkv}}
\advance\xworkz by 20                   % pfeilanfang
\put(\xworkz,\yworkz){\vector(+1,0){\xworkv}}
%
%
% zeichne \marginparwidth
\yworkz = \theight                      % berechne die..
\divide \yworkz by 4                    % y-koordinate..
\advance\yworkz by \bodyref             % des pfeilzentrums
\xworkz = \mparwidth                    % berechne die..
\divide \xworkz by 2                    % x-koordinate..
\advance\xworkz by \margnoteref         % des pfeilzentrums
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 10}}
\xworkv = \mparwidth                    % berechne die..
\divide\xworkv by 2                     % pfeil-..
\advance\xworkv by -10                  % laenge
\advance\xworkz by -10                  % pfeilanfang
\put(\xworkz,\yworkz){\vector(-1,0){\xworkv}}
\advance\xworkz by 20                   % pfeilanfang
\put(\xworkz,\yworkz){\vector(+1,0){\xworkv}}
%
%
% zeichne \marginparsep
\advance\yworkz by 30                   % y-koordinate
%
\if@twoside
    \ifodd\count\z@
%
%Twosided, odd page
%
    \xworkz = \margnoteref                  % pfeilanfang..
    \advance\xworkz by 20                   % rechts
    \put(\xworkz,\yworkz){\vector(-1,0){20}}% pfeil
    \advance\xworkz by 10                   % pfeilzentrum
    \put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
    \put(\xworkz,\yworkz){\makebox(0,0){\tiny 9}}
    \xworkz = \margnoteref                  % pfeilanfang..
    \advance\xworkz by -\mparsep            % links..
    \advance\xworkz by -20                  % berechnen
    \put(\xworkz,\yworkz){\vector(+1,0){20}}% pfeil
        \else
%
% Twosided, even page
%
    \xworkz = \marginref                    % pfeilanfang..
    \advance\xworkz by 20                   % rechts
    \put(\xworkz,\yworkz){\vector(-1,0){20}}% pfeil
    \advance\xworkz by 10                   % pfeilzentrum
    \put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
    \put(\xworkz,\yworkz){\makebox(0,0){\tiny 9}}
    \xworkz = \marginref                    % pfeilanfang..
    \advance\xworkz by -\mparsep            % links..
    \advance\xworkz by -20                  % berechnen
    \put(\xworkz,\yworkz){\vector(+1,0){20}}% pfeil
    \fi
\else
%
% Not twosided, do odd page
%
\xworkz = \margnoteref                  % pfeilanfang..
\advance\xworkz by 20                   % rechts
\put(\xworkz,\yworkz){\vector(-1,0){20}}% pfeil
\advance\xworkz by 10                   % pfeilzentrum
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 9}}
\xworkz = \margnoteref                  % pfeilanfang..
\advance\xworkz by -\mparsep            % links..
\advance\xworkz by -20                  % berechnen
\put(\xworkz,\yworkz){\vector(+1,0){20}}% pfeil
\fi
%
%
% zeichne \footskip
\xworka = \twidth
\divide\xworka by 8
\xworkz = \marginref                    % berechne die...
\advance\xworkz by \xworka              % x-koordinate des pfeilzentrums
\yworkz = \footref                      % zeichne..
\advance\yworkz by -20                  % unteren..
\put(\xworkz,\yworkz){\vector(0,+1){20}}% pfeil
\advance\yworkz by -10                  %
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 11}}
\yworkz = \bodyref                      % zeichne..
\advance\yworkz by 20                   % oberen..
\put(\xworkz,\yworkz){\vector(0,-1){20}}% pfeil
%
%
% zeichne \footheight
\advance\xworkz by \xworka              % x-koordinate des pfeilzentrums
\yworkz = \footref                      % zeichne..
\advance\yworkz by -20                  % unteren..
\put(\xworkz,\yworkz){\vector(0,+1){20}}% pfeil
\advance\yworkz by -10                  %
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 12}}
\yworkz = \footref                      % zeichne..
\advance\yworkz by \fheight             % den..
\advance\yworkz by 20                   % oberen..
\put(\xworkz,\yworkz){\vector(0,-1){20}}% pfeil
%
%
% zeichne \voffset
\xworkz = \eighthalfinch                % x-koordinate des
\advance\xworkz by -50                  % pfeilzentrums
\yworkz = \eleveninch                   % berechne..
\yworkv = \eleveninch                   % die..
\advance\yworkz by \vofset              % y-koordinate..
\divide\yworkz by 2                     % des pfeilzentrums..
\yworka = \yworkz                       % und..
\advance\yworkv by -\vofset             % die..
\divide\yworkv by 2                     % laenge des..
\advance\yworkv by -10                  % pfeils
\put(\xworkz,\yworkz){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworkz){\makebox(0,0){\tiny 2}}
\advance\yworkz by -10                  % pfeilanfang
\put(\xworkz,\yworkz){\vector(0,-1){\yworkv}}
\advance\yworkz by 20                   % pfeilanfang
\put(\xworkz,\yworkz){\vector(0,+1){\yworkv}}
%
%
% zeichne \topmargin, headheight, headsep
\xworka = \twidth                       % berechne die
\divide\xworka by 8                     % x-schrittweite
\xworkz = \marginref                    %
\advance\xworkz by \xworka              % x-koordinate des pfeilzentrums
\put(\xworkz,\yworka){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworka){\makebox(0,0){\tiny 4}}
\advance\xworkz by \xworka              % x-koordinate des pfeilzentrums
\put(\xworkz,\yworka){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworka){\makebox(0,0){\tiny 5}}
\advance\xworkz by \xworka              % x-koordinate des pfeilzentrums
\put(\xworkz,\yworka){\circle{20}}      % erzeuge einen kringel..
\put(\xworkz,\yworka){\makebox(0,0){\tiny 6}}
\advance\yworka by -10                  % verschiebe..
\xworkz = \marginref                    % den pfeil-..
\advance\xworkz by \xworka              % anfangspunkt
\yworkv = \yworka
\advance\yworkv by -\vofset
\put(\xworkz,\yworka){\vector(0,-1){\yworkv}}
\advance\xworkz by \xworka              % anfangspunkt
\yworkv = \yworka
\advance\yworkv by -\headref
\advance\yworkv by -\hheight
\put(\xworkz,\yworka){\vector(0,-1){\yworkv}}
%
\advance\xworkz by \xworka              % anfangspunkt
\advance\yworkv by \hheight
\put(\xworkz,\yworka){\vector(0,-1){\yworkv}}
%
%
\xworkz = \marginref                    % definiere x-..
\advance\xworkz by \xworka              % anfangspunkt
\yworkv = \headref
\advance\yworkv by \hheight
\advance\yworkv by -20
\put(\xworkz,\yworkv){\vector(0,+1){20}}
%
\advance\xworkz by \xworka              % anfangspunkt
\yworkv = \headref
\advance\yworkv by -20
\put(\xworkz,\yworkv){\vector(0,+1){20}}
%
\advance\xworkz by \xworka              % anfangspunkt
\yworkv = \headref
\advance\yworkv by -20
\advance\yworkv by -\hsep
\put(\xworkz,\yworkv){\vector(0,+1){20}}
%
%
%
\thicklines
% Footer 
%
\put(\marginref,\footref){\framebox
  (\twidth,\fheight){\footnotesize Footer}}
%
% Marginal notes
%
\put(\margnoteref,\bodyref){\framebox
  (\mparwidth,\theight)%
{\footnotesize
\shortstack{Margin\\Notes}}}
%
\end{picture}
 
\medskip 
%
% Display the settings used to make
% the picture.   Note: fractional
% points are truncated, i.e.,
% 72.27pt is displayed as 72pt
%
{\tt
\begin{tabular}{l@{\hspace{20pt}}l}
1 \bs hoffset = \number\hofref pt &
2 \bs voffset = \number\vofref pt \\
  \typeout{hoffset = \number\hofref  pt}
  \typeout{voffset = \number\vofref  pt}
3 \bs
   \if@twoside
     \ifodd\count\z@ oddsidemargin
     \else evensidemargin
     \fi 
   \else oddsidemargin
   \fi
= \number
   \if@twoside
     \ifodd\count\z@ \omargin
     \else \emargin
     \fi 
   \else \omargin
   \fi
pt & 4 \bs topmargin = \number\tmargin pt \\
5 \bs headheight = \number\hheight pt &
  6 \bs headsep = \number\hsep pt \\
  \typeout{textheight = \number\theight  pt}
  \typeout{textwidth  = \number\twidth  pt}
7 \bs textheight = \number\theight pt &
  8 \bs textwidth = \number\twidth pt \\
9 \bs marginparsep = \number\mparsep pt &
10 \bs marginparwidth = \number\mparwidth pt \\
11 \bs footskip = \number\fskip pt &
12 \bs footheight = \number\fheight pt \\ [10pt]
\multicolumn{2}{c}{72pt $\approx$ 1 inch = 2.54 cm}
\end{tabular}}
%
\newpage % neue seite
%
}  % end of \def\layout
