% ARTICLE DOCUMENT STYLE -- version 0.8 - released 18 Dec 1983
%    for LaTeX version 2.0
% Copyright (C) 1983 by Leslie Lamport

\typeout{Document Style 'article'. Version 0.8 - released 18 Dec 1983}

% CHANGES THAT SHOULD BE MADE TO ARTICLE:
%
%  - 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.
%
\makeatletter

%    ****************************************
%    *               FONTS                  *
%    ****************************************
%

\parskip 3pt plus 2pt minus 1pt
\parindent 20pt

% type size commands
\mainbaselineskip=12.6pt
\def\normalsize{\tenpt\baselineskip\mainbaselineskip
   \normalbaselineskip\mainbaselineskip}
\let\large\twelvept
\let\Large\fourteenpt
\let\LARGE\seventeenpt
\let\huge\twentypt
\let\small\ninept
\let\footnotesize\eightpt
\let\scriptsize\sevenpt
\let\tiny\fivept


%    ****************************************
%    *            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. 
%
%  The macros \@secmark, \@subsecmark, etc. are called by \section, 
%  \subsection, etc. to make appropriate changes to the running heads.
%  \@secmark, etc. take a single argument, which is the argument of the 
%  \section, etc. macro from which they're called.  
%  The page style \ps@... macros change the running heads by
%  redefining \@secmark, etc. 

\def\head{\@ifnextchar[{\@xhead}{\@yhead}}
\def\@xhead[#1]#2{\if #1l \def\@lhead{#2}\else \def\@rhead{#2}\fi}
\def\@yhead#1{\def\@lhead{#1}\def\@rhead{#1}}

% Initial default definitions.
\def\@secmark#1{}
\def\@subsecmark#1{}
\def\@subsubsecmark#1{}
\def\@lhead{{\tt \char '134\relax head} command sets heading}  
\def\@rhead{{\tt \char '134\relax head} command sets heading}  

% Note use of \hbox{} in case of empty heading fields in the
% following definitions of \ps@...

\def\ps@myheadings{\def\@oddhead{\sl\hbox{}\hfil\@rhead \hfil \rm\co@page}%
\def\@oddfoot{}\def\@evenhead{\rm\co@page\hfil\sl\@lhead\hfil}%
\def\@evenfoot{}\def\@chapmark##1{}\def\@secmark##1{}}

\if@twoside 
\def\ps@headings{\def\@oddfoot{}%
\def\@oddhead{\sl\hbox{}\firstmark\hfil\rm\co@page}%
\def\@evenfoot{}%
\def\@evenhead{\rm\co@page\hss\sl\@lhead\hss}%
\def\@secmark##1{\mark{\hfil \co@section \hskip 1em##1}}}
\else
\def\ps@headings{\def\@oddhead{\sl\hbox{}\firstmark \hfil \rm\co@page}%
\def\@oddfoot{}%
\def\@secmark##1{\mark{\hfil \co@section \hskip 1em##1}}}
\fi

\def\ps@empty{\def\@oddhead{}\def\@oddfoot{}%
\def\@evenhead{}\def\@evenfoot{}}

\def\ps@plain{\def\@oddhead{}\def\@oddfoot{\rm\hfil\co@page
     \hfil}\def\@evenhead{}\let\@evenfoot\@oddfoot}




%    ****************************************
%    *            SUBSTYLES                 *
%    ****************************************
%

\def\ds@draft{\overfullrule 5pt}



%    ****************************************
%    *           ENVIRONMENTS               *
%    ****************************************
%
% titlepage
%
\def\titlepage{\newpage\thispagestyle{empty}}
\def\endtitlepage{\newpage\c@page\@ne}

% Default values for list environment.

\def\topsepcorrection{.75}
\leftmargini 38pt
\leftmarginii 30pt
\leftmarginiii 20pt
\leftmarginiv 15pt
\leftmarginv 15pt
\leftmarginvi 10pt

\topsep 5pt
\labelsep 5pt
\tabbingsep \labelsep
\parsep 5pt
\parstretch 0pt plus 2pt minus 1pt

%minipage
\def\@minipagerestore{\let\@mpfnnumber=\@alph}


%                PARAGRAPH-FORMATTING ENVIRONMENTS
%                ---------------------------------
% VERSE
%   \CR ends line
%   Line continuations indented further.
%   Blank line makes new paragraph with \parskip space
%
\def\verse{\let\\=\@centercr \list{}{\itemsep\z@ 
  \itemindent -15pt\listparindent \itemindent 
  \rightmargin\leftmargin\advance\leftmargin 15pt}\item[]}
\let\endverse\endlist

% QUOTATION
%   Fills lines
%   Indents paragraph
%   
\def\quotation{\list{}{\listparindent 20pt\relax\itemindent\listparindent
    \rightmargin\leftmargin}\item[]}
\let\endquotation=\endlist

% QUOTE -- same as quotation except no paragraph indentation,
\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist

%                 LIST-MAKING ENVIRONMENTS
%                 ------------------------
%
% \description : temporary definition.

\def\description#1{\list{#1}{\settowidth\@tempdima{#1}
\ifdim \@tempdima > \labelwidth \else \labelwidth\@tempdima\fi}}

\def\enddescription{\endlist}

% PARAMETERS FOR enumerate
%
\let\@enumspacing\relax
\def\ce@enum@i{\arabic{enum@i}.}
\def\co@enum@i{\arabic{enum@i}}
 
\def\ce@enum@ii{(\alph{enum@ii})}
\def\co@enum@ii{\co@enum@i\ce@enum@ii}
 
\def\ce@enum@iii{\roman{enum@iii}.}
\def\co@enum@iii{\co@enum@ii\ce@enum@iii}
 
\def\ce@enum@iv{\Alph{enum@iv}.}
\def\co@enum@iv{\co@enum@iii\ce@enum@iii}

% Parameters for itemize
\let\@itemspacing=\relax
\def\item@i{$\bullet$}

\def\item@ii{--}

\def\item@iii{$\ast$}

\def\item@iv{$\cdot$}

% Theorem environments -- use defaults

% Bibliography
\def\thebibliography#1{\beginbibliography
\list{\@bibnum.}{\settowidth\labelwidth{#1}}}
\let\endthebibliography=\endlist
\def\beginbibliography{\par\pagebreak[3]
\vskip 20pt
\hbox to\hsize{\hss REFERENCES\hss}
\nobreak\vskip 10pt\relax}


% THE theindex ENVIRONMENT
%   Produces double column format.  
%   Each paragraph is a separate entry.
%
\newif\if@restonecol

\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
\columnsep 35pt\twocolumn[\vskip 
    30pt\centering\large INDEX\par\vskip 20pt\relax]
    \pagestyle{myheadings}\head{Index}\thispagestyle{plain}\parindent\z@
    \parskip\z@ plus .3pt\relax\let\item\@idxitem}

\def\@idxitem{\par\hangindent 40pt}

\def\subitem{\par\hangindent 40pt \hspace*{20pt}}

\def\subsubitem{\par\hangindent 40pt \hspace*{30pt}}

\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}

\def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax}

% Array and tabular environment parameters
\arraycolsep 5pt
\tabcolsep 6pt
\arrayrulewidth .4pt
\doublerulesep 2pt

% \fbox parameters
\fboxsep = 3pt
\fboxrule = .4pt

% Date
\def\today{\ifcase\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\day, \number\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}}

% \section, \subsection and \subsubsection
% In *-version, they don't include a section number or add a
% contents line.  In plain version, they have an optional first
% argument which is a short form to use in contents and heading.
%
% Note use of \addvspace to get proper space before and after 
% \section even when followed immediately by \subsection,
% and use of @nobreak with \everypar to avoid page breaks.

\def\@chapapp{Section} % changed to 'Appendix' by \appendix


\def\section{\par  
   \if@nobreak \else \pagebreak[3]
     \addvspace{25pt} \fi          
     \@ifstar{\@ssection}{\@dblarg\@section}}

\def\@section[#1]#2{\@refstepcounter{section} 
   \@secmark{#1}
   \vbox{\Large\bf\@hangfrom{\co@section.\hskip 10pt}#2}
   \addcontentsline{toc}{section}{\writecommand
        \makebox[1.5em][l]{\co@section.}#1}     
 \addtocontents{lof}{\writecommand\addvspace{10pt}} % add between-section space
 \addtocontents{lot}{\writecommand\addvspace{10pt}} % to lists of figs & tables
   \@xsection}

\def\@xsection{\nobreak
   \global\@nobreaktrue
   \vskip 10pt
   \everypar{\global\@nobreakfalse\everypar{}}}

\def\@ssection#1{\vbox{\Large\bf\noindent #1}\@xsection}

\def\subsection{\par  
   \if@nobreak \else \pagebreak[3]
     \addvspace{15pt} \fi          
     \@ifstar{\@ssubsection}{\@dblarg\@subsection}}


\def\@subsection[#1]#2{\@refstepcounter{subsection} 
   \vbox{\large\bf\@hangfrom{\co@subsection.\hskip 10pt}#2}
   \addcontentsline{toc}{subsection}{\writecommand
           \makebox[2.3em][l]{\co@subsection.}#1}
   \@xsubsection}

\def\@xsubsection{\nobreak
   \global\@nobreaktrue
   \vskip 5pt
   \everypar{\global\@nobreakfalse\everypar{}}} 

\def\@ssubsection#1{\vbox{\large\bf\noindent #1}\@xsubsection}

\def\subsubsection{\par  
   \if@nobreak \else \pagebreak[3]
     \addvspace{15pt} \fi          
     \@ifstar{\@ssubsubsection}{\@dblarg\@subsubsection}}

\def\@subsubsection[#1]#2{\@refstepcounter{subsubsection} 
   \vbox{\normalsize\bf\@hangfrom{\co@subsubsection.\hskip 10pt}#2}
   \addcontentsline{toc}{subsubsection}{\writecommand
      \makebox[3.2em][l]{\co@subsubsection.}#1}
   \@xsubsubsection}

\def\@xsubsubsection{\nobreak
   \global\@nobreaktrue
   \vskip 5pt
   \everypar{\global\@nobreakfalse\everypar{}}}

\def\@ssubsubsection#1{\vbox{\normalsize\bf\noindent #1}\@xsubsubsection}


\def\@hangfrom#1{\setbox\@tempboxa=\hbox{#1}
      \hangindent 1\wd\@tempboxa\noindent\box\@tempboxa}


% Table of contents

\def\begintableofcontents{\par\hbox to\columnwidth{\hss
   \large CONTENTS\hss}\vskip 20pt\relax}

\def\tableofcontents{\begintableofcontents
\makeatletter  
\@input{\jobname.toc}     
  \if@filesw \newwrite\tf@toc \openout\tf@toc=\jobname.toc  \fi
  \makeatother}

% Macros to produce table of contents lines

\def\l@section#1#2{\pagebreak[3]
  \vskip 1.0em plus 1pt\def\@secsk{T}\hbox to \columnwidth
      {\bf #1\hfill \hbox to 2em{\hfil #2}}\nobreak} 

% Note braces around argument #2 to keep declarations local.

\def\@toclines#1#2#3{\vskip \z@ plus .2pt
  \hbox to \columnwidth{\hskip #1\relax {#2}\@lead\hbox to 1.5em{\hfil #3}}}

\def\l@subsection{\@toclines{1.5em}}
\def\l@subsubsection{\@toclines{3.8em}}
\def\@lead{\leaders\hbox to .9em{\hfill.\hfill}\hfill}


%    ****************************************
%    *             APPENDIX                 *
%    ****************************************
%
% The \appendix command must do the following:
%    -- reset the section counter to zero
%    -- set \@chapapp to Appendix (for messages)
%    -- redefine the section counter to produce appendix numbers
%    -- reset the subsection counter to zero
%    -- redefine the \section command if appendix titles and headings are

%       to look different from section titles and headings.

\def\appendix{\setcounter{section}{0}\setcounter{subsection}{0}\def\@chapapp%
{Appendix}\def\co@section{\@Alph\c@section}}


%    ****************************************
%    *             FOOTNOTES                *
%    ****************************************
%

\footnotesep 11pt
\skip\footins 2pt

\def\footnoterule{\kern-1\p@
  \hrule width .4\columnwidth \kern .6\p@} % the \hrule is .4pt high

\let\@footnotenumber\@arabic

\long\def\@makefntext#1#2{\noindent\hangindent 5pt\hbox 
    to 5pt{\hss $^{#1}$}\vrule \@height \footnotesep \@width \z@ #2\strut}

\def\@makefnmark#1{\hbox{$^{#1}$}}



\def\co@equation{\@arabic{\c@equation}}


%    ****************************************
%    *         FIGURES AND TABLES           *
%    ****************************************
% 
% Float placement parameters
\c@topnumber=2
\def\topfraction{.7}
\c@bottomnumber=1
\def\bottomfraction{.3}
\c@totalnumber=3
\def\textfraction{.2}
\def\floatpagefraction{.5}
\c@dbltopnumber= 2
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.5}

%% Note the extra pair of braces around the argument of \@dblarg
\long\def\@caption#1{\@dblarg{{\@xcaption{#1}}}}

\long\def\@xcaption#1[#2]#3{\addcontentsline{\@nameuse
  {ext@#1}}{figure}{\csname fnum@#1\endcsname. #2}
  \par\vskip 10pt \setbox\@tempboxa\hbox{\rm
   \csname fnum@#1\endcsname: \ignorespaces #3}\ifdim \wd\@tempboxa >\hsize
     \unhbox\@tempboxa\par
   \else\hbox to\hsize{\hfil\box\@tempboxa\hfil}\fi}

\@definecounter{figure}
\def\co@figure{\@arabic\c@figure}

\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{Figure \co@figure}
\def\figure{\@float{figure}}
\let\endfigure\end@float
\@namedef{figure*}{\@dblfloat{figure}}
\@namedef{endfigure*}{\end@dblfloat}

\def\beginlistoffigures{\par\hbox to\columnwidth{\hss
   \large FIGURES\hss}\vskip 20pt\relax}

\def\listoffigures{\beginlistoffigures
  \makeatletter
  \@input{\jobname.lof}     
  \if@filesw \newwrite\tf@lof \openout\tf@lof=\jobname.lof  \fi
   \makeatother}

\def\l@figure{\@toclines\z@}

\@definecounter{table}
\def\co@table{\@arabic\c@table}

\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{Table \co@table}
\def\table{\@float{table}}
\let\endtable\end@float
\@namedef{table*}{\@float{table}}
\@namedef{endtable*}{\end@float}

\def\beginlistoftables{\par\hbox to\columnwidth{\hss
   \large TABLES\hss}\vskip 20pt\relax}

\def\listoftables{\beginlistoftables \makeatletter
  \@input{\jobname.lot}     
  \if@filesw \newwrite\tf@lot \openout\tf@lot=\jobname.lot  \fi\makeatother}


%    ****************************************
%    *           INITIALIZATION             *
%    ****************************************
%
% Default initializations

\ps@plain
\pagenumbering{arabic}
\onecolumn
\makeatother

