% ACS Thesis style
% by Jim Fox, May 30, 1990
 
\typeout{[UW Thesis style. Version 1.5]}
%
% version 1.5: - negative page numbering for prelim section
%                to help dvi->printer programs order the output pages.
%              - default year
%
% version 1.4: - (re)fixes that persistent bug in the facing-page captions.
%
% version 1.3: - fixes a bug in the facing-page captions.
%              - allows footnotes style to be default
%              - cleans up 12pt default
%              - cleans up page bottom margins
%              - adds title page options
%
 
%   This thesis style is essentually a 12-point book style with
%   four modifications and the addition of preliminary page macros.
%
%   1)  Parameter settings:  Page size, position, and numbering.
%
%   2)  Chapter and sections:  Alteration of type size and positioning
%       of titles; allowance for very long text; allowance for
%       user specified line breaks in chapter titles.
%
%   3)  Footnotes:  Provision for bottom-of-page notes (LaTeX default),
%       end-of-chapter notes, or end-of-thesis notes; alteration
%       of bottom-of-page footnote style.
%
%   4)  Facing caption pages:  Captions for full page figures or tables,
%       where the page margins and numbering are reversed.
 
 
%
% ----  Footnotes  --------------------------------------------
%
% Footnote placement option
% (this must come before option processing (i.e. book))
%
%   [endnotes] put the references at the thesis end
%   [chapternotes] put the references at the chapter end
%   [footnotes] put the references at the page bottom
%
\let\n@teitem\relax
\def\@chapternotetext{\bgroup
  \let\input\relax \catcode`\^^M=12\newlinechar=`\^^M\d@chapternote}
\long\def\d@chapternote#1{%
    \immediate \write\tf@not{\n@teitem#1\relax}%
                       \egroup}
\newif\ifendnotes      % true if doing endnotes
  \endnotesfalse
\newif\ifchapternotes  % true if doing chapternotes
  \chapternotesfalse
\newwrite\tf@not       % file for chapter or thesis notes
\def\ds@footnotes{     % selects bottom-of-page notes (default)
  \endnotesfalse \chapternotesfalse
  \let\chapternotes\relax \let\endnotes\relax}
\def\ds@chapternotes{  % selects end-of-chapter notes
  \let\@footnotetext\@chapternotetext
  \endnotesfalse \chapternotestrue
  \let\endnotes\relax}
\def\ds@endnotes{      % selects end-of-thesis notes
  \let\@footnotetext\@chapternotetext
  \endnotestrue \chapternotesfalse
  \let\chapternotes\relax
  \@startnotes}
 
 
%   Chapter and End notes
%
\def\@startnotes{%  opens the .not file
  \immediate \openout\tf@not\jobname.not\relax
  \immediate \write\tf@not{\relax}
  \setcounter{footnote}{0}}
%
%   When text is written to file (.not) the source linebreaks
%   are maintained.  This keeps the individual lines in the file short.
%
\def\chapternotes{\clearpage   % prints chapter notes (a section)
  \ifchapternotes\ifnum\c@footnote>1
    \begin{center} Notes to Chapter \Roman{chapter} \end{center}\par
    \addcontentsline{toc}{section}{\protect
        \numberline{}{Notes to Chapter \Roman{chapter}}}
    \begin{enumerate}
    \immediate\closeout\tf@not
    \catcode`@=11
    \let\n@teitem\item
    \@input{\jobname.not}
    \end{enumerate}
    \clearpage\fi\fi}
 
\def\endnotes{                 % prints end notes (a chapter)
  \ifendnotes\ifnum\c@footnote>1
    \chapter{Notes}
    \begin{enumerate}
    \immediate\closeout\tf@not
    \catcode`@=11
    \let\n@teitem\item
    \@input{\jobname.not}
    \end{enumerate}
    \clearpage\fi\fi}
 
% ----  [architect] style -----------------
% This is really untested and incomplete...
%
% sets landscape page sizing.  Two-column mode must be manually
% entered/exited via \twocolumn and \onecolumn
%
\newif\ifarchitect \architectfalse
\def\ds@architect{\architecttrue}
%
 
% ----  Thesis is a modified 12-pt book style  ----------------------------
%
\let\@ld@options\@options
\def\@options{\def\@ptsize{2}\@ld@options}  % default is 12 point (vers 1.3)
\input book.sty
\@twosidefalse   % no two-side for thesis (but see mods for facing captions)
 
% increase baselines for normal and footnote sizes
\def\@normalsize{\@setsize\normalsize{18pt}\xiipt\@xiipt
 \abovedisplayskip 15pt plus3pt minus7pt\belowdisplayskip \abovedisplayskip
 \abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 8pt plus4pt
 minus3pt\let\@listi\@listI}
%
\def\footnotesize{\@setsize\footnotesize{14pt}\xpt\@xpt
 \abovedisplayskip 12pt plus2pt minus5pt\belowdisplayskip \abovedisplayskip
 \abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 7pt plus3pt minus3pt
 \def\@listi{\leftmargin\leftmargini \topsep 8pt plus 2pt minus 2pt\parsep 4pt
 plus 2pt minus 1pt
 \itemsep \parsep}}
%
\def\@listI{\leftmargin\leftmargini \parsep 7pt plus 3pt minus 1pt\topsep
 12pt plus 5pt minus 6pt\itemsep 7pt plus 3pt minus 1pt}
 
 
% margins are approximately 1 inch, except 1.5 inch at the binding
%
\textheight 590pt \textwidth 433pt
\oddsidemargin 36pt \evensidemargin 0pt
\marginparwidth 72pt \marginparsep 7pt
 \topmargin 0pt   \headheight 12pt \headsep 36pt
\footheight 12pt \footskip 12pt
\footnotesep=14pt
 
% architect margins are 1.5 at top and left and 1 at right and bottom
\ifarchitect
  \textheight 373pt \textwidth 614pt
  \oddsidemargin 36pt \evensidemargin 0pt
  \topmargin 36pt   \headheight 12pt \headsep 36pt
  \typeout{[architect style]}
  \fi
 
%  footnotes if no option specified
%
\ifchapternotes\else\ifendnotes\else\ds@footnotes\fi\fi
 
 
%  bottom-of-page footnotes format
%  full width line and hanging indent
%
\def\footnoterule{\kern-3\p@
 \hrule width \columnwidth \kern 2.6\p@}
\long\def\@makefntext#1{\parindent 1em\noindent \hang
 \hbox to1em{\hss$^{\@thefnmark}\,$}#1}
 
 
 
%
%  ----  Text pages  ----------------------------------
%
\def\textpages{  % sets page numbering for text
   \clearpage\pagestyle{myheadings}\markboth{}{}
   \def\Thechapter{\arabic{chapter}}
   \pagenumbering{arabic}
   \textheight 602pt  % allow for no footers (vers 1.3)
     \footheight 0pt \footskip 0pt
   \ifarchitect \textwidth 614pt \oddsidemargin 36pt \twocolumn\fi}
 
 
\def\appendix{\par
 \setcounter{chapter}{0}
 \setcounter{section}{0}
 \def\@chapapp{Appendix}
 \def\Thechapter{\Alph{chapter}}
 \def\thechapter{\Alph{chapter}}}
 
 
%  Chapters
%
\def\@makechapterhead#1{ \vspace*{2pc} {\centering
 \ifnum \c@secnumdepth >\m@ne \large \@chapapp{} \Thechapter \par
 \vspace{10pt} \fi \large\bf \uppercase{#1}\par
 \nobreak \vspace{20pt}} }
%
\def\@makeschapterhead#1{ \vspace*{2pc} {\centering
 \large\bf \uppercase{#1}\par
 \nobreak \vspace{20pt}} }
%
\def\chapter{\cleardoublepage  % Starts new right-hand page.
   \thispagestyle{empty}     % Page style of chapter page is 'empty'
   \global\@topnum\z@        % Prevents figures from going at top of page.
   \@afterindenttrue         % Allows indent in first paragraph.  Change
   \ifchapternotes\@startnotes\fi  % if chapter notes
   \let\\\relax                  % vers 1.3
   \secdef\@chapter\@schapter}   % to \@afterindentflase to omit indent.
%
%  Complication is added here to allow line breaks
%  in the chapter titles (via \\).
%
\def\@chapter[#1]#2{
  \ifnum \c@secnumdepth >\m@ne
  \refstepcounter{chapter}
  \typeout{\@chapapp\space\thechapter.}
  {\def\\{ }  % allow \\ in title
   \addcontentsline{toc}{chapter}{\protect
     \numberline{\@chapapp\ \thechapter}#1}}\else
  {\def\\{ }  % allow \\ in title
   \addcontentsline{toc}{chapter}{#1}}\fi
 \addtocontents{lof}{\protect\addvspace{10pt}}
 \addtocontents{lot}{\protect\addvspace{10pt}}
 \if@twocolumn
  \@topnewpage[\@makechapterhead{#2}]
  \else \@makechapterhead{#2}
  \@afterheading \fi}
\def\@schapter#1{\if@twocolumn \@topnewpage[\@makeschapterhead{#1}]
  \else \@makeschapterhead{#1}
  \@afterheading\fi}
%
%  Sections
%
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
  -.2ex}{2.3ex plus .2ex}{\normalsize \sl}}
 \def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus
  -.2ex}{1.5ex plus .2ex}{\normalsize \it}}
 \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
  -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize \it}}
%
%  Provide for `Chapter ' in the toc
%
\def\l@chapter#1#2{\pagebreak[3]
 \vskip 1.0em plus 1pt \@tempdima 78pt \begingroup
 \parindent \z@ \rightskip \@pnumwidth
 \parfillskip -\@pnumwidth
 \bf \leavevmode \advance\leftskip\@tempdima \hskip -\leftskip #1\nobreak\hfil
\nobreak\hbox to\@pnumwidth{\hss #2}\par
 \endgroup}
%
%
%  specification of \newfileline will cause a line break in any
%  table of contents file.  This allows long or complicated titles.
%
\let\newfileline\relax             % will give linebreaks in .aux
\let\n@wfileline\relax             % will give linebreaks in .toc
%
\def\addcontentsline#1#2#3{\if@filesw \begingroup
 \let\label\@gobble \let\index\@gobble
 \def\newfileline{\n@wfileline^^J}% % gives linebreaks in .aux
 \def\protect##1{\string\string\string##1\string\space
    \space}\@temptokena{\thepage}%
 \edef\@tempa{\write \@auxout{\string\@writefile{#1}{\protect
     \contentsline{#2}{#3}{\the\@temptokena}}}}\@tempa
   \if@nobreak \ifvmode\nobreak\fi\fi\endgroup\fi}
 
\def\enddocument{\@checkend{document}\clearpage\begingroup
 \if@filesw \immediate\closeout\@mainaux
 \def\global\@namedef##1##2{}\def\newlabel{\@testdef r}%
 \def\bibcite{\@testdef b}\@tempswafalse \makeatletter
 \def\n@wfileline{^^J}\input \jobname.aux
 \if@tempswa \@warning{Label(s) may have changed.  Rerun to get
 cross-references right}\fi\fi\endgroup\deadcycles\z@\@@end}
 
 
 
%  ----  Facing caption pages -----------------
%
%  Facing caption pages (Style manual, p 15) must be formatted
%  much like the even numbered pages of a `two-sided' book.
%  i.e., the binding is on the right and the page number is
%  on the left.
%
%  A facing page float is indicated by the positioning character [f],
%  i.e., \begin{figure}[pf] ... \end{figure}
%
%  to mark facing page floats a control sequence whose name contains
%  the float box name is def'd to F for facing stuff and P otherwise
%  (a possible cs name is, for example, '\facing:\bx@A')
%
% these macros originally from latex.tex
\def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
   \@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner
      \@parmoderr\@floatpenalty\z@
    \else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname
       \multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n
       \global\@namedef{facing:\expandafter\string\@currbox}{P}
       \@tfor \@tempa :=#2\do
                        {\if\@tempa h\advance\@tempcnta \@ne\fi
                         \if\@tempa t\advance\@tempcnta \tw@\fi
                         \if\@tempa b\advance\@tempcnta 4\relax\fi
                         \if\@tempa p\advance\@tempcnta 8\relax\fi
 \if\@tempa f\global\@namedef{facing:\expandafter\string\@currbox}{F}\fi
         }\global\count\@currbox\@tempcnta}\@fltovf\fi
    \global\setbox\@currbox\vbox\bgroup
%    \boxmaxdepth\z@     % commented out 15 Dec 87
    \hsize\columnwidth \@parboxrestore}
 
% when a facing page caption is boxed for output,
% the control sequence \facingp@ge is defined, else it is not.
%
\def\@outputpage{\begingroup\catcode`\ =10 \if@specialpage
     \global\@specialpagefalse\@nameuse{ps@\@specialstyle}\fi
     \@ifundefined{facingp@ge}%
          {\let\@thehead\@oddhead % case for normal pages
           \let\@thefoot\@oddfoot  \let\@themargin\oddsidemargin}%
          {\let\@thehead\@evenhead  % case for facing pages
           \let\@thefoot\@evenfoot \let\@themargin\evensidemargin}
     \global\let\facingp@ge\relax  % same as undefined (vers 1.3)
     \shipout
     \vbox{\normalsize \baselineskip\z@ \lineskip\z@
           \let\par\@@par %% 15 Sep 87
           \vskip \topmargin \moveright\@themargin
           \vbox{\setbox\@tempboxa
                   \vbox to\headheight{\vfil \hbox to\textwidth
                                       {\let\label\@gobble \let\index\@gobble
                                         \@thehead}} %% 22 Feb 87
                 \dp\@tempboxa\z@
                 \box\@tempboxa
                 \vskip \headsep
                 \box\@outputbox
                 \baselineskip\footskip
                 \hbox to\textwidth{\let\label\@gobble
                           \let\index\@gobble  %% 22 Feb 87
                           \@thefoot}}}\global\@colht\textheight
           \endgroup\stepcounter{page}\let\firstmark\botmark}
 
\def\@wtryfc #1{\global\setbox\@outputbox\vbox{\unvbox\@outputbox
    \vskip\@fpsep\box #1}
   \expandafter\if\csname facing:\string#1\endcsname F\gdef\facingp@ge{}\fi}
 
 
%
% ------------ Page numbering --------------
%
% modify stepcounter to decrement if the argument is negative.
% Negative pages are needed this because Texrox uses the page number
% to order pages.
%
\def\stepcounter#1{%
  \expandafter\ifnum\csname c@#1\endcsname<0
     \global\expandafter\advance\csname c@#1\endcsname\m@ne
  \else \global\expandafter\advance\csname c@#1\endcsname\@ne\fi
     {\let\@elt\@stpelt \csname cl@#1\endcsname}}
%
\def\@roman#1{\ifnum#1<0\romannumeral -#1\else\romannumeral #1\fi}
%
%
 
%  ----  Preliminary pages  ---------------------------
%
\def\prelimpages{ % sets page numbering for the preliminary pages
   \pagestyle{empty} % will be {plain} at start of toc
   \pagenumbering{roman}
   \setcounter{page}{-1}
   \textheight 572pt  % add separation for page numbers (vers 1.3)
      \footheight 12pt \footskip 30pt
   \ifarchitect \textwidth 450pt \oddsidemargin 118pt\fi}
%
%         (these macros are used once and discarded)
%
%  Title page
%
%  options and defaults
%
\def\Title#1{\gdef\@Title{#1}}
\def\Author#1{\gdef\@Author{#1}}
\def\Year#1{\gdef\@Year{#1}}  \Year{\year}
\def\Degree#1{\gdef\@Degree{#1}} \Degree{Doctor of Philosophy}
%
\def\School#1{\gdef\@School{#1}} \School{University of Washington}
\def\Degreetext#1{\gdef\@Degreetext{#1}} 
  \Degreetext{A dissertation submitted in partial fulfillment\\
    of the requirements for the degree of}
\newcount\@Signatures 
\def\Signatures#1{\global\@Signatures=#1\relax}
  \Signatures{3} % number of signature lines
 
\def\titlepage{                   % Prints the title page
    \vspace{7pc}
    \begin{center}
      {\Large
      \lineskip 3ex
      \@Title\par}
      \vskip0pt plus1fill
      by
      \par\vskip0pt plus1fill
      \@Author
      \par\vskip0pt plus2fill
      \@Degreetext
      \par\vskip0pt plus2fill
      \@Degree
      \par\vskip0pt plus2fill
      \@School
      \par\vskip0pt plus1fill
      \@Year
      \par\vskip0pt plus2fill
     \makebox[\textwidth]{Approved by\hrulefill}
      \par
      {(Chairperson of Supervisory Committee)}
      \par
      \@whilenum \@Signatures>1 \do
       {\vskip18pt
        \makebox[\textwidth]{\phantom{Approved by}\hrulefill}
        \advance\@Signatures by\m@ne}
      \par\vskip2pc
      \makebox[\textwidth]{Program Authorized\hfill}
      \makebox[\textwidth]{to Offer Degree\hrulefill}
      \par\vskip2pc
      \makebox[\textwidth]{Date\hrulefill}
     \par
    \end{center}
     \vskip0pt plus2fill
     \newpage
  \let\titlepage\relax}
 
%   Quote slip
%
\long\def\quoteslip#1{
   \null
   \vskip0pt plus1fill
   \noindent #1\par
   \vskip3pc
   \begin{flushright}
      \makebox[3in]{Signature\hrulefill}
      \par\vskip2pc
      \makebox[3in]{Date\hrulefill}
   \end{flushright}
   \vskip0pt plus2fill
   \newpage
   \let\quoteslip\relax}
%
%   Abstract
%
%  normal parameters
\def\Professor#1{\gdef\@Professor{#1}}
\def\Department#1{\gdef\@Department{#1}}
\long\def\abstract#1{
   \begin{center}
      \@School
      \par\vskip1pc
      Abstract
      \par\vskip1pc
      {\large \@Title \par}
      \par\vskip1pc
      by \@Author
      \par\vskip1pc
      Chairperson of Supervisory Committee:
         \begin{tabular}[t]{cc}\@Professor\\\@Department\end{tabular}
      \par\vskip1pc
   \end{center}
   #1
   \vfill
   \newpage
   \let\abstract\relax}
%
%
%   Table of contents
%
%
\def\tableofcontents{\chapter*{Table of Contents\@mkboth{}{}}
   \pagestyle{plain}
   \thispagestyle{empty}
   \setcounter{page}{-2}
   {\let\footnotemark\relax  % in case one is in the title
   \@starttoc{toc}
    }
   \newpage}
%
%   List of figures
%
\def\listoffigures{\chapter*{List of Figures\@mkboth{}{}}
   \thispagestyle{plain}
   \addcontentsline{toc}{chapter}{List of Figures}
   {\let\footnotemark\relax  % in case one is in the title
   \@starttoc{lof}
    }
   \newpage}
%
%   List of tables
%
\def\listoftables{\chapter*{List of Tables\@mkboth{}{}}
   \thispagestyle{plain}
   \addcontentsline{toc}{chapter}{List of Tables}
   {\let\footnotemark\relax  % in case one is in the title
   \@starttoc{lot}
    }
   \newpage}
%
%  Bibliography
%
\def\thebibliography#1{\chapter*{Bibliography\@mkboth
 {BIBLIOGRAPHY}{BIBLIOGRAPHY}}
 \addcontentsline{toc}{chapter}{Bibliography}
 \list
 {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
 \advance\leftmargin\labelsep
 \usecounter{enumi}}
 \def\newblock{\hskip .11em plus .33em minus .07em}
 \sloppy\clubpenalty4000\widowpenalty4000
 \sfcode`\.=1000\relax}
 
%
%   Acknowledgments
%
\long\def\acknowledgments#1{\chapter*{Acknowledgments\@mkboth{}{}}
   \thispagestyle{plain}
   #1\par
   \vfill
   \newpage
   \let\acknowledgments\relax}
 
%
%   Dedication
%
\long\def\dedication#1{\chapter*{Dedication\@mkboth{}{}}
   \thispagestyle{plain}
   #1\par
   \vfill
   \newpage
   \let\dedication\relax}
 
%
%   Vita
%
\long\def\vita#1{\chapter*{Vita\@mkboth{}{}}
   #1\par
   \vfill
   \newpage
   \let\vita\relax}
 
% End of the thesis style