% University of South Carolina Thesis Style.
% Intended to conform with the Honor School's Thesis Guidelines
%
% Copyright (C) 2004,2006 by Jose M. Vidal and Erick M. Bousman. All Rights Reserved.
%
% The author grants permission for anyone to use this macro package and
% to distribute it unchanged without further restriction.  If you choose
% to modify this package, you must indicate that you have modified it
% prior to your distributing it.  I don't want to get bug reports about
% changes that *you* have made!
% 

\ProvidesPackage{uschonorsthesis}
\typeout{Document Style Option `uschonorsthesis'.}

\long\def\comment#1{}
\comment{
  See sample honorsthesis.tex
}
\RequirePackage{setspace}
\RequirePackage{geometry}

%Add hyperlinks. You can comment out this line if its giving you problems.
%float.sty and algorithm.sty have to be loaded *before* hyperref.
%Note that later in \hypersetup{} we make links invisible so
%the printout will look nice. The links still work.
\RequirePackage[plainpages=false,pdfpagelabels]{hyperref}

% First thing we do is make sure that report has been loaded.  A
% common error is to try to use uscthesis as a documentstyle.
\@ifundefined{chapter}{\@latexerr{The `uschonorsthesis' option should be used
with the `report' document style}{You should probably read the
honorsthesis.tex example.}}{}

\doublespacing

%Set the margins
\geometry{letterpaper, left=1.5in, top=1in, right=1in, bottom=1in}

%chapter appears two inches below top of page
\def\@makechapterhead#1{%
  \vspace*{.4in}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}

%chapter* appears two inches below top of page.
\def\@makeschapterhead#1{%
  \vspace*{.4in}
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}

%make the footnote line 2in
\renewcommand{\footnoterule}{\vspace*{-3pt}%
  \hrule width 2in height 0.4pt \vspace*{2.6pt}}

%Leave two spaces above and below rule
%\skip\footins 20pt plus4pt minus4pt
\addtolength{\skip\footins}{1.5em plus 4pt minus4pt}
\setlength{\footnotesep}{2em}

% \author, \title are defined in report; here are the rest of the
% front matter defining macros
\def\dept#1{\gdef\@dept{#1}}
\def\directordept#1{\gdef\@directordept{#1}}
\def\directorname#1{\gdef\@directorname{#1}}% emb Added this because I thought I had to
\def\secondreaderdept#1{\gdef\@secondreaderdept{#1}}
\def\secondreadername#1{\gdef\@secondreadername{#1}}% emb Added this because I thought I had to
\def\thirdreaderdept#1{\gdef\@thirdreaderdept{#1}}
\def\abstract#1{\gdef\@abstract{#1}}
\def\director#1{\gdef\@director{#1}}

% \def\authordegree#1{\gdef\@authordegree{#1}} % emb commented out, unnecessary
\def\degree#1{\gdef\@degree{#1}}
\def\college#1{\gdef\@college{#1}}

\def\copyrightyear#1{\gdef\@copyrightyear{#1}} % \author, \title in report
\def\@title{}
\def\@author{}
\def\@keywords{}
\def\@abstract{}
\def\@director{}
\def\@authordegree{}
\def\@degree{Master of Engineering}
\def\@college{Engineering and Information Technology}
\def\@dept{Computer Science and Engineering}
\def\@directordept{Computer Science and Engineering}
\def\@directorname{}% emb Add this because I thought I had to
\def\@secondreaderdept{Computer Science and Engineering}
\def\@secondreadername{}% emb Added this because I thought I had to
\def\@thirdreaderdept{Computer Science and Engineering}

\def\makethesistitle{%
  \@ifundefined{hypersetup}{}{%
    \hypersetup{%
      bookmarksnumbered,
      pdftitle={\@title},
      pdfauthor={\@author},
      pdfsubject={\@dept},
      pdfkeywords={\@keywords},
      pdfview=FitH,
      pdfborder=0 0 0, %Make all links invisible, so it looks good when printed
    }}
  \pagenumbering{roman}%
  \thispagestyle{empty}%
  \begin{center}
    \textsc{\expandafter{\@title}} \\
    By:\\ 
    \vspace{1em} 
     \@author\\
    \vspace{1em}
%    \begin{singlespace}
%      \@authordegree
%    \end{singlespace} 
%    --------------------------------------------------------------\\
\vspace{2em}

\begin{singlespace}
    Submitted in Partial Fulfillment\\
    Of the requirements for\\
    Graduation with Honors from the \\% emb Changed to allow for Honors Thesis
    South Carolina Honors College \\
%    College of \@college \\ emb Unnecessary for Honors College thesis
%    University of South Carolina \\
\end{singlespace}
    \vspace{3em}
    \@copyrightyear \\
    \vspace{3em}
    Approved:\\
    \vspace{\stretch{1}}
    \begin{singlespace}
      \noindent
      \begin{minipage}{4in}
       \begin{center}
         \hrule 
         \vspace{5pt}
	\@directorname \\% emb Added to put Director's name
        Director of Thesis
%        Department of \@directordept \\% emb Changed to use directordept variable
       \end{center}
      \end{minipage}
%      \hfill
      \begin{minipage}[center]{4in}
       \begin{center}
         \vspace{6em}
        \hrule 
        \vspace{5pt}
	\@secondreadername \\% emb Added to put Second Reader's name
        Second Reader
       \end{center}
      \end{minipage}
      \begin{minipage}[t]{4in}
       \begin{center}
         \vspace{6em}
        \hrule 
        \vspace{5pt}
        Davis Baird, Leslie Sargent Jones, G. James Burns or Douglas F. Williams \\
	For South Carolina Honors College % emb Changed to allow these people, not Dean
       \end{center}
      \end{minipage}
    \end{singlespace}
 \end{center}\newpage}


\def\makecopyrightpage{%
  \begin{center}
    \vspace{6in}\ \copyright by \@author, \@copyrightyear \\
    All Rights Reserved.
  \end{center}}

%\renewenvironment{abstract}{%
%  \newpage{}
%  \addcontentsline{toc}{chapter}{Abstract}
%  \@beginparpenalty\@lowpenalty
%  \begin{center}%
%    ABSTRACT \\
%    \@title \\
%    \@author \\
%    \vspace{3em}
%    \@endparpenalty\@M 
%  \end{center}}%

\newcommand{\makeumiabstract}{%
  \newpage{}
  \addcontentsline{toc}{chapter}{Abstract}
  \@beginparpenalty\@lowpenalty
  \begin{center}%
    ABSTRACT \\
    \@title \\
    \@author \\
    \vspace{3em}
    \@endparpenalty\@M
  \end{center}
  \@abstract \\[2em]
  \textbf{Dissertation Director:} \@director}%

\def\prefacesection#1{%
	\chapter*{#1}
	\addcontentsline{toc}{chapter}{#1}}

% Redefine \thebibliography to go to a new page and put an entry in the
% table of contents
\let\@ldthebibliography\thebibliography
\renewcommand{\thebibliography}[1]{\newpage
	\addcontentsline{toc}{chapter}{Bibliography}
	\@ldthebibliography{#1}}

\newcommand{\makelistoffigures}{
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}
\newpage
}

\newcommand{\makelistoftables}{
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}
\newpage
}

\newcommand{\makeabstract}{
  \prefacesection{Abstract}
  \@abstract}

%Make it easier to place figures
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}

% Start out normal
\pagestyle{plain}







