% uofs-thesis.sty 9 July 91
% based on the ``Graduate Student Handbook'' 1991
% Russ Muzzolini
% University of Saskatchewan
% email: russ@skorpio.usask.ca

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{uofs-thesis}
  [Using uofs-thesis.sty - last modified April 15, 2003.]

% Modifications 
%
% July 20, 2004 - Wenguang Wang
% (no I'm not looking after this :-)
% Change the spacing in \chapter, \chapter*, and \permission to make
% them conform to the university requirements.  This has been checked
% by Tammy Morrison <tammy.morrison@usask.ca>
%
% April 15, 2003 - Wenguang Wang
% (no I'm not looking after this :-)
% Use setspace.sty instead of doublespace.sty so that the colorlinks
% option can be enabled with hyperref. Doublespace.sty was designed
% for LaTeX 2.09. Setspace.sty is the successor
% of doublespace.sty and is designed for LaTeX2e.
%
% March 13, 2003 - Wenguang Wang
% (no I'm not looking after this :-)
% Add List of Acronyms, and command \noloa
%
% June 18, 1997 - Greg Oster
% (no I'm not looking after this)
% Updated the postal code to be S7N 5A9 from S7N 0W0.
%
%%%%%%%%%%%%%%%%%%%%
%September 11, 1996 - Russ Muzzolini
%-moved all page numbers to bottom center
%-changed format of abstract page to only have abtract heading and abstract text
%-use smaller fonts on title page
%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%
%April 4, 1996 - Russ Muzzolini
%-works with Latex 2e
%-added dependancy on package fancy_headings to fix page numbering placement
%in top right corner - thanks to Greg Oster 
%-changed Computational Science to Computer Science
%-removed ``,'' between degree month and year
%-changed Bibliography to References (without associated numbering)
%-added command \thesis_contents to add contents, lof and lot to thesis
%-added command \thesis_body to setup page format for body of thesis
%-increased depth of section numbering
%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%
%June 7, 1993 - Russ Muzzolini
%added the dissertation environment including the commands
% \makedissertation \committee{} \summary{} \external{} \bio{} \publications{} \honours{}
%modified margins so that the new requirements in the 
% ``Guide for the Preparation of a Thesis'' (March 1993) are satisfied
%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%
%June 7, 1993 - Russ Muzzolini
%added the dissertation environment including the commands
% \makedissertation \committee{} \summary{} \external{} \bio{} \publications{} \honours{}
%modified margins so that the new requirements in the 
% ``Guide for the Preparation of a Thesis'' (March 1993) are satisfied
%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%
% mitthesis.sty  12 Sep 89
% For Massachusetts Institute of Technology theses (grad and undergrad),
% based on "Specifications for Thesis Preparation" Revised 1986.
%mitthesis-sample.tex  12 Sep 89
% by Stephen Gildea <gildea@erl.mit.edu>
%%%%%%%%%%%%%%%%%%%%%
% 
%
% This style option is designed to work with the report document
% style of LaTeX version 2.09.  Use
% \documentstyle[mitthesis]{report}

% "Preferably, the text should appear on only one side of the paper."
% Hence no doubleside option.

% Copyright (c) 1987 by Stephen Gildea
% Permission to copy all or part of this work is granted, provided
% that the copies are not made or distributed for resale, and that
% the copyright notice and this notice are retained.
% 
% THIS WORK IS PROVIDED ON AN "AS IS" BASIS.  THE AUTHOR PROVIDES NO
% WARRANTY WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE WORK,
% INCLUDING WARRANTIES WITH RESPECT TO ITS MERCHANTABILITY OR FITNESS
% FOR ANY PARTICULAR PURPOSE.

% If you make any improvements, I'd like to hear about them.

% Stephen Gildea
% MIT Earth Resources Lab
% Cambridge, Massachusetts 02139
% mit-erl!gildea
% gildea@erl.mit.edu

% 29 Jun 87 original version
% 12 Sep 89 <prange> \supervisor optional arg added
% July 9 ,1991 uofs version
%
% "Margins must be at least an inch and a half on the binding margin
% (normally the left side), and at least one inch on the other sides."
\evensidemargin 0in
\textwidth 15cm
\topmargin 0in

%NEW
% ``a minimum left margin of four centimeters is required on each page. Other
%   margins must be at least two and one half (2.5) centimeters . . .''

\oddsidemargin 1.5cm
\textheight 22.75cm
%\footheight 1.0cm
\footskip 1.0cm                 
\topmargin -1.0in

\headheight 1.8cm                       
\headsep 0.7cm


%some definitions for figures
\def\maxy{7.8in}
\def\maxx{6.0in}

%need page numbering centered at bottom for each new chapter


% "The main body of the text should utilize a space and a half or double
% spacing.  The abstract, biography, footnotes, and bibliography
% sections may be single spaced"

% setspace instead of doublespace should be used in LaTeX2e, since
% setspace can be used together with colorlinks of hyperref
\input{setspace.sty}

\def\baselinestretch{1.5}

%''The page numbering must be in arabic . . . ``
%\markboth{}{}

%note that when I redefined the headline to put the pagenumber exactly
%1.5cm from the top and 1.5cm from the right edge (using hspace and vspace)
%latex would output an annoying overfull vbox and underfull hbox for every page
%(because the headline can only be as wide as the textwidth the \hspace would
%cause an overfull warning)
%so I left the page number 1.5cm from the top and 2.5 cm from the right edge.
%
%
%\renewcommand{\ps@myheadings}{\let\@mkboth\@gobbletwo
%\def\@oddhead{\hspace{15.8cm}\vspace{1.0cm}
%\rm\thepage }\def\@oddfoot{}\def\@evenhead{\rm \thepage\hfil\sl\leftmark\hbox
%{}}\def\@evenfoot{}\def\chaptermark##1{}\def\sectionmark##1{}%
%\def\subsectionmark##1{}}

%\pagestyle{myheadings}
%\pagenumbering{arabic}

%Grad studies now wants roman numerals for all preamble except title page
%add fancy headings to place page number correctly on right top corner
\renewcommand{\topfraction}{1.00}
\renewcommand{\bottomfraction}{1.00}
\renewcommand{\textfraction}{0.00}
\pagestyle{plain}

%\input fancyheadings.sty
%\pagestyle{fancy}
%\addtolength{\headwidth}{1.0cm}
%\setlength{\headrulewidth}{0pt}
%\cfoot[\fancyplain{}{}]{\thepage}
%\rhead[]{} 

%old defs for fancy
%\rhead[\fancyplain{}{}]{\thepage}
%\cfoot[\thepage]{} 
\pagenumbering{roman}


%% End of formatting parameters %%

%% Define all the pieces that go on the title page and the abstract.

% \title and \author already exist
\def\prevdegrees#1{\gdef\@prevdegrees{#1}}
\def\@prevdegrees{}

\def\department#1{\gdef\@department{#1}}

% If you are getting two degrees, use \and between the names.
\def\degree#1{\setbox0\hbox{#1}  %for side effect of setting \@degreeword
  \gdef\@degree{#1}}

% \and is used inside the \degree argument to separate two degrees
\def\and{\gdef\@degreeword{degrees} \par and \par}
\def\@degreeword{degree}

% If there is no \copyrightnotice command, it is asssumed that MIT
% holds the copyright.  This commands adds the copyright symbol to the
% beginning, and puts the standard permission notice below.
\def\copyrightnotice#1{\copyrightnoticetext{\copyright\ #1\par\permission}}

% Occacionally you will need to exactly specify the text of the 
% copyright notice.  The \copyrightnoticetext command is then useful.
\long\def\copyrightnoticetext#1{\gdef\@copyrightnotice{#1}}

\def\thesisdate#1{\gdef\@thesisdate{#1}}

% typically just a month and year
\def\degreemonth#1{\gdef\@degreemonth{#1}}
\def\degreeyear#1{\gdef\@degreeyear{#1}}

% Usage: \supervisor{name}{title}
%        \chairman{name}{title}

% since there can be more than one supervisor,
% we build the appropriate boxes for the titlepage and
% the abstractpage as the user makes multiple calls
% to \supervisor
\newbox\@titlesupervisor        \newbox\@abstractsupervisor 

% The \supervisor command takes an optional argument in case you
% want to label a person other than "Thesis Supervisor".  For example,
% \supervisor[Thesis Co-supervisor]{Arthur Cheng}

\def\supervisor{\@ifnextchar[{\@supervisor}{\@supervisor[Supervisor]}}
\def\@supervisor[#1]#2{\setbox\@abstractsupervisor\vbox{\unvbox\@abstractsupervisor
\vskip \baselineskip\par\centerline{{\em #1:} #2 }}}
%{{#1}& #2\\ }}}

% department chairman, not thesis committee chairman
\def\chairman#1#2{\gdef\@chairmanname{#1}\gdef\@chairmantitle{#2}}

% by Wenguang Wang
\def\xxxx{0} % by default is thesis
% use this command before maketitle for proposal
\def\isproposal{
  \def\xxxx{1}
}

% by Wenguang Wang
%% \def\maketitle{\@ifnextchar[%
%%   {\def\xxxx{1}\@maketitle}
%%   {\def\xxxx{0}\@maketitle[0]}}
\def\maketitle{\@ifnextchar[%
  {\@maketitle}
  {\@maketitle[0]}}

\def\@maketitle[#1]{%
  \begin{titlepage}
        \vfill

  %Grad studies wants regular font used for the title page
  %and the title to be all caps

    {\def\baselinestretch{1.2}\bf \@title \par}
    \ \par
    \vskip \baselineskip
    
    \begin{spacing}{2}
      \ifnum\xxxx > 0 {A Thesis Proposal Submitted to the Committee\\}\else
      {A Thesis Submitted to the College of\\
        Graduate Studies and Research\\}
      \fi
      in Partial Fulfillment of the Requirements\\
      For the Degree of
      \@degree\\
      in the Department of Computer Science\\
      University of Saskatchewan\\
      Saskatoon, Saskatchewan\\
    \end{spacing}
    \vskip \baselineskip
    \vskip \baselineskip
    \vskip \baselineskip
    by
    \begin{spacing}{2}
      \@author\\
       \ifnum\xxxx > 0 {\today}
%       \else{\@degreemonth \  \@degreeyear}
       \else{}
       \fi
    \end{spacing}
    \vskip \baselineskip
    \vskip \baselineskip
    \vskip \baselineskip
    \vskip \baselineskip
    \vskip \baselineskip
    \vskip \baselineskip
    \vskip \baselineskip
    
    \copyright \ Copyright \@author, \@degreemonth \ \@degreeyear. All rights reserved.
  \end{titlepage}
}

%\def\acknowledge#1{\begin{ackpage}
\def\acknowledge#1{
  \thispagestyle{plain}

%  \def\baselinestretch{1.5}\centerline{\bf \@headingsize \@ackheading}\vskip \baselineskip
  \centerline{\bf \@headingsize \@ackheading}\vskip \baselineskip

  \addcontentsline{toc}{chapter}{\protect\numberline{}{\@ackheading}}
  \par{#1}
  \pagebreak
}
%\end{ackpage}}


%\def\permission{\begin{permpage}
\def\permission{
  %{\def\baselinestretch{1.2}\centerline{\bf PERMISSION TO USE}\vskip \baselineskip}
  \setcounter{page}{1}
  \thispagestyle{plain}
  \addcontentsline{toc}{chapter}{\protect\numberline{}{\@permheading}}
%  \spacing{1.2}\centerline{\bf \large \@permheading}\vskip \baselineskip
%  \begin{spacing}{1.2}
   \centerline{\bf \@headingsize \@permheading}%\vskip \baselineskip
%    \vspace{1.5in}
    \vspace{1cm}
In presenting this thesis in partial fulfillment of the requirements for a
Postgraduate degree from the University of Saskatchewan, I agree that the
Libraries of this University may make it freely available for inspection.  I
further agree that permission for copying of this thesis in any manner, in
whole or in part, for scholarly purposes may be granted by the professor or
professors who supervised my thesis work or, in their absence, by the Head
of the Department or the Dean of the College in which my thesis work was
done.  It is understood that any copying or publication or use of this
thesis or parts thereof for financial gain shall not be allowed without my
written permission.  It is also understood that due recognition shall be
given to me and to the University of Saskatchewan in any scholarly use which
may be made of any material in my thesis.\\
\indent Requests for permission to copy or to make other use of material in this
thesis in whole or part should be addressed to:
\vskip \baselineskip
\vskip \baselineskip
\centerline{Head of the Department of Computer Science}
\centerline{University of Saskatchewan}
\centerline{Saskatoon, Saskatchewan, Canada}
\centerline{S7N 5A9}
%\end{spacing}
\pagebreak
}

%\end{permpage}}


% this environment should probably be called abstract,
% but we want people to also be able to get at the more
% basic abstact environment
\def\abstractpage{%
  \thispagestyle{plain}
  \addcontentsline{toc}{chapter}{\protect\numberline{}{\@abstractheading}}
  \begin{abstract}\vspace{10pt}\par\it}

\def\endabstractpage{\end{abstract}\newpage}




\def\makedissertation
{
\begin{spacing}{1.5}
%{sumdef \sumdefined}
\centerline{ \vspace{-0.5in}}
\begin{center}
\large
{\bf UNIVERSITY OF SASKATCHEWAN}
\par
College of Graduate Studies and Research
\par
{\bf SUMMARY OF DISSERTATION}
\par
Submitted in Partial Fulfillment 
\par
of the Requirements for the 
%\vskip \baselineskip
\par
{\bf DEGREE OF DOCTOR OF PHILOSOPHY}
\par
by
\par
\@author
\par
Department of Computer Science\\
University of Saskatchewan
\vskip \baselineskip
\@degreemonth \  \@degreeyear
\vskip \baselineskip
\end{center}
\end{spacing}
\begin{spacing}{1}
\par
{\noindent\bf Examining Committee:}
\vspace{.1in}
\par\noindent
\@committee
\vskip \baselineskip

{\noindent\bf External Examiner:}
\vspace{.1in}
\par \noindent
\@external
\newpage
\end{spacing}
\begin{spacing}{1.5}
%summary part
\ifnum\refcount>0
  {\bf\begin{center}{\large \bf \@title}\end{center}}
  \vspace{12pt}
  \@summary
\else
  \typeout{****A summary of up to 250 words must be included.}
\fi

%bio part
%to print out a counter -> \number\biocount
\ifnum\biocount>0
  \vspace{\@sectionsep}
  \newpage
  {\bf \centerline{BIOGRAPHICAL}}
  \vspace{10pt}
  \noindent
  \@bio
\else
  \typeout{****A biography must be included.}
\fi

%honours part
\ifnum\honcount>0
  \vspace{\@sectionsep}
  {\bf \centerline{HONOURS}}
  \vspace{10pt}
  \noindent
  \@honours
\else
  \typeout{****Warning: no honours section.}
\fi
\end{spacing}
%publications section
\ifnum\pubcount>0
  %redefine the bibliography environment so that the publications
  %section will have the appropriate form
  {
  \global\def\thebibliography##1{\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}
   \let\endthebibliography=\endlist
  }

  \vspace{\@sectionsep}
  {\bf \centerline{PUBLICATIONS}}
  \vspace{5pt}
  \begin{spacing}{1}
  \bibliography{\@publications}
  \end{spacing}
\else
  \typeout{****Warning: no publications section.}
\fi
}

%define the flags for the components of the dissertation summary
\newcount\refcount \refcount=0
\newcount\pubcount \pubcount=0
\newcount\honcount \honcount=0
\newcount\biocount \biocount=0


%define the commands for the pieces of the dissertation summary
\def\bio#1{  \advance\biocount by 10 \gdef\@bio{#1}}
\def\@bio{}

\def\external#1{\gdef\@external{#1}}
\def\@external{}

\def\committee#1{\gdef\@committee{#1}}
\def\@committee{}

\def\publications#1{  \advance\pubcount by 10 \gdef\@publications{#1}}
\def\@publications{}

\def\honours#1{  \advance\honcount by 10 \gdef\@honours{#1}}
\def\@honours{}

\def\summary#1{\advance\refcount by 10 \gdef\@summary{#1}}
\def\@summary{}

\def\sectionsep#1{\gdef\@sectionsep{#1}}
\def\@sectionsep{0.1in}




% You can use the titlepage environment to do it all yourself if you
% don't want to use \maketitle.  If the titlepage environment, the
% paragraph skip is infinitely stretchable, so if you leave a blank line
% between lines that you want space between, the space will stretch so
% that the title page fills up the entire page.
\def\titlepage{\newpage\centering
  \thispagestyle{empty}
  \parindent 0pt \parskip 10pt plus 1fil minus 1fil
  \def\baselinestretch{1}\@normalsize\vbox to \vsize\bgroup\vbox to 9in\bgroup}
% The \kern0pt pushes any depth into the height.  Thanks to Richard Stone.
\def\endtitlepage{\par\kern 0pt\egroup\vss\egroup\newpage}

\def\permpage{\newpage
%  \thispagestyle{empty}
  \parindent .5in \parskip 0pt plus 1fil minus 1fil
  \def\baselinestretch{1}\@normalsize\vbox to \vsize\bgroup\vbox to 9in\bgroup}
% The \kern0pt pushes any depth into the height.  Thanks to Richard Stone.
\def\endpermpage{\par\kern 0pt\egroup\vss\egroup\newpage}


\def\ackpage{\newpage
%  \thispagestyle{empty}
  \parindent .5in \parskip 0pt plus 1fil minus 1fil
  \def\baselinestretch{1.5}\@normalsize\vbox to \vsize\bgroup\vbox to 9in\bgroup}
% The \kern0pt pushes any depth into the height.  Thanks to Richard Stone.
  \def\endackpage{\par\kern 0pt\egroup\vss\egroup\newpage}

%\def\abstract{\centerline{\bf \large \@abstractheading}\def\baselinestretch{1}\@normalsize\vskip 
\def\abstract{\centerline{\bf \@headingsize \@abstractheading}\def\baselinestretch{1}\@normalsize\vskip 
\baselineskip}
\def\endabstract{\par}

% If using the report style, use - instead of . in the figure number.
%\@ifundefined{thechapter}{}{\def\thefigure{\thechapter-\arabic{figure}}}


%contents stuff for thesis, also adjust page counter font
\def\notocflag{0}
\def\nolofflag{0}
\def\nolotflag{0}
\def\noloaflag{0}
\def\notoc{\def\notocflag{1}}
\def\nolof{\def\nolofflag{1}}
\def\nolot{\def\nolotflag{1}}
\def\noloa{\def\noloaflag{1}}

%% the acronym is the parameter of \thesisbody:
%%        \begin{thesisbody}{\input{acronym}}
%%        \end{thesisbody}
%% 
%% Here is a sample format of the acronym.tex
%% \chapter*{List of Acronyms}
%% { \flushleft
%%
%% \textbf{2Q} -- Two Queue
%%
%% \textbf{AFC} -- Application/file-level characterization
%% }

\def\thesisbody#1{
        \newpage
%       \pagestyle{fancy}
%       \addtolength{\headwidth}{1.0cm}
%       \setlength{\headrulewidth}{0pt}
%       \rhead[\fancyplain{}{}]{\thepage}
%       \cfoot[\thepage]{}
%       \pagenumbering{roman}

        %single spacing for lists
        \begin{spacing}{1.5}
        \ifnum\notocflag>0 \else
          \addcontentsline{toc}{chapter}{\protect\numberline{}{\@tocheading}}
          \tableofcontents
          \pagebreak
        \fi
        \ifnum\nolotflag>0 \else
          \addcontentsline{toc}{chapter}{\protect\numberline{}{\@lotheading}}
          \listoftables
          \pagebreak
        \fi
        \ifnum\nolofflag>0 \else
          \addcontentsline{toc}{chapter}{\protect\numberline{}{\@lofheading}}
          \listoffigures
          \pagebreak
        \fi
        \ifnum\noloaflag>0 \else
          \addcontentsline{toc}{chapter}{\protect\numberline{}{\@loaheading}}
          #1
          \pagebreak
        \fi
        \end{spacing}
        %reset page counter and line spacing for rest of thesis
        \pagebreak
        \setcounter{page}{1}
        \pagenumbering{arabic}
% the following must be done (elsewhere) with a begin/end pair
%        \spacing{1.5}

        \begin{spacing}{1.5}
%        \begin{spacing}{1} % singal space to save space
}

\def\endthesisbody{\end{spacing}}

%some options from Greg Oster for heading styles
%
\def\@headingsize{\Large}
\def\chapcenterflag{0}
\def\chapsmallflag{1}
\def\@appheading{Appendix}
\def\@bibheading{References}
\def\@tocheading{Table of Contents}
\def\@lotheading{List of Tables}
\def\@lofheading{List of Figures}
\def\@loaheading{List of Acronyms}
\def\@permheading{Permission To Use}
\def\@abstractheading{Abstract}
\def\@ackheading{Acknowledgements}

\def\chapcenter{\def\chapcenterflag{1}}
\def\chaplarge{\def\chapsmallflag{0}  \def\@headingsize{\Huge}}
\def\chapcaps{\renewcommand{\@chapapp}{CHAPTER}
  \def\@appheading{APPENDIX}
  \def\@bibheading{REFERENCES}
  \def\@tocheading{TABLE OF CONTENTS}
  \def\@lofheading{LIST OF FIGURES}
  \def\@loaheading{LIST OF ACRONYMS}
  \def\@lotheading{LIST OF TABLES}
  \def\@permheading{PERMISSION TO USE}
  \def\@abstractheading{ABSTRACT}
  \def\@ackheading{ACKNOWLEDGEMENTS}
}

% \vspace*{31pt} is changed to \vspace*{0pt} by Wenguang
\def\@makechapterhead#1{ \ifnum\chapsmallflag>0 \vspace*{31pt} \else \vspace*{50pt} \fi { \parindent 0pt \center
\ifnum\chapcenterflag>0 \else \raggedright \fi
 \ifnum \c@secnumdepth >\m@ne 
   \ifnum\chapsmallflag>0 
%     \LARGE \bf \@chapapp{} \thechapter \par 
%     \vskip 20pt  \LARGE \bf #1\par 
%   \else
%     \Huge \bf \@chapapp{} \thechapter \par 
%     \vskip 20pt  \Huge \bf #1\par  
     \@headingsize \bf \@chapapp{} \thechapter \par 
     \vskip 0pt % 20pt  -- by Wenguang, remove the extra skip
     \@headingsize \bf #1\par 
   \else
     \@headingsize \bf \@chapapp{} \thechapter \par 
     \vskip 20pt  \@headingsize \bf #1\par  
   \fi
 \fi
 \nobreak \vskip 20pt % 40pt  -- by Wenguang, remove the extra space for \chapter
} }



\def\@makeschapterhead#1{ \ifnum\chapsmallflag>0 \vspace*{0pt} \else \vspace*{50pt} \fi { \parindent 0pt \center
\ifnum\chapcenterflag>0 \else \raggedright \fi
\ifnum\chapsmallflag>0 
 \Large \else \huge \fi \bf #1\par 
 \nobreak \vskip 10pt % 40pt -- reduced by Wenguang, remove extra space for \chapter*
} }

\def\chapter{ \clearpage \thispagestyle{plain} \global\@topnum\z@
  \@afterindentfalse \secdef\@chapter\@schapter}

\def\@chapter[#1]#2{\ifnum \c@secnumdepth > \m@ne
  \refstepcounter{chapter}
  \typeout{\@chapapp\space\thechapter.}
  \addcontentsline{toc}{chapter}{\protect
    \numberline{\thechapter}#1}\else
  \addcontentsline{toc}{chapter}{#1}\fi
  \chaptermark{#1}
  \addtocontents{lot}{\protect\addvspace{10pt}} 
  \addtocontents{lof}{\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}

\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
 -.2ex}{2.3ex plus .2ex}{\Large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus 
 -.2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus 
 -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\def\paragraph{\@startsection
 {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
 {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus 
 .2ex}{-1em}{\normalsize\bf}}

\def\chaptermark#1{}

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

\def\appendix{\par
 \setcounter{chapter}{0}
 \setcounter{section}{0}
 \def\@chapapp{\@headingsize\@appheading}
\def\baselinestretch{1}
 \def\thechapter{\Alph{chapter}}}

\leftmargini 2.5em
\leftmarginii 2.2em \leftmarginiii 1.87em \leftmarginiv 1.7em \leftmarginv 1em
\leftmarginvi 1em
\leftmargin\leftmargini
\labelsep .5em
\labelwidth\leftmargini\advance\labelwidth-\labelsep
\def\@listI{\leftmargin\leftmargini \parsep 5pt plus 2.5pt minus 1pt\topsep
10pt plus 4pt minus 6pt\itemsep 5pt plus 2.5pt minus 1pt}
\let\@listi\@listI
\@listi 
\def\@listii{\leftmargin\leftmarginii
 \labelwidth\leftmarginii\advance\labelwidth-\labelsep
 \topsep 5pt plus 2.5pt minus 1pt
 \parsep 2.5pt plus 1pt minus 1pt
 \itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
 \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
 \topsep 2.5pt plus 1pt minus 1pt 
 \parsep \z@ \partopsep 1pt plus 0pt minus 1pt
 \itemsep \topsep}
\def\@listiv{\leftmargin\leftmarginiv
 \labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
\def\@listv{\leftmargin\leftmarginv
 \labelwidth\leftmarginv\advance\labelwidth-\labelsep}
\def\@listvi{\leftmargin\leftmarginvi
 \labelwidth\leftmarginvi\advance\labelwidth-\labelsep}



\def\tableofcontents{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi\chapter*{\@headingsize\@tocheading\@mkboth{}{}}
 \@starttoc{toc}\if@restonecol\twocolumn\fi}
\def\l@part#1#2{\addpenalty{-\@highpenalty}
 \addvspace{2.25em plus 1pt} 
\begingroup
 \@tempdima 3em \parindent \z@ \rightskip \@pnumwidth \parfillskip
-\@pnumwidth 
 {\large \bf \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
 \nobreak \global\@nobreaktrue \everypar{\global\@nobreakfalse\everypar{}}
\endgroup}
\def\l@chapter#1#2{\addpenalty{-\@highpenalty} 
 \vskip 1.0em plus 1pt \@tempdima 1.5em 
\begingroup
 \parindent \z@ \rightskip \@pnumwidth 
 \parfillskip -\@pnumwidth 
 \bf \leavevmode \advance\leftskip\@tempdima \hskip -\leftskip #1\nobreak\hfil
\nobreak\hbox to\@pnumwidth{\hss #2}\par
 \penalty\@highpenalty \endgroup}
\def\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\def\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
\def\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\def\l@paragraph{\@dottedtocline{4}{10em}{5em}}
\def\l@subparagraph{\@dottedtocline{5}{12em}{6em}}
\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi\chapter*{\@headingsize \@lofheading\@mkboth
 {}{}}\@starttoc{lof}\if@restonecol
 \twocolumn\fi}
\def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi\chapter*{\@headingsize \@lotheading\@mkboth
 {}{}}\@starttoc{lot}\if@restonecol
 \twocolumn\fi}
\let\l@table\l@figure


\def\thebibliography#1{\chapter*{\@headingsize \@bibheading\@mkboth
 {}{}}
 \begin{spacing}{1.0}
 \addcontentsline{toc}{chapter}{\protect\numberline{}{\@bibheading}}
 \list
 {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
 \advance\leftmargin\labelsep
 \usecounter{enumi}}
 \def\baselinestretch{1.0}
 \def\newblock{\hskip .11em plus .33em minus .07em}
 \sloppy\clubpenalty4000\widowpenalty4000
 \sfcode`\.=1000\relax}
\def\endthebibliography{\end{spacing} \endlist}
%\let\endthebibliography=\endlist


