\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{RutgersThesis}
	[2020-12-04 James Holland's LaTeX package attempting to approximate the Rutgers' Doctoral Electronic Thesis and Dissertation Style Guide]
	
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	OPTIONS AND SETUP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\newif\if@titlepage \@titlepagetrue
	\newif\if@mainmatter \@mainmattertrue
	\newif\if@frontmatter \@frontmatterfalse
	\newif\if@chapterformat\@chapterformatfalse
	\newif\if@sectionformat\@sectionformatfalse
	\newif\if@copyright \@copyrighttrue
%---------------------------------------------------------------------------------------
	\DeclareOption{chapterformat}{\@chapterformattrue\@sectionformatfalse}
	\DeclareOption{sectionformat}{\@sectionformattrue\@chapterformatfalse}
	\DeclareOption{nocopyright}{\@copyrightfalse}
%---------------------------------------------------------------------------------------
%---------------------------------------------------------------------------------------
	\ProcessOptions
%---------------------------------------------------------------------------------------
	
	
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	PACKAGES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	\RequirePackage{setspace}		% Required for doublespaced text, singlespaced foot/endnotes, singlespaced backmatter
	\AtBeginDocument{\doublespace}
	\RequirePackage{textcase}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	ADDED MACROS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	\renewcommand{\author}[1]{\def\@author{#1}}
%---------------------------------------------------------------------------------------
	\def\provideenvironment{\@star@or@long\provide@environment} % Used for checking whether a certain environment already exists, functions similarly to \providecommand
	\def\provide@environment#1{%
			\@ifundefined{#1}%
					{\def\reserved@a{\newenvironment{#1}}}%
					{\def\reserved@a{\renewenvironment{dummy@environ}}}%
			\reserved@a
	}
	\def\dummy@environ{}
%---------------------------------------------------------------------------------------
	\providecommand*\ifcounter[1]{% Used for checking whether a certain counter already exists (e.g. whether chapters exist)
	  \ifcsname c@#1\endcsname
		\expandafter\@firstoftwo
	  \else
		\expandafter\@secondoftwo
	  \fi
	}
%---------------------------------------------------------------------------------------
	\providecommand{\titleformatting}{}
		\renewcommand{\titleformatting}{}
	\providecommand{\authortitlepageformatting}{}
		\renewcommand{\titleformatting}{}
	\providecommand{\abstractformatting}{}
		\renewcommand{\abstractformatting}{}
	\providecommand{\titlepageformatting}{}
		\renewcommand{\abstractformatting}{}
	\if@chapterformat %
	\else%
		\if@sectionformat%
		\else%
			\renewcommand{\titleformatting}{\large\bfseries}
			\renewcommand{\abstractformatting}{\large\bfseries}
		\fi%
	\fi
%---------------------------------------------------------------------------------------
	\let\@title\@empty
	\let\@author\@empty
	\let\@date\@empty
	\def\@department{[Use \textbackslash department\{official program name\} to set the program's name]}
	\def\@director{[Use\textbackslash director\{full name\} to set the Dissertation director's name]}
	\def\@committeenumber{4}
	\newcommand{\department}{\gdef\@department}
	\newcommand{\director}{\gdef\@director}
	\newcommand{\committeenumber}{\gdef\@committeenumber}
%---------------------------------------------------------------------------------------
\providecommand{\chapter}{\@ifstar {\clearpage \section*}{\clearpage \section}}
	

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	COUNTERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	\setcounter{secnumdepth}{2}
	\ifcounter{chapter}{\@addtoreset{footnote}{chapter}}{%
		\newcounter{chapter}%
		\@addtoreset{footnote}{section}%
		\@addtoreset{section}{chapter}%
		\let\@variantsection\section%
		\renewcommand{\section}{\newpage\@variantsection}%
	}
	\renewcommand{\thefootnote}{\arabic{footnote}}
	
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	PAGE STYLE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	\setlength\paperheight{11in} %	dimensions for the page
	\setlength\paperwidth{8.5in}
	\setlength\voffset{-1in}
	\setlength\topmargin{.5in}
	\setlength\headheight{0in}
	\setlength\headsep{.5in}
	\setlength\marginparsep{0pt}
	\setlength\marginparwidth{0pt}
	\setlength\footskip{.5in}
	\setlength\oddsidemargin{.5in}
	\setlength\hoffset{0in}
	\setlength\textwidth{6in}
	\setlength\textheight{9in}

	
	\def\ps@headings{%  Page style for the main text
		\if@frontmatter
			\def\@oddfoot{\hfill\normalfont\thepage\hfill}%
			\def\@oddhead{}%
			\let\@mkboth\markboth%
		\else
			\def\@oddfoot{}%
			\def\@oddhead{\hfill\normalfont\thepage}%
			\let\@mkboth\markboth%
		\fi
	}
	
	\def\ps@plain{\ps@headings}
	
	
	\pagestyle{headings}
	\pagenumbering{arabic}
	\raggedbottom
	\onecolumn

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	FRONT MATTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%----------------------------------------------------------------------------------
\newcommand{\copywritepage}{
	~\vfil
	\begin{center}
		\copyright\the\year \\
		\@author\\
		\MakeTextUppercase{All Rights Reserved}
	\end{center}
	\vfil~
	\thispagestyle{empty}
}
%----------------------------------------------------------------------------------
\provideenvironment{abstract}{}{}



\@ifclassloaded{amsart}{
	\renewenvironment{abstract}%
	{%
		\clearpage
		\begin{center}
			\def\newpage{} \def\clearpage{} \def\cleardoublepage{} 
			\if@sectionformat
				\section*{Abstract of the Dissertation}
				\addcontentsline{toc}{section}{Abstract of the Dissertation}
			\else
				\if@chapterformat
					\chapter*{Abstract of the Dissertation}
					\addcontentsline{toc}{chapter}{Abstract of the Dissertation}
				\else
					{\abstractformatting\MakeUppercase{Abstract of the Dissertation}}\\
					\addcontentsline{toc}{chapter}{Abstract of the Dissertation}
				\fi
			\fi
			\@title\\
			By \MakeTextUppercase{\@author}\\~\\
			Dissertation Director:\\
			\@director
		\end{center}
		~\\~\\
	}{%
		\clearpage
	}
}{

\@ifclassloaded{amsproc}{
\renewenvironment{abstract}%
	{%
		\clearpage
		\begin{center}
			\def\newpage{} \def\clearpage{} \def\cleardoublepage{} 
			\if@sectionformat
				\section*{Abstract of the Dissertation}
				\addcontentsline{toc}{section}{Abstract of the Dissertation}
			\else
				\if@chapterformat
					\chapter*{Abstract of the Dissertation}
					\addcontentsline{toc}{chapter}{Abstract of the Dissertation}
				\else
					{\abstractformatting\MakeUppercase{Abstract of the Dissertation}}\\
					\addcontentsline{toc}{chapter}{Abstract of the Dissertation}
				\fi
			\fi
			\@title\\
			By \MakeTextUppercase{\@author}\\~\\
			Dissertation Director:\\
			\@director
		\end{center}
		~\\~\\
	}{%
		\clearpage
	}
}{

\@ifclassloaded{amsbook}{
\renewenvironment{abstract}%
	{%
		\clearpage
		\begin{center}
			\def\newpage{} \def\clearpage{} \def\cleardoublepage{} 
			\if@sectionformat
				\section*{Abstract of the Dissertation}
				\addcontentsline{toc}{section}{Abstract of the Dissertation}
			\else
				\if@chapterformat
					\chapter*{Abstract of the Dissertation}
					\addcontentsline{toc}{section}{Abstract of the Dissertation}
				\else
					{\abstractformatting\MakeUppercase{Abstract of the Dissertation}}\\
					\addcontentsline{toc}{chapter}{Abstract of the Dissertation}
				\fi
			\fi
			\@title\\
			By \MakeTextUppercase{\@author}\\~\\
			Dissertation Director:\\
			\@director
		\end{center}
		~\\~\\
	}{%
		\clearpage
	}
}{

\renewenvironment{abstract}%
	{%
		\clearpage
		\begin{center}
			\def\newpage{} \def\clearpage{} \def\cleardoublepage{} 
			\if@sectionformat
				\section*{\centering\abstractformatting Abstract of the Dissertation}
				\addcontentsline{toc}{section}{Abstract of the Dissertation}
			\else
				\if@chapterformat
					\chapter*{\centering\abstractformatting Abstract of the Dissertation}
					\addcontentsline{toc}{chapter}{Abstract of the Dissertation}
				\else
					{\abstractformatting\MakeUppercase{Abstract of the Dissertation}}\\
					\addcontentsline{toc}{chapter}{Abstract of the Dissertation}
				\fi
			\fi
			\@title\\
			By \MakeTextUppercase{\@author}\\~\\
			Dissertation Director:\\
			\@director
		\end{center}
		~\\~\\
	}{%
		\clearpage
	}

}
}
}
%----------------------------------------------------------------------------------
\provideenvironment{acknowledgments}{}{}



\@ifclassloaded{amsart}{
	\renewenvironment{acknowledgments}%
	{%
		\clearpage
		\begin{center}
			\def\newpage{} \def\clearpage{} \def\cleardoublepage{} 
			\if@sectionformat
				\section*{Acknowledgments}
				\addcontentsline{toc}{section}{Acknowledgments}
			\else
				\if@chapterformat
					\chapter*{Acknowledgments}
					\addcontentsline{toc}{chapter}{Acknowledgments}
				\else
					{\abstractformatting\MakeUppercase{Acknowledgments}}\\
					\addcontentsline{toc}{chapter}{Acknowledgments}
				\fi
			\fi
		\end{center}
		~\\~\\
	}{%
		\clearpage
	}
}{

\@ifclassloaded{amsproc}{
\renewenvironment{acknowledgments}
	{
		\clearpage
		\begin{center}
		\def\newpage{} \def\clearpage{} \def\cleardoublepage{}
		\if@sectionformat
			 \section*{Acknowledgments}
			 \addcontentsline{toc}{section}{Acknowledgments}
		\else
			\if@chapterformat
				\chapter*{Acknowledgments}
				\addcontentsline{toc}{chapter}{Acknowledgments}
			\else
				{\abstractformatting \MakeTextUppercase{Acknowledgments}}
				\addcontentsline{toc}{chapter}{Acknowledgments}
			\fi
		\fi
		\end{center}
		~\\~\\
	}{
		\clearpage
	}
}{

\@ifclassloaded{amsbook}{
\renewenvironment{acknowledgments}
	{
		\clearpage
		\begin{center}
		\def\newpage{} \def\clearpage{} \def\cleardoublepage{}
		\if@sectionformat
			 \section*{Acknowledgments}
			 \addcontentsline{toc}{section}{Acknowledgments}
		\else
			\if@chapterformat
				\chapter*{Acknowledgments}
				\addcontentsline{toc}{chapter}{Acknowledgments}
			\else
				{\abstractformatting \MakeTextUppercase{Acknowledgments}}
				\addcontentsline{toc}{chapter}{Acknowledgments}
			\fi
		\fi
		\end{center}
		~\\~\\
	}{
		\clearpage
	}
}{

\renewenvironment{acknowledgments}
	{
		\clearpage
		\begin{center}
		\def\newpage{} \def\clearpage{} \def\cleardoublepage{}
		\if@sectionformat
			 \section*{\centering \abstractformatting Acknowledgments}
			 \addcontentsline{toc}{section}{Acknowledgments}
		\else
			\if@chapterformat
				\chapter*{\centering \abstractformatting Acknowledgments}
				\addcontentsline{toc}{chapter}{Acknowledgments}
			\else
				{\abstractformatting \MakeTextUppercase{Acknowledgments}}
				\addcontentsline{toc}{chapter}{Acknowledgments}
			\fi
		\fi
		\end{center}
		~\\~\\
	}{
		\clearpage
	}

}
}
}

	
%----------------------------------------------------------------------------------
\newcommand{\printcommitteelines}{
	% #1: image path and core part of name
	% #2: maximum number
	\newcount\tmp
	\tmp=0
	\loop
		% increment dummy counter
		\advance\tmp by 1
		% include the image
		\rule{3.5in}{.5pt}\\
		% repeat the loop provided the counter is within specified bound
		\ifnum\tmp<\@committeenumber
	\repeat
}

\renewenvironment{titlepage}
	{%
		\clearpage
		\thispagestyle{empty}
		\pagestyle{empty}%
		\setcounter{page}\@ne
	}%
	{\clearpage
	}
	

\renewcommand\maketitle{
	\if@copyright
		\copywritepage{}
	\fi
	\begin{titlepage}%
		\global\let\thanks\relax
		\global\let\@thanks\@empty
		\let\footnoterule\relax
		\let\footnote\relax
		\thispagestyle{empty}%
		\begin{center}
			\titlepageformatting
			{\titleformatting \MakeTextUppercase{\@title}}\\
			By\\
			{\authortitlepageformatting \MakeTextUppercase{\@author}}\\
			A dissertation submitted to the\\
			School of Graduate Studies\\
			Rutgers, The State University of New Jersey\\
			In partial fulfillment of the requirements\\
			For the degree of\\
			Doctor of Philosophy\\
			Graduate Program in \@department\\
			Written under the direction of\\
			\@director\\
			And approved by\\
			\printcommitteelines{}
			New Brunswick, New Jersey\\
			\@date
		\end{center}
	\end{titlepage}
	\setcounter{footnote}{0}%
	\global\let\maketitle\relax
	\global\let\and\relax
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	LOCATION FORMAT (matters, etc.)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
%---------------------------------------------------------------------------------------
	\providecommand{\mainmatter}{}
	\providecommand{\frontmatter}{}
	\providecommand{\backmatter}{}
	
	\renewcommand\frontmatter{%
		\clearpage
		\@mainmatterfalse
		\@frontmattertrue
		\pagestyle{headings}
		\pagenumbering{roman}%
		\setcounter{chapter}{0}%
		\setcounter{section}{0}%
		\def\@frontback{}
	}
%---------------------------------------------------------------------------------------
	\renewcommand\mainmatter{%
		\addtocontents{toc}{\protect\addvspace{15pt}}
		\clearpage
		\@mainmattertrue
		\@frontmatterfalse
		\pagestyle{headings}
		\pagenumbering{arabic}
		\setcounter{chapter}{0}%
		\setcounter{section}{0}%
	}
%---------------------------------------------------------------------------------------
	\renewcommand\backmatter{%
		\addtocontents{toc}{\protect\addvspace{15pt}}
		\clearpage
		\@mainmatterfalse
		\@frontmatterfalse
		\pagestyle{headings}
		\setcounter{chapter}{0}%
		\setcounter{section}{0}%
		\singlespace
	}
%---------------------------------------------------------------------------------------
%---------------------------------------------------------------------------------------


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	LISTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newlength\fivespaces{}
\settowidth{\fivespaces}{\ \ \ \ \ }
	
%---------------------------------------------------------------------------------------
\renewenvironment{verse}
	{%
		\let\\\@centercr
		\list{}{%
			\itemsep			\z@
			\itemindent	-1.5em%
			\listparindent\itemindent
			\rightmargin	\leftmargin
			\setlength{\leftmargin}{\fivespaces}
			\advance\leftmargin 1.5em
		}%
		\item\relax\singlespace
	}{%
			\endlist%
	}
\newenvironment{shortverse}
	{%
		\let\\\@centercr
		\list{}{%
			\itemsep			\z@
			\itemindent	-1.5em%
			\listparindent\itemindent
			\rightmargin	\leftmargin
			\setlength{\leftmargin}{\fivespaces}
			\advance\leftmargin 1.5em
		}%
		\item\relax%
	}{%
			\endlist%
	}
%---------------------------------------------------------------------------------------
\newenvironment{shortquotation}%
	{%
		\list{}{\listparindent 1.5em%
		\itemindent		\listparindent
		\rightmargin	\leftmargin
		\setlength{\leftmargin}{\fivespaces}
		\parsep				\z@ \@plus\p@}%
		\item\relax
	}{%
		\endlist%
	}

\renewenvironment{quotation}%
	{%
		\list{}{
		\listparindent 1.5em%
		\itemindent		\listparindent
		\rightmargin	\leftmargin
		\setlength{\leftmargin}{\fivespaces}
		\parsep				\z@ \@plus\p@}%
		\item\relax\singlespace
	}{%
		\endlist%
	}
%---------------------------------------------------------------------------------------
\newenvironment{shortquote}
	{\list{}{\rightmargin\leftmargin \setlength{\leftmargin}{\fivespaces} }%
		\item\relax}
	{\endlist}
							
\renewenvironment{quote}
	{\list{}{\rightmargin\leftmargin \setlength{\leftmargin}{\fivespaces} }%
		\item\relax\singlespace}
	{\endlist}
%---------------------------------------------------------------------------------------


\endinput
%%
%% End of file `RutgersThesis.sty'.
