%%% -*-LaTeX-*-

%%% This is a LaTeX-2e style file suitable for inclusion in an
%%% report-class document to satisfy the formatting requirements
%%% of the University of Utah Senior Honors Thesis, as specified
%%% in ``The Senior Honors Thesis'', Fall 2002, from the Honors
%%% Program office.

%%% Here is the general layout of an Honors Thesis file:
%%%
%%%     \documentclass[12pt]{report}
%%%     \usepackage{uuhonors}
%%%
%%%     \title{Title goes here}
%%%     \author{Your name here}
%%%     \degree{Degree name here}
%%%     \department{Department name here}
%%%     \advisor{Advisor name here}
%%%     \chair{Chair name here}
%%%     \supervisor{Supervisor name here}
%%%     \director{Martha S. Bradley}    % Probably constants for long intervals
%%%
%%%     \begin{document}
%%%
%%%     \maketitle
%%%
%%%     \begin{abstract}
%%%        Abstract goes here...
%%%     \end{abstract}
%%%
%%%     \begin{dedication}      % This environment is optional
%%%        Dedication goes here...
%%%     \end{dedication}
%%% 
%%%     \tableofcontents
%%%
%%%     \chapter{Introduction}
%%%     \pagenumbering{arabic}
%%%     ...
%%%
%%%     \finalpage{birthdate}{birthplace}{localaddress}
%%%     \end{document}

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{uuhonors}[2003/08/20 University of Utah Honors Thesis package for use with report.cls]

%%% --------------------------------------------------------------------
%%% The details...
%%% Set page dimensions: left: 1.5in, right, top, bottom: 1in

\setlength{\topmargin}{0pt}
\setlength{\oddsidemargin}{0.5in}
\setlength{\evensidemargin}{0.5in}
\setlength{\textwidth}{6in}
\setlength{\headsep}{2\normalbaselineskip}
\setlength{\textheight}{9in}  % 11in - 1in - 1in
\addtolength{\textheight}{-\normalbaselineskip} % - head
\addtolength{\textheight}{-\headsep} % - \headsep

%%% Page numbers at top with running headings
\pagestyle{headings}

%%% Two sectional names are all caps:
\renewcommand{\abstractname}{ABSTRACT}
\renewcommand{\contentsname}{TABLE OF CONTENTS}

%%% Table of Contents heading is centered, sigh...
%%% Modify definition from about l. 599 of report.cls
\renewcommand{\tableofcontents}{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \thispagestyle{plain}
    \section*{\centerline{\contentsname} %CHANGE HERE: use \section*, and add \centerline
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
    }



%%% Abstract needs a table-of-contents entry, and a page number at bottom
\let \oldabstract = \abstract
\let \oldendabstract = \endabstract
\renewenvironment{abstract}
{%
    \pagenumbering{roman}
    \oldabstract
    \setcounter{page}{2}
    \addcontentsline{toc}{chapter}{\protect\numberline{}Abstract}
    \thispagestyle{plain}
}
{%
    \oldendabstract
}

%%% Double spacing requirement
\usepackage{doublespace}
\setstretch{1.5}

%%% Complex titlepage, based on modification of
%%% \maketitle from report.cls [2001/04/21 v1.4e], line 181


\newcommand{\degree}[1]{\newcommand{\@Degree}{#1}}
\newcommand{\department}[1]{\newcommand{\@Department}{#1}}
\newcommand{\advisor}[1]{\newcommand{\@Advisor}{#1}}
\newcommand{\chair}[1]{\newcommand{\@Chair}{#1}}
\newcommand{\director}[1]{\newcommand{\@Director}{#1}}
\newcommand{\supervisor}[1]{\newcommand{\@Supervisor}{#1}}
\renewcommand{\title}[1]{\renewcommand{\@title}{#1}}

\renewcommand{\maketitle}
{%
    \begin{titlepage}%
      \vbox to \textheight
      {%
        \vss
        \setstretch{1}
        \let\footnotesize\small
        \let\footnoterule\relax
        \let \footnote \thanks
        \null\vfil
        % \vskip 30\p@
        \begin{center}%
            \large
            {\LARGE \MakeUppercase{\@title} \par}%
            \vskip 5ex%
            by
            \vskip 2ex%
            \@author \\
            \vskip 5ex
            A Senior Honors Thesis Submitted to the Faculty of \\
            the University of Utah\\
            in Partial Fulfillment of the Requirements for the\\
            \vskip 5ex
            \@Degree\\[2ex]
            in \\[2ex]
            \@Department\\[4ex]
            \begin{tabular}{p{3in}p{3in}}
                APPROVED:\\
                \null                     & \null \\
                \hbox to 2.5in{\hrulefill} & \hbox to 2.5in{\hrulefill} \\[-3.5ex]
                \@Supervisor               & \@Chair\\
                Supervisor                & Chair, \@Department\\
                \null                     & \null \\
                \hbox to 2.5in{\hrulefill} & \hbox to 2.5in{\hrulefill} \\[-3.5ex]
                \@Advisor                 & \@Director \\
                Departmental Honors Advisor & Director, Honors Program
            \end{tabular}
            \vskip 3ex
            \@date
        \end{center}\par
        \@thanks
        \vfil\null
        \vss
       }
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  % \global\let\@author\@empty    %% Need later in \finalpage!
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}

%%% Final page:
%%% \finalpage{birthdate}{birthplace}{address}
%%%
\newcommand{\finalpage}[3]
{
    \newpage
    \null
    \vfill
    \thispagestyle{empty}
    \begin{center}
        \begin{tabular}{p{2in}p{3.5in}}
            Name of Candidate: & \@author \\
            Birth Date:        & #1 \\
            Birth Place:       & #2 \\
            Address:           & #3
        \end{tabular}
    \end{center}
    \vfill
    \null
}

%%% Dedication (unnumbered page just before table-of-contents, with no
%%% heading, and centered on the page)

\newenvironment{dedication}
{%
    \thispagestyle{empty}
    \stepcounter{page}      %should not be necessary, but seems to be, sigh...
    \stepcounter{page}      %should not be necessary, but seems to be, sigh...
    \mbox{}
    \vfill
}
{
    \vfill
    \newpage
}
