% \iffalse meta-comment
%
% Copyright (C) 2002-11 by Diane Gall <gall@spookyhill.net>
% -------------------------------------------------------
% 
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX 
% version 2003/06/01 or later.
%
% This work has the LPPL maintenance status "author-maintained".
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{york-thesis.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{york-thesis}
%<*class>
[2011/06/13 v3.6 York University (Toronto, Canada) thesis class]
%</class>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{listings}
\EnableCrossrefs         
\RecordChanges
\widowpenalty=50000 \clubpenalty=50000
\begin{document}
  \DocInput{york-thesis.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v1.0}{1995/04/25}{Set up for distribution to others}
% \changes{v1.1}{2002/02/13}{Various housekeeping functions}
% \changes{v2.5}{2005/04/20}{Extensive changes to comply with the new
%   Spring 2005 FGS Thesis and Dissertation Guidelines}
% \changes{v3.0}{2005/05/21}{Converted all code to literate
%   programming; corrected innumerable minor errors}
% \changes{v3.5}{2010/05/06}{Updated author name}
%
% \GetFileInfo{york-thesis.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
% 
% \title{The \textsf{york-thesis} class\thanks{This document
%     corresponds to \textsf{york-thesis}~\fileversion, dated
%     \filedate.}}  \author{Diane Gall \\
%   \texttt{gall@spookyhill.net}\thanks{For the love of all that is
%     holy, if you find errors your output, get hold of me pronto at
%     \texttt{gall@spookyhill.net}---I will make every effort to make
%     the corrections quickly and get back to you. However, you need
%     to describe the problem clearly and include the source and
%     output that offends.}}
%
% \maketitle
% \parindent = 0pt
% \parskip = 1em
% \begin{abstract}
%   \noindent The \textsf{york-thesis} class implements the York
%   University (Toronto, Canada) Faculty of Graduate Studies guidelines
%   for Theses and Dissertations (Spring 2005). This class file is based
%   on the \textsf{report} class included in every \LaTeX\
%   distribution. All requirements are pre-programmed and various
%   additional bits that I found useful when writing my dissertation are
%   included.
% \end{abstract}
%
% \section{Introduction}
%
% This document specifies completely the changes the class file makes
% to the \textsf{report} class in order for the output to meet the
% York FGS specifications for Theses and Dissertations. These
% guidelines are available from your graduate programme office and
% from FGS.\footnote{They are also available at
%   \texttt{http://www.yorku.ca/grads/pub/td.htm}} It is your
% responsibility to ensure that your output meets these requirements.
%
% \section{Usage}
%
% \subsection{Installation}
%
% Now that you have run both \texttt{york-thesis.ins} and
% \texttt{york-thesis.dtx} through \LaTeX, the only file you
% \textit{need} to install is the \texttt{york-thesis.cls} file. It
% goes in your personal \texttt{texmf} tree, wherever that is. For
% MacOS X users, this location is in \texttt{Library/texmf/tex/latex/}
% in your home folder.
%
% If you are using emacs and AUCTeX, the file \texttt{york-thesis.el}
% should be installed in a folder called \texttt{style} in your
% personal \texttt{emacs-lisp} folder in your home directory. This
% file contains some definitions for AUCTeX.
%
% The york-thesis-Template.tex file contains a sample master document
% that uses all of the features provided by the class file over
% \textsf{report.cls}. If you forget to set anything, the defaults
% from the class file will be used, so review your output carefully.
%
% \subsection{Deployment}
% 
% \DescribeMacro{\documentclass} Use: |\documentclass| \oarg{options}
% \{\textsf{york-thesis}\}
%
% The \textsf{york-thesis} class is invoked in the standard
% fashion. The defaults are
% \textsf{letterpaper,10pt,oneside,onecolumn,draft,openany}. The
% |\documentclass| command has extra functionality built into two
% options: \textsf{draft} and \textsf{final}. The \textsf{draft}
% option sets the margins to 1 inch all around and single-spaces
% everything. All other \textsf{draft} features of the \textsf{report}
% class (such as marking overfull boxes and providing empty boxes for
% graphics) are left intact, if you explicitly declare \textsf{draft};
% otherwise, you get the graphics drawn and bad boxes are not marked.
% The \textsf{final} option, by itself in the options list, sets all
% parameters for producing output suitable for examination and
% deposit. All other options are available, though some (like
% \textsf{titlepage}) do nothing.\footnote{If you declare
%   \textsf{twocolumn}, the output may be goofy. I intend to make this
%   a real option in future. See \S\ref{future}.}
%
% \subsection{Preprogrammed Formats}
% \label{preprog}
%
% The York FGS guidelines are both specific and vague. Where the
% guidelines \textit{require} some feature, it is implemented as the
% default. If you change the behaviour of anything, you should confirm
% that this liberty is permitted by the guidelines. I have taken some
% liberties that are permitted---these are detailed below.
%
% \DescribeMacro{\chapter} \DescribeMacro{\section}
% \DescribeMacro{\subsection} \DescribeMacro{\subsubsection}
% \DescribeMacro{\paragraph} I have made the size and spacing of the
% output these commands less idiotic---that is, smaller. The chapter
% type size is slightly larger than that for the others (|\Large|
% rather than |\Huge|), but the others are now simply |\large|, save
% |\paragraph|, which is |\normalsize|. Additionally, the chapter
% command gives you a chapter number with the title on a single line
% without the word `Chapter' to remind you that this is where a
% chapter begins. I think we can all tell from the context.
%
% \DescribeMacro{\appendix} Appendices are marked with
% capital Roman letters (i.e., A, B, C, et cetera), and treated
% exactly the same as a normal chapter.
%
% \DescribeEnv{quote} \DescribeEnv{quotation} \DescribeEnv{verse} I
% have made a command decision regarding these environments. The
% guidelines allow for single spacing these in the submission copy and
% I think it just looks better to do so. So, these three environments
% are single-spaced in both \textsf{draft} and \textsf{final}. I am
% planning to implement a switch for this in the future. If this is an
% important feature for anyone, please give me a shout.
%
% \DescribeMacro{\footnote} The guidelines allow footnotes to be
% single-spaced, so they are. Also, I have set the footnote
% continuation bar (the one that gets drawn when footnotes continue on
% the next page) to be drawn across the width of the text. Again, if
% anyone needs a switch to double space their footnotes soon, give me
% a shout.
%
% \subsection{Booleans and Macros}
%
% \subsubsection{Preamble Material}
%
% These booleans and macros must be set before the |document|
% environment begins.
%
% \DescribeMacro{masters} This \textsf{boolean} sets whether the
% document should be typeset as a PhD dissertation or a Masters
% thesis.
%
% \DescribeMacro{hasfigures} This \textsf{boolean} sets whether there
% are any figures in the text. All this switch does is tell \LaTeX\ to
% construct a list of figures and insert an entry for the list of
% figures in the table of contents.
%
% \DescribeMacro{hastables} This \textsf{boolean} sets whether there
% are any tables in the text. All this switch does is tell \LaTeX\ to
% construct a list of tables and insert an entry for the list of
% tables in the table of contents.
%
% \DescribeMacro{\title} This macro specifies the title of the work
% for the title page.
%
% \DescribeMacro{\author} This macro specifies your name for the title
% page.
%
% \DescribeMacro{\department} This macro specifies the department or
% graduate programme within which you are pursuing the degree.
%
% \DescribeMacro{\date} This macro specifies the full month and year
% of the defense date.
%
% \DescribeMacro{\committeememberslist} Use: |\committeememberslist|
% \marg{enumerated list}
%
% This macro specifies the list of your
% examination committee members for the authenticity page, if you are
% printing one. What goes into the macro must be an enumerated list.
%
% \DescribeMacro{\mastersof} This macro specifies which Masters degree
% you are attempting (i.e., Master of Science, Master of Arts). This
% macro has no effect if |\boolean{masters}| is false, i.e., if this
% is a PhD dissertation.
%
% \DescribeMacro{\degreename} This macro specifies the name of the
% degree you are attempting: Master or Magisteriate, Doctor or
% Doctorate.
%
% \DescribeMacro{\abstractfile} This macro specifies the filename of
% the .tex file that contains your abstract. If you do not specify a
% file, nothing is typeset. The macro constructs the title and table
% of contents entry for the page. All you need to do in the file is
% enter the text. The first line of the abstract should not be
% indented, so this is forced by the class file.
%
% \DescribeMacro{\dedicationfile} This macro specifies the filename of
% the .tex file that contains your dedication text. All you need to do
% here is specify the text of your dedication.
%
% \changes{v3.2}{2006/01/31}{Added the \textsf{dedicationfile} macro.}
%
% \DescribeMacro{\acknowledgementsfile} This macro specifies the
% filename of the .tex file that contains your acknowledgements. If
% you do not specify a file, nothing is typeset.  The macro constructs
% the title and table of contents entry for the page. All you need to
% do in the file is enter the text.  The first line of the
% acknowledgements should not be indented, so this is forced by the
% class file.
%
% \DescribeMacro{\prefacefile} This macro specifies the filename of
% the .tex file that contains your preface. If you do not specify a
% file, nothing is typeset.  The macro constructs the title and table
% of contents entry for the page. All you need to do in the file is
% enter the text.  The first line of the preface should not be
% indented, so this is forced by the class file.
%
% \DescribeMacro{\abbreviationsfile} This macro specifies the filename
% of the .tex file that contains any abbreviations for citations, et
% cetera, that you are going to use in the text. If you do not specify
% a file, nothing is typeset.  The macro constructs the title and
% table of contents entry for the page. All you need to do in the file
% is enter the text.  The first line of the abbreviations page should
% not be indented, so this is forced by the class file.
%
% \subsubsection{Source Material}
% \label{sourcemat}
%
% These macros are used inside the |document| environment.
%
% \DescribeMacro{\makefrontmatter} This macro generates the title
% page, abstract, acknowledgements, preface, abbreviations page, table
% of contents, and lists of tables and figures. It can be commented
% out until you need the front matter generated.
%
% \DescribeMacro{\epigraph} Use: |\epigraph| \marg{pithy quote}
% \marg{source} 
%
% I have added a command to insert an epigraph to be used inside an
% |epigraphs| environment immediately after the |\chapter| command (or
% wherever it strikes your fancy). It takes two arguments: a pithy
% quote and the source. The text is inserted right-justified with a
% rule underneath just after the chapter title (when invoked right
% after the |\chapter| command). The output is single-spaced in
% \texttt{draft} mode and double-spaced in \texttt{final} mode. As you
% can see, the possibilities are endless.
%
% \subsection{Environments}
%
% The |quote|, |quotation|, and |verse| environments have been
% modified as specified in \S\ref{preprog}.
%
% \DescribeEnv{epigraphs} This environment allows for the setting of
% epigraphs---if you are so inclined. It is a list environment and
% uses the |\epigraph| macro as the list item as specified in
% \S\ref{sourcemat}.
%
% \DescribeEnv{fquote} \DescribeEnv{fquotation} \DescribeEnv{fverse}
% These environments are redefinitions of the corresponding
% environments for use inside footnotes. They properly set the text
% size to |\footnotesize| and control the spacing appropriately.
%
% \section{Miscellaneous Goodies}
%
% \subsection{Bugs}
%
% There are, of course, no bugs in this class file. In the incredibly
% unlikely event that it does not perform correctly, it is obvious that
% it is the operator's fault. Please send a detailed description of your
% error to me at \texttt{gall@spookyhill.net} and I will instruct you in
% the proper use of the class file. If, on the other hand, you have the
% temerity to think that there could be \textit{improvements} to this
% most perfect code, please send those along as well for I do enjoy
% condescending to those who dare second-guess genius.\footnote{For the
%   humour-impaired, if this thing is messed up, send me a detailed
%   description of the error or improvement desired and I'll make
%   something useful happen.}
%
% \subsection{Future Features}
% \label{future}
%
% \begin{itemize}
%
% \item Implement a switch for the |quote|, |quotation|, |verse|
%   environments so that they can be set to double-space in
%   \textsf{final} mode.
%
% \item Implement a switch for the |\footnote| command so that they
%   can be double-spaced in \textsf{final} mode.
%
% \item Some people might want to have the option of setting their
%   \textsf{draft} documents two sided and/or two columned (i.e., any
%   damned way they want). If you do so right now, things may look
%   goofy (most of the frontmatter, for instance). I want to make it
%   such that a decent looking \textsf{draft} document can be
%   generated. My idea here is that users might want to make their
%   thesis/dissertation look like a book at the end of the day, since
%   the \textsf{final} document is not set like a book. This is not a
%   high priority.
%
% \item Generation of subject matter appropriate text. I forsee a
%   |generate| option for the |\documentclass| command. This option
%   will, if the computer is attached to the Internet, search all
%   available sources, generate a thesis statement (based upon the
%   value of the |\title| macro), and the supporting arguments for
%   that thesis. I anticipate a great deal of extra code will be
%   necessary, so this feature will be an ongoing project.
%
% \end{itemize}
%
% \StopEventually{\PrintChanges}
%
% \section{Implementation}
%
% \subsection{Initial Code}
%
% All of these packages are in the standard distribution of
% \LaTeX. I've included the \textsf{makeidx} so I can re-define
% |\printindex|. The |saving| boolean is defined here for use with the
% class options.
%
%    \begin{macrocode}
\RequirePackage{ifthen} 
\RequirePackage{calc}
\RequirePackage{makeidx}
\newboolean{saving}
%    \end{macrocode}
%
% \subsection{Declaration of Options}
%
% \changes{v1.1}{2002/02/13}{added \textsf{final} and \textsf{draft}
%   options in \textsf{documentclass} macro.}
% \changes{v3.0}{2005/05/21}{changed the fashion in which options are
%   processed so that \textsf{report.cls} correctly gets the draft and
%   final options.}  \changes{v3.0}{2005/05/21}{FGS guidelines allow
%   for 10pt, 11pt, and 12pt type now. I no longer enforce 12pt;
%   however, it is set as the default. Other type sizes must be
%   explicitly declared.}
%
% All of the options available to the |report| class are available in
% \textsf{york-thesis}.\footnote{Do not use the |titlepage| and
%   |abstract| environments from \textsf{report.cls}. The title page
%   and the abstract are taken care of by the |makefronmatter|
%   macro.} I have changed the default options (i.e., the option set
%   executed where there are no explicitly declared options in the
%   |\documentclass| macro. There are also two changes to the standard
%   behaviour of two options: \textsf{draft} and \textsf{final}.
%
% The default option list is:
%   \textsf{letterpaper,10pt,oneside,onecolumn,draft,openany}
%
% I have set the options up in a way that increases the number of
% options for typesetting the document.
%
% If \textsf{draft} is declared \textit{implicitly} (that is, neither
% \textsf{draft} or \textsf{final} is declared in the options list),
% then all text is set to single-spacing, graphics are drawn, and bad
% boxes are not marked.
%
% If draft is declared \textit{explicitly} (that is, \textsf{draft} is
% declared in the options list), then all text is set to
% single-spaced, graphics are not drawn (bounding boxes are drawn),
% and bad boxes are marked.
%
% If \textsf{final} is declared, the text is set to double-space (as
% described in \S\ref{preprog}), one sided printing, and one
% column. If \textsf{final} is declared alone, what you get is
% acceptable by FGS for deposit.
%
%    \begin{macrocode}
\DeclareOption{draft}{\setboolean{saving}{true}}
\DeclareOption{final}{\setboolean{saving}{false}
  \PassOptionsToClass{letterpaper,12pt,oneside,%
    onecolumn,final,openany}{report}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ExecuteOptions{draft}
%    \end{macrocode}
%
% \subsection{Execution of Options}
%
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
% \subsection{Package Loading}
%
%    \begin{macrocode}
\LoadClass{report}
%    \end{macrocode}
%
% \subsection{Main Code}
%
% \subsubsection{Preliminary Matter}
%
% I need to re-define a number of standard macros and settings to get
% everything to come out exactly right. This is where that magic
% happens.
%
%    \begin{macrocode}
\let\oldquote\quote \let\oldendquote\endquote
\let\oldquotation\quotation \let\oldendquotation\endquotation
\let\oldverse\verse \let\oldendverse\endverse
\let\oldbibliography\bibliography
\let\oldendbibliography\endbibliography
\let\oldprintindex\printindex
%    \end{macrocode}
%
%
% The following are booleans along with their initial values
%
% \changes{v2.5}{2005/04/20}{added the boolean
%   \textsf{authenticitypage}} \changes{v3.0}{2005-05-21}{removed the
%   boolean \textsf{authenticitypage}; the authenticity page is now
%   always generated}
%
% \begin{macro}{hasfigures}
%
% This \textsf{boolean} sets whether a list of figures should be
% generated 
%
% \begin{macrocode}
\newboolean{hasfigures}\setboolean{hasfigures}{false}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{hastables}
%
% This \textsf{boolean} sets whether a list of tables should be
% generated 
%
% \begin{macrocode}
\newboolean{hastables}\setboolean{hastables}{false}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{masters}
% 
%   The |masters| boolean was taken from dissertation.sty with
%   modification. If set \textsf{true}, you will need to specify which
%   master's degree you are pursuing with the |\masterof| macro.
%
%    \begin{macrocode}
\newboolean{masters}\setboolean{masters}{false}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\spacing}
%
%   I redefine |\baselinestretch| and recompute |\baselineskip|
%   lateral effect: set typeface to normal size roman
%
%    \begin{macrocode}
\newcommand{\spacing}[1]{\renewcommand{\baselinestretch}{#1}%
  \large\normalsize}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@removefromreset}
%
%   I define a command that can undo footnote reset between chapters
%   (shamelessly lifted from removefr.sty by Donald Arseneau) and then
%   do it.
%
%    \begin{macrocode}
\def\@removefromreset#1#2{\let\@tempb\@elt
  \expandafter\let\expandafter\@tempa\csname c@#1\endcsname
  \def\@elt##1{\expandafter\ifx\csname c@##1\endcsname\@tempa\else
    \noexpand\@elt{##1}\fi}%
  \expandafter\edef\csname cl@#2\endcsname{\csname cl@#2\endcsname}%
  \let\@elt\@tempb}
\@removefromreset{footnote}{chapter}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\resetfootnote}
% 
%   Here I undo the hideous |\@addtoreset| in \textsf{report.cls}
%
%    \begin{macrocode}
\def\resetfootnote{\setcounter{footnote}{0}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\footnotetext}
%
%   Make footnotes single spaced, footnote continuation lines
%        longer
%
%        \changes{v1.1}{2002/02/13}{made footnote spacing single
%          spaced in final}
%
%        \changes{v3.4}{2006/05/16}{stole code from |footmisc| to
%          lengthen footnote continuation lines}
%
%
%    \begin{macrocode}
\long\def\@footnotetext#1{%
 \insert\footins{%
  \def\baselinestretch {1}%
  \reset@font\footnotesize
  \interlinepenalty\interfootnotelinepenalty
  \splittopskip\footnotesep
  \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
  \hsize\columnwidth
  \@parboxrestore
  \protected@edef\@currentlabel{%
    \csname p@footnote\endcsname\@thefnmark}%
  \color@begingroup
    \@makefntext{%
      \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
  \color@endgroup}}
\gdef\split@prev{0} 
\let\pagefootnoterule\footnoterule 
\let\mpfootnoterule\footnoterule 
\def\splitfootnoterule{\kern-3\p@ \hrule \kern2.6\p@} 
\def\footnoterule{\relax 
 \ifx \@listdepth\@mplistdepth 
   \mpfootnoterule 
 \else 
   \ifnum\split@prev=\z@ 
   \pagefootnoterule 
 \else 
   \splitfootnoterule 
   \fi 
   \xdef\split@prev{\the\insertpenalties}% 
 \fi 
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\appendix}
%
%   Renew the |\appendix| command to deal with spacing in appendices
%   correctly
%
%    \begin{macrocode}
\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@Alph\c@chapter}
  \ifthenelse{\boolean{saving}}{\spacing{1}}{\spacing{2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibliography}
%
%   Renew the |\bibliography| macro so that it puts in its own toc entry
%
%    \begin{macrocode}
\renewenvironment{bibliography}[1]%
  {\addcontentsline{toc}{chapter}{Bibliography}\oldbibliography {#1}}%
  {\oldendbibliography}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\printindex}
%
%   Renew the |\printindex| macro so that it puts in its own toc entry
%
%    \begin{macrocode}
\renewcommand{\printindex}{\newpage%
  \addcontentsline{toc}{chapter}{Index}\oldprintindex}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\hugeskip}
%
%   Skip twice as much as the TeX command |\bigskip|
%
%    \begin{macrocode}
\def\hugeskip{\vskip 24pt plus 8pt minus 8pt}
%    \end{macrocode}
%
% \end{macro}
%
% \begin{macro}{\@ifdefined} 
%
%   Expand second argument if the command in the first argument is not
%   defined
%
%    \begin{macrocode}
\def\@ifdefined#1#2{\@ifundefined{#1}{}{#2}}
%    \end{macrocode}
%
% \end{macro}
%
% \begin{macro}{\@makechapterhead}
%
%   These macros are redefined here to use not-so-huge type and to
%   provide chapters of form: N chaptername
%
%   \changes{v1.5}{2003/09/20}{Changed appearance of chapter titles:
%     removed \textsf{chaptername} and placed the section number on
%     the same line as the label (suggested by Dave Makalsky)}
%
%    \begin{macrocode}
\def\@makechapterhead#1{ \vspace*{50pt} { \parindent 0pt
    \raggedright%
    \ifnum \c@secnumdepth > \m@ne \Large\bf 
    \thechapter \hskip 1em \fi \Large \bf #1\par
    \nobreak \vskip 40pt } }
\def\@makeschapterhead#1{ \vspace*{50pt} { \parindent 0pt \raggedright
    \Large \bf #1\par
    \nobreak \vskip 40pt }}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\section}
%
%  This section of code re-defines some standard stuff for sanity.
%
%    \begin{macrocode}
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                 {-3.5ex \@plus -1ex \@minus -.2ex}%
                                 {2.3ex \@plus.2ex}%
                                 {\normalfont\large\bfseries}}
\renewcommand\subsection{\@startsection {subsection}{1}{\z@}%
                                 {-3.5ex \@plus -1ex \@minus -.2ex}%
                                 {2.3ex \@plus.2ex}%
                                 {\normalfont\normalsize\bfseries}}
\renewcommand\subsubsection{\@startsection {subsubsection}{1}{\z@}%
                                 {-3.5ex \@plus -1ex \@minus -.2ex}%
                                 {2.3ex \@plus.2ex}%
                                 {\normalfont\normalsize\bfseries}}
%    \end{macrocode}
% \end{macro}
%
% We rename the headings for the toc, lof, and the references.
%
%    \begin{macrocode}
\renewcommand\contentsname{Table of Contents}
\renewcommand\listfigurename{List of Figures}
\renewcommand\listtablename{List of Tables}
\renewcommand\bibname{Bibliography}
%    \end{macrocode}
%
% We modify the definitions for the various contents headers 
%
%    \begin{macrocode}
\newcommand{\contentsheader}[2] { \addtocontents{#1} {
    \centerline{\underline{#2}\protect\hfill%
      \underline{Page}}}}
\renewcommand\tableofcontents { \chapter*{\contentsname}
  \addcontentsline{toc}{chapter}{Table of Contents}
  \@starttoc{toc}} 
\renewcommand\listoffigures { \chapter*{\listfigurename}
  \addcontentsline{toc}{chapter}{List of Figures}
  \@starttoc{lof}} 
\renewcommand\listoftables { \chapter*{\listtablename}
  \addcontentsline{toc}{chapter}{List of Tables}
  \@starttoc{lot}}
%    \end{macrocode}
%
% \subsubsection{Margins and spacing}
%
% Rules taken from York FGS Guidelines for Theses and Dissertations
%
% The style guide, for the final deposited verrsion, requires 1.5in
% left and top margin and 1.0in right and bottom margins.
%
% If |\boolean{saving}| is true, set for draft; otherwise, set for
% final
%
%    \begin{macrocode}
\ifthenelse{\boolean{saving}} {%
  \setlength {\topmargin}{0.0in}
  \setlength {\textheight}{\paperheight-2.5in}
  \setlength {\oddsidemargin}{0.0in}
  \setlength {\evensidemargin}{0.0in}
  \setlength {\textwidth}{\paperwidth-2in}
  \spacing{1}
  } {%
  \setlength {\topmargin}{0.65in}
  \setlength {\textheight}{\paperheight-3.05in}
  \setlength {\oddsidemargin}{0.6in}
  \setlength {\evensidemargin}{0.1in}
  \setlength {\textwidth}{\paperwidth-2.65in}
  \setlength {\footskip}{0.3in}
  \spacing{2}
%    \end{macrocode}
%
% \begin{environment}{quote}
%
%   \changes{v1.1}{2002/02/13}{changed \textsf{quote} environment for
%     single spacing in \textsf{final}}
%
% \begin{macrocode}
  \renewenvironment{quote}{\oldquote\spacing{1}}%
       {\oldendquote\spacing{2}}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{quotation}
%
%   \changes{v1.1}{2002/02/13}{changed \textsf{quotation} environment
%     for single spacing in \textsf{final}}
%
% \begin{macrocode}
  \renewenvironment{quotation}{\oldquotation\spacing{1}}%
       {\oldendquotation\spacing{2}}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{verse}
%
%   \changes{v1.1}{2002/02/13}{changed \textsf{verse} environment for
%     single spacing in \textsf{final}}
%
% \begin{macrocode}
  \renewenvironment{verse}{\oldverse\spacing{1}}%
       {\oldendverse\spacing{2}}}
%    \end{macrocode}
% \end{environment}
%
% Let's space the footnotes nicely and, since we have no headers,
% remove them from the page layout.
%
%    \begin{macrocode}
\setlength {\footnotesep}{14pt}
\setlength {\headheight}{0in}
\setlength {\headsep}{0in}
%    \end{macrocode}
%
% \subsubsection{Commands to define parameters for the front matter}
% 
% There are two kinds of commands that define parameters for the front
% matter: macros that provide info (like |\author| or |\abstractfile|)
% and booleans that set flags.
% 
% The following are the definitions of the macros that provide info
% (standard LaTeX commands like |\author| are omitted because they are
% already defined).
%
% \changes{v2.5}{2005/04/20}{added \textsf{degreename},
%   \textsf{committeememberslist}}
%
%    \begin{macrocode}
\def\department#1{\gdef\@department{#1}}
\def\masterof#1{\gdef\@masterof{#1}}
\def\abstractfile#1{\gdef\@abstractfile{#1}}
\def\dedicationfile#1{\gdef\@dedicationfile{#1}}
\def\acknowledgementsfile#1{\gdef\@acknowledgementsfile{#1}}
\def\prefacefile#1{\gdef\@prefacefile{#1}}
\def\abbreviationsfile#1{\gdef\@abbreviationsfile{#1}}
\def\committeememberslist#1{\gdef\@committeememberslist{#1}}
\def\degreename#1{\gdef\@degreename{#1}}
%    \end{macrocode}
%
% The following are the initial values for some macros that provide
% info.
%
%    \begin{macrocode}
\gdef\@author{YOUR FULL NAME} \gdef\@title{{\bf THE TITLE OF YOUR
    WORK}} \gdef\@date{\number\year} \gdef\@department{PHILOSOPHY}
\gdef\@masterof{Arts} \gdef\@committeememberslist{%
  \begin{enumerate}%
  \item Joanne Examiner%
  \item Fred P. Questioner%
  \end{enumerate}}
\ifthenelse{\boolean{masters}}{\gdef\@degreename{MASTER}}%
  {\gdef\@degreename{DOCTOR}}
%    \end{macrocode}
%
% \subsubsection{Generate frontmatter}
% 
% \begin{macro}{\makefrontmatter}
%     
%   What we want is a single macro that will generate all of the
%   frontmatter of the document, such as, the title page, abstract,
%   authenticity page, table of contents, etc.\@ Each page of the
%   frontmatter is created by individual macros. This keeps things
%   modular and tidy. Any sections of the frontmatter that are not
%   declared are ignored.
%
% \changes{v1.1}{2002/02/13}{added a TOC entry for the Table of
%   Contents}
% \changes{v3.6}{2011/06/13}{added code so that fancyhdr package could
%   be used}
%
%    \begin{macrocode}
\def\makefrontmatter{%
  \pagestyle {empty}
  \pagenumbering {roman}
  \maketitlepage
  \pagestyle {empty}  \makecopyrightpage
  \pagestyle {empty}  \makeauthenticitypage
  \setcounter {page} {3}
  \@ifdefined {@abstractfile}{\makeabstract}
  \pagestyle {fancy}
  \@ifdefined {@dedicationfile}{\makededication}
  \@ifdefined {@acknowledgementsfile}{\makeacknowledgements} 
  \tableofcontents
  \ifthenelse{\boolean{hastables}}{\listoftables}{}
  \ifthenelse{\boolean{hasfigures}}{\listoffigures}{}
  \@ifdefined{@prefacefile}{\makepreface}
  \@ifdefined{@abbreviationsfile}{\makeabbreviations}
  \newpage
  \pagenumbering {arabic}
  \setcounter {page}{1}}
%    \end{macrocode}
%
% \end{macro}
%
% \begin{macro}{\maketitlepage}
%
%   The title page is standard. The guidelines require uppercase
%   throughout, so I have forced this wherever necessary.
%
% \changes{v3.3}{2002/03/07}{removed the tabular environment from
% around the title macro. I still have the problem of not being able
% to force a line break inside the title macro.}
%
%    \begin{macrocode}
\def\maketitlepage{
  \vspace*{.85in}
  \begin{center}
    \spacing{1}
    \textbf{\MakeUppercase{\@title}}
    \hugeskip
    \hugeskip
    \hugeskip
    {\bigskip \MakeUppercase{\@author}}
  \end{center}
  \hugeskip \hugeskip \hugeskip \hugeskip \hugeskip \hugeskip
  {\spacing{1}
    \begin{center}
      \ifmasters A THESIS \else A DISSERTATION \fi
      SUBMITTED TO THE FACULTY OF GRADUATE STUDIES \\
      IN PARTIAL FULFILMENT OF THE REQUIREMENTS \\
      FOR THE DEGREE OF \\
      \hugeskip \hugeskip \hugeskip 
      \ifmasters \MakeUppercase{\@degreename} OF
      \MakeUppercase{\@masterof} 
      \else
      \MakeUppercase{\@degreename} OF PHILOSOPHY \fi \\
      \hugeskip \hugeskip
      GRADUATE PROGRAM IN \MakeUppercase{\@department} \\
      YORK UNIVERSITY \\
      TORONTO, ONTARIO \\
      \MakeUppercase{\@date}
    \end{center}}
  \newpage }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\copyrightpage}
% 
% The copyright page has to be centred both left and right and up and
% down \textit{between the margins}. Not hard to do but a little bit
% of a pain to make come out just right.
%
% The author might be using the department generated copyright pages,
% but I have no idea if this is still a common practice. So, the
% copyright page is always generated.
%
%    \begin{macrocode}
\def\makecopyrightpage{%
  \begin{center}
    \setlength{\fboxrule}{.004in} \setlength{\fboxsep}{2cm} 
    \mbox{}
    \par\vspace*{\stretch{1}}
    \fbox{\parbox{4in}{%
      \spacing{1} 
      \begin{center} 
        \textbf{\MakeUppercase{\@title}} 
      \end{center} by
      \textbf{\@author}

      \bigskip
      a \ifmasters thesis \else dissertation \fi submitted to the 
      Faculty of Graduate Studies of York University in partial 
      fulfilment of the requirements for the degree of 
      \begin{center}
        \ifmasters \textbf{\MakeUppercase{\@degreename} OF
          \MakeUppercase{\@masterof}} 
        \else 
          \textbf{\MakeUppercase{\@degreename} OF PHILOSOPHY} \fi \\ 
                   $\copyright$\ \number\year \\
      \end{center}

      Permission has been granted to: a) YORK UNIVERSITY LIBRARIES
      to lend or sell copies of this dissertation in paper,
      microform or electronic formats, and b) LIBRARY AND ARCHIVES
      CANADA to reproduce, lend, distribute, or sell copies of this
      \ifmasters thesis \else dissertation \fi anywhere in the world
      in microform, paper or electronic formats \textit{and} to
      authorise or procure the reproduction, loan, distribution or
      sale of copies of this \ifmasters thesis \else dissertation
      \fi anywhere in the world in microform, paper or electronic
      formats.

      \bigskip The author reserves other publication rights, and
      neither the \ifmasters thesis \else dissertation \fi nor
      extensive extracts for it may be printed or otherwise
      reproduced without the author's written permission.}}
  \vspace*{\stretch{1}}
\end{center}
\newpage}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makeauthenticitypage}
%
% This page is used in lieu of a Certificate page when the thesis or
% dissertation is being deposited electronically. Now that we can do
% this, I have no idea why anyone \textit{wouldn't} submit
% electronically. As such, we will always have an authenticity
% page. If you don't like it, throw it away and stick a certificate
% page in.
%
%    \begin{macrocode}
\def\makeauthenticitypage{%
  \par\vfill
  {\spacing{1}
    \begin{center}
      \textbf{\MakeUppercase{\@title}} \hugeskip\hugeskip by
      \textbf{\@author}
    \end{center}
    \hugeskip\noindent By virtue of submitting this document
    electronically, the author certifies that this is a true
    electronic equivalent of the copy of the \ifmasters thesis \else
    dissertation \fi approved by York University for the award of
    the degree. No alteration of the content has occurred and if
    there are any minor variations in formatting, they are as a
    result of the coversion to Adobe Acrobat format (or similar
    software application).  \hugeskip
    \begin{flushright}
      \begin{minipage}[t]{4in}
        Examination Committee Members: \@committeememberslist
      \end{minipage}
    \end{flushright}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makeabstract}
%
% The abstract page is pretty standard. It sets up a toc entry, starts
% a new chapter, and forces a non-indented first paragraph.
%
%    \begin{macrocode}
\def\makeabstract{%
  \chapter*{Abstract}
  \addcontentsline {toc}{chapter}{Abstract}
  \noindent
  \@input{\@abstractfile}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makededication}
%
%   \changes{v3.2}{2006/01/31}{Added the \textsf{makededication} and
%     \textsf{dedicationfile} macro.}  
%
%   The dedication page is pretty simple. It just sets whatever is in
%   your dedication.tex file.
%
%    \begin{macrocode}
\def\makededication{%
  \newpage
  \@input{\@dedicationfile}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makepreface}
%
% We need to include the preface file, if specified
%
% \changes{v2.0}{2004/05/13}{Added prefacefile support}
%
%    \begin{macrocode}
\def\makepreface{%
  \chapter*{Preface}
  \addcontentsline {toc}{chapter}{Preface}
  \noindent
  \@input{\@prefacefile}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makeabbreviations}
%
% This page will probably be rarely used. If you have a lot of
% references from one or two authors, sometimes it is clearer to use
% an abbreviation rather than the sometimes cryptic in-line
% citation. This is the page where you provide the legend. 
%
% I have found this particularly useful in conjunction with
% \texttt{natbib}'s |\citepalias| and |\citetalias| macros.
%
%    \begin{macrocode}
\def\makeabbreviations{%
  \chapter*{Abbreviations}
  \addcontentsline{toc}{chapter}{Abbreviations}
  \noindent
  \@input{\@abbreviationsfile}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makeacknowledgements}
%
%    \begin{macrocode}
\def\makeacknowledgements{% 
  \chapter*{Acknowledgements}
  \addcontentsline{toc}{chapter}{Acknowledgements}
  \noindent
  \@input{\@acknowledgementsfile}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Other new commands and environments}
%
% \begin{environment}{epigraphs}
% \begin{macro}{\epigraph}
%       
%   Constructed with stolen code from epigraph.sty by Peter Wilson
%   (pandgwilson at earthlink dot net)
%
%   This is simple: |\epigraph| macros go in an |epigraphs| environment
%
% \changes{v3.0}{2005/05/21}{Set \textsf{epigraphwidth} to .8 of the
%   \textsf{columnwidth} rather than the \textsf{textwidth}}
%
% \changes{v3.1}{2005/07/27}{Make \textsf{epigraphs} environment
% single-spaced in all output modes.}
%
%    \begin{macrocode}
\newlength{\epigraphwidth}\setlength{\epigraphwidth}{.8\columnwidth}
\newlength{\epigraphrule}\setlength{\epigraphrule}{.4\p@}
\newcommand{\@epirule}{\rule[.5ex]{\epigraphwidth}{\epigraphrule}}
\newcommand{\epigraph}[2]%
  {\item #1\vspace{-12pt}\begin{flushright}#2\end{flushright}}
\newcommand{\epigraphlabel}[1]{\hfill}
\newenvironment{epigraphs}{%
    \begin{flushright}
      \begin{minipage}{\epigraphwidth}
        \list{}%
     {\itemindent\z@ \labelwidth\z@ \labelsep\z@
      \leftmargin\z@ \rightmargin\z@
      \let\makelabel\epigraphlabel}}%
  {\endlist\vspace{-18pt}\@epirule\vspace{24pt}\end{minipage}\end{flushright}}
\let\oldepigraphs\epigraphs \let\oldendepigraphs\endepigraphs
\ifthenelse{\boolean{saving}}{}{%
  \renewenvironment{epigraphs}{\oldepigraphs\spacing{1}}%
       {\oldendepigraphs\spacing{2}}
}
%    \end{macrocode}
%   \end{macro}
% \end{environment}
%
% \begin{environment}{fquote}
%
%   The |fquote| environment corrects for line spacing and indentation
%   when used inside a |\footnote|.
%
% \changes{v2.0}{2004/05/13}{Added \textsf{fquote} environment for
%   footnotes}
%
%    \begin{macrocode}
\newenvironment{fquote}%
  {\oldquote\footnotesize}%
  {\oldendquote\normalsize}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{fquotation}
%
%   The |fquotation| environment corrects for line spacing and indentation
%   when used inside a |\footnote|.
%
% \changes{v2.0}{2004/05/13}{Added \textsf{fverse} environment for
%   footnotes}
%
%    \begin{macrocode}
\newenvironment{fquotation}{\oldquotation\footnotesize}%
     {\oldendquotation\normalsize}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{fverse}
%   The |fverse| environment corrects for line spacing and indentation
%   when used inside a |\footnote|.
%
% \changes{v2.0}{2004/05/13}{Added \textsf{fverse} environment for
%   footnotes}
%
%    \begin{macrocode}
\newenvironment{fverse}{\oldverse\footnotesize}%
     {\oldendverse\normalsize}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\threestars}
%      The |threestars| macro gives a centred set of three asterisks for
%      use at the end of a section near the end of a chapter so that a
%      new `concluding' section need not be used.
%
% \changes{v3.1}{2005/07/27}{Added \textsl{threestars} macro}
%
%    \begin{macrocode}
\newcommand{\threestars}{\begin{center}%
  *\hspace{.5in}*\hspace{.5in}*\hspace{.5in}\end{center}}
%    \end{macrocode}
% \end{macro}
%
% \Finale
% \newpage
% \appendix
%
% \section{The york-thesis-Template.tex File}
%
% This is a listing of a sample master document for your thesis or
% dissertation. I recommend placing chapters and appendices in
% separate files (like I force you to do for your abstract, preface,
% acknowledgements, and abbreviations). This makes everything more
% manageable from an editor point of view (you are scrolling through
% thousands of lines) and makes typesetting parts of the document much
% easier.
%
% \lstinputlisting[language=TeX,basicstyle={\footnotesize}]{york-thesis-Template.tex}
\endinput
