% This LaTeX style is for papers to be printed in the proceedings of
% AAAI-87. 
% Prepared by Peter F. Patel-Schneider, liberally using the ideas of
% other style hackers, including Barbara Beeton.
% This style is NOT guaranteed to work.  It is provided in the hope
% that it will make the preparation of papers for AAAI-87 easier. 
%
% There are undoubtably bugs in this style.  If you make bug fixes,
% improvements, etc.  please let me know.  My e-mail address is:
%	pfps@spar.UUCP
%	pfps@spar-20.ARPA  -- should work
%	pfps@sri-kl.ARPA   -- if above does not work
% References to subsections will not work correctly.  There is a fix,
% which is to use \ref{<section>}\ref{<subsection>}.  This is not
% ideal, but I don't know any better way.

\typeout{Conference Style for AAAI-87 -- released 3 April 1987}

% This style is not meant to be used as an option to the article
% style, but instead reads in the article style on its own.  This is
% so that it can have options of its own.
%
% Without options, this style will create dvi files that can be
% printed directly on model paper, provided a printing device that can
% print on paper that large is available.  The page margins may have
% to be adjusted.
% The option ``reduced'' is for printing draft copies on normal size
% paper. 
% The option ``onecolumn'' is for printing final copies on printing
% devices that cannot print directly on model paper.  This option
% prints one column per page.  It is tuned for LaserWriters and may
% have to be modified for other printing devices.
% Note that the columns come out in a strange order when using the
% ``onecolumn'' option.  Make sure that your columns are in the
% correct places on the model paper.
%
% NOTE:  Physical dimensions, such as the size of figure, are correct
% for the reduced size.  Make sure that you calculate such sizes correctly.
%
% NOTE:  Some laser printers, including several that can print on
% model-paper size pages, have a serious problem printing TeX output.
% These printing devices, commonly known as ``write-white'' laser
% printers, tend to make characters too light.  To get around this
% problem, a darker set of fonts must be created for these devices.
%
% NOTE:  Printing final copies using the ``onecolumn'' option requires
% the ability to print on legal size paper.  If this is not possible,
% the best remaining option is to make the columns slightly shorter,
% by changing \modelheight to a smaller value, such as 10.9in.
%
% Instructions for preparing final copy using a laserwriter:
% Note:  Some versions of dvi2ps do not handle magnifications
%        correctly.  There is a fix for this problem in the file, but
%	 it does change the output slightly.  
% Note:  It is possible to run out of memory on laserwriters.  If you
%	 do not get all of your output, try printing one page at a time.
% The easiest way to print the final copy for pasting on the model
% paper is to just put a tray of legal-size paper in the laserwriter and
% use the ``onecolumn'' option.  However, if the title area is too
% wide to fit in the reduced imaging width this entails, a separate
% pass will be required to print the title area.  For this pass, use
% the option ``titleonly''.  Then print the first page of the
% resulting dvi file on regular paper and cut and paste as appropriate. 
% Note:  Get a legal-size paper tray and legal-size paper for your
%	 laserwriter early on. 
% Note:  The legal-size paper tray must be in the laserwriter BEFORE
%	 the job reaches the laserwriter for it to print correctly.

% flags for options
\newif\if@reduced \@reducedfalse
\newif\if@onecolumn \@onecolumnfalse
\newif\if@titleonly \@titleonlyfalse
% reduced output option
\def\ds@reduced{\typeout{-- reduced output -- DRAFT USE ONLY} \@reducedtrue}
% one column per page option
\def\ds@onecolumn{\typeout{-- one column per page} \@onecolumntrue}
\def\ds@titleonly{\typeout{-- for printing the title area correctly}
	\@titleonlytrue}
\@options % to execute the appropriate \ds@foo commands

%This is a better way of getting reduced output, but some dvi
%conversion programs do not handle magnifications correctly.
\documentstyle{article}
\makeatletter
\if@reduced
  \mag=1000
  \setlength\topmargin{-0.5in}
  \setlength\oddsidemargin{-0.5in} \relax
\else
  \mag=1200
  \setlength\topmargin{0.6in}
  \setlength\oddsidemargin{0.55in}
\fi
\def\reduction{.833333}
%This is a worse way.  Note that the output from this method is
%slightly different from the method above.  In particular, physical
%dimensions will be in terms of the output size.
%\if@reduced
%  \documentstyle{article}
%  \setlength\topmargin{-0.5in}
%  \setlength\oddsidemargin{-0.5in}
%  \def\reduction{.833333}
%\else
%  \documentstyle[12pt]{article}
%  \def\reduction{1.0}
%  \setlength\topmargin{0.6in}
%  \setlength\oddsidemargin{0.55in}
%  \def\baselinestretch{0.90} %This is a crock to get things to work
%  %  out reasonably close to the right way.  USE AT YOUR OWN RISK!!
%\fi
\flushbottom
\makeatletter

\if@titleonly %spacing to print as much of the title area as possible
  \setlength\oddsidemargin{-0.8in}
\fi

\newlength\modelheight \setlength\modelheight{11.4in}
\newlength\modelwidth  \setlength\modelwidth{8.8in}
\newlength\modelsep    \setlength\modelsep{.4in}
\newlength\modelbox    \setlength\modelbox{2.375in}
\newlength\modelcolumn \setlength\modelcolumn{4.2in}
\setlength\textheight{\reduction\modelheight}
\setlength\textwidth{\reduction\modelwidth}
\setlength\columnsep{\reduction\modelsep}

% Draft heading for reduced options
\if@reduced
   \pagestyle{myheadings} \thispagestyle{myheadings}
   \markboth{Draft Output---Do Not Use for Submission}{Draft
	Output---Do Not Use for Submission} \relax
\else
  \thispagestyle{empty} \pagestyle{empty}
  \setlength\headheight{0pt}
  \setlength\headsep{0pt} \relax
\fi
\setlength\footheight{0pt}
\setlength\footskip{0pt}

% style options
\flushbottom
\twocolumn
\sloppy
\parindent 2em
\leftmargini 2em
\leftmargin\leftmargini 
\leftmarginii 2em
\leftmarginiii 1.5em
\leftmarginiv 1.0em
\leftmarginv .5em
\leftmarginvi .5em

% We're never going to need a table of contents, so just flush it to
% save space --- suggested by drstrip@sandia-2
\def\addcontentsline#1#2#3{}

% Title stuff, taken from deproc.
\def\maketitle{\par
 \begingroup
 \def\@makefnmark{\hbox to 0pt{$^{\@thefnmark}$\hss}}
 \twocolumn[\@maketitle]
 \@thanks
 \endgroup
 \let\maketitle\relax
 \let\@maketitle\relax
 \gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\thanks\relax
 \@afterheading}
\def\@maketitle{\vbox to \reduction\modelbox{\hsize\textwidth
 \linewidth\hsize \vfil \vskip\baselineskip \centering
 {\Large\bf \@title \par} \vskip 2em
 {\large 
  \def\and{\unskip\enspace{\rm and}\enspace}%
  \def\And{\end{tabular}\hss \egroup \hskip 1in plus 2fil 
           \hbox to 0pt\bgroup\hss \begin{tabular}[t]{c}\bf}%
  \hbox to \linewidth{\hfil \hfil
    \hbox to 0pt\bgroup\hss \begin{tabular}[t]{c}\bf\@author 
			    \end{tabular}\hss\egroup
    \hfil\hfil}}
  \vskip 3\baselineskip \vfil
}}
\renewenvironment{abstract}{\centerline{\large\bf
	Abstract}\vspace{0.5ex}\begin{quote} \small}{\par\end{quote}\vskip 1ex}

%  Footnotes not quite so far apart.
\footnotesep=10pt
%  Allow more space above a narrower footnote rule.
\skip\footins=12pt              % full blank line
\def\footnoterule{\kern-8pt
  \hrule width 5pc \kern 7.6pt } % the \hrule is .4pt high

%  Force footnotes to bottom of page, regardless of ragged bottom.
\def\@makecol{\ifvoid\footins \setbox\@outputbox\box\@cclv
   \else\setbox\@outputbox
     \vbox to\@colht{\unvbox\@cclv\vfill\relax
          \vskip\skip\footins\footnoterule\unvbox\footins}\fi
     \xdef\@freelist{\@freelist\@midlist}\gdef\@midlist{}\@combinefloats
     \setbox\@outputbox\vbox to\@colht{\boxmaxdepth\maxdepth
        \@texttop\unvbox\@outputbox \@textbottom}\global\maxdepth\@maxdepth}

%  All footnotes are numbered; no other symbols.
\setcounter{footnote}{0}

% section numbers
\def\thesection       {\Roman{section}.}
\def\thesubsection    {\Alph{subsection}.}
\def\thesubsubsection {\arabic{subsubsection}.}
\def\appendix{\par
  \setcounter{section}{0}
  \setcounter{subsection}{0}
  \def\thesection{Appendix \Roman{section}}.}

% fix to bug in sections having to do with not globally resetting \everypar
%%Is this still needed??
%\def\@afterheading{\global\@nobreaktrue    
%      \global\everypar{\global\@nobreakfalse      
%                \everypar{}}}           

% bibliography
\def\thebibliography#1{\section*{References}
  \global\def\@listi{\leftmargin\leftmargini
               \labelwidth\leftmargini \advance\labelwidth-\labelsep
               \topsep 1pt plus 2pt minus 1pt
               \parsep 0.25ex plus 1pt \itemsep 0.25ex plus 1pt}
  \list {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
    \advance\leftmargin\labelsep\usecounter{enumi}}
    \def\newblock{\hskip .11em plus .33em minus -.07em}
    \sloppy
    \sfcode`\.=1000\relax}

% don't box citations and also add space between multiple citations
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{, }\@ifundefined
       {b@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}

% This stuff allows short (name-less) citations, when used in
% conjunction with a bibliography style that creates labels like
%	\citename{<names>, }<year>
\let\@internalcite\cite
\def\cite{\def\citename##1{##1}\@internalcite}
\def\shortcite{\def\citename##1{}\@internalcite}
\def\@biblabel#1{\def\citename##1{##1}[#1]\hfill}

% sections with slightly less space
\def\section{\par\@startsection {section}{1}{\z@}{-2.0ex plus
    -1ex minus -.2ex}{1.5ex plus 1.0ex minus .2ex}{\centering\Large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-2.0ex plus -1ex minus 
   -.2ex}{0.8ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{2.0ex plus
   1ex minus .2ex}{0.5ex plus .2ex}{\hspace*{5ex}\normalsize\bf}}
\def\paragraph{\@startsection
     {paragraph}{4}{\z@}{1.5ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
     {subparagraph}{4}{\parindent}{1.5ex plus 1ex minus 
     .2ex}{-1em}{\normalsize\bf}}

% lists with slightly less space
\labelwidth\leftmargini\advance\labelwidth-\labelsep
\labelsep 5pt
\parsep 2pt plus 1pt minus 0.5pt
\topsep 4pt plus 1pt minus 2pt
\partopsep 1pt plus 0.5pt minus 0.5pt
\itemsep 2pt plus 1pt minus 0.5pt

\def\@listi{\leftmargin\leftmargini}
\def\@listii{\leftmargin\leftmarginii
   \labelwidth\leftmarginii\advance\labelwidth-\labelsep
   \topsep 2pt plus 1pt minus 0.5pt
   \parsep 1pt plus 0.5pt minus 0.5pt
   \itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
    \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
    \topsep 1pt plus 0.5pt minus 0.5pt 
    \parsep \z@ \partopsep 0.5pt plus 0pt minus 0.5pt
    \itemsep \topsep}
\def\@listiv{\leftmargin\leftmarginiv
     \labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
\def\@listv{\leftmargin\leftmarginv
     \labelwidth\leftmarginv\advance\labelwidth-\labelsep}
\def\@listvi{\leftmargin\leftmarginvi
     \labelwidth\leftmarginvi\advance\labelwidth-\labelsep}

% CHANGE TO THE OUTPUT ROUTINE TO PRINT EACH COLUMN ON A SEPARATE PAGE
\if@onecolumn
  \setlength\topmargin{0in}
  \setlength\oddsidemargin{-0.6in}
  \def\@outputdblcol{
    \if@firstcolumn \global\@firstcolumnfalse
      \global\setbox\@leftcolumn\box\@outputbox
    \else \global\@firstcolumntrue
%      \shipout\vbox{\vskip \topmargin \box\@outputbox}
      \shipout\vbox{\vskip \topmargin \moveright\@themargin \box\@outputbox}
      \setbox\@outputbox\vbox{\hbox to\textwidth
             {\hbox to\columnwidth{\box\@leftcolumn \hss}
              \hfil \vrule width\columnseprule\hfil
              \hbox to\columnwidth{\hss}}}
      \@combinedblfloats
      \@outputpage \begingroup \@dblfloatplacement \@startdblcolumn
                 \@whilesw\if@fcolmade\fi{\@outputpage\@startdblcolumn}
                 \endgroup
    \fi}
\fi
