% ADASSPROC.STY -- ADASS Conference Proceedings Book Style
% Version 8.0  (1998)
% Assembled for ADASS VIII (98) by Raymond Plante
%
% This style augments adassconf.sty for assembling papers into the 
% the proceedings volume.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Exit if adassconf.sty has not been loaded
%
\ifx \adassconfstyloaded\relax
     \let\adassprocstyloaded\relax
\else
     \errmessage{adassconf style not loaded! ^^J Add "adassconf'' to 
	         documentstyle options before adassproc and rerun LaTeX}
     \endinput
\fi

\def\finclude#1#2{\relax
  \ifnum\@auxout=\@partaux
    \@latex@error{\string\include\space cannot be nested}\@eha
  \else \@flexinclude{#1}{#2} \fi}
\def\@flexinclude#1#2 {%
  \if@filesw
    \immediate\write\@mainaux{\string\@input{#1.aux}}%
  \fi
  \@tempswatrue
  \if@partsw
    \@tempswafalse
    \edef\reserved@b{#1}%
    \@for\reserved@a:=\@partlist\do
      {\ifx\reserved@a\reserved@b\@tempswatrue\fi}%
  \fi
  \if@tempswa
    \let\@auxout\@partaux
    \if@filesw
      \immediate\openout\@partaux #1.aux
      \immediate\write\@partaux{\relax}%
    \fi
    \@input@{#1.#2}%
    \@writeckpt{#1}%
    \if@filesw
      \immediate\closeout\@partaux
    \fi
  \else
    \@nameuse{cp@#1}%
  \fi
  \let\@auxout\@mainaux}

\def\includelatex#1{\finclude{#1}{latex}}
\def\includetex#1{\finclude{#1}{tex}}
\def\addpaper#1{%
     \immediate\write\@auxout{\string\new@paper{#1}}
     \include{filtered/#1}}
\def\new@paper#1{\relax}
\newenvironment{paperlist}{\relax}{\relax}

\def\reset@rticle{\refstepcounter{chapter}\setcounter{footnote}{0}
                  \setcounter{equation}{0}\setcounter{figure}{0}
                  \setcounter{table}{0}}

\newindex{author}{adx}{and}{Author Index}
\newindex{subject}{sdx}{snd}{Subject Index}
\def\paindex#1{\index[author]{#1|textbf}}
\def\aindex#1{\index[author]{#1}}
\def\sindex#1{\index[subject]{#1}}

% \@temptokena={\def\rightmark{\the\@nameuse{idxtitle@\@indextype}}%
%               \def\leftmark{\the\@nameuse{idxtitle@\@indextype}}} 
% \toks0=\expandafter{\theindex}
% \edef\theindex{\the\@temptokena\the\toks0}

\renewenvironment{theindex}
               {\edef\indexname{\the\@nameuse{idxtitle@\@indextype}}%
                \if@twocolumn
                  \@restonecolfalse
                \else
                  \@restonecoltrue
                \fi
                \columnseprule \z@
                \columnsep 35\p@
                \twocolumn[\@makeschapterhead{\indexname}]%
                \def\rightmark{\the\@nameuse{idxtitle@\@indextype}}%
                \def\leftmark{\the\@nameuse{idxtitle@\@indextype}}
	        \addcontentsline{toc}{index}{\indexname}
                \thispagestyle{frontbackplain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \let\item\@idxitem}
               {\if@restonecol\onecolumn\else\clearpage\fi}

\renewcommand\backmatter{\addtocontents{toc}{\vskip 2.25em \@plus\p@}}

\renewcommand\thepart{\@arabic\c@part}
\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >-2\relax
      \refstepcounter{part}%
      \addtocontents{toc}{\protect\contentsline {part}{Part \thepart. #1}{}}%
    \else
      \addtocontents{toc}{\protect\contentsline {part}{#1}{}}%
    \fi
    \markboth{}{}%
    {\null\vskip 0.5in
     \interlinepenalty \@M
     \normalfont
     \hbox to \hsize {\hfil
     \ifnum \c@secnumdepth >-2\relax
       \large \partname~\thepart.
     \fi
     \large #2}}%
    \@endpart}
\def\@spart#1{%
    {\null\vskip 0.5in
     \interlinepenalty \@M
     \normalfont
     \large #1\par}%
    \@endpart}
\renewcommand\part{\cleardoublepage
   		   \thispagestyle{empty}%
   		   \if@twocolumn
   		       \onecolumn
   		       \@tempswatrue
   		     \else
   		       \@tempswafalse
   		   \fi
   		   \secdef\@part\@spart}

\newcommand*\l@frontsection{\@dottedtocline{0}{0em}{2.3em}}
\newcommand*\l@article{\@dottedtocline{0}{0em}{3em}}
\let\l@index=\l@frontsection
\def\pasp@titletocentry#1{\addcontentsline{toc}{article}{#1}}
\def\pasp@authortocentry#1{
     \addtocontents{toc}{\protect\nopagebreak[4]}
     \addtocontents{toc}{\protect\begin{tocauthorlist}} 
     \addtocontents{toc}{#1}
     \addtocontents{toc}{\protect\end{tocauthorlist}}
     \addtocontents{toc}{\vskip 3pt plus 1pt minus 2pt\protect\pagebreak[2]}}
%     {{\protect\authmargins\par #1}}}
\def\authmargins{\advance\textwidth -3em\parindent 0em
                 \advance\textwidth -\@pnumwidth\parsep\z@ \@plus\p@}
\def\authortocentry#1{\pasp@authortocentry{#1}}
\newenvironment{tocauthorlist}
               {\list{}{\listparindent 0em
                        \itemindent   \listparindent
                        \rightmargin  \@pnumwidth
                        \partopsep    \z@ % \@plus\p@  % 
                        \topsep       3pt % plus 1pt
                        \parsep       \z@ % \@plus\p@
			\raggedright%
                        \small\slshape}%
                \item\relax}
               {\endlist}

\def\@makeschapterhead#1{%
    \noindent\textbf{#1}\par\bigskip
}
\renewcommand\tableofcontents{%
                      \cleardoublepage
                      \markboth{Contents}{Contents}
		      \@makeschapterhead{Contents}
%		      \thispagestyle{frontbackplain}
		      \thispagestyle{plain}
                      \@starttoc{toc}}
\newcommand{\preface}{\cleardoublepage
                      \addcontentsline{toc}{frontsection}{Preface}
                      \markboth{Preface}{Preface}
		      \thispagestyle{frontbackplain}
		      \@makeschapterhead{Preface}}
\newcommand{\conferencePhotograph}{\cleardoublepage
                      \markboth{Conference Photograph}{Conference Photograph}
                      \addcontentsline{toc}{frontsection}{Conference Photograph}%
                      \null\hphantom{\bf Conference Photograph}\par}
\newcommand{\colophon}{\cleardoublepage
                      \markboth{Colophon}{Colophon}
		      \thispagestyle{frontbackplain}
                      \addcontentsline{toc}{frontsection}{Colophon}
		      \@makeschapterhead{Colophon}}
\newcommand{\participantList}{\cleardoublepage
                      \markboth{Participant List}{Participant List}
		      \thispagestyle{frontbackplain}
                      \addcontentsline{toc}{frontsection}{Participant List}
		      \@makeschapterhead{Participant List}}
\newenvironment{participants}{\list{}%
                              {\leftmargin \parindent
                               \itemindent -\leftmargin
                               \rightmargin 0pt
                               \labelsep 0pt
                               \parsep 0pt
                               \itemsep 0pt
                               \raggedright
                               \labelwidth 0pt}}%
                             {\endlist}

\let\std@frontmatter=\frontmatter
\let\std@mainmatter=\mainmatter
\let\std@backmatter=\backmatter
\newif\if@frontmatter \@frontmatterfalse
\renewcommand{\frontmatter}{\std@frontmatter\@frontmattertrue
     \addtocontents{toc}{\protect\bgroup\protect\def\protect\@pnumwidth{3.1em}}
     \protected@write\@auxout{}{\string\new@matter{front}}
}
\renewcommand{\mainmatter}{\std@mainmatter\if@frontmatter
     \addtocontents{toc}{\protect\egroup}\else\fi\@frontmatterfalse
     \protected@write\@auxout{}{\string\new@matter{main}}
}
\renewcommand{\backmatter}{\std@backmatter\reset@marks
     \protected@write\@auxout{}{\string\new@matter{back}}
}
\def\new@matter#1{\relax}
\def\reset@marks{\def\leftmark{\expandafter\@leftmark\botmark{}{}}
                 \def\rightmark{\expandafter\@rightmark\firstmark{}{}}}
\def\ps@frontbackplain{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\thepage\hfil\slshape\leftmark}%
    \def\@oddhead{\hfill\thepage}%
    \let\@mkboth\@gobbletwo
    \let\chaptermark\@gobble
    \let\sectionmark\@gobble
    }



\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
    \thispagestyle{empty}\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}

\setcounter{tocdepth}{0}
\paspbook

