% MSU Thesis Class
%
% Copyright 2009,2010 by Alan Munn <amunn@msu.edu>
%
% This is a class file for producing dissertations and theses according to the 
% Michigan State University Graduate School Guidelines (2009-2011)
%
%
% This class may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or 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 2005/12/01 or later.
%
% This package has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this package is Alan Munn.
%
% This package consists of the following source files:  
% 	msu-thesis.cls, gb4e-compat.tex;  
% Documentation files:
%   msu-thesis.tex and msu-thesis.pdf; 
% A template file:
%   MSU-thesis-template.tex
% A test file and test bibliography: 
% 	MSU-thesis-testfile.tex, MSU-thesis-testfile.bib
% It also contains a copy of the LSA Unified Style Sheet for lingusitics: 
% 	unified.bst
%
% Version 1.0 2010/04/17 Initial release
% Version 1.1 2010/04/20 Require etex package (fix problem with qtree)
% Version 1.2 2010/07/01 Changed TOC depth to include subsubsections
%						Changed footmarkstyle to make footnote marker correct size
%						Changed section definitions to correct double spacing
% 						problem
% Version 1.3 2010/07/02	Fixed subscript size problem within footnotes
%						Changed TOC to have dotted leaders everywhere
% Version 1.3b 2010/07/02 Now requires at least Memoir v1.618033 [2008/05/27]
% Version 1.4 2010/08/23 Added options for all Masters degrees
% 						Added option [final] to generate additional titlepage
% 						and abstract
% 						Added new command \advisor for advisor name used in
% 						[final] mode
% 						Added new environment {msuabstract} for the abstract text
% 						Added new titling command \makeabstract which produces
% 						the abstracts
% 						Fixed first and additional abstract formatting problem
% 						Added warning about final mode for paper submission only
% 						in anticipation of electronic submission
% Version 1.4b 2010/12/11 Fixed problems with Appendix formatting in the TOC
% Version 1.5 2010/12/12	Removed code to format the second abstract since this
% 						is no longer part of the document with electronic 
% 						submission.  Removed \advisor command.
%
% Use at your own risk! 
% Report bugs/problems/questions to <amunn@msu.edu>
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{msu-thesis}[2010/12/12  Michigan State University Thesis Class version 1.5]
\DeclareOption{PhD}{\gdef\@degree{DOCTOR OF PHILOSOPHY}\gdef\@diss{DISSERTATION}}
\DeclareOption{MA}{\gdef\@degree{MASTER OF ARTS}\gdef\@diss{THESIS}}
\DeclareOption{MS}{\gdef\@degree{MASTER OF SCIENCE}\gdef\@diss{THESIS}}
\DeclareOption{MAT}{\gdef\@degree{MASTER OF ARTS FOR TEACHERS}\gdef\@diss{THESIS}}
\DeclareOption{MBA}{\gdef\@degree{MASTER OF BUSINESS ADMINISTRATION}\gdef\@diss{THESIS}}
\DeclareOption{MFA}{\gdef\@degree{MASTER OF FINE ARTS}\gdef\@diss{THESIS}}
\DeclareOption{MIPS}{\gdef\@degree{MASTER OF INTERNATIONAL PLANNING STUDIES}\gdef\@diss{THESIS}}
\DeclareOption{MHRL}{\gdef\@degree{MASTER OF HUMAN RESOURCES AND LABOR RELATIONS}\gdef\@diss{THESIS}}\DeclareOption{MMus}{\gdef\@degree{MASTER OF MUSIC}\gdef\@diss{THESIS}}
\DeclareOption{MSN}{\gdef\@degree{MASTER OF SCIENCE IN NURSING}\gdef\@diss{THESIS}}
\DeclareOption{MPP}{\gdef\@degree{MASTER OF PUBLIC POLICY}\gdef\@diss{THESIS}}
\DeclareOption{MSW}{\gdef\@degree{MASTER OF SOCIAL WORK}\gdef\@diss{THESIS}}
\DeclareOption{MURP}{\gdef\@degree{MASTER IN URBAN AND REGIONAL PLANNING}\gdef\@diss{THESIS}}

\ExecuteOptions{PhD}
\DeclareOption*{% 
\PassOptionsToClass{\CurrentOption}{memoir}% 
}
\ProcessOptions
\LoadClass[12pt,oneside,letterpaper]{memoir}[2008/05/27]
\RequirePackage{afterpage}[1995/10/27]
\RequirePackage{varioref}[2006/05/13]
\RequirePackage{etex}

% set up page for MSU Thesis guidelines
\settypeblocksize{9in}{6in}{*}
\setlrmargins{1.5in}{*}{*}
\setulmargins{1in}{*}{*}
\setheadfoot{\baselineskip}{.5in}
\AtBeginDocument{%
\checkandfixthelayout

% set up subscript sizes so that 10 pt is the smallest
% (MSU Requirement)
\DeclareMathSizes{12}{12}{10}{10}
\DeclareMathSizes{10.95}{10.95}{10}{10}
\DeclareMathSizes{10}{10}{10}{10}
}%

% This stuff is modifications of gb4e for linguistics
\@ifpackageloaded{gb4e}{\input{gb4e-compat.tex}}{\relax}


% set up standard titles (Most not needed; just contents)

\renewcommand*\contentsname{TABLE OF CONTENTS}

%\renewcommand{\title}[1]{\gdef\@title{\MakeUppercase{#1}}}
\addtoiargdef{\title}{%
  \begingroup\let\footnote\@gobble}{%
  \begingroup
    \renewcommand{\thanks}[1]{}
    \renewcommand{\thanksmark}[1]{}
    \renewcommand{\thanksgap}[1]{}
    \protected@xdef\thetitle{\MakeUppercase{#1}}
  \endgroup\endgroup}
\newif\ifappendices\appendicesfalse
\newcommand*{\@appendixcover}{\ifappendices{APPENDICES}\else{APPENDIX}\fi}
\newcommand*{\fieldofstudy}[1]{\gdef\@fieldofstudy{\MakeUppercase{#1}}}
\newcommand{\dedication}[1]{\gdef\@dedication{#1}}
\newcommand*{\degree}[1]{\gdef\@degree{\MakeUppercase{#1}}}
\newcommand*{\appendixcover}[1]{\gdef\@appendixcover{\MakeUppercase{#1}}}

% make msuabstract environment into a command for reuse (not really needed now)
\long\def\msuabstract#1\end{\gdef\@msuabstract{#1}\end} 
\newcommand*{\@titleintro}{A } % this is the beginning to the title page phrase



% make title 2in from top of page
\setlength{\droptitle}{.25in}

% set up the title page
\pretitle{\begin{center}\MakeUppercase}
\posttitle{\\[\baselineskip]\end{center}}
\preauthor{\begin{center}by\\[\baselineskip]}
\postauthor{\end{center}}
\predate{\vfill\begin{center}\@titleintro\@diss\\[\baselineskip]Submitted\\to Michigan State University\\in partial fulfillment of the requirements\\for the degree of\\[\baselineskip]\@degree\\[\baselineskip]\@fieldofstudy\\[\baselineskip]}

% set up the chapter titles
\chapterstyle{thatcher}
\setlength{\beforechapskip}{0pt}
%\setlength{\afterchapskip}{28pt}
\renewcommand*{\chapnamefont}{\centering\bfseries}
\renewcommand*{\chapnumfont}{\bfseries}
\renewcommand*{\chaptitlefont}{\bfseries}
\renewcommand*{\printchapternonum}{}
% set up the section styles
\setsecheadstyle{\SingleSpacing\large\bfseries}
\setsubsecheadstyle{\SingleSpacing\bfseries}
\setsubsubsecheadstyle{\SingleSpacing\bfseries}

% set up TOC
\maxtocdepth{subsubsection}
\setsecnumdepth{subsubsection}
\renewcommand*{\printtoctitle}[1]{\centering\bfseries\contentsname}
\renewcommand*{\cftchaptername}{Chapter\space}
\renewcommand*{\cftappendixname}{Appendix\space}
\renewcommand*{\cftchapterdotsep}{\cftdotsep}
\renewcommand*{\l@chapter}[2]{%
  \l@chapapp{\MakeUppercase{#1}}{#2}{\cftchaptername}} % Format chapter names
\renewcommand*{\l@appendix}[2]{%
  \l@chapapp{\MakeUppercase{#1}}{#2}{\cftappendixname}} % Format appendix names
\setlength{\cftchapternumwidth}{3em}
  

% set up footnotes
\footmarkstyle{\normalsize\textsuperscript{#1}} % reset size so that mark is right size
\setlength{\footmarkwidth}{1.8em} 
\setlength{\footmarksep}{-1.8em} 
\setlength{\footparindent}{1em} 
\renewcommand{\foottextfont}{\small}
\feetbelowfloat


\renewenvironment{abstract}{%
\pagestyle{empty}
   \chapter*{\abstractname} 
   \plainbreak{-1.5}
    \begin{center}
    		\thetitle\plainbreak{1}by\plainbreak{1}\theauthor
 	\end{center}
     \DoubleSpacing
   \thispagestyle{empty}}{}


\newcommand{\makeabstract}{%
\pagestyle{empty}\begin{abstract}
	\@msuabstract
\end{abstract}
}
% set up captions
\captionstyle[\centering]{\raggedright}

\pagestyle{plain}

% make the titlepage
\newcommand{\maketitlepage}{%
\begin{titlingpage}
\maketitle
\end{titlingpage}
\addtocounter{page}{1}}

% make the copyright page
\newcommand*{\makecopyrightpage}{%
\clearpage\thispagestyle{empty}
\vspace*{7in}
{\raggedleft Copyright by\\\theauthor\\\thedate\\}
\clearpage}

% make the dedication page
\newcommand*{\makededicationpage}{%
\clearpage\pagestyle{plain}
\chapter*{\ }
\vspace{.35\textheight}\begin{center}
\@dedication
\end{center}}

% make the appendices cover page
\newcommand*{\makeappendixcover}{%
\clearpage\pagestyle{plain}
\chapter*{\ }
\vspace{.35\textheight}\begin{center}
\bfseries\@appendixcover
\end{center}}

% make the bibliography page
\newcommand*{\makebibliographycover}{%
\clearpage\pagestyle{plain}
\chapter*{\ }
\vspace{.35\textheight}\begin{center}
\bfseries\MakeUppercase{\bibname}
\end{center}}

\endinput