% uncthesis.sty -- UNC Thesis Style
% Created: Sat May 18 12:43:26 1996 by faith@acm.org
% Revised: Sun Dec  7 19:44:16 1997 by faith@acm.org
% Public Domain 1996, 1997 Rickard E. Faith (faith@acm.org)
%
% [I'm so sick of copyright restrictions, that I'm putting this in the
% public domain so that you can steal whatever you need and make your own
% thesis style.  Hack away...]
%
% This program comes with ABSOLUTELY NO WARRANTY.
% 
% $Id: uncthesis.sty,v 1.8 2003/07/21 14:52:23 clark Exp $
%
% References in []'s from : ``A Guide to the Preparation and Submission of
% Theses and Dissertations'' (The Graduate School, The University of North
% Carolina at Chapel Hill).  See: http://www.unc.edu/pubs/academ/thesdiss/
%
% Modified July 7, July 15, 2000 by John Keyser
% Modified January 2002 by Tom Hudson
% Modified Spring 2003 by Michele Weigle
%

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{uncthesis}[1997/11/25] %[$\mbox{}$Revision: 1.8 $\mbox{}$]
\typeout{UNC Thesis Style, $Revision: 1.8 $, by Rik Faith
(faith@cs.unc.edu)}

\RequirePackage{ifthen}
%\RequirePackage{doublespace}
\RequirePackage{setspace}   % Changed doublespace to setspace -- MCW 4/13/03
\RequirePackage{comment}

% Make copyright use uppercase C
%\DeclareTextCommandDefault{\copyright}{{\textcircled{C}}}
% Make copyright symbol fit in circle and be sans-serif  -MCW 5/21/03
\DeclareTextCommandDefault{\copyright}{{\textcircled{\textsf{c}}}}

% Set up spacing.  Magic numbers are from p. 53 of The LaTeX Companion
% (Goosens, Mittlebach, Samarin; Addison-Wesley Publishing Co., 1994).
% [XI. SPACING AND INDENTATION]

                                 % Set up one and one-half spacing
\ifthenelse{\@ptsize = 0}{\setstretch{1.25}}{} % 10-point
\ifthenelse{\@ptsize = 1}{\setstretch{1.21}}{} % 11-point
\ifthenelse{\@ptsize = 2}{\setstretch{1.24}}{} % 12-point
\def\unc@adjusttitlespacing{\vspace*{-\baselineskip}\vspace*{-1ex}}
\def\unc@adjustabstractspacing{\vspace*{-2\baselineskip}\vspace*{-2ex}}
\def\unc@adjustchapterspacing{\vspace*{-\baselineskip}}
\def\unc@adjustbibspacing{\vspace*{-\baselineskip}}

\DeclareOption{double}{                  % Set up double spacing
  \ifthenelse{\@ptsize = 0}{\setstretch{1.67}}{} % 10-point
  \ifthenelse{\@ptsize = 1}{\setstretch{1.62}}{} % 11-point
  \ifthenelse{\@ptsize = 2}{\setstretch{1.66}}{} % 12-point
  \def\unc@adjusttitlespacing{\vspace*{-\baselineskip}\vspace*{-1ex}}
  \def\unc@adjustabstractspacing{\vspace*{-2\baselineskip}\vspace*{-1.6ex}}
  \def\unc@adjustchapterspacing{\vspace*{-\baselineskip}\vspace*{0.6ex}}
  \def\unc@adjustbibspacing{\vspace*{-\baselineskip}\vspace*{-1.2ex}}
}

\DeclareOption{single}{
  \setstretch{1}                % Set up single spacing
  \def\unc@adjusttitlespacing{\vspace*{-\baselineskip}\vspace*{-1ex}}
  \def\unc@adjustabstractspacing{\vspace*{-2\baselineskip}\vspace*{-2ex}}
  \def\unc@adjustchapterspacing{\vspace*{-\baselineskip}\vspace*{-0.5ex}}
  \def\unc@adjustbibspacing{\relax}
}

\DeclareOption{nodraft}{\unc@nodraft}
\DeclareOption{bottom}{\unc@bottom}
\DeclareOption{draft}{\unc@draft} % timestamp each page

\DeclareOption{nofront}{\unc@nofront} % condense front matter
\DeclareOption{nolists}{\unc@nolists} % condense front matter

\DeclareOption{narrow}{\unc@narrow}
\DeclareOption{debug}{\thesisdebugmargins}

% Set up margins [X. MARGINS]
%
% You will likely need to tweak these.  Print a test and use a ruler.  =) -MCW
%
\def\unc@pageheight  {11in}
\def\unc@pagewidth   {8.5in}
%\def\unc@leftmargin  {1.5in}
\def\unc@leftmargin  {1.3125in}   % use 1 5/16'' margin -MCW
%\def\unc@rightmargin {1in}
\def\unc@rightmargin {1.0625in}   % use 1 1/16'' margin -MCW
\def\unc@topmargin   {1in}
%\def\unc@bottommargin{1in}
\def\unc@bottommargin{1.0625in}   % use 1 1/16'' margin -MCW

\def\unc@narrow{%
\typeout{(Using slightly narrow margins for mpar)}
\def\unc@pageheight  {11in}
\def\unc@pagewidth   {8.5in}
\def\unc@leftmargin  {1.75in}
\def\unc@rightmargin {1.5in}
\def\unc@topmargin   {1in}
\def\unc@bottommargin{1in}
\unc@setmargins
}

\def\unc@setmargins{%
                        % Don't change these
\headheight 2ex
\headsep .5in                 % [XII. PAGINATION]
\footskip .5in                % [XII. PAGINATION]
\advance\footskip 1ex
%  \parindent 5em                % [XI. SPACING AND INDENTATION]

%% textheight = unc@pageheight - unc@topmargin - unc@bottommargin - extra
\textheight\unc@pageheight
\advance\textheight -\unc@topmargin
\advance\textheight -\unc@bottommargin
\advance\textheight -\headheight
%  \advance\textheight -\headsep
\advance\textheight -1ex        %extra footskip
%  \advance\textheight -\footskip

%% topmargin = unc@topmargin - 1in - voffset
\topmargin\unc@topmargin
\advance\topmargin -1in
\advance\topmargin -\voffset
\advance\topmargin -\headsep
%  \advance\topmargin \headheight

%% textwidth = unc@pagewidth - unc@leftmargin - unc@rightmargin
\textwidth\unc@pagewidth
\advance\textwidth -\unc@leftmargin
\advance\textwidth -\unc@rightmargin

%% oddsidemargin = unc@leftmargin - 1in - hoffset
\oddsidemargin\unc@leftmargin
\advance\oddsidemargin -1in
\advance\oddsidemargin -\hoffset
\if@twoside
\evensidemargin\unc@rightmargin
\advance\evensidemargin -1in
\advance\evensidemargin -\hoffset
\else
\evensidemargin\oddsidemargin
\fi

\marginparwidth\oddsidemargin
\advance\marginparwidth -\marginparsep
}

\def\thesisdebugmargins{%
\typeout{Margins (in inches):}
\newcount\unc@tmp
\newcount\unc@inches
\newcount\unc@hundredths
\def\unc@convert##1{%
\unc@tmp=\csname ##1\endcsname
\unc@inches=\unc@tmp
\divide \unc@inches by 65536
\divide \unc@inches by 72
\divide \unc@tmp by 47186     % hundreths
\unc@hundredths=-\unc@inches
\multiply\unc@hundredths 100
\advance\unc@hundredths \unc@tmp
\typeout{ ##1 = \the\unc@inches .\two@digits{\the\unc@hundredths}}
}
\unc@convert{textheight}
\unc@convert{topmargin}
\unc@convert{headheight}
\unc@convert{headsep}
\unc@convert{voffset}
\unc@convert{footskip}
\unc@convert{textwidth}
\unc@convert{oddsidemargin}
\unc@convert{evensidemargin}
\unc@convert{hoffset}
\unc@convert{marginparwidth}
\unc@convert{marginparsep}
}


% Defaults

\newcommand{\unc@draftnote}{}

\def\thesistype#1{\gdef\unc@type{#1}}
% \gdef\unc@type{Dissertation}

\def\thesisuniversity#1{\gdef\unc@university{#1}}
% \gdef\unc@university{The University of North Carolina at Chapel Hill}

% 2002 - supposed to be lower case.  TCH
\gdef\unc@type{dissertation}
\gdef\unc@university{the University of North Carolina at Chapel Hill}

\def\thesisdegree#1{\gdef\unc@degree{#1}}
\gdef\unc@degree{Doctor of Philosophy}

\def\thesisdepartment#1{\gdef\unc@department{#1}}
\gdef\unc@department{Department of Computer Science}

\def\thesislocation#1{\gdef\unc@location{#1}}
\gdef\unc@location{Chapel Hill}

\def\thesisyear#1{\gdef\unc@year{#1}}
\gdef\unc@year{\the\year}

\def\thesistitle#1{\gdef\unc@title{#1}}
\gdef\unc@title{Title}

\def\thesisauthor#1{\gdef\unc@author{#1}\gdef\unc@AUTHOR{\uppercase{#1}}}
\gdef\unc@author{Author}
\gdef\unc@AUTHOR{AUTHOR}

\def\thesisadvisortitle#1{\gdef\unc@advisortitle{#1}}
\gdef\unc@advisortitle{Advisor}
\def\thesisadvisor#1{\gdef\unc@advisora{#1}}
\gdef\unc@advisora{Advisor}
\def\thesisadvisora#1{\gdef\unc@advisora{#1}}
\def\thesisadvisorb#1{\gdef\unc@advisorb{#1}}

\def\thesisreadertitle#1{\gdef\unc@readertitle{#1}}
\gdef\unc@readertitle{Reader}
\def\thesisreadera#1{\gdef\unc@readera{#1}}
\def\thesisreaderb#1{\gdef\unc@readerb{#1}}
\def\thesisreaderc#1{\gdef\unc@readerc{#1}}
\def\thesisreaderd#1{\gdef\unc@readerd{#1}}
\def\thesisreadere#1{\gdef\unc@readere{#1}}
\def\thesisreaderf#1{\gdef\unc@readerf{#1}}
\def\thesisreaderg#1{\gdef\unc@readerg{#1}}

% title should be large and bold
\def\thesistitlefont#1{\gdef\unc@titlefont{#1}}
\gdef\unc@titlefont{\Large\bfseries}
% author font should be 12 pt.    -MCW 5/22/03
\def\thesisauthorfont#1{\gdef\unc@authorfont{#1}}
\ifthenelse{\@ptsize=0}{\gdef\unc@authorfont{\large}}{}
\ifthenelse{\@ptsize=1}{\gdef\unc@authorfont{\large}}{}
\ifthenelse{\@ptsize=2}{\gdef\unc@authorfont{}}{}
% titlepage font should be 12 pt.    -MCW 5/22/03
% (as specified by margin lady Sue)
\def\thesistitlepagefont#1{\gdef\unc@titlepagefont{#1}}
\ifthenelse{\@ptsize=0}{\gdef\unc@titlepagefont{\large}}{}
\ifthenelse{\@ptsize=1}{\gdef\unc@titlepagefont{\large}}{}
\ifthenelse{\@ptsize=2}{\gdef\unc@titlepagefont{}}{}

% Macros

% 5/20/2003 changes by MCW
%      - Title and and "by" author should be single-spaced
%      - 1 inch between title and "by" (according to sample title page
%      in grad school dissertation guidelines document)  
%      - 1 inch between author and statement
%      - single-space between "Chapel Hill" and year
\def\thesismaketitle{
  \pagenumbering{roman}\setcounter{page}{1}\thispagestyle{empty}
  \begin{spacing}{1}\reset@font
% To be exactly 2 in from top of page on hplj146 with 11 pt base font
    \vspace*{0.96875 in}
    \begin{center}
      \begin{spacing}{1}
        {\unc@titlefont\unc@adjusttitlespacing\unc@title}
      \end{spacing}
%      \vspace{1 in}  
% To be exactly 1 in from name with 11 pt base font
    \vspace{0.96875 in}
% Use title page font for everything on the title page except the title
      {\unc@titlepagefont by} \\
      {\unc@titlepagefont \unc@author}
    \end{center}
% To be exactly 1 in from name with 11 pt base font
     \vspace{0.875 in}
    {\unc@titlepagefont A \unc@type{} submitted to the faculty of
    \unc@university{} in partial fulfillment of the requirements for the
    degree of \unc@degree{} in the \unc@department{}.} 
% To fit with 6 signature lines
    \vspace{0.2in}
    \begin{center}
      {\unc@titlepagefont \unc@location} \\
      {\unc@titlepagefont \unc@year} \\
% To fit with 6 signature lines
      \vspace{0.35 in}
      \hfill\unc@signatures
    \end{center}
  \end{spacing}
  \newpage
  }

%\def\unc@signatureline#1#2{\vspace{0.5in}\hbox to 3in{\hfil\shortstack{\vrule
% change made to fit 6 signature lines -MCW  5/5/03
\def\unc@signatureline#1#2{\vspace{0.35in}\hbox to 3in{\hfil\shortstack{\vrule
      width 3in height 0.4pt\\{\unc@titlepagefont #1, #2}}}}
  
\def\unc@signatures{
  \begin{minipage}{3in}
% ``Approved by:'' should be centered  -MCW 5/20/03
    \begin{center}{\unc@titlepagefont Approved by:}\end{center}
    
    \@ifundefined{unc@advisora}{}%
       {\unc@signatureline{\unc@advisora}{\unc@advisortitle}}
    \@ifundefined{unc@advisorb}{}%
       {\unc@signatureline{\unc@advisorb}{\unc@advisortitle}}
    \@ifundefined{unc@readera}{}%
       {\unc@signatureline{\unc@readera}{\unc@readertitle}}
    \@ifundefined{unc@readerb}{}%
       {\unc@signatureline{\unc@readerb}{\unc@readertitle}}
    \@ifundefined{unc@readerc}{}%
       {\unc@signatureline{\unc@readerc}{\unc@readertitle}}
    \@ifundefined{unc@readerd}{}%
       {\unc@signatureline{\unc@readerd}{\unc@readertitle}}
    \@ifundefined{unc@readere}{}%
       {\unc@signatureline{\unc@readere}{\unc@readertitle}}
    \@ifundefined{unc@readerf}{}%
       {\unc@signatureline{\unc@readerf}{\unc@readertitle}}
    \@ifundefined{unc@readerg}{}%
       {\unc@signatureline{\unc@readerg}{\unc@readertitle}}
  \end{minipage}
  }

% 2002 - ALL RIGHTS RESERVED supposed to be uppercase - TCH
\def\thesismakecopyright{
  % Added following line by JCK to make start on right-hand side
  \cleardoublepage
  \thispagestyle{plain}
  \mbox{}\vfill
  \begin{spacing}{1.1}
    \begin{center}
% If using copyright symbol, don't need the word "Copyright" -MCW 5/21/03
%      Copyright \copyright{} \unc@year \\
      \copyright{} \unc@year \\
      \unc@author \\
      ALL RIGHTS RESERVED
    \end{center}
  \end{spacing}
  \newpage
  }

% 2003 MCW - contents, lot, lof, bibliography should be in all caps
\renewcommand\contentsname{TABLE OF CONTENTS}
\renewcommand\listfigurename{LIST OF FIGURES}
\renewcommand\listtablename{LIST OF TABLES}
\renewcommand\bibname{BIBLIOGRAPHY}

% This adds extra inter-entry spacing in toc/lof/lot/... as per the
% thesis guide requirements. intra-entry spacing is whatever the current
% environment dictates when \listof... or \tableof... appears.
% 2003 CCW
\let\ORIGINALaddcontentsline\addcontentsline
\newcommand*\UNCaddcontentsline[3]{
      \addtocontents{#1}
                   {\protect\contentsline{#2}{#3}{\thepage}
                    \protect\addvspace{10pt}}}
\let\addcontentsline\UNCaddcontentsline

\renewcommand{\@tocrmarg}{1.5 in}
%\renewcommand{\@pnumwidth}{0.5 in}

% Adds ``Table'' and ``Figure'' to list of tables and figures
% 2003 CCW
%\let\@ORIGINALcaption\@caption
%\newcommand*\@UNCcaption[5]{%
% there's a hidden [] in the input ... #1[#2]#3 ...
% so take 5 arguments and work with the odd ones
% \par
% \ifthenelse{\equal{#1}{figure}}
%    {\addcontentsline{\csname ext@#1\endcsname}{#1}{Figure
%        \protect\numberline{\csname the#1\endcsname}{\ignorespaces #3}}} 
% {\ifthenelse{\equal{#1}{table}}
%    {\addcontentsline{\csname
%           ext@#1\endcsname}{#1}{Table \protect\numberline{\csname
%           the#1\endcsname}{\ignorespaces #3}}} 
%    {\addcontentsline{\csname
%           ext@#1\endcsname}{#1}{\protect\numberline{\csname
%           the#1\endcsname}{\ignorespaces #3}}}}% 
% \begingroup
%   \@parboxrestore
%   \if@minipage
%     \@setminipage
%   \fi
%   \normalsize
%   \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #5}
%   \par
% \endgroup}
%\let\@caption\@UNCcaption

% Don't put items all the way to the page number (break lines early)
% 2003 MCW

%\newcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
%\newcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
%\newcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
%\newcommand*\l@paragraph{\@dottedtocline{4}{10em}{5em}}
%\newcommand*\l@subparagraph{\@dottedtocline{5}{12em}{6em}}
%\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
%\renewcommand*\l@table{\@dottedtocline{1}{1.5em}{2.3em}}

%\def\@dottedtocline#1#2#3#4#5{%
  % #1 is level (1 is chapter, 2 is section, ...)
  % #2 is length of left indent
  % #3 is length of space between number and title
%  \ifnum #1>\c@tocdepth \else
%    \vskip \z@ \@plus.2\p@
%    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
%     \parindent #2\relax\@afterindenttrue
%     \interlinepenalty\@M
%     \leavevmode
%     \@tempdima #3\relax
%     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
%     {#4}\nobreak
%     \leaders\hbox{$\m@th
%        \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
%        mu$}\hfill
%     \nobreak
%     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
%     \par}%
%  \fi}

\def\unc@nofront{
  \def\thesismaketitle{
    \pagenumbering{roman}\setcounter{page}{1}\thispagestyle{empty}
    \begin{spacing}{1}\reset@font
      \vspace*{1in}
      \begin{center}
        \begin{spacing}{2}
          {\unc@titlefont\unc@adjusttitlespacing\unc@title}
        \end{spacing}
        \vspace{0.5in}
        {\unc@authorfont by} \\
        \vspace{0.5in}
        {\unc@authorfont \unc@author}
      \end{center}
      \vspace{0.5in}
      \begin{center}\unc@draftnote\end{center}
    \end{spacing}
    }
  \def\thesismakecopyright{}%
  \excludecomment{dedication}%
  \excludecomment{acknowledgments}%
  \renewenvironment{abstract}{%
    \global\@topnum\z@
    \@afterindentfalse
    \begin{center}\bfseries
      \vspace{0.5in} \abstractname
    \end{center}%
    \quotation}{\endquotation\newpage}%
  }

\def\unc@nolists{%
  \renewcommand{\listofabbreviations}{}%
  \renewcommand{\listoffigures}{}%
  \renewcommand{\listoftables}{}%
  }

\def\unc@draft{%
  \renewcommand{\ps@plain}{%
    \renewcommand{\@oddhead}{\hfil\textrm{\thepage}}%
    \renewcommand{\@evenhead}{\textrm{\thepage}\hfil}%
% Added Feb 2003 by MCW -- adds initials to draft footer
    \@ifundefined{unc@authorinit}{
       \renewcommand{\@oddfoot}{\hfil Draft of \unc@timestamp} 
       \renewcommand{\@evenfoot}{Draft of \unc@timestamp\hfil \unc@authorinit}
    } {
       \renewcommand{\@oddfoot}{\unc@authorinit \hfil Draft of \unc@timestamp}
       \renewcommand{\@evenfoot}{Draft of \unc@timestamp\hfil}
    }
    }%
  \renewcommand{\unc@draftnote}{\emph{\bf (Draft of \unc@timestamp)}}
  }

\def\unc@mydraft{%
  \renewcommand{\ps@plain}{%
    \renewcommand{\@oddhead}{\hfil\textrm{\thepage}}%
    \renewcommand{\@evenhead}{\textrm{\thepage}\hfil}%
    \renewcommand{\@oddfoot}{\hfil Draft of \unc@timestamp}%
    \renewcommand{\@evenfoot}{Draft of \unc@timestamp\hfil}%
    }%
  \renewcommand{\unc@draftnote}{\emph{\bf (Draft of \unc@timestamp)}}
  }

\def\unc@nodraft{%
  \renewcommand{\ps@plain}{%
    \renewcommand{\@oddhead}{\hfil\textrm{\thepage}}%
    \renewcommand{\@evenhead}{\textrm{\thepage}\hfil}%
    \renewcommand{\@oddfoot}{}%
    \renewcommand{\@evenfoot}{}%
    \let\@mkboth\@gobbletwo%
    }%
  }

\def\unc@bottom{%
  \renewcommand{\ps@plain}{%
    \renewcommand{\@oddhead}{}%
    \renewcommand{\@evenhead}{}%
    \renewcommand{\@oddfoot}{\hfil\textrm{\thepage}\hfil}%
    \renewcommand{\@evenfoot}{\hfil\textrm{\thepage}\hfil}%
    \let\@mkboth\@gobbletwo%
    }%
  }

\newcount\unc@hour
\newcount\unc@minute

\unc@hour=\time
\divide\unc@hour 60
\unc@minute=-\unc@hour
\multiply\unc@minute 60
\advance\unc@minute \time

\def\unc@timestamp{\today{} at
  \two@digits{\the\unc@hour}:\two@digits{\the\unc@minute}}

% Added Feb 2003 by MCW -- adds initials to draft footer
\def\authorinit#1{\gdef\unc@authorinit{#1}}

%% Redefine a bunch of stuff...

\renewcommand{\abstractname}{ABSTRACT}

% 2002 - ABSTRACT first, then author: title
\renewenvironment{abstract}{%
  %\clearpage\thispagestyle{plain}
  % Modified to following line by JCK to make start on right-hand side
  \cleardoublepage\thispagestyle{plain}
  \global\@topnum\z@
  \@afterindentfalse\reset@font
  \begin{spacing}{1}\vspace*{1in}\begin{center}\bfseries
    \unc@adjustabstractspacing
    \abstractname \\
    \uppercase{\unc@AUTHOR}:
    \unc@title. \\ (Under the direction of
    \@ifundefined{unc@advisorb}%
       {\unc@advisora}{\unc@advisora{} and \unc@advisorb}.) \\
%    \vspace{0.5in} \abstractname
  \end{center}\end{spacing}%
  }{\vfill\newpage}

\newenvironment{dedication}%
  {\cleardoublepage\thispagestyle{plain}\global\@topnum\z@\@afterindentfalse}%
  {\newpage}

% 2002 - ACKNOWLEDGMENTS in upper case - TCH
%\newcommand{\acknowledgmentsname}{Acknowledgments}
\newcommand{\acknowledgmentsname}{ACKNOWLEDGMENTS}
\newenvironment{acknowledgments}{\chapter*{\acknowledgmentsname}}{}

\newcommand{\colophonname}{Colophon}
\newenvironment{colophon}{\chapter*{\colophonname}}{}

\newcommand{\glossaryname}{Glossary}
\renewenvironment{glossary}{\chapter*{\glossaryname}}{}

\def\unc@first{0}
\renewcommand{\chapter}{
  \if@openright\cleardoublepage\else\clearpage\fi
  % Modified to following by JCK to fix page numbering in table of contents
  %\cleardoublepage
  \thispagestyle{plain}
  \global\@topnum\z@
  \@afterindentfalse
  \secdef\@chapter\@schapter}

% for \chapter
\def\@makechapterhead#1{\cleardoublepage%
  \ifnum\unc@first=0%
     \def\unc@first{1}\pagenumbering{arabic}\setcounter{page}{1}\fi
  % Following line added by JCK 7/10/00 to fix Appendix page number
  \ifthenelse{\equal{\appendixname}{\@chapapp}}{}{\thispagestyle{empty}}%
  {\parindent \z@ \raggedright \reset@font
    \begin{center}
      % Following 3 lines added by JCK 7/10/00 to fix Appendix margins
      \ifthenelse{\equal{\appendixname}{\@chapapp}}
        {}
        {\begin{spacing}{1}\vspace*{1in}\end{spacing}}
      \huge\bfseries\unc@adjustchapterspacing
      \ifnum \c@secnumdepth >\m@ne
        \@chapapp{} \thechapter
        \par\nobreak
        \vskip 20\p@
      \fi
      \interlinepenalty\@M
      #1\par\nobreak
    \end{center}

    \vskip 40\p@}}

% 2002 - Not supposed to list acknowledgments in the TOC - TCH
% \chapter*
\def\@makeschapterhead#1{\cleardoublepage%
  \ifthenelse{\equal{#1}{\contentsname}\or\equal{#1}{\colophonname}%
              \or\equal{#1}{\acknowledgmentsname}}%
    {\relax}
    {\addcontentsline{toc}{chapter}{#1}} % [XIX. TABLE OF CONTENTS]
  \ifthenelse{\equal{#1}{\bibname}}{\unc@adjustbibspacing}{\relax}%
  {\parindent \z@ \raggedright
    \begin{center}
      % Following 3 lines added by JCK 7/10/00 to fix certain margins
      \ifthenelse{\equal{#1}{\bibname} \or \equal{#1}{\listfigurename} \or
                  \equal{#1}{\listtablename} \or
                  \equal{#1}{\listabbreviationname}}
        {}
        {\begin{spacing}{1}\vspace*{1in}\end{spacing}}
      \reset@font
      \interlinepenalty\@M
      \huge\bfseries\unc@adjustchapterspacing #1\par\nobreak
    \end{center}
    \vskip 40\p@
    }}


% START ABBREVIATION SUPPORT
\def\xspace{\futurelet\next\@xspace}
\def\@xspace{%
  \ifx\next\bgroup\else
  \ifx\next\egroup\else
  \ifx\next\/\else
  \ifx\next\ \else
  \ifx\next~\else
  \ifx\next.\else
  \ifx\next,\else
  \ifx\next:\else
  \ifx\next;\else
  \ifx\next?\else
  \ifx\next'\else
  \ifx\next)\else
  \ifx\next-\else
  \space
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
  }

\def\abbreviation#1#2#3{%
  \unc@addabbreviation{#2}{#3}
  \def#1{\relax}%
  \setbox0=\hbox{#3}%
  \ifdim\wd0>0pt\gdef#1{\abbreviationfinal{#1}{#2}\empty%
    #3 (#1)\xspace}
  \else\gdef#1{#2\protect\xspace}%
  \fi
  }

\def\abbreviationfinal#1#2#3{%
  \def#1{\relax}%
  \setbox0=\hbox{#3}%
  \ifdim\wd0>0pt\gdef#1{\abbreviationfinal{#1}{#2}\empty%
    #3 (#1)\xspace}
  \else\gdef#1{#2\protect\xspace}%
  \fi
  }

\def\abbreviationr#1#2#3{%
  \unc@addabbreviation{#2}{#3}
  \def#1{\relax}%
  \setbox0=\hbox{#3}%
  \ifdim\wd0>0pt\gdef#1{\abbreviationrfinal{#1}{#2}\empty%
    #1 (#3)\xspace}
  \else\gdef#1{#2\protect\xspace}%
  \fi
  }

\def\abbreviationrfinal#1#2#3{%
  \def#1{\relax}%
  \setbox0=\hbox{#3}%
  \ifdim\wd0>0pt\gdef#1{\abbreviationrfinal{#1}{#2}\empty%
    #1 (#3)\xspace}
  \else\gdef#1{#2\protect\xspace}%
  \fi
  }

\def\unc@addabbreviation#1#2{%
  \protected@write\@auxout
  {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
  {\string\@writefile{loa}{\protect\abbreviationline{#1}{#2}}}%
  \typeout{\protect #1 #2}
  }

\def\abbreviationline#1#2{\makebox[1in][l]{\textbf{#1}} #2\newline}
%\def\listabbreviationname{List of Abbreviations}
% LOA title should be all caps   -MCW  7/8/2003
\def\listabbreviationname{LIST OF ABBREVIATIONS}
\newcommand{\listofabbreviations}{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listabbreviationname
      \@mkboth{\uppercase{\listabbreviationname}}%
              {\uppercase{\listabbreviationname}}}%
    \@starttoc{loa}%
    \if@restonecol\twocolumn\fi
    }

\def\trademark#1#2#3{%
  \def#1{\relax}%
  \setbox0=\hbox{#3}%
  \ifdim\wd0>0pt\gdef#1{\trademark{#1}{#2}\empty%
    #1{}\footnote{\rm #2 is a trademark of #3.}\xspace}%
  \else\gdef#1{#2\xspace}%
  \fi
  }

\def\regtrademark#1#2#3{%
  \def#1{\relax}%
  \setbox0=\hbox{#3}%
  \ifdim\wd0>0pt\gdef#1{\regtrademark{#1}{#2}\empty%
    #1{}\footnote{#2 is a trademark of #3.}\xspace}%
  \else\gdef#1{#2\xspace}%
  \fi
  }

\def\regtrademarkfull#1#2#3{%
  \def#1{\relax}%
  \setbox0=\hbox{#3}%
  \ifdim\wd0>0pt\gdef#1{\regtrademarkfull{#1}{#2}\empty%
    #1{}\footnote{#3}\xspace}%
  \else\gdef#1{#2\xspace}%
  \fi
  }
% END ABBREVIATION SUPPORT

\newlength{\@shortcaptionsize}
% START OF SHORT CAPTION SUPPORT FOR SIDEWAYS FIGURES
\def\shortcaption{\refstepcounter\@captype \@dblarg{\@shortcaption\@captype}}
\long\def\@shortcaption#1[#2]#3{\par\addcontentsline{\csname
  ext@#1\endcsname}{#1}{\protect\numberline{\csname
  the#1\endcsname}{\ignorespaces #2}}\begingroup
    \@parboxrestore
    \normalsize
    \@makeshortcaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
  \endgroup}
\long\def\@makeshortcaption#1#2{%
  \vskip\abovecaptionskip
  \setlength{\@shortcaptionsize}{.75\hsize}%
  \sbox\@tempboxa{#1: #2}%
  \ifdim \wd\@tempboxa >\@shortcaptionsize
    \hbox to\hsize{\hfil\parbox[t]{\@shortcaptionsize}{#1: #2}\hfil}
  \else
    \global \@minipagefalse
    \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

% END OF SHORT CAPTION SUPPORT FOR SIDEWAYS FIGURES

\ExecuteOptions{nodraft}
\unc@setmargins
\ProcessOptions
\AtBeginDocument{\pagestyle{plain}}
