% Bishop's University report document class
% (c) 2024 Stefan D. Bruda <stefan@bruda.ca>
%
% You can redistribute this class and/or modify it under the terms of
% the GNU Lesser General Public License as published by the Free
% Software Foundation <http://www.gnu.org/licenses/lgpl.html>; either
% version 3 of the License, or (at your option) any later version.
% 
% This document class is distributed in the hope that it will be
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% Lesser General Public License for more details.

\long\def\comment#1{}
\comment{

  This document class defines the format of various graduate reports
  in the department of Computer Science at Bishop's University
  including but not necessarily limited to the thesis proposal and the
  research progress report.  It is a relatively thin layer on top of
  the ``article'' standard document class, with changes mostly in the
  title area.  We also define the margins and fonts, we set page
  headers and footers, we disallow page breaks at hyphens, and we set
  the style of all the hyperlinks (such as references and citations).
  We also define proofs and theorem-like environments as per the
  ``amsthm'' style with explicit numbering rules.

  Font sizes of 10-, 11-, and 12-point are all acceptable.  The
  recommended size (and also the default) is 11-point.  Provide the
  document class option ``10pt'' or ``12pt'' to use a 10-point or
  12-point font size, respectively.

  The use of this document class is compulsory for all the graduate
  reports in the department.  We further recommend (but do not
  require) the use of BibTeX to manage references with the ``siam''
  bibliography style.

  The following commands control the title area in addition to the
  usual \title and \author.  They all have sensible defaults and so
  can be omitted in most cases.

  \report defines the kind of report being produced and defaults to
  ``thesis proposal'' if omitted.

  \dept defines the department and defaults to ``Department of
  Computer Science'' if omitted.

  \degree defines the degree sought and defaults to ``Master of
  Science'' if omitted.

  Example of use:

    \documentclass{bureport}

    \begin{document}
    \title{How to Write Reports\\
        With Two Line Titles}
    \author{John Henry Candidate}
    \report{miscellaneous report}

    \maketitle
 
    \section{Introduction}
      ...
    \section{Literature Review}
      ...
    \section{Conclusions}
      ...
    \bibliographystyle{siam}
    \bibliography{mybib}
    \end{document}

}

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{bureport}[2024/03/20 v1.1 Bishop's University report document class]
\typeout{`bureport.cls' is free software; you are welcome to redistribute it under certain conditions, see http://www.gnu.org/licenses/lgpl.html.}

%\def\titlerunning#1{\gdef\@titleRunning{#1}}
%\def\authorrunning#1{\gdef\@authorRunning{#1}}
%\titlerunning{bureport: Missing running title}
%\authorrunning{bureport: Missing running author}

\def\baseFontSize#1{\gdef\@BaseFontSize{#1}}
\def\headHeightSize#1{\gdef\@HeadHeightSize{#1}}

\def\@BaseFontSize{11pt}
\def\@HeadHeightSize{13.6pt}

\DeclareOption{8pt}{\PackageWarning{bureport}{Font size '\CurrentOption' is too small, use at least 10pt.}}
\DeclareOption{9pt}{\PackageWarning{bureport}{Font size '\CurrentOption' is too small, use at least 10pt.}}
\DeclareOption{10pt}{\baseFontSize{10pt}\headHeightSize{12.0pt}}
\DeclareOption{11pt}{\baseFontSize{11pt}\headHeightSize{13.6pt}}
\DeclareOption{12pt}{\baseFontSize{12pt}\headHeightSize{14.5pt}}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ExecuteOptions{}
\ProcessOptions\relax

\LoadClass[oneside,letterpaper,\@BaseFontSize]{article}

% Most theses use external figures
\RequirePackage{graphicx}

% amsthm handles proofs nicely
\RequirePackage{amsthm}

% All the theorem-like environments are numbered together, but
% definition are numbered separately.

\newtheorem{definition}{Definition}[section]

\newtheorem{theorem}{Theorem}[section]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}

\RequirePackage{xcolor}
\RequirePackage{hyperref}

% Sensible hyperlink colors:
\hypersetup{
    colorlinks,
    linkcolor={red!50!black},
    citecolor={blue!50!black},
    urlcolor={blue!80!black}
}

% Head height is dependent on the font point size
\setlength{\headheight}{\@HeadHeightSize}

% 1" margin size all over
\RequirePackage[left=1in, right=1in, top=1in, bottom=1in]{geometry}

% Use Palatino for most fonts and Computer Modern as fixed width font
% (which is a very nice combination):
%\RequirePackage{palatino,mathpple}
\RequirePackage{newpxtext}
\RequirePackage{newpxmath}
\renewcommand{\ttdefault}{cmtt}
\SetMathAlphabet\mathtt{normal}{OT1}{cmtt}{m}{n}

% Disallow page breaks at hyphens (this will give some underfull vbox's,
% so an alternative is to use \brokenpenalty=100 and manually search
% for and fix such page breaks)
\brokenpenalty=10000

% More space to place floats.
\renewcommand{\topfraction}{0.95}
\renewcommand{\bottomfraction}{0.95}
\renewcommand{\textfraction}{0.05}
\renewcommand{\floatpagefraction}{0.8}

\RequirePackage{fancyhdr}
\pagestyle{fancy}

% \author, \title, \dept, \degree are defined in article;
% here are the rest of the front matter defining macros
\def\dept#1{\gdef\@dept{#1}}
\def\degree#1{\gdef\@degree{#1}}
\def\report#1{\gdef\@report{#1}}

%\def\@title{}\def\@author{}

\def\@dept{Department of Computer Science}
\def\@degree{Master of Science}
\def\@report{thesis proposal}

%From authoraftertitle.sty (https://ctan.org/pkg/authoraftertitle)
\newcommand\Originalauthor{}
\let\Originalauthor\author
\renewcommand*{\author}[1]{%
  \Originalauthor{#1}%
  \renewcommand*{\MyAuthor}{#1}%
}
\newcommand*{\MyAuthor}{}

\fancyhead{}
\fancyhead[LO,LE]{\expandafter\MakeUppercase\expandafter{\MyAuthor: \@report}}
\fancyfoot{}
\fancyfoot[CO,CE]{\thepage}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% Title:

\let\oldmaketitle=\maketitle
\def\@maketitle{%
	\newpage
	\null
	\vspace{-1cm}
	\begin{center}%
		\let \footnote \thanks
		{\sc\LARGE{\@title}\par}
                \vskip 0.8\baselineskip
                {\large\sc by\par}
                \vskip 0.8\baselineskip
                \begin{tabular}[t]{c}%
                  \large\sc
                  \@author
                \end{tabular}\par
                \let\@runauthor=\@author
                \begin{quote}
                  \large
                  A \@report\ submitted to the
                  \@dept\ at Bishop's University
                  in conformity with the requirements for
                  the degree of \@degree.
                \end{quote}
		%\vskip 0.5\baselineskip
                {\large\sc
		\@date}
	\end{center}%
	\par
	%\vskip \baselineskip
}

% Abstract:

\renewenvironment{abstract}{%
  \begin{quotation}
    \noindent
    \textbf{Abstract:}\quad
  }
  {\end{quotation}}

\endinput
