
%% *****************************************************
% UPDATED VERSION AS OF 2012
%
% updated by Sayan Roy, 09/05/2012, removes unneeded part of abstract, fixed font problem and this file is designed FOR THESIS HAVING MORE THAN ONE ABSTRACT
%
%
%
% ndsuthesis.cls 
% North Dakota State University Thesis document class for LaTeX2e
% created by Jorge Alberto Calvo, 2002/08/07
%
% This is the main file for the ndsuthesis document class, which is 
% intended to meet the requirements for the North Dakota State 
% University Ph.D. dissertations and Masters' disquisitions.
% 
% This file replaces earlier versions of ndsudisq.sty and 
% ndthesis.cls, both of which are now obsolete and inadequate for 
% disquisitions at NDSU.
%
% The ndsuthesis document class was build on top of the Standard LaTeX 
% document class article [1996/10/31 v1.3u].  Usage beyond what is 
% described in the accompanying document ``Using the NDSU Thesis 
% Document Class for LaTeX'' or changes in the implementation of the 
% article document class may result in unpredictable behavior.
%
%% *****************************************************

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{ndsuthesis}[2002/08/07 v1.0]

\newcommand{\NDSUtype}{ms-thesis}
\DeclareOption{phd}{\renewcommand{\NDSUtype}{phd}}
\DeclareOption{thesis}{\renewcommand{\NDSUtype}{ms-thesis}}
\DeclareOption{paper}{\renewcommand{\NDSUtype}{ms-paper}}
\DeclareOption{ma-thesis}{\renewcommand{\NDSUtype}{ma-thesis}}
\DeclareOption{ma-paper}{\renewcommand{\NDSUtype}{ma-paper}}

\newcommand{\NDSUams}{ams}
\DeclareOption{nomath}{\renewcommand{\NDSUams}{nil}}

\DeclareOption{draft}{\PassOptionsToClass{draft}{article}}
\DeclareOption{final}{\PassOptionsToClass{final}{article}}

\DeclareOption*{\OptionNotUsed}
\ProcessOptions\relax

%% The ndsuthesis class is based on the standard article class using 
%% the 12pt option.  In addition the draft/final options may be used.
%%  
%% The ifthen package by Leslie Lamport and David Carlisle is used to
%% deal with conditionals.
%%
%% The setspace package by Geoffrey Tobin is used to switch between 
%% single and double spacing.
%%
%% The amsmath package by the American Mathematical Society is used
%% to implement the underlining required at the top of the List of 
%% Tables and List of Figures.

\LoadClass[10pt, leqno]{article}

\RequirePackage{ifthen}
\RequirePackage{setspace}
\RequirePackage{amsmath}
\ifthenelse{\equal{\NDSUams}{ams}}{%
     \RequirePackage{amsthm}
     \RequirePackage{amscd}
     \RequirePackage{amsxtra}
     \RequirePackage{upref}
     \RequirePackage{amsfonts}}{}

%% The following code defines an all caps command \allcaps (used for 
%% chapter headings throughout the disquisition) and an underline 
%% command \underln (used at the top of the List of Tables and List of 
%% Figures).

\newcommand{\allcaps}[1]{\uppercase\expandafter{#1}}
\newcommand{\underln}[1]{$\underline{\text{#1}}$}

%% *****************************************************

%% Margins, Page Numbers, Hyphenation, and Double Spacing.

%% The standard margins required by the Graduate School are 1.375in 
%% on the left and 1in for the right, top, and bottom.  Here they are 
%% set just a smidge larger (1 smidge < .1in) to account for expansion 
%% when copying, except for the bottom margin which is approximately 
%% 1.125in to allow enough room between the bottom of the text and the 
%% page number.

\normalsize
\setlength{\textwidth}{6in}
\setlength{\textheight}{8.75in}
\setlength{\evensidemargin}{.25in}
\setlength{\oddsidemargin}{.25in}
\setlength{\topmargin}{-.5in}
\setlength{\footskip}{.4in}
\setlength{\baselineskip}{13pt}
\setlength{\parindent}{10mm}

%% Page numbers are required to be produced by the same font
%% attributes as the rest of the text.  The following commands place 
%% page numbers at the center of the footer, the bottom of which 
%% should be no less than .75in from the bottom of the page.

\let\scriptsize\normalsize
\pagestyle{plain}
\pagenumbering{roman}

%% Although hyphenation is allowed in the main body of the 
%% disquisition, the Graduate School discourages its use.  The 
%% following command eliminates hyphenation.  (But see \mainbody.)

\hyphenpenalty=10000

%% Except for special occasions (in the Cover Page, Abstract Page, 
%% Table of Contents, List of Tables, List of Figures, and 
%% References), the body of the disquisition should be double spaced.

\doublespacing

%% *****************************************************

%% Prefactory Material.

%% The prefactory material of the disquisition should contain a Cover 
%% Page, an Approval Page, an Abstract, and a Table of Contents.  Some
%% departments require or allow other pages, such as an Acknowledgment 
%% or a Dedication page, which follow the Abstract.  For all optional 
%% pages or sections, the main heading must match the style of the 
%% Table of Contents heading.  When optional pages are included in the 
%% disquisition, they must be listed in the Table of Contents.

%% Cover Page.  
%%
%% The command \coverpage creates a standard Cover Page.  There is an 
%% optional argument (default = 15mm) which controls the blank space left 
%% between the different components of the page.  If provided, the 
%% optional argument to \title is used on the cover page; this allows 
%% for more control over line breaks.

%% Approval Page. 
%%
%% All copies of the disquisition must include an Approval of 
%% Disquisition Page that follows the title page.  This page must bear
%% the signatures of those members of the advisory/supervisory 
%% committee who have approved the disquisition and of the chair of 
%% the major department or director of the program.  The original 
%% form, available only at the Graduate School, must be submitted with 
%% the final, approved copies.

%% Abstract.
%%
%% The environment abstract produces the appropriate output for the 
%% abstract page.  In this page, the introductory paragraph is 
%% single-spaced; the text is double-spaced.  Thesis and paper 
%% abstracts must not exceed one page.  Dissertation abstracts
%% must not exceed 350 words.

%% Table of Contents, List of Tables, List of Figures.
%%
%% The List of Tables and List of Figures follow the Table of Contents 
%% when appropriate.  Tables and figures must be placed within the 
%% text after their first mention.  Tables and figures which are not 
%% pertinent to the text may be placed in an appendix.
%%
%% The following parameters adjust the visual appearance of the Table 
%% of Contents, List of Tables, and List of Figures.  You may need to 
%% change these if your disquisition is longer than 99 pages.

\renewcommand{\@pnumwidth}{5.7mm}
\renewcommand{\@tocrmarg}{10mm}
\renewcommand{\@dotsep}{2}

\newcommand{\NDSUtitle}{Title}
\newcommand{\NDSUtitlealt}{Title for Cover}
\newcommand{\NDSUfname}{Firstname}
\newcommand{\NDSUlname}{Lastname}
\newcommand{\NDSUcoll}{College of Science and Mathematics}
\newcommand{\NDSUdept}{Mathematics}
\newcommand{\NDSUprof}{Thesis Advisor}
\newcommand{\NDSUdate}{%
     \ifcase\month\or January\or February\or March\or April\or May\or June\or 
     July\or August\or September\or October\or November\or December\fi
     \space\number\year}

\renewcommand{\title}[2][?]{%
     \ifthenelse{\equal{#1}{?}}
          {\renewcommand{\NDSUtitlealt}{#2}}
	  {\renewcommand{\NDSUtitlealt}{#1}}
     \renewcommand{\NDSUtitle}{#2}}
\newcommand{\name}[2]{%
     \renewcommand{\NDSUfname}{#1}
     \renewcommand{\NDSUlname}{#2}}
\newcommand{\college}[1]{\renewcommand{\NDSUcoll}{#1}}
\newcommand{\department}[1]{\renewcommand{\NDSUdept}{#1}}
\newcommand{\professor}[1]{\renewcommand{\NDSUprof}{#1}}
\renewcommand{\date}[1]{\renewcommand{\NDSUdate}{#1}}

\newcommand{\coverpage}[1][15mm]{%
     \clearpage
     \thispagestyle{empty}
     \begin{center}
     {\bf 
        \vspace{#1}
        \begin{spacing}{2} 
        {\large \allcaps{\NDSUtitlealt}} \par  
        \end{spacing}
        \vspace{#1}
        \begin{spacing}{1}  
        \ifthenelse{\equal{\NDSUtype}{phd}}{A Dissertation}{%
        \ifthenelse{\equal{\NDSUtype}{ms-thesis}}{A Thesis}{%
        \ifthenelse{\equal{\NDSUtype}{ms-paper}}{A Paper}{%
        \ifthenelse{\equal{\NDSUtype}{ma-thesis}}{A Thesis}{%
        \ifthenelse{\equal{\NDSUtype}{ma-paper}}{A Paper}{}}}}} \\
         Submitted to the Graduate Faculty \\
         of the \\ 
         North Dakota State University \\
         of Agriculture and Applied Science \par 
        \end{spacing}
        \vspace{#1}
        \begin{spacing}{2}
         By \\
         \NDSUfname \, \NDSUlname \par 
        \end{spacing}
        \vspace{#1}
        \begin{spacing}{1} 
        In Partial Fulfillment of the Requirements \\
         for the Degree of \\  
        \ifthenelse{\equal{\NDSUtype}{phd}}{DOCTOR OF PHILOSOPHY}{%
        \ifthenelse{\equal{\NDSUtype}{ms-thesis}}{MASTER OF SCIENCE}{%
        \ifthenelse{\equal{\NDSUtype}{ms-paper}}{MASTER OF SCIENCE}{%
        \ifthenelse{\equal{\NDSUtype}{ma-thesis}}{MASTER OF ARTS}{%
        \ifthenelse{\equal{\NDSUtype}{ma-paper}}{MASTER OF ARTS}{}}}}} \par
        \vspace{#1}
         Major Department: \\ 
         \NDSUdept \par 
        \vspace{#1}
         \NDSUdate \par 
        \vspace{#1}
         Fargo, North Dakota
        \end{spacing}}
     \end{center}
     \clearpage}
     
\renewenvironment{abstract}{%
     \setcounter{page}{3}
     \section*{\abstractname}
     \vspace{11pt}
     \vspace{.25in} 
     \begin{spacing}{2}}{%
     \end{spacing}
     \clearpage}
     
\renewcommand\tableofcontents{%
     \section*{\contentsname}
     \vspace{11pt}
     \begin{spacing}{1}
     \@starttoc{toc}
     \end{spacing}}

\renewcommand\listoffigures{%
    \section*{\listfigurename}
     \noindent \underln{Figure} \hfill \underln{Page} \par
% *****JC ***** 6/11/2008
     \vspace{18pt} 
     \begin{spacing}{1}
     \@starttoc{lof}
     \end{spacing}}

\renewcommand\listoftables{%
    \section*{\listtablename}
     \noindent \underln{Table} \hfill \underln{Page}
% *****JC ***** 6/11/2008
     \vspace{18pt} 
     \begin{spacing}{1}
     \@starttoc{lot}
     \end{spacing}}


%% *****************************************************

%% Main Body.
     
%% The command \mainbody sets up the proper formatting for the Main 
%% Body of the disquisition, which should be have page numbers in 
%% arabic numerals, starting with 1.

\newcommand{\mainbody}{%
     \clearpage
     \pagenumbering{arabic}
     \setcounter{page}{1}
     \hyphenpenalty=500}
     
%% *****************************************************
     
%% Section Titles.  

%% The top-level sections of the disquisition are also called chapters.  
%% Thus, the terms chapter and section are completely synonymous.  
%% Chapters are divided into subsections, and subsections into 
%% subsubsections.  We treat the Table of Contents, the List of 
%% Figures, the List of Tables, the References, as well as all 
%% unnumbered sections in the prefactory part (e.g., dedications, 
%% acknowledgments, etc.)  of the dissertation and all appendices as 
%% chapters.  All chapters should appear in the Table of Contents,
%% with the sole exception of the Table of Contents itself.  

\renewcommand{\abstractname}{Abstract}
\renewcommand{\appendixname}{Appendix}
\renewcommand{\contentsname}{Table Of Contents}
\renewcommand{\listfigurename}{List Of Figures}
\renewcommand{\listtablename}{List Of Tables}
\renewcommand{\refname}{References}
\newcommand{\sectionname}{Chapter}

\setcounter{section}{0}
\setcounter{subsection}{0}
\newcounter{appendix}
\renewcommand{\theappendix}{{appendix}}

\newcommand{\chapter}{\secdef\NDSUseca\NDSUsecb}
\renewcommand{\section}{\secdef\NDSUseca\NDSUsecb}
\newcommand{\NDSUseca}[2][?]{% --> \section[toc-entry]{title}
     \cleardoublepage
     \refstepcounter{section}
     \begin{center} 
     {\bf { \allcaps{\sectionname\;\thesection. #2}}}
     \end{center}
     \addcontentsline{toc}{subsection}
          {\allcaps{CHAPTER \thesection.\;\;#1}}
		
     \addtocontents{toc}{\quad}}
\newcommand{\NDSUsecb}[2][?]{% --> \section*[toc-entry]{title}
     \cleardoublepage
     \begin{center} 
     {\bf { \allcaps{#2}}}
     \end{center}
     \ifthenelse{\equal{#2}{\contentsname}}{}{%
     \ifthenelse{\equal{#1}{?}}{%
          \addcontentsline{toc}{subsection}{\allcaps{#2}}
	  \addtocontents{toc}{\quad}}{%
          \addcontentsline{toc}{subsection}{\allcaps{#1}}
	  \addtocontents{toc}{\quad}}}}

\renewcommand{\subsection}{\secdef\NDSUsseca\NDSUssecb}
\newcommand{\NDSUsseca}[2][?]{% --> \subsection[toc-entry]{title}
     \refstepcounter{subsection}
% *****JC ***** 6/11/2008
 \noindent {\bf \thesubsection. #2} \par 
%     \begin{center}
%     {\bf \thesubsection. #2} 
%     \end{center}
     \addcontentsline{toc}{subsubsection}{\thesubsection.\;\;#1}
     \addtocontents{toc}{\quad}}
\newcommand{\NDSUssecb}[2][?]{% --> \subsection*[toc-entry]{title}
     \noindent {\bf #2} \par     
     \ifthenelse{\equal{#1}{?}}{%
          \addcontentsline{toc}{subsubsection}{#2}
	  \addtocontents{toc}{\quad}}{%
          \addcontentsline{toc}{subsubsection}{#1}
	  \addtocontents{toc}{\quad}}}

\renewcommand{\subsubsection}{\secdef\NDSUssseca\NDSUsssecb}
\newcommand{\NDSUssseca}[2][?]{% --> \subsubsection[toc-entry]{title}
     \refstepcounter{subsubsection}
     \noindent {\bf \thesubsubsection. #2} \par
     \addcontentsline{toc}{subsubsection}
          {\hspace{13mm}\thesubsubsection.\;\;#1}
     \addtocontents{toc}{\quad}}
\newcommand{\NDSUsssecb}[2][?]{% --> \subsubsection*[toc-entry]{title}
     \noindent {\bf #2} \par
     \ifthenelse{\equal{#1}{?}}{%
          \addcontentsline{toc}{subsubsection}{\hspace{13mm}#2}
	  \addtocontents{toc}{\quad}}{%
          \addcontentsline{toc}{subsubsection}{\hspace{13mm}#1}
	  \addtocontents{toc}{\quad}}}

\renewcommand{\appendix}{\secdef\NDSUappa\NDSUsecb}
\newcommand{\NDSUappa}[2][?]{% --> \appendix[toc-entry]{title}
     \cleardoublepage
     \refstepcounter{appendix}
     \begin{center} 
     { \allcaps{\appendixname\;\theappendix. #2}} 
     \end{center}
     \addcontentsline{toc}{subsection}
          {\allcaps{\appendixname\;\theappendix.\;\;#1}}
     \addtocontents{toc}{\quad}}

%% *****************************************************

%% Figure and Table Captions.  

%% The caption for a figure should appear in the text AFTER the 
%% figure, CENTERED on the page, and within the borders of the 
%% figure.  

%% The caption for a table should appear in the text BEFORE the 
%% table and LEFT JUSTIFIED to the page's margin.  

%% Captions should also appear as entries in the List of Figures and 
%% the List of Tables, as appropriate.  If these are longer than one 
%% line, they should appear as single spaced.  
     
%% The \caption[width]{caption.text} command takes an optional 
%% argument which, in the case of figures, sets the width of the 
%% caption.
   
\newcommand{\NDSUfloat}{nil}
\renewenvironment{figure}{%
     \renewcommand{\NDSUfloat}{lof}
     \@float{figure}}{%
     \renewcommand{\NDSUfloat}{nil}
     \end@float}
\renewenvironment{table}{%
     \renewcommand{\NDSUfloat}{lot}
     \@float{table}}{%
     \renewcommand{\NDSUfloat}{nil}
     \vspace{12pt}
     \end@float}
\let\NDSUcaption\caption
\renewcommand{\caption}[2][?]{%
     \ifthenelse{\equal{#1}{?}}{%
          \NDSUcaption{#2}}{%
     \ifthenelse{\equal{\NDSUfloat}{lof}}{%
          \begin{center}
	  \begin{minipage}[t]{#1}
	  \NDSUcaption{#2}
	  \end{minipage}
	  \end{center}}{%
          \NDSUcaption{#2}}}
     \addtocontents{\NDSUfloat}{\quad}}
\renewcommand{\@makecaption}[2]{#1. #2\par}
% \long\def\@makecaption#1#2{%
%      \vskip 10pt 
%      #1. #2\par}
     
%% *****************************************************

%% References.  

%% The Reference section can be constructed manually by using the 
%% references environment and the \bibitem command.

\newenvironment{references}[1][0]{%
     \begin{thebibliography}{0}
     \hyphenpenalty=10000
     \begin{spacing}{1}    
     \vspace{-1pt}}{%
     \end{spacing}
     \end{thebibliography}}

%% See the LaTeX companion for more information.

%% Alternatively, BibTeX may be used.  In this case, use:
%
%  \bibliographystyle{ndsuthesis} 
%  \bibliography{<bibdatabase>}
% 
%% where bibdatabase is a .bib data file.  In this case ndsuthesis.bst 
%% automatically sets up the Reference section according to the AMS 
%% standard form (amsplain).  See the LaTeX companion for more 
%% information on the proper usage of BibTeX.

%% *****************************************************
