% PREPRN DOCUMENT STYLE -- version 0.6 for LaTeX version 0.9
% Copyright (C) 1983 by Leslie Lamport

\warning{Document Style 'preprn' -- version 0.6 for LaTeX version 0.9}
\warning{}

% CHANGES THAT SHOULD BE MADE TO PREPRN:
%
%  - change \section etc. so they work right with names more
%    than one line long.  Requires ragged-righting and turning off
%    hyphenation, as per 4 Feb 83 message from DEK.
%  - make table of contents, list of figure, etc. entries work right
%    for titles longer than one line.  Not clear how to do this.
%


%    ****************************************
%    *               FONTS                  *

%    ****************************************
%
% THESE DEFINITIONS ARE ALL TEMPORARY UNTIL MORE FONTS ARE
% LOADED.

\let\@mainsize=\tenpoint
\tenpoint
\def\@parskip{4pt plus 1pt}
\parskip\@parskip
\parindent 11pt



% Environment names for type styles
% Note that the \@end... commands are left undefined, since
% TeX turns an undefined \begincsname ... \endcsname into \relax

\def\@beginroman{\rm\ignorespaces}
\def\@beginitalic{\it\ignorespaces}
\def\@begintypewriter{\tt\ignorespaces}
\def\@beginboldface{\bf\ignorespaces}
\def\@beginsansserif{\sf\ignorespaces}
\def\@beginsmallcaps{\sc\ignorespaces}

% type size commands

\def\@beginnormal{\tenpoint\def\@parskip{4pt plus 1pt}\parskip\@parskip
    \ignorespaces}

\def\tit{\twelvepoint\def\@parskip{5pt plus 2pt}\parskip\@parskip}
\def\@begintitle{\tit\ignorespaces}

\def\Tit{\eighteenpoint}
\def\@beginTitle{\Tit\ignorespaces}

\def\@beginsmall{\ninepoint\def\@parskip{3pt plus 1pt}\parskip\@parskip
      \ignorespaces}
\def\@beginfootnotesize{\eightpoint
     \def\@parskip{3pt plus 1pt}\parskip\@parskip\ignorespaces}

\def\@beginscriptsize{\sevenpoint
     \def\@parskip{3pt plus 1pt}\parskip\@parskip\ignorespaces}



%    ****************************************
%    *            PAGE STYLES               *
%    ****************************************
%
%  To get heads and feet defined for different styles, the text 
%  to be put on the left- or right-hand page heading is defined
%  by the macro \@lhead or \@rhead.  (left-hand = even page number)
%  These can be set by the user commands \lhead, \rhead and
%  \head. (\head = \rhead)  The \section, \subsection, etc. macros
%  call \@secmark, \@subsecmark, etc. to set these macros.  
%  These macros take a single argument -- which is the argument
%  of the \section, etc. macro from which they're called.  The
%  different substyles set the way headings are created by
%  defining the \@secmark, etc. macros, as well as the page
%  style @ps@... macros.
%
%  Below are the style definitions for the default preprn style.
%

\def\lhead#1{\def\@lhead{#1}}
\def\rhead#1{\def\@rhead{#1}}
\def\head#1{\def\@lhead{#1}\def\@rhead{#1}}

\def\@secmark#1{}
\def\@subsecmark#1{}
\def\@subsubsecmark#1{}
\def\@lhead{}
\def\@rhead{}

% NOTE USE OF \hbox{} IN CASE OF EMPTY HEADING FIELDS
\def\@ps@myheadings{\def\@oddhead{\it\hbox{}\hfil\@rhead \hfil \rm\@pagenum}%
\def\@oddfoot{}\def\@evenhead{\rm\@pagenum\hfil\it\@lhead\hfil}%
\def\@evenfoot{}\def\@secmark##1{}}

\def\@ps@headings{\def\@oddhead{\it\hbox{}\hfil\firstmark \hfil \rm\@pagenum}
\def\@oddfoot{}\def\@evenhead{\rm\@pagenum\hfil\it\firstmark\hfil\hbox{}}%
\def\@evenfoot{}%
\def\@secmark##1{\tokens{\@cx@section}\mark{{\the\tokens\@ca@section\hskip 
1em##1}}}}% note use of \tokens

\def\@ps@empty{\def\@oddhead{}\def\@oddfoot{}%
\def\@evenhead{}\def\@evenfoot{}}
\def\@ps@plain{\def\@oddhead{}\def\@oddfoot{\rm\hfil\@pagenum
     \hfil}\def\@evenhead{}\def\@evenfoot{\rm\hfil
     \@pagenum\hfil}}





%    ****************************************
%    *           ENVIRONMENTS               *
%    ****************************************
%
% TITLEPAGE
\def\@begintitlepage{\newpage\thispagestyle{empty}}
\def\@endtitlepage{\newpage}

% DEFAULT VALUES FOR list ENVIRONMENT
\def\@d@leftmargin{15pt}
\def\@d@labelwidth{11pt}
\def\@d@labelsep{4pt}


%                PARAGRAPH-FORMATTING ENVIRONMENTS
%                ---------------------------------
% VERSE
%   \CR ends line
%   Line continuations indented further.
%   Blank line makes new paragraph with \parskip space
%
\def\@beginverse{\def\CR{\item}\def\CRSP##1{\par\vskip ##1 \item}\@beginlist
      {}{\itemsep{0pt}
      \listparindent{-15pt}\leftmargin{30pt}\rightmargin{15pt}}\item}
\let\@endverse=\@endlist

% QUOTATION
%   Fills lines
%   Indents paragraph
%   
\def\@beginquotation{\@beginlist{}{\listparindent{15pt}}\item}
\let\@endquotation=\@endlist

% QUOTE -- same as quotation except no paragraph indentation,
\def\@beginquote{\@beginlist{}{}\item}
\let\@endquote=\@endlist

%                 LIST-MAKING ENVIRONMENTS
%                 ------------------------
%
% PARAMETERS FOR enumerate

\namedef{@co@enum1}{\@arabic{\backslash{@c@enum1}}.}
\namedef{@co@enum2}{(\@alph{\backslash{@c@enum2}})}
\namedef{@co@enum3}{\@roman{\backslash{@c@enum3}}.}
\namedef{@co@enum4}{\@Alph{\backslash{@c@enum4}}.}
\pnamedef{@cr@enum1}{#1}{\@arabic{#1}}
\pnamedef{@cr@enum2}{#1#2}{\@arabic{#1}(\@alph{#2})}
\pnamedef{@cr@enum3}{#1#2#3}{\@arabic{#1}(\@alph{#2})\@roman{#3}}
\pnamedef{@cr@enum4}{#1#2#3#4}{\@arabic{#1}(\@alph{#2})\@roman{#3}-\@Alph{#4}}
\namedef{@ca@enum1}{{\backslash{@c@enum1}}}
\namedef{@ca@enum2}{{\backslash{@c@enum1}}{\backslash{@c@enum2}}}
\namedef{@ca@enum3}{\backslash{@ca@enum2}{\backslash{@c@enum3}}}
\namedef{@ca@enum4}{\backslash{@ca@enum3}{\backslash{@c@enum4}}}
\namedef{@enum1margin}{26pt} 
\namedef{@enum2margin}{25pt}
\namedef{@enum3margin}{25pt}
\namedef{@enum4margin}{25pt}
\@definecounter{enum1}
\@definecounter{enum2}
\@definecounter{enum3}
\@definecounter{enum4}

% PARAMETERS FOR itemize

\namedef{@item1}{$\bullet$}
\namedef{@item2}{--}
\namedef{@item3}{$\ast$}
\namedef{@item4}{$\cdot$}
\namedef{@item1margin}{26pt}
\namedef{@item2margin}{25pt}
\namedef{@item3margin}{25pt}
\namedef{@item4margin}{25pt}



%          THEOREM ENVIRONMENTS
%          --------------------
%
\let\localtheoremdef=\theoremdef% all theorem environments global
\def\@thmnumber#1{\@arabic{#1}}
\def\@@beginthmenv#1#2{\@refstepcounter{#1}\vspace{3pt}\par\noindent{\bf #2 
     \backslash{@co@#1}:}\hskip 3pt\it}          
\def\@@endthmenv{\vspace{3pt}\rm\@parhack}
\theoremdef{theorem}{Theorem}


% BIBLIOGRAPHY
%  Numbers entries
%

\def\@beginbibliography#1{\par\goodpagebreak\vskip 20pt
       \hbox to \the\hsize{\hss\@bibtitle\hss}\nobreak\vskip 10pt
       \@beginlist{\@bibitems}{\labelwidthof{#1}}}
\let\@endbibliography=\@endlist
\def\@bibtitle{REFERENCES}
\def\@bibnumcite{[\arabic]}
\def\@biblabelcite#1{[#1]}
\def\@bibitems{\arabic.}
\def\@biblabel#1{#1:}

% ARRAY AND TABULAR ENVIRONMENT PARAMETERS
% TEMPORARY DEFINITIONS

\def\@ar@spacer{\hbox to 11pt{}}
\def\@ar@rule{\hbox to 5.3pt{}\vrule width .4pt\hbox to 5.3pt{}}
\def\@tb@spacer{\hbox to 11pt{}}
\def\@tb@rule{\hbox to 5.3pt{}\vrule width .4pt\hbox to 5.3pt{}}
\def\@tb@lrule{\vrule width .4pt\hbox to 5.3pt{}}
\def\@tb@rrule{\hbox to 5.3pt{}\vrule width .4pt}
\def\hline{\hrule height .4pt}



%    ****************************************
%    *          MISCELLANEOUS               *
%    ****************************************
%
% Spacing and rule width for \boxit
%
\def\@maxmsgs{24} 
\def\@boxitsep{.2em}
\def\@boxitrule{.4pt}
% 
% Date

\def\today{\ifcase\the\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\the\day, \number\the\year}



%    ****************************************
%    *             SECTIONS                 *
%    ****************************************
%
% DEFINE COUNTERS
\@definecounter{section}
\@definecounter{subsection}
\@definecounter{subsubsection}

\@addtoreset{subsection}{section}
\@addtoreset{subsubsection}{subsection}

\def\@co@section{\@arabic{\@c@section}}
\def\@co@subsection{\@co@section .\@arabic{\@c@subsection}}
\def\@co@subsubsection{\@co@subsection .\@arabic{\@c@subsubsection}}

\def\@ca@section{{\@c@section}}
\def\@ca@subsection{\@ca@section{\@c@subsection}}
\def\@ca@subsubsection{\@ca@subsection{\@c@subsubsection}}

\def\@cra@section#1{\@Alph{#1}}
\def\@cr@section#1{\@arabic{#1}}
\let\@cx@section=\@cr@section %% Initializing for running heads
\def\@cr@subsection#1#2{\@arabic{#1}.\@arabic{#2}}
\def\@cr@subsubsection#1#2#3{\@arabic{#1}.\@arabic{#2}.\@arabic{#3}}
%\def\@cra@subsection#1#2{\@cra@section{#1}.\@arabic{#2}}
%\def\@cra@subsubsection#1#2#3{\@cra@section{#1}.\@arabic{#2}.\@arabic
%    {#3}}

% \section, \subsection and \subsubsection
%

\def\@secapp{Section} % reset to Appendix by \appendix


\def\section#1{\@refstepcounter{section}      % step counter
     \par                                     % end previous paragraph     
     \vspace{25pt}                            % extra vertical space
     \goodpagebreak                           % good place for page break 
     \@secmark{#1}                            
     \vbox                                    % section heading 
       {\@mainsize\bf\@hangfrom{\@co@section.\hskip 10pt}#1}
     \@addtableentry{toc}{\string             % add table of contents line
         \@secpage\@ca@section{#1}}
     \nobreak                                 % very bad place for page break
     \def\@nobreak{T}
     \parskip15pt                             % space in front of first par.
     \everypar{\@everypar\parskip\@parskip    % first par will restore \parskip
         \def\@nobreak{F}\everypar{\@everypar}}}

\def\subsection#1{\@refstepcounter{subsection} % step counter
     \par                                     % end previous paragraph     
     \vspace{15pt}                            % extra vertical space
     \if\@nobreak F\goodpagebreak\fi          % good place for page break if
     \@subsecmark{#1}
     \vbox                                    % subsection heading 
       {\@mainsize\bf\@hangfrom{\@co@subsection.\hskip 10pt}#1}
     \@addtableentry{toc}{\string              % add table of contents line
         \@subsecpage\@ca@subsection{#1}}
     \nobreak                                 % very bad place for page break
     \def\@nobreak{T}
     \parskip10pt                             % space in front of first par.
     \everypar{\parskip\@parskip\@everypar    % first par will restore \parskip
         \def\@nobreak{F}\everypar{\@everypar}}}

\def\subsubsection#1{\@refstepcounter{subsubsection} % step counter
     \par                                     % end previous paragraph     
     \vspace{15pt}                             % extra vertical space
     \if\@nobreak F\goodpagebreak\fi          % good place for page break if
     \@subsubsecmark{#1}
     \vbox                                    % subsubsection heading 
       {\@mainsize\bf\@hangfrom{\@co@subsubsection.\hskip 10pt}#1} 
     \@addtableentry{toc}{\string              % add table of contents line
         \@subsubsecpage\@ca@subsubsection{#1}}
     \nobreak                                 % very bad place for page break
     \def\@nobreak{T}
     \parskip10pt                             % space in front of first par.
     \everypar{\parskip\@parskip\@everypar    % first par will restore \parskip
         \def\@nobreak{F}\everypar{\@everypar}}}

% initialization

\def\@nobreak{F}

% TABLE OF CONTENTS

\def\@t@toc{F}                                % must initialize \@t@toc
\def\tableofcontents{
     \begin{center}
     {\tit CONTENTS}                          % write ``CONTENTS''
     \end{center}
     \vspace{20pt}                            % vertical space
     \begingroup
     \@input{\jobname.toc}                    % input previous .TOC file
     \endgroup
    \if\@tfilesw T\gdef\@t@toc{T}
     \newwrite\@tf@toc                        % open .TOC file (must come
     \openout\@tf@toc=\jobname.toc \fi}       % after \@input


% MACROS TO DEFINE TABLE OF CONTENTS LINES
% NOTE THE USE OF \@secsk TO PRODUCE AN EXTRA SPACE FOR A SUBSECTION
% ENTRY THAT COMES AFTER A SUBSUBSECTION ENTRY.

\def\@tabentry#1#2{\vskip 0pt plus .2pt\hbox 
      to \columnwidth{#1\@lead\hbox to 1.5em{\hfil #2}}}
\let\@tabmainentry=\@tabentry

\def\@secpage#1#2#3{\goodpagebreak
\vskip 1.0em plus 1pt\def\@secsk{T}\hbox to \columnwidth
      {\bf\hbox to 1.5em{\@cr@section{#1}.\hss}#2\hfill
      \hbox to 2em{\hfil #3}}\nobreak} 
\def\@subsecpage#1#2#3#4{\vskip 0pt plus .2pt\if
       \@secsk T\vskip .5em\def\@secsk{F}\fi
      \hbox to \columnwidth
      {\hbox to 1.5em{}\hbox to 2.3em{\@cr@section{#1}.#2.\hss}#3\@lead\hbox 
      to 1.5em{\hfil #4}}}
\def\@subsubsecpage#1#2#3#4#5{\vskip 0pt plus .2pt\def\@secsk{T}\hbox
      to \columnwidth
      {\hbox to 3.8em{}\hbox to 3.2em{\@cr@section{#1}.#2.#3.\hss}#4\@lead
      \hbox to 1.5em{\hfil #5}}}

\def\@lead{\leaders\hbox to .9em{\hfill.\hfill}\hfill}


\def\@hangfrom#1{{\parindent 0pt \setbox\@tmpbox=\hbox{#1}
      \hangindent \wd\@tmpbox\relax$ $\box\@tmpbox}}


%    ****************************************
%    *             APPENDIX                 *
%    ****************************************
%
% The \appendix command must do the following:
%    -- reset the section counter to zero
%    -- set \@secapp to Appendix (for messages)
%    -- redefine the section counter to produce appendix numbers
%    -- set \@cx@section to \@cra@section [for running heads]
%    -- write commands on the .toc, .lof and .lot files
%       to redefine the section counter.
%    -- write a command on the .aux file to \def\@appsw{T}
%    -- reset the section counter to zero
%    -- redefine the \section command if appendix titles and headings are
%       to look different from section titles and headings.
%

\def\@appdefs{\def\@cr@section##1{\@Alph{##1}}}

\def\appendix{\setcounter{section}{0}\setcounter{subsection}{0}\def\@secapp%
{Appendix}\def\@co@section{\@Alph{\@c@section}}\let\@cx@section=\@cra@section%
\if\@afilesw T\immediate\write\@auxout%
{\string\def\string\@appsw{T}}\fi
\if \@t@toc T\write\@tf@toc{\string\@appdefs}\fi
\if \@t@lof T\write\@tf@lof{\string\@appdefs}\fi
\if \@t@lot T\write\@tf@lot{\string\@appdefs}\fi}

%    ****************************************
%    *             FOOTNOTES                *
%    ****************************************
%
\def\@footinsertskip{10pt plus2pt minus4pt}
\def\@topinsertskip{20pt plus2pt minus4pt}
\def\@topinsertskipdim{20pt}
\def\@footruleheight{.4pt}
\def\@footruleshift{4pt}
\setdimen\@footinsert=\textheight
\setskip\@footinsert=\@footinsertskip
%TEMPORARY DEFINITION
\splittopskip=9pt  %broken footnotes will have this as the top baseline
\@definecounter{footnote}
\def\@co@footnote{\@arabic{\@c@footnote}}
\def\@cr@footnote#1{\@arabic{#1}}
\def\@makefootnote#1#2{\eightpoint\par\noindent\hangindent 5pt\hbox 
    to 5pt{\hss $^{#1}$}\strut #2\strut}



%  EQUATION 
%
%\@addtoreset{equation}{chapter}
\def\@co@equation{(\@arabic{\@c@equation})}
\def\@ca@equation{{\@c@equation}}
\def\@cr@equation#1{(\@arabic{#1})}
%\def\@cra@equation#1#2{(\@cra@chapter{#1}.\@arabic{#2})}


%    ****************************************
%    *         FIGURES AND TABLES           *
%    ****************************************
% 
\@definecounter{figure}

\def\@co@figure{\@arabic{\@c@figure}}
\def\@ca@figure{{\@c@figure}}
\def\@cr@figure#1{\@arabic{#1}}

\def\@t@lof{F} % don'T produce .LOF file if no \listoffigures
\def\@tr@lof#1#2#3{\ifnum#1>\@x@sec\relax % skip 10 pt between figures
     \vskip 10pt\fi\def%                     % for different sections
\@x@sec{#1}\hbox to \columnwidth
      {\hbox to 1.5em{\hss#1.}\hskip .8em #2\@lead\hbox 
      to 1.5em{\hfil #3}}}

\def\listoffigures{\begin{center}
{\tit FIGURES}
\end{center}\par\vskip 10pt\def\@x@sec{-1}\begingroup
\@input{\jobname.lof}\endgroup\par
\if\@tfilesw T\gdef\@t@lof{T}\newwrite\@tf@lof\openout\@tf@lof=\jobname.lof\fi}

\@definecounter{table}

\def\@co@table{\@arabic{\@c@table}}
\def\@ca@table{{\@c@table}}
\def\@cr@table#1{\@arabic{#1}}

\def\@t@lot{F} % don'T produce .LOT file if no \listoftables
\let\@tr@lot=\@tr@lof

\def\listoftables{\begin{center}
{\tit TABLES}
\end{center}\par\vskip 10pt\def\@x@sec{-1}\begingroup
\@input{\jobname.lot}\endgroup\par
\if\@tfilesw T\gdef\@t@lot{T}\newwrite\@tf@lot\openout\@tf@lot=\jobname.lot\fi}



\def\@figsep{7pt}
\def\@textfigsep{5pt}
\def\@captionskip{6pt}
\def\@caption#1#2{#1: #2}




%    ****************************************
%    *           INITIALIZATION             *
%    ****************************************
% Default initializations
\@ps@plain
\pagenumbering{arabic}
\@makesinglecolumn

