% Brown University PhD thesis style -- modifications to the report style
%
%      last modified by:  Robert Goldman    8-8-90 (debugged third reader,
%						    added advisor to abstract
%						    page per UMI reqs).
%      previous mods:     Lynn Andrea Stein 5-15-90  (third reader)
%			  Randy Callistri   3-16-90  (top headings,doublespace)
%                                           12-21-89 (examplespage)
%                         John Stasko       1-10-89  (created)
%

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

  Example of use:
    \documentstyle[11pt,brownphd]{report}
    \begin{document}
    \title{How to Write Theses\\
        With Two Line Titles}
    \author{Robin Candidate}
    \degrees{B.~S., Whatsamatta U., 1983\\
         Sc.~M., Brown University, 1985}
    \principaladviser{Don Knuth}
    \firstreader{Marvin Minsky}
    \secondreader{Marlin Perkins}
	\secondreaderforeigntrue
	\secondreaderfrom{(Another Department)}
    \threereaderstrue
    \thirdreader{John Stasko}

    \beforepreface
    \prefacesection{Vita}
       It all started in a little log cabin...
    \prefacesection{Preface}
    This thesis tells you all you need to know about...
    \prefacesection{Acknowledgements}
    I would like to thank the academy...
    \afterpreface

    \chapter{Introduction}
       \input{chapter1}
    \chapter{Conclusions}
     ...
    \appendix
    \chapter{A Long Proof}
     ...
    \bibliographystyle{plain}
    \bibliography{mybib}
    \addcontentsline{toc}{chapter}{Bibliography}


Documentation:
    This style file modifies the standard report style to follow the
    Graduate School's "Instructions for the Preparation and Presentation
    of Ph.D. Dissertations."  It sets the margins, interline spacing,
    the figure and table numbering style, and disallows page breaks at hyphens.
    Part of its format is borrowed from the suthesis.sty file for formatting
    Stanford Ph.D. theses.

    The \beforepreface command creates the title page, a copyright page,
    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}
    \degrees{Previous degrees earned by candidate}
    \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}
	   If a reader is not local
	\secondreaderforeigntrue		(or first, or third)
	\secondreaderfrom{the affiliation of the foreignreader}
       and, if there are three readers,
    \threereaderstrue           (false by default)
    \thirdreader{the third 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
          This is a little tricky.  Check the grad school's document.
    \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)
    \examplespagetrue or \examplespagefalse [added by rjc]
        - produce or don't produce a List of Examples page
          (true 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 11pt substyle being used.  This seems to give
acceptable looking results, but it may be changed to get a different size.

}

% We need 1" margins except at left which is 1 1/2"
% jts values:
\oddsidemargin 0.6in \evensidemargin 0.6in
\marginparwidth 40pt \marginparsep 10pt
\topmargin 0pt
\textheight 8.25in \textwidth 5.7in
% las stuff:
%\setlength{\oddsidemargin}{1.1in}
%\setlength{\evensidemargin}{\oddsidemargin}
%\setlength{\marginparwidth}{40pt}
%\setlength{\marginparsep}{10pt}
%\setlength{\topmargin}{0pt}
%\setlength{\textheight}{8.25in}
%\setlength{\textwidth}{5.2in}
%

% 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=10000

% Use 1.3 times the normal baseline-to-baseline skip
\renewcommand{\baselinestretch}{1.3}

% 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}

% 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\degrees#1{\gdef\@degrees{#1}}
\def\principaladviser#1{\gdef\@principaladviser{#1}}
\def\advis@r{Adviser}
\def\principaladvisor#1{\gdef\@principaladviser{#1}\gdef\advis@r{Advisor}}
\def\examsigner#1{\gdef\@examsigner{#1}}
\def\firstreader#1{\gdef\@firstreader{#1}}
\def\secondreader#1{\gdef\@secondreader{#1}}
\def\thirdreader#1{\gdef\@thirdreader{#1}}
\def\firstreaderfrom#1{\gdef\@firstreaderfrom{#1}}
\def\secondreaderfrom#1{\gdef\@secondreaderfrom{#1}}
\def\thirdreaderfrom#1{\gdef\@thirdreaderfrom{#1}}
\def\submitdate#1{\gdef\@submitdate{#1}}
\def\dotheabstract#1{\gdef\@dotheabstract{#1}}
\def\copyrightyear#1{\gdef\@copyrightyear{#1}} % \author, \title in report
\def\@title{}\def\@author{}\def\@dept{computer science}\def\@degrees{}
\def\@principaladviser{}\def\@firstreader{}\def\@secondreader{}
\def\@thirdreader{}
\def\@examsigner{\@principaladviser}
\def\@firstreaderfrom{}\def\@secondreaderfrom{}\def\@thirdreaderfrom{}
\def\@dotheabstract{}
\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}
\ifnum\month=12
    \@tempcnta=\year \advance\@tempcnta by 1
    \edef\@copyrightyear{\number\the\@tempcnta}
\else
    \def\@copyrightyear{\number\the\year}
\fi
% examplespage -- rjc; contentspage -- rjc? doublespace -- rjc.
% threereaders -- las; foreignreaders -- las; headerstyle -- las
\newif\ifcopyright \newif\iffigurespage \newif\iftablespage
\newif\ifforreal
\newif\ifexamplespage \newif\ifcontentspage \newif\ifdoublespace
\newif\ifthreereaders \newif\iffirstreaderforeign
\newif\ifsecondreaderforeign \newif\ifthirdreaderforeign 
\newif\ifheaderstyle
\copyrighttrue \figurespagetrue \tablespagetrue 
\forrealfalse
\examplespagefalse \contentspagetrue \doublespacefalse
\threereadersfalse \firstreaderforeignfalse
\secondreaderforeignfalse \thirdreaderforeignfalse 
\headerstylefalse

\def\titlep{%
    \thispagestyle{empty}%
    \null\vskip.5in%
    \begin{center}
        {\expandafter{\@title}}
    \end{center}
    \vfill
    \begin{center}
        by\\
        \@author\\
        \@degrees\\
    \end{center}
    \vfill
    \begin{center}
        Thesis\\
        Submitted in partial fulfillment of the requirements for the\\
        Degree of Doctor of Philosophy in the Department of Computer
        Science\\
        at Brown University.\\
    \end{center}
    \vfill
    \begin{center}
        \@submitdate\\
    \end{center}\vskip.5in\newpage}

\def\copyrightpage{%
    \thispagestyle{empty}%
    \pagenumbering{roman}
    \null\vfill
    \begin{center}
        \Large\copyright\ Copyright \@copyrightyear\\
        by\\
        \@author\\
    \end{center}
    \vfill\newpage}

\def\signaturepage{%
%    \null\vskip.5in
    \begin{center}
    This dissertation by \@author\\
    is accepted in its present form \\
    by the Department of Computer Science \\
    as satisfying the dissertation requirement \\
    for the degree of Doctor of Philosophy.
    \end{center}
    \vspace{.5in}
    % doublespace -- rjc
    \ifdoublespace\let\oldbase\baselinestretch
              \renewcommand{\baselinestretch}{1}
              \normalsize\@normalsize \fi
    \begin{tabular}{lc}
    Date \rule{1in}{.05mm}\hspace*{.75in} & \rule{3in}{.05mm}   \\
                          & \@principaladviser  \\[.75in]
    \multicolumn{2}{c}{Recommended to the Graduate Council}     \\[.50in]
    Date \rule{1in}{.05mm}\hspace*{.75in} & \rule{3in}{.05mm}   \\
                          & \@firstreader \\[.40in]
    Date \rule{1in}{.05mm}\hspace*{.75in} & \rule{3in}{.05mm}   \\
                          & \@secondreader % 
%    \ifthreereaders \\[.40in]
%    Date \rule{1in}{.05mm} \hspace*{.75in} & \rule{3in}{.05mm}   \\
%                          & \@thirdreader \\[-0.1in]
%						  & \@thirdreaderfrom 
%    \fi
\\[.60in]
    \multicolumn{2}{c}{Approved by the Graduate Council}        \\[.25in]
    Date \rule{1in}{.05mm}\hspace*{.75in} & \rule{3in}{.05mm}   \\
    \end{tabular}
    \ifdoublespace\renewcommand{\baselinestretch}{\oldbase}
              \normalsize\@normalsize\fi

}


\def\abstractpage{%
		\thispagestyle{empty}%
		\pagenumbering{roman}
%	    \null\vskip.5in\noindent
		\noindent Abstract of {\it \@title\/} by \@author, Ph.D., Brown
		University, \@submitdate.  
		Thesis advisor \@principaladviser.\\[.25in]
		%took out an @ sign; not sure that's the right thing -rpg
		%added it back in - it is.  -rph
		\@dotheabstract\thispagestyle{empty}
    \vfill\pagebreak}

\def\checklistpage{%
	\thispagestyle{empty}
	\pagenumbering{roman}
%   \null\vskip.5in
%	\begin{tabular}{l@{\hfill\rule{0.7in}{.05mm}}}
	\begin{tabular}{l@{\hfill$\ldots$}}
	\multicolumn{1}{l}{Receipts:  (2 fl. BOB)}\\
		\hspace*{1in} Cashier's Office (pink) \\
		\hspace*{1in} Bursar's Office (white) \\
		\\
		Original and 1 copy dissertation \\
		3 Title Pages \\
		2 Abstract Pages \\
		University Microfilms Agreement (signed) \\
		Survey of Earned Doctorates \\
		Career Plans Questionnaire 
	\end{tabular}\pagebreak}
	

\def\doextras{%
		\titlep
		\titlep
		\titlep
		\abstractpage
		\abstractpage
		\checklistpage}

\def\beforepreface{
	\ifforreal\doextras\doublespacetrue\headerstylefalse\fi
    \titlep
    \ifcopyright\copyrightpage\ifforreal\else\cleardoublepage\fi\fi
    \signaturepage\ifforreal\else\cleardoublepage\fi
}

\def\prefacesection#1{%
    \ifheaderstyle
         \pagestyle{headings}
    \else
        \pagestyle{plain}
    \fi
    \chapter*{#1}
    \addcontentsline{toc}{chapter}{#1}}

\def\afterpreface{\newpage
    \ifcontentspage
        \tableofcontents
\ifforreal\newpage\else\cleardoublepage\fi
    \fi
    \iftablespage
        \listoftables
\ifforreal\newpage\else\cleardoublepage\fi
    \fi
    \iffigurespage
        \listoffigures
\ifforreal\newpage\else\cleardoublepage\fi
    \fi
    \ifexamplespage
        \listofexamples
\ifforreal\newpage\else\cleardoublepage\fi
    \fi
    \pagenumbering{arabic}
    \ifheaderstyle
         \pagestyle{headings}
    \else
        \pagestyle{plain}
    \fi}

% Start with pagestyle{plain} in case front matter isn't processed
\ifheaderstyle
    \pagestyle{headings}
\else
    \pagestyle{plain}
\fi



