% Modified from vuthesis.sty in /opt/local/cs/lib/TeX/inputs 29 Oct 1998
% by Ravi Kapadia (ravi@vuse.vanderbilt.edu) 9 Nov 1999
% by Matt Domsch (mdomsch@vuse.vanderbilt.edu) 24 Mar 1999
% by Jay Pfaffman (pfaffman@relaxpc.com) 18 Jan 2000
% Changes:
%   - Renamed this vuthesis.cls
%   - Added dependency on LaTeX2e
%   - Conforms to 1999 Vanderbilt University Graduate School format
%     for thesis and dissertations (to the best of my knowledge)

%JP Changes:
%   - \figurespagefalse and \tablespagefalse actually work
%   - table of contents page is 1in too low
%   - added paperpurpose (MAP or Dissertation)
%   - do not assume that fullpage.sty has been loaded

% STOLEN FROM STANFORD: by Brian Carlson, Vanderbilt University
% Stanford University PhD thesis style -- modifications to the report style
% For LaTeX2e version 2e
%
% Edit Tue Sep 13 14:40:26 1988 by Joseph Pallas
% Edit Tue Thu 24 10:14:00 1999 by Matt Domsch


\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{vuthesis}[1999/03/24 Document Class `vuthesis'.]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions\relax
\LoadClass{report}
% Load the indentfirst package so that the first paragraph following a
% heading is indented (normally it's not with the report class)
\usepackage{indentfirst}
% Load doublespace package to define spacing environment
\usepackage{doublespace}
% Load float package to move figure caption to below figure
\usepackage{float}
% Give lots of context when TeX finds a problem
\errorcontextlines 999

% Set the baselinestretch values for single and double spacing
% appropriate for a 12pt normal font
\newcommand{\doublespacesize}{2}
\newcommand{\singlespacesize}{1}
\renewcommand{\baselinestretch}{1}

% Print chapter number in roman numerals
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}

% Number chapters, sections,subsections,subsubsections
\setcounter{secnumdepth}{1}
\setcounter{secnumdepth}{2}
\setcounter{secnumdepth}{3}
% Print chapters, sections in the TOC
\setcounter{tocdepth}{3}
% Set the names of these areas to be what we want, all caps
\renewcommand{\contentsname}{{\sc Table of Contents}}
\renewcommand{\listfigurename}{{\sc List of Figures}}
\renewcommand{\listtablename}{{\sc List of Tables}}
\renewcommand{\bibname}{{\sc References}}
\renewcommand\chaptername{{\sc Chapter}}
\renewcommand\appendixname{{\sc Appendix}}

\long\def\comment#1{}
\comment{

  Example of use:
    \documentclass[12pt]{vuthesis}
    \begin{document}
    \title{How to Write Theses\\
            With Two Line Titles}
    \author{John Henry Candidate}
    \principaladviser{John Parker}
    \firstreader{John Green}
    \secondreader{John BigBooty\\(Another Department)}
 
    \beforepreface
    \prefacesection{Preface}
        This thesis tells you all you need to know about...
    \prefacesection{Acknowledgments}
        I would like to thank...
    \afterpreface
 
    \chapter{Introduction}
         ...
    \chapter{Conclusions}
         ...
    \appendix
    \chapter{A Long Proof}
         ...
    \bibliographystyle{plain}
    \bibliography{mybib}
    \end{document}

Documentation:
    This style file modifies the standard report style to follow the
    Graduate Program Offices's "Directions for Preparing Doctoral
    Dissertations".  It sets the margins and interline spacing and
    disallows page breaks at hyphens.

    The \beforepreface command creates the title page, a copyright page
    (optionally), and a signature page.  Then the user should put
    preface section(s), using the \prefacesection{section title}
    command.  The \afterpreface command then produces the tables of
    contents, tables and figures, and sets things up to start
    the main body (on arabic page 1).
    
    The following commands can control what goes in the front matter
    material:
    
        \title{thesis title}
        \author{author's name}
        \dept{author's department}
                - Computer Science if omitted
        \principaladviser{the principal advisor's name}
           (or \principaladvisor, if you prefer advisor spelled with o)
        \firstreader{the first reader's name}
        \secondreader{the second reader's name}
        \submitdate{month year in which submitted to GPO}
                - date LaTeX'd if omitted
        \copyrightyear{year degree conferred (next year if submitted in Dec.)}
                - year LaTeX'd (or next year, in December) if omitted
        \copyrighttrue or \copyrightfalse
                - produce or don't produce a copyright page (true by default)
        \figurespagetrue or \figurespagefalse
                - produce or don't produce a List of Figures page
                  (true by default)
        \tablespagetrue or \tablespagefalse
                - produce or don't produce a List of Tables page
                (true by default)
        \paperpurpose (added by JP)
                - Purpose of paper (Dissertation by default)

This style uses interline spacing that is 1.3 times normal, except
in the figure and table environments where normal spacing is used.
That can be changed by doing:
    \renewcommand{\baselinestretch}{1.6}
(or whatever you want instead of 1.6)
Unfortunately, that command probably won't take effect unless it comes
before the \begin{document} or after something like \small \normalsize.

The example above shows the 12pt substyle being used.  This seems to give
acceptable looking results, but it may be omitted to get smaller print.

}

%% Matt spent a lot of time messing with these values
%% change only if absolutely necessary.  They assume 8.5x11 paper
% We need 1" margins except on the binding edge, where it is 1 1/2"
% Theses are single-sided, so we don't care about \evensidemargin

% JP -- I'm confused.  Did Matt's values assume that fullpage.sty was
% included?  I'm changing this so that fullpage.sty is not assumed.

\setlength\paperheight{11in}
\setlength\paperwidth{8.5in}
\textwidth6in % Was 6in
\setlength{\textheight}{9.5in} % was 8.8?
\oddsidemargin 0.5in 
\evensidemargin 0.5in
\topmargin-.75in      % JP -- was 6pt
\headheight.25in     % JP added
\headsep.5in        % JP added
\reversemarginpar
\marginparwidth1.15in % width of margin notes --- JP  changed from 40pt
\marginparsep 10pt   % width of space between paragraph and margin note
\setlength\footskip{42pt}
\setlength\intextsep{37pt plus 0pt minus 0pt} 
\setlength\textfloatsep{37pt plus 0pt minus 0pt}%tdw 10/9/91 added to reflect 
                                        %Jungsoon's problems.

% make all pages fill the body area
\widowpenalty=0 % don't allow widow lines
% Disallow page breaks at hyphens (this will give some underfull vbox's,
% so an alternative is to use \brokenpenalty=100 and manually search
% for and fix such page breaks)
\brokenpenalty=10

% Redefine the macro used for floats (including figures and tables)
% so that single spacing is used.
% (Note \def\figure{\@float{figure}set single spacing} doesn't work
%  because figure has an optional argument)
\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
       \@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
         }\global\count\@currbox\@tempcnta}\@fltovf\fi
    \global\setbox\@currbox\vbox\bgroup 
    \def\baselinestretch{1}\@normalsize
   \boxmaxdepth\z@
    \hsize\columnwidth \@parboxrestore}

% JP
% Set paperpurpose to Dissertation.  Can be changed with \paperpurpose
\def\@paperpurpose{Dissertation}
\def\paperpurpose#1{\gdef\@paperpurpose{#1}}
\newif\ifcandidacy

% Redefine the macro used for footnotes to use single spacing
\long\def\@footnotetext#1{\insert\footins{\def\baselinestretch{1}\footnotesize
    \interlinepenalty\interfootnotelinepenalty 
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
   \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
    {\rule{\z@}{\footnotesep}\ignorespaces
      #1\strut}}}

% \author, \title are defined in report; here are the rest of the
% front matter defining macros
\def\dept#1{\gdef\@dept{#1}}
\def\principaladviser#1{\gdef\@principaladviser{#1}}
\def\advis@r{Adviser} % default spelling
\def\principaladvisor#1{\gdef\@principaladviser{#1}\gdef\advis@r{Advisor}}
\def\firstreader#1{\gdef\@firstreader{#1}}
\def\secondreader#1{\gdef\@secondreader{#1}}
\def\thirdreader#1{\gdef\@thirdreader{#1}}
\def\fourthreader#1{\gdef\@fourthreader{#1}}
\def\submitdate#1{\gdef\@submitdate{#1}}
\def\copyrightyear#1{\gdef\@copyrightyear{#1}} % \author, \title in report
\def\@title{}\def\@author{}\def\@academicarea{Physics}
\def\@principaladviser{}\def\@firstreader{}\def\@secondreader{}
\def\@thirdreader{}\def\@fourthreader{}
\def\@submitdate{\ifcase\the\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\the\year}

% Stanford says that December theses should have the next year as the
% copyright year

\ifnum\month=12
    \@tempcnta=\year \advance\@tempcnta by 1
    \edef\@copyrightyear{\number\the\@tempcnta}
\else
    \def\@copyrightyear{\number\the\year}

\fi\vskip 0.5in
\newif\ifcopyright \newif\iffigurespage \newif\iftablespage
\copyrighttrue \figurespagetrue \tablespagetrue\vskip 0.5in


\def\titlep{{%
        % uncomment the following two lines to get the correct format 
        % for the title page, comment them again to reset
        % the settings for the rest of the dissertation
                                % JP -- tried to fix this and reset
                                % the margins at end of \titlep
                                % but why change them at all?
     %\addtolength{\topmargin}{-0.5in}
      %\addtolength{\textheight}{2in}
        \thispagestyle{empty}%
        \null
        \begin{center}
                \begin{spacing}{\doublespacesize}
                \uppercase\expandafter{\@title}\\
                \end{spacing}
                \vskip 0.1in
                \vfil
                By\\ 
                \vskip 0.1in
                \vfil
                \begin{spacing}{\doublespacesize}
                \@author\\
                \end{spacing}
                \vskip 0.1in
                \vfil
                \begin{spacing}{\doublespacesize}
                  \@paperpurpose \\
                Submitted to the Faculty of the \\
                Graduate School of Vanderbilt University \\
          \ifcandidacy 
                for Candidacy for the Degree of
          \else 
                in partial fulfillment of the requirements\\ 
          \fi
                for the degree of\\
                \end{spacing}
               
                \begin{spacing}{\doublespacesize}
                DOCTOR OF PHILOSOPHY  \\
                in  \\
                \end{spacing}
             
                \vfil
                \@academicarea \\ % JP Fixed this
                \vskip 0.2in 
                \vfil
                \@submitdate\\
              \vskip 0.1in 
                \vfil
                Nashville, Tennessee \\ 
        \end{center}
        \vskip .3in
        \vfil
        \vfil   
	\vfil 
	\vfil 
	\vfil 
        \nobreak  %Ravi changed this to accomodate six signatures
        % and JP changed it to have only five
%        \begin{minipage}{4.5in}
          \begin{center}
        Approved: \\
        \hbox to 4.5in{\hfil{}}
        \vskip 0.15in
        Dr. Keivan G. Stassun
    %    \hbox to 4.5in{{}{\hrulefill}{}}
        \vskip 0.15in
        Dr. David J. James
    %    \hbox to 4.5in{{}{\hrulefill}{}}
        \vskip 0.15in
        Dr. David A. Weintraub
%        \hbox to 4.5in{{}{\hrulefill}{}}
        \vskip 0.15in
        Dr. Kelly Holley-Bockelmann
%        \hbox to 4.5in{{}{\hrulefill}{}}
        \vskip 0.15in
%        \hbox to 4.5in{{}{\hrulefill}{}}
        Dr. Kalman Varga
%        \vskip 0.12in
%        \hbox to 3.5in{{}{\hrulefill}{}}
        \end{center}
%        \end{minipage} 
        \hskip 0.1in 
%        \begin{minipage}{1in}
%        Date: \\
%        \hbox to 1in{\hfil{}}
%        \vskip 0.15in
%        \hbox to 1in{{}{\hrulefill{}}}
%        \vskip 0.15in
%        \hbox to 1in{{}{\hrulefill}{}}
%        \vskip 0.15in
%        \hbox to 1in{{}{\hrulefill}{}}
%        \vskip 0.15in
%        \hbox to 1in{{}{\hrulefill}{}}
%        \vskip 0.15in
%        \hbox to 1in{{}{\hrulefill}{}}
%        \vskip 0.12in
%        \hbox to 2.3in{{}{\hrulefill}{}}
%        \end{minipage}
        \newpage}
       % JP -- reset margins for rest of document
%      \addtolength{\topmargin}{0.25in}
     \addtolength{\textheight}{-0.5in}
}

\def\copyrightpage{%
        \thispagestyle{empty}
        \null\vfill
        \begin{center}
                \copyright\ Copyright by \@author \ \@copyrightyear \\
                All Rights Reserved
        \end{center}
        \vfill\newpage}

\def\beforepreface{
        \pagenumbering{roman}
    
        \titlep
        \ifcopyright\copyrightpage
        \addtocontents{toc}{\hfill Page}
        \addtocontents{toc}{}
        \fi
        }

\newcommand{\prefacesection}[1]
{
\chapter*{#1}
\addcontentsline{toc}{chapter}{\protect\uppercase{#1}}
}

\def\afterpreface{
  
  \newpage
  \begin{spacing}{1}
    \tableofcontents
  \end{spacing}
  \newpage
  \addcontentsline{toc}{chapter}{\listtablename}
  \iftablespage\listoftables\newpage
  \addtocontents{lot}{{\sc Table} \hfill {\sc Page}}
  \addtocontents{lot}{}
  \addcontentsline{toc}{chapter}{\listfigurename}
  \addtocontents{lof}{{\sc Figure} \hfill {\sc Page}}
  \addtocontents{lof}{}
  \fi
  \addtocontents{toc}{\protect\flushleft {\sc Chapter} \hfill {\sc Page}}        
  \iffigurespage\listoffigures\newpage
  \fi
  
  \pagenumbering{arabic}
  \pagestyle{plain}
  % make rest of document (main text) double space
  \renewcommand{\baselinestretch}{\doublespacesize}\@normalsize
} 
% Redefine \thebibliography to go to a new page and put an entry in the
% table of contents
\let\@ldthebibliography\thebibliography
\renewcommand{\thebibliography}[1]{\newpage
        \addcontentsline{toc}{chapter}{REFERENCES}
        \@ldthebibliography{#1}}


% Start out normal
\pagestyle{plain}
\renewcommand{\textfraction}{0.1}



\def\advisor#1{\gdef\@advisor{#1}}
\def\academicarea#1{\gdef\@academicarea{{#1}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of 'abstract' page style.  
%

\renewenvironment{abstract}{
              \bgroup
              \newpage
              \newcounter{savepageno}
              \setcounter{savepageno}{\value{page}}
              % \thispagestyle{empty}
              \pagestyle{empty}
              \hfill\normalsize\rm\underline{\@academicarea}
              \vspace{1.5\baselineskip}
              \begin{center}
              \begin{spacing}{\doublespacesize}
                 \normalsize\uppercase\expandafter{\@title}\\
                 \vspace{1.0\baselineskip}
                 \uppercase\expandafter{\@author}
              \end{spacing}
              \end{center}
   \begin{spacing}{1}
     \ifcandidacy
     \centerline{Abstract}
     \else
     \centerline{\underline{Dissertation under the direction of
     Professor \@advisor}}\par
 \fi
   \vspace{0.5\baselineskip}
   \end{spacing}
   \begin{spacing}{\doublespacesize}
}
{
   \end{spacing}
   \ifcandidacy
   {\vfill \vfill \vspace{0.2in}
     \par\newpage\setcounter{page}{\value{savepageno}}\egroup}
   \else
   {\vfill \vfill \vspace{0.2in}
     Approved\,\rule[-1mm]{3.2in}{0.4pt} \hfill \ Date\,\rule[-1mm]{1.5in}{0.4pt}\\
     \par\newpage\setcounter{page}{\value{savepageno}}\egroup}
   \fi
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Single-space quote and quotation environments
\renewenvironment{quotation}
               {\list{}{\listparindent 1.5em%
                        \itemindent    \listparindent
                        \rightmargin   \leftmargin
                        \parsep        \z@ \@plus\p@}%
                        \begin{spacing}{\singlespacesize}
                \item\relax}
               {\end{spacing}\endlist}
\renewenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                        \begin{spacing}{\singlespacesize}
                \item\relax}
               {\end{spacing}
                \endlist}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Print the caption for a figure below the figure
% Uses package ``float''
\floatstyle{plain}
\restylefloat{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Center top of page upper case large chapter and chapter* titles,
% single spaced
\def\@makechapterhead#1{%
\begin{spacing}{1}
  {\parindent \z@ \centering \normalfont
    \ifnum \c@secnumdepth >\m@ne
        % \Large\bfseries \uppercase{\@chapapp}\space \thechapter \vspace{2ex}
        % changed 10\18\99
         \uppercase{\@chapapp}\space \thechapter \vspace{8ex \@plus -0ex \@minus -0ex}
        \par\nobreak
    \fi
    \interlinepenalty\@M
    % \Large \bfseries \uppercase{#1}\par\nobreak
    % changed 10\18\99
   \uppercase{#1}\par\nobreak \vspace{8ex \@plus -0ex \@minus -0ex}
    % \vskip 24\p@
    % \vskip 36\p@    
  }
\end{spacing}
}

\def\@makeschapterhead#1{%
\begin{spacing}{1}
  {\parindent \z@ \centering
    \normalfont
    \interlinepenalty\@M
    % \Large \bfseries  \uppercase{#1}\par\nobreak
    % changed 10\18\99
     \uppercase{#1}\par\nobreak \vspace{4ex \@plus -0ex \@minus -0ex}
    % \vskip  24\p@
    % \vskip 36\p@
  }
\end{spacing}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%SECTION FORMAT
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                {-5.5ex \@plus -0ex \@minus -0ex}%
                                {.1ex \@plus.0ex}%
                                {\normalfont\centering}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%Subsection Format
\renewcommand\subsection{\@startsection {subsection}{2}{\z@}%
                                {-5.5ex \@plus -0ex \@minus -0ex}%
                                {.1ex \@plus.0ex}%
                                {\normalfont}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%Subsubsection Format
\renewcommand\subsubsection{\@startsection {subsubsection}{3}{\z@}%
                                {-5.5ex \@plus -0ex \@minus -0ex}%
                                {.1ex \@plus.0ex}%
                                {\normalfont}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Fix up the table of contents
% Print chapter lines uppercase, with a blank line above and below
\def\l@chapter#1#2{\pagebreak[3]
 \vskip 1.0em plus 1pt % space above chapter line
 \@dottedtocline{0}{0em}{4em}{\uppercase{#1}}{#2}
 \vskip 1.0em plus 1pt % space below chapter line
}

% Print sub-chapter lines indented appropriately
\renewcommand\l@section{\@dottedtocline{1}{5.5em}{2.4em}}
\renewcommand\l@subsection{\@dottedtocline{2}{8.5em}{3.2em}}
\renewcommand\l@subsubsection{\@dottedtocline{3}{11em}{4.1em}}
\renewcommand\l@paragraph{\@dottedtocline{4}{13.5em}{5em}}
\renewcommand\l@subparagraph{\@dottedtocline{5}{16em}{6em}}

% Put a blank line above figure and table entries in their lists
\renewcommand{\l@figure}{
 \vskip 1.0em plus 1pt % space above figure name
 \@dottedtocline{1}{1.5em}{3.3em}
}
\renewcommand{\l@table}{\l@figure}

% Put a period after the item number in the table of contents
\def\numberline#1{\hb@xt@\@tempdima{{#1.}\hfil}}

% Redefine \appendix to put an entry in the table of contents
\let\@ldappendix\appendix
\renewcommand{\appendix}{
        \@ldappendix
        %\addtocontents{toc}{\protect\pagebreak[4]} % force a pagebreak
        \addtocontents{toc}{\protect\flushleft {\sc Appendix}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

