% $Header: /home/smithg/projects/thesis/documents/thesis_document/RCS/turabian.sty,v 1.2 2001/04/09 21:14:35 smithg Exp $
%
% section modified from aaai.sty by Zhengzhu Feng, Jun 02, 2000

% Implements the Turabina-like citation style that's required by the
% Computer Science Department of Mississippi State University. This
% package assumes that the bibliography is generated by BibTeX using
% the Chicago style (chicago.bst). ** Other bib style may not
% work!**. However, you can hand code the bibliography with each
% bibitem looks like: 
%
%    \bibitem[\protect\citeauthoryear{Hoey, St-Aubin, Hu, and
%    Boutilier}{Hoey et~al.}{1999}]{hoey-et-al-1999}
%    Hoey, J., R.~St-Aubin, A.~Hu, and C.~Boutilier (1999).
%    \newblock Spudd: Stochastic planning using decision diagrams.
%    \newblock In {\em Proceedings of the Fifteenth Conference on
%    Uncertainty in Artificial Intelligence}.
%
% The first argument to \citeauthoryear is the complete list of
% last names of authors, the second argument is the ``short'' form of
% the list of authors, and third one is the year of publish.
% 
% In addition to the 4 citation commands provided by the original
% aaai.sty, I added another, \citeallauthors, that give the full list
% of authors in their last names. The original documentation (see
% below) seems to say that citations are enclosed in square brackets,
% but actually \begincite and \endcite is defined to be '(' and ')'.
%        

%
% The following is the original doc.
%

% 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 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@research.bell-labs.com (Please also copy to press@aaai.org)

% The preparation of this file was supported by Schlumberger Palo Alto
% Research, AT\&T Bell Laboratories, AAAI, and Morgan Kaufmann Publishers.

% This section implements citations for the ``named'' bibliography style,
% modified for AAAI use.

% This file can be modified and used in other conferences as long
% as credit to the authors and supporting agencies is retained, this notice
% is not changed, and further modification or reuse is not restricted.

% The ``named'' bibliography style creates citations with labels like
%       \citeauthoryear{author-info}{year}
% these labels are processed by the following commands:
%       \cite{keylist}
%               which produces citations with both author and year,
%               enclosed in square brackets
%       \shortcite{keylist}
%               which produces citations with year only,
%               enclosed in square brackets
%       \citeauthor{key}
%               which produces the author information only
%       \citeyear{key}
%               which produces the year information only

%--------------------------------------------------------------------------
%
% $Log: turabian.sty,v $
% Revision 1.2  2001/04/09 21:14:35  smithg
% Minor citation style change
%
% Revision 1.1  2001/04/09 21:13:29  smithg
% Initial revision
%
%

\def\leftcite{(}\def\rightcite{)}

\def\cite{\def\citeauthoryear##1##2##3{\def\@thisauthor{##2}%
             \ifx \@lastauthor \@thisauthor \relax \else##2 \fi ##3}\@icite}
\def\shortcite{\def\citeauthoryear##1##2##3{##3}\@icite}

\def\citeauthor{\def\citeauthoryear##1##2##3{##2}\@nbcite}
%\def\citeyear{\def\citeauthoryear##1##2##3{##3}\@nbcite}
\def\citeyear{\def\citeauthoryear##1##2##3{##3}\@icite}

\def\citeallauthors{\def\citeauthoryear##1##2##3{##1}\@nbcite}

% internal macro for citations with () and with breaks between citations
% used in \cite and \shortcite
\def\@icite{\leavevmode\def\@citeseppen{-1000}%
 \def\@cite##1##2{\leftcite\nobreak\hskip 0in{##1\if@tempswa , ##2\fi}\rightcite}%
 \@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}

% internal macro for citations without [] and with no breaks
% used in \citeauthor and \citeyear
\def\@nbcite{\leavevmode\def\@citeseppen{1000}%
 \def\@cite##1##2{{##1\if@tempswa , ##2\fi}}%
 \@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}


\newcommand{\citesep}{;}

% don't box citations, separate with ; and a space
% also, make the penalty between citations a parameter, 
% it may be a good place to break
\def\@citex[#1]#2{%
  \def\@lastauthor{}\def\@citea{}%
  \@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{\citesep \penalty\@citeseppen\ }%
     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{\def\@thisauthor{}{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
     {\csname b@\@citeb\endcsname}\let\@lastauthor\@thisauthor}}{#1}}



 \def\@lbibitem[#1]#2{
  \item \mbox{}\\
    \par \if@filesw 
      { \def\protect##1{\string ##1\space}\immediate
        \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces}

%since the whole thesis is in double space, here we need to change
%it back to single space in references...

\renewenvironment{thebibliography}[1]
     {\chapter*{\bibname
        \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}%
      \addcontentsline{toc}{chapter}{\protect\hspace{2em}\MakeUppercase\bibname} \vskip -0.35in%
      \begin{singlespace*}%
      \list {}{\leftmargin 0.5in \listparindent -0.3in
        \parsep 0in \itemsep -.2in}      
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
    {\end{singlespace*}
       \def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}


