summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ut-thesis/ut-thesis.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/ut-thesis/ut-thesis.dtx')
-rw-r--r--macros/latex/contrib/ut-thesis/ut-thesis.dtx265
1 files changed, 132 insertions, 133 deletions
diff --git a/macros/latex/contrib/ut-thesis/ut-thesis.dtx b/macros/latex/contrib/ut-thesis/ut-thesis.dtx
index 1478c5d25a..acb18a1f78 100644
--- a/macros/latex/contrib/ut-thesis/ut-thesis.dtx
+++ b/macros/latex/contrib/ut-thesis/ut-thesis.dtx
@@ -5,7 +5,7 @@
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{ut-thesis}
%<*class>
-[2021/07/20 v3.0.5 University of Toronto thesis class]
+[2021/08/26 v3.1.5 University of Toronto thesis class]
%</class>
%
%<*driver>
@@ -20,13 +20,10 @@
\let\ottfamily\ttfamily
\renewcommand{\ttfamily}{\color{code}\ottfamily}
\renewcommand{\MacroFont}{\ttfamily\color{code}}
-\usepackage[colorlinks,linkcolor=link]{hyperref}
+\usepackage[colorlinks,linkcolor=link,urlcolor=link]{hyperref}
\setlength{\skip\footins}{4ex}
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt}
-\newcommand{\smacro}[2][0]{%
- \begin{macro}{#2}\end{macro}%
- \vspace{\dimexpr #1\baselineskip-3\baselineskip}}
\begin{document}
\DocInput{ut-thesis.dtx}
\end{document}
@@ -65,7 +62,7 @@
% There are two ways to do this:
% \begin{itemize}
% \item \textbf{local file}: Place the file |ut-thesis.cls| in your project directory.
-% This is usually easiest, and works if you don't have write access
+% This works if you don't have write access
% in the \LaTeX\ distribution, such as if you use Overleaf.
% \item \textbf{installing}: Installation steps will depend on your \LaTeX\ distribution.
% Some helpful instructions can be found
@@ -84,72 +81,68 @@
%
% The default class options are denoted like |option*|.
%
-% \subsubsection{Paper Size}\label{use:opt:paper}
-%
-% The standard page sizes are supported, including:
-% |[letterpaper*]|, and |[a4paper]|.
-%
% \subsubsection{Font Size}\label{use:opt:fontsize}
%
-% \smacro[ 1]{[10pt*]}
-% \smacro[ 1]{[11pt]}
-% \smacro[-2]{[12pt]}
-% \begin{macro}{]}
+% \begin{macro}{[10pt*]}
+% \begin{macro}{[11pt]}
+% \begin{macro}{[12pt]}
% The three standard font sizes are supported.
% SGS requires at least 10\,pt font for the text,
% but captions, footnotes, etc.\ can be smaller.
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \subsubsection{Line Spacing}\label{use:opt:spacing}
%
-% \smacro[ 1]{[singlespacing]}
-% \smacro[ 1]{[onehalfspacing*]}
-% \smacro[-2]{[doublespacing]}
-% \begin{macro}{]}
+% \begin{macro}{[singlespacing]}
+% \begin{macro}{[onehalfspacing*]}
+% \begin{macro}{[doublespacing]}
% Three options are available for line spacing.
% Note that |[singlespacing]| does not conform to the SGS guidelines,
% but we provide it in case you ever prefer it while writing.
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \subsubsection{Margins}\label{use:opt:margins}
%
-% \paragraph{Sides:}
-% Three variants of margins are defined,
-% reflecting preferences for printing and binding,
-% the first two being the same as in the |book| class:
-%
-% \begin{macro}{[oneside]}
-% All pages behave as if they open to the right (wider left margin).
-% \end{macro}
-%
-% \begin{macro}{[twoside*]}
-% Most pages will alternate opening to the right and left;
-% however, the commands: |\maketitle|, |\begin{abstract}| and |\mainmatter|,
-% which create new pages, will always open to the right,
-% sometimes requiring a blank page before to do so.
+% We aim to support both digital and print copies of the thesis,
+% with two aspects affected:
+% \begin{enumerate}
+% \item whether margins are equal (digital) or unequal (print),
+% where unequal margins include a wider inner margin for binding
+% \item whether pages will be printed on one or both sides,
+% essentially only relevant for print copies
+% \end{enumerate}
+%
+% \begin{macro}{[equalmargins*]}
+% The inner and outer margins are averaged
+% to keep the |\textwidth| consistent with the |[unequalmargins]| option.
% \end{macro}
%
-% \begin{macro}{[equalmargins]}
-% The left and right margins are equal (averaged);
-% all pages behave as if they open to the right.
+% \begin{macro}{[unequalmargins]}
+% The outer margin is equal to the top and bottom margins;
+% the inner margin is 0.50~inches wider than the outer margin.
% \end{macro}
%
-% \paragraph{Opening:}
-% Only if |[twoside]| is used, two additional options from the |book| class
-% control how other new pages will open, including new pages created by:
-% |\listoftables|, |\listoffigures|, and |\chapter{}|.
-%
-% \begin{macro}{[openright*]}
-% These pages will always open to the right (like |\maketitle|, etc.).
+% \begin{macro}{[oneside*]}
+% All pages behave as if they open to the right (wider left margin);
+% no extra blank pages.
% \end{macro}
%
-% \begin{macro}{[openany]}
-% These pages can open to the left or right.
+% \begin{macro}{[twoside]}
+% Most pages will alternate opening to the right and left;
+% however, some commands which create new pages
+% will always open to the right,
+% sometimes requiring a blank page before to do so.
+% See the |book| class for more information, as well as
+% details about the |[openright*]| and |[openany]| options.
% \end{macro}
%
-% \paragraph{Widths:}
% Four widths of margins are defined based on
-% the inner (left) and outer (right/top/bottom) dimensions:
+% the inner (left) and outer (right/top/bottom) dimensions.
+% If |[equalmargins]| is used, the left/right margins are averaged.
%
% \begin{macro}{[narrowmargins]}
% Inner: 1.25 inch; outer: 0.75 inch
@@ -165,19 +158,20 @@
% Inner: 2.00 inch; outer: 1.50 inch
% \end{macro}
%
-% \subsubsection{Draft}\label{use:opt:draft}
+% \subsubsection{Book Options}\label{use:opt:book}
%
-% \begin{macro}{[draft]}
-% Adds ``DRAFT'' to all 4 corners, plus the date centered below the footer.
-% The default |draft| behaviour for the |book| class is also supported.
-% \end{macro}
+% This class inherits from the standard \LaTeX\ |book| class,
+% so all other |book| options are processed by that class.
+% Two caveats are that |[titlepage]|/|[notitlepage]| have no effect and
+% |[twocolumn]| has undefined behaviour.
%
% \subsection{Commands}\label{use:cmd}
%
% \subsubsection{Author Information}\label{use:cmd:author}
%
% The following 5 commands should be used in the preamble
-% to define the content of the titlepage (|\maketitle|) and abstract page (|abstract| environment).
+% to define the content of the titlepage (|\maketitle|)
+% and abstract page (|abstract| environment).
%
% \begin{macro}{\author}
% Your full name.
@@ -191,14 +185,17 @@
% The title of your degree (spelled out, like ``Doctor of Philosophy'' not ``PhD'').
% \end{macro}
%
-% \begin{macro}{\department}
-% The name of your department.
-% \end{macro}
-%
% \begin{macro}{\gradyear}
% The year of your degree completion.
% \end{macro}
%
+% \begin{macro}{\department}
+% The name of your department.
+% The optional first argument (|\department[this]{}|)
+% can be used to replace or leave blank
+% the default text ``Department of'' preceeding the department name.
+% \end{macro}
+%
% If undefined, template values are used like ``(author)''.
%
% \subsubsection{Document Parts}\label{use:cmd:parts}
@@ -272,14 +269,14 @@
% \subsubsection{Dedication \& Acknowledgements}\label{use:env:ded-ackn}
%
% \begin{macro}{dedication}
-% The |dedication| environment formats text flush right and 2/3 down a new page.
-% Not necessary for SGS requirements, so you're welcome to redefine this environment.
+% The |dedication| environment formats text flush right and 1/3 down a new page.
+% Not necessary for SGS requirements, so you can redefine this environment.
% \end{macro}
%
% \begin{macro}{acknowledgements}
% The |acknowledgements| environment creates a centered heading using |\section*{}|,
% and a new page after the text.
-% Not necessary for SGS requirements, so you're welcome to redefine this environment.
+% Not necessary for SGS requirements, so you can redefine this environment.
% \end{macro}
%
% \subsubsection{Base Environments}\label{use:env:misc}
@@ -298,81 +295,75 @@
%
% \section{Implementation}\label{imp}
%
-% \subsection{Option Declaration}\label{imp:opt}
-%
-% \subsubsection{Draft Mode}\label{imp:opt:draft}
-% Specifying |draft| adds ``DRAFT'' to all 4 corners,
-% plus the date centered below the footer.
-% The default |draft| behaviour for the |book| class is also supported.
-% \begin{macrocode}
-\newcommand{\draftmarkstyle}{\scriptsize\sffamily}
-\DeclareOption{draft}{%
- \PassOptionsToClass{\CurrentOption}{book}
- \AtEndOfClass{
- \AtBeginShipout{\AtBeginShipoutUpperLeft{%
- \draftmarkstyle
- \put(+0.125in, -0.125in-\f@size pt ){\rlap{DRAFT}}
- \put(-0.125in+\paperwidth,-0.125in-\f@size pt ){\llap{DRAFT}}
- \put(+0.125in, +0.125in-\paperheight){\rlap{DRAFT}}
- \put(-0.125in+\paperwidth,+0.125in-\paperheight){\llap{DRAFT}}
- \put(+0.5\paperwidth,+0.125in-\paperheight)%
- {\makebox[0in][c]{\today}}
-}}}}
-% \end{macrocode}
-%
-% \subsubsection{Margins}\label{imp:opt:margins}
-% First, we define three lengths to help us compute the margins:
-% |\margin@v| is the top and bottom margins;
-% |\margin@xhi| is the inner margin offset;
-% |\margin@xho| is the outer margin offset.
-% \begin{macrocode}
-\newlength{\margin@v}
-\newlength{\margin@xhi}\setlength{\margin@xhi}{0.5in}
-\newlength{\margin@xho}\setlength{\margin@xho}{0.0in}
-% \end{macrocode}
+% \subsection{Margin Math}\label{imp:margins}
%
-% The options are based off |\margin@v|:
-% \begin{macrocode}
-\DeclareOption{narrowmargins} {\setlength{\margin@v}{0.75in}}
-\DeclareOption{normalmargins} {\setlength{\margin@v}{1.00in}}
-\DeclareOption{widemargins} {\setlength{\margin@v}{1.25in}}
-\DeclareOption{extrawidemargins}{\setlength{\margin@v}{1.50in}}
-% \end{macrocode}
+% First, we define a boolean |margins@equal| to store
+% whether margins should be equal or not, plus
+% two lengths to help us compute the margins:
+% |\margin@base| is the minimum used directly for the top and bottom, and
+% |\margin@offset| is the difference between inner/outer margins
+% if they are not equal.
%
-% For digital copies, |equalmargins| may be preferred.
-% However, to keep the |\textwidth| consistent
-% for any of the above margin options with and without |equalmargins|,
-% we simply average the inner and outer offsets:
% \begin{macrocode}
-\DeclareOption{equalmargins}%
- {\setlength{\margin@xho}{0.5\margin@xhi}
- \setlength{\margin@xhi}{0.5\margin@xhi}}
+\newif\ifmargins@equal
+\newlength{\margin@base}
+\newlength{\margin@offset}
+\setlength{\margin@offset}{0.5in}
% \end{macrocode}
%
-% Finally, we actually compute the margins using the above three lengths,
+% After processing all options,
+% we compute the margins using the above lengths,
% and adjust the placement of the header, footer, and margin notes.
+% If margins are equal, we average |\margin@offset|
+% to keep the |\textwidth| consistent with the unequal case.
+%
% \begin{macrocode}
\AtEndOfClass{
- \setlength{\leftmargin}{\dimexpr\margin@v+\margin@xhi}
- \setlength{\rightmargin}{\dimexpr\margin@v+\margin@xho}
+ \ifmargins@equal
+ \setlength{\leftmargin}{\dimexpr\margin@base+.5\margin@offset}
+ \setlength{\rightmargin}{\dimexpr\margin@base+.5\margin@offset}
+ \else
+ \setlength{\leftmargin}{\dimexpr\margin@base+\margin@offset}
+ \setlength{\rightmargin}{\dimexpr\margin@base}
+ \fi
\geometry{
- top = \margin@v,
- bottom = \margin@v,
+ top = \margin@base,
+ bottom = \margin@base,
inner = \leftmargin,
outer = \rightmargin,
- headsep = \dimexpr 0.5\margin@v - \headheight,
- footskip = \dimexpr 0.5\margin@v,
- marginparwidth = \dimexpr \rightmargin - 0.25in,
+ headsep = \dimexpr0.5\margin@base-\headheight,
+ footskip = \dimexpr0.5\margin@base,
+ marginparwidth = \dimexpr\rightmargin-0.25in,
marginparsep = 0.125in,
}}
% \end{macrocode}
%
+% \subsection{Option Declaration}\label{imp:opt}
+%
+% \subsubsection{Margins}\label{imp:opt:margins}
+%
+% Four margin width options are based on |\margin@base|:
+%
+% \begin{macrocode}
+\DeclareOption{narrowmargins} {\setlength{\margin@base}{0.75in}}
+\DeclareOption{normalmargins} {\setlength{\margin@base}{1.00in}}
+\DeclareOption{widemargins} {\setlength{\margin@base}{1.25in}}
+\DeclareOption{extrawidemargins}{\setlength{\margin@base}{1.50in}}
+% \end{macrocode}
+%
+% Setting the margins either equal or unequal:
+%
+% \begin{macrocode}
+\DeclareOption{equalmargins}{\margins@equaltrue}
+\DeclareOption{unequalmargins}{\margins@equalfalse}
+% \end{macrocode}
+%
% \subsubsection{Line Spacing}\label{imp:opt:spacing}
+%
% We're using the |setspace| package.
% We simply call one of the spacing commands after the class is loaded.
% So, be careful to place any line spacing commands within a group,
% or the global setting can be changed in the middle of the document.
-% The default is |onehalfspacing|.
%
% \begin{macrocode}
\DeclareOption{doublespacing}{%
@@ -388,11 +379,18 @@
%
% \subsubsection{Book Options}\label{imp:opt:misc}
%
+% We need to redeclare the |oneside| option from |book| so that
+% it can be used as a default:
+%
+% \begin{macrocode}
+\DeclareOption{oneside}{\PassOptionsToClass{oneside}{book}}
+% \end{macrocode}
+%
% Finally, we try to process all remaining options using the |book| class,
% so the usual options and default values should be defined, like:
% \begin{itemize}
-% \item page size: e.g. |letterpaper|, |a4paper|, \dots
% \item font size: e.g. |10pt|, |11pt|, |12pt|
+% \item sides: e.g. |oneside|, |twoside|
% \item open side for twoside: e.g. |openright|, |openany|
% \end{itemize}
%
@@ -407,18 +405,16 @@
% |LaTeX Warning: Unused global option(s): ...|
%
% \begin{macrocode}
-\ExecuteOptions{letterpaper} % book
-\ExecuteOptions{normalmargins,onehalfspacing,chapterhead} % ut-thesis
-\ProcessOptions
+\ExecuteOptions{onehalfspacing,normalmargins,equalmargins,oneside}
+\ProcessOptions\relax
% \end{macrocode}
%
-% \subsection{Initialization}\label{imp:init}
+% \subsection{Loading Dependencies}\label{imp:load}
+%
% We load the |book| class and the required packages.
%
% \begin{macrocode}
\LoadClass{book}
-\RequirePackage{picture} % for draft mode
-\RequirePackage{atbegshi} % for draft mode
\RequirePackage{geometry} % for margins etc.
\RequirePackage{setspace} % for line spacing
% \end{macrocode}
@@ -431,8 +427,9 @@
\renewcommand*{\author} [1]{\gdef\@author{#1}}
\renewcommand*{\title} [1]{\gdef\@title{#1}}
\newcommand*{\degree} [1]{\gdef\@degree{#1}}
-\newcommand*{\department}[1]{\gdef\@department{#1}}
\newcommand*{\gradyear} [1]{\gdef\@gradyear{#1}}
+\newcommand*{\department}[2][Department of]%
+ {\gdef\@deptpre{#1}\gdef\@deptname{#2}}
% \end{macrocode}
%
% Setting default values that will hopefully be overwritten.
@@ -441,23 +438,19 @@
\author {(author)}
\title {(title)}
\degree {(degree)}
-\department{(department)}
\gradyear {(gradyear)}
+\department{(department)}
% \end{macrocode}
%
% \subsection{Front Matter}\label{imp:front}
%
% \subsubsection{Matter Commands}\label{imp:front:pp}
+%
% We enforce that the |\frontmatter| and |\mainmatter| use the right
% page numbering and styles.
-% Also, if we are using |[twoside]|,
-% then we need to reduce all page numbers in the front matter by 1,
-% so that the |abstract| is page ``ii'',
-% because adjusting the |page| counter directly causes typesetting problems,
-% such as incorrect alternating margins.
+%
% \begin{macrocode}
-\newcommand{\@romanskip}[1]{\@roman{\if@twoside\numexpr#1-1\else#1\fi}}
-\g@addto@macro\frontmatter{\pagenumbering{romanskip}\pagestyle{plain}}
+\g@addto@macro\frontmatter{\pagenumbering{roman}\pagestyle{plain}}
\g@addto@macro\mainmatter {\pagenumbering{arabic}\pagestyle{headings}}
% \end{macrocode}
%
@@ -486,7 +479,7 @@
\vfill
A thesis submitted in conformity with the requirements\\
for the degree of {\@degree}\\[1ex]
- Graduate Department of {\@department}\\
+ {\@deptpre} {\@deptname}\\
University of Toronto\\
\vfill
{\copyright} Copyright {\@gradyear} by {\@author}
@@ -511,7 +504,7 @@
{\@title}\\[2ex]
{\@author}\\
{\@degree}\\[1ex]
- Graduate Department of {\@department}\\
+ {\@deptpre} {\@deptname}\\
University of Toronto\\
{\@gradyear}\\
\section*{Abstract}
@@ -554,17 +547,21 @@
% \subsection{Page Styles}\label{imp:hf}
%
% \subsubsection{Blank Pages}\label{imp:hf:blank}
+%
% By default, all blank pages will have page style |plain|,
% but the original definition is stored in |\ocleardoublepage|.
+%
% \begin{macrocode}
\let\ocleardoublepage\cleardoublepage
\def\cleardoublepage{{\newpage\pagestyle{plain}\ocleardoublepage}}
% \end{macrocode}
%
% \subsubsection{Headers \& Footers}\label{imp:hf:hf}
+%
% We redefine the |headings| page style
% with a new formatting hook |\headerstyle{}|,
% but is otherwise similar to the original |headings|.
+%
% \begin{macrocode}
\newcommand{\headerstyle}[1]{\footnotesize\MakeUppercase{#1}}
\if@twoside
@@ -590,11 +587,13 @@
% \end{macrocode}
%
% Default page style.
+%
% \begin{macrocode}
\pagestyle{headings}
% \end{macrocode}
%
% \subsection{Spacing Adjustments}\label{imp:adj}
+%
% The default spacing below captions is too small
% for captions on top of floats (e.g.\ for tables),
% so we make it consistent above and below.