Debian Codegraph @

texmf-dist/source/latex/ut-thesis/ut-thesis.dtx

raw
1 % \iffalse
2 %<*driver>
3 \ProvidesFile{ut-thesis.dtx}
4 %</driver>
5 %<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
6 %<class>\ProvidesClass{ut-thesis}
7 %<*class>
8 [2024/07/26 v3.1.8 University of Toronto thesis class]
9 %</class>
10 %
11 %<*driver>
12 \documentclass[10pt]{ltxdoc}
13 \usepackage[osf]{mathpazo}
14 \usepackage[toc]{multitoc}
15 \renewcommand*{\multicolumntoc}{2}
16 \usepackage[margin=3cm,inner=5cm]{geometry}
17 \usepackage{xcolor}
18 \definecolor{code}{HTML}{990033}
19 \definecolor{link}{HTML}{006699}
20 \let\ottfamily\ttfamily
21 \renewcommand{\ttfamily}{\color{code}\ottfamily}
22 \renewcommand{\MacroFont}{\ttfamily\color{code}}
23 \usepackage[colorlinks,linkcolor=link,urlcolor=link]{hyperref}
24 \setlength{\skip\footins}{4ex}
25 \setlength{\parindent}{0pt}
26 \setlength{\parskip}{6pt}
27 \begin{document}
28 \DocInput{ut-thesis.dtx}
29 \end{document}
30 %</driver>
31 % \fi
32 %
33 % \GetFileInfo{ut-thesis.dtx}
34 %
35 % \title{The \textit{ut-thesis} class
36 % \thanks{\fileversion~[\filedate]\hfill
37 % \href{https://ctan.org/pkg/ut-thesis}{\texttt{https://ctan.org/pkg/ut-thesis}}\hfill
38 % \href{https://github.com/jessexknight/ut-thesis}{\texttt{github.com/jessexknight/ut-thesis}}}}
39 % \author{
40 % Francois Pitt,
41 % Jesse Knight
42 % \thanks{maintainer, contact:
43 % \href{mailto:[email protected]}
44 % {\texttt{[email protected]}}}
45 % }
46 %
47 % \maketitle
48 %
49 % \begin{abstract}\noindent
50 % The \textit{ut-thesis} document class implements the formatting requirements of
51 % the University of Toronto School of Graduate Studies (SGS),
52 % as of Fall 2020.
53 % \end{abstract}
54 %
55 % {\footnotesize\setlength{\parskip}{3pt}\tableofcontents}
56 % \clearpage
57 %
58 % \section{Installation}\label{inst}
59 %
60 % There are two main options to start using the class:
61 % \begin{itemize}
62 % \item \textbf{installing}: The \textit{ut-thesis} class is available
63 % under the major \LaTeX\ distributions (Linux: TeX Live, macOS: MacTeX, Windows: MiKTeX).
64 % Installation steps will depend on the distribution; some helpful information is
65 % \href{https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages}{here}.
66 % Within TeX Live, \textit{ut-thesis} is part of the
67 % \href{https://packages.ubuntu.com/kinetic/all/texlive-publishers/filelist}
68 % {publishers} bundle, so it should be available on Overleaf.
69 % \item \textbf{local file}: Place the file |ut-thesis.cls| in your project directory.
70 % The class will only be available in this directory.
71 % This works if you don't have write access in the \LaTeX\ distribution,
72 % or if you want to use an updated version of the class.
73 % \end{itemize}
74 %
75 % \section{Usage}\label{use}
76 %
77 % |\documentclass{ut-thesis}|\\
78 % |\documentclass[ <options> ]{ut-thesis}|
79 %
80 % The default options produce a final copy, ready for submission to
81 % the University of Toronto School of Graduate Studies (SGS).
82 % There is some example code on
83 % \href{https://github.com/jessexknight/ut-thesis/tree/master/test}{GitHub}.
84 %
85 % \subsection{Options}\label{use:opt}
86 %
87 % The default class options are denoted like |option*|.
88 %
89 % \subsubsection{Font Size}\label{use:opt:fontsize}
90 %
91 % \begin{macro}{[10pt*]}
92 % \begin{macro}{[11pt]}
93 % \begin{macro}{[12pt]}
94 % The three standard font sizes are supported.
95 % SGS requires at least 10\,pt font for the text,
96 % but captions, footnotes, etc.\ can be smaller.
97 % \end{macro}
98 % \end{macro}
99 % \end{macro}
100 %
101 % \subsubsection{Line Spacing}\label{use:opt:spacing}
102 %
103 % \begin{macro}{[singlespacing]}
104 % \begin{macro}{[onehalfspacing*]}
105 % \begin{macro}{[doublespacing]}
106 % Three options are available for line spacing.
107 % Note that |[singlespacing]| does not conform to the SGS guidelines,
108 % but we provide it in case you ever prefer it while writing.
109 % \end{macro}
110 % \end{macro}
111 % \end{macro}
112 %
113 % \subsubsection{Margins}\label{use:opt:margins}
114 %
115 % We aim to support both digital and print copies of the thesis,
116 % with two aspects affected:
117 % \begin{enumerate}
118 % \item whether margins are equal (digital) or unequal (print),
119 % where unequal margins include a wider inner margin for binding
120 % \item whether pages will be printed on one or both sides,
121 % essentially only relevant for print copies
122 % \end{enumerate}
123 %
124 % \begin{macro}{[equalmargins*]}
125 % The inner and outer margins are averaged
126 % to keep the |\textwidth| consistent with the |[unequalmargins]| option.
127 % \end{macro}
128 %
129 % \begin{macro}{[unequalmargins]}
130 % The outer margin is equal to the top and bottom margins;
131 % the inner margin is 0.50~inches wider than the outer margin.
132 % \end{macro}
133 %
134 % \begin{macro}{[oneside*]}
135 % All pages behave as if they open to the right (wider left margin);
136 % no extra blank pages.
137 % \end{macro}
138 %
139 % \begin{macro}{[twoside]}
140 % Most pages will alternate opening to the right and left;
141 % however, some commands which create new pages
142 % will always open to the right,
143 % sometimes requiring a blank page before to do so.
144 % See the |book| class for more information, as well as
145 % details about the |[openright*]| and |[openany]| options.
146 % \end{macro}
147 %
148 % Four widths of margins are defined based on
149 % the inner (left) and outer (right/top/bottom) dimensions.
150 % If |[equalmargins]| is used, the left/right margins are averaged.
151 %
152 % \begin{macro}{[narrowmargins]}
153 % Inner: 1.25 inch; outer: 0.75 inch
154 % (minimum SGS requirements)
155 % \end{macro}
156 % \begin{macro}{[normalmargins*]}
157 % Inner: 1.50 inch; outer: 1.00 inch
158 % \end{macro}
159 % \begin{macro}{[widemargins]}
160 % Inner: 1.75 inch; outer: 1.25 inch
161 % \end{macro}
162 % \begin{macro}{[extrawidemargins]}
163 % Inner: 2.00 inch; outer: 1.50 inch
164 % \end{macro}
165 %
166 % \subsubsection{Book Options}\label{use:opt:book}
167 %
168 % This class inherits from the standard \LaTeX\ |book| class,
169 % so all other |book| options are processed by that class.
170 % Two caveats are that |[titlepage]|/|[notitlepage]| have no effect and
171 % |[twocolumn]| has undefined behaviour.
172 %
173 % \subsection{Commands}\label{use:cmd}
174 %
175 % \subsubsection{Author Information}\label{use:cmd:author}
176 %
177 % The following 5 commands should be used in the preamble
178 % to define the content of the titlepage (|\maketitle|)
179 % and abstract page (|abstract| environment).
180 %
181 % \begin{macro}{\author}
182 % Your full name.
183 % \end{macro}
184 %
185 % \begin{macro}{\title}
186 % The title of your thesis.
187 % \end{macro}
188 %
189 % \begin{macro}{\degree}
190 % The title of your degree (spelled out, like ``Doctor of Philosophy'' not ``PhD'').
191 % \end{macro}
192 %
193 % \begin{macro}{\gradyear}
194 % The year of your degree completion.
195 % \end{macro}
196 %
197 % \begin{macro}{\department}
198 % The name of your department.
199 % The optional first argument (|\department[this]{}|)
200 % can be used to replace or leave blank
201 % the default text ``Department of'' preceeding the department name.
202 % \end{macro}
203 %
204 % If undefined, template values are used like ``(author)''.
205 %
206 % \begin{macro}{\copyrighttext}
207 % The copyright text printed on the titlepage.
208 % The default, which can be overwritten if needed, is:
209 % |{\copyright} Copyright {\@gradyear} by {\@author}|.
210 % \end{macro}
211 %
212 % \subsubsection{Document Parts}\label{use:cmd:parts}
213 %
214 % From the |book| class, four commands can be used to divide the document into major parts.
215 % These should be used in the order they appear here, as needed.
216 % The first two commands are necessary for the required SGS page numbering style.
217 %
218 % \begin{macro}{\frontmatter}
219 % Turns off chapter numbers, uses roman numerals for page numbers.\\
220 % Suggested use: immediately after |\begin{document}|.
221 % \end{macro}
222 %
223 % \begin{macro}{\mainmatter}
224 % Turns on chapter numbers, uses arabic numerals for page numbers.\\
225 % Suggested use: immediately before the first main |\chapter{}| command.
226 % \end{macro}
227 %
228 % \begin{macro}{\appendix}
229 % Uses letters for chapter numbers, no change to page numbers.\\
230 % Suggested use: immediately before the first appendix |\chapter{}| command.
231 % \end{macro}
232 %
233 % \begin{macro}{\backmatter}
234 % Turns off chapter numbers, no change to page numbers.\\
235 % Suggested use: immediately before |\printbibliography| or |\bibliography{}|.
236 % \end{macro}
237 %
238 % \subsubsection{Front Matter}\label{use:cmd:front}
239 %
240 % From the |book| class, the following commands are available to generate the frontmatter.
241 % These should be used in the order they appear here, as needed.
242 %
243 % \begin{macro}{\maketitle}
244 % Creates the title page according to SGS requirements,
245 % and adds a blank page following if using |[twoside]|.
246 % \end{macro}
247 %
248 % (The abstract page should appear here;
249 % see \S~\ref{use:env:abs}).
250 %
251 % (The dedication and acknowledgements should appear here, as needed;
252 % see \S~\ref{use:env:ded-ackn}).
253 %
254 % \begin{macro}{\tableofcontents}
255 % Prints the table of contents, starting on a new page.
256 % \end{macro}
257 %
258 % \begin{macro}{\listoftables}
259 % Prints the table of tables, starting on a new page.
260 % \end{macro}
261 %
262 % \begin{macro}{\listoffigures}
263 % Prints a table of figures, starting on a new page.
264 % \end{macro}
265 %
266 % \subsection{Environments}\label{use:env}
267 %
268 % \subsubsection{Abstract}\label{use:env:abs}
269 %
270 % \begin{macro}{abstract}
271 % Creates the abstract page according to SGS requirements,
272 % and adds a blank page if using |[twoside]|.
273 % The abstract content should be added within the environment,
274 % and should be no more than
275 % 350 words for a PhD thesis or
276 % 150 words for a Master's thesis.
277 % We do not provide tools for counting words.
278 % \end{macro}
279 %
280 % \subsubsection{Dedication \& Acknowledgements}\label{use:env:ded-ackn}
281 %
282 % \begin{macro}{dedication}
283 % The |dedication| environment formats text flush right and 1/3 down a new page.
284 % Not necessary for SGS requirements, so you can redefine this environment.
285 % \end{macro}
286 %
287 % \begin{macro}{acknowledgements}
288 % The |acknowledgements| environment creates a centered heading using |\section*{}|,
289 % and a new page after the text.
290 % Not necessary for SGS requirements, so you can redefine this environment.
291 % \end{macro}
292 %
293 % \subsubsection{Base Environments}\label{use:env:misc}
294 %
295 % As in the |book| class, the base environments
296 % like |figure|, |table|, and |equation| are sub-numbered
297 % within the current chapter like ``(2.1)'' for Equation~1 in Chapter~2.
298 % The behaviour is equivalent to: |\counterwithin{equation}{section}|,
299 % and can be undone with: |\counterwithout{equation}{section}|.
300 %
301 % For sub-figures, we recommend the |subcaption| package.
302 %
303 % The |quote| and |quotation| environments from the |book| class are also available.
304 %
305 % \clearpage
306 %
307 % \section{Implementation}\label{imp}
308 %
309 % \subsection{Margin Math}\label{imp:margins}
310 %
311 % First, we define a boolean |margins@equal| to store
312 % whether margins should be equal or not, plus
313 % two lengths to help us compute the margins:
314 % |\margin@base| is the minimum used directly for the top and bottom, and
315 % |\margin@offset| is the difference between inner/outer margins
316 % if they are not equal.
317 %
318 % \begin{macrocode}
319 \newif\ifmargins@equal
320 \newlength{\margin@base}
321 \newlength{\margin@offset}
322 \setlength{\margin@offset}{0.5in}
323 % \end{macrocode}
324 %
325 % After processing all options,
326 % we compute the margins using the above lengths,
327 % and adjust the placement of the header, footer, and margin notes.
328 % If margins are equal, we average |\margin@offset|
329 % to keep the |\textwidth| consistent with the unequal case.
330 %
331 % \begin{macrocode}
332 \AtEndOfClass{
333 \ifmargins@equal
334 \setlength{\leftmargin}{\dimexpr\margin@base+.5\margin@offset}
335 \setlength{\rightmargin}{\dimexpr\margin@base+.5\margin@offset}
336 \else
337 \setlength{\leftmargin}{\dimexpr\margin@base+\margin@offset}
338 \setlength{\rightmargin}{\dimexpr\margin@base}
339 \fi
340 \geometry{
341 top = \margin@base,
342 bottom = \margin@base,
343 inner = \leftmargin,
344 outer = \rightmargin,
345 headsep = \dimexpr0.5\margin@base-\headheight,
346 footskip = \dimexpr0.5\margin@base,
347 marginparwidth = \dimexpr\rightmargin-0.25in,
348 marginparsep = 0.125in,
349 }}
350 % \end{macrocode}
351 %
352 % \subsection{Option Declaration}\label{imp:opt}
353 %
354 % \subsubsection{Margins}\label{imp:opt:margins}
355 %
356 % Four margin width options are based on |\margin@base|:
357 %
358 % \begin{macrocode}
359 \DeclareOption{narrowmargins} {\setlength{\margin@base}{0.75in}}
360 \DeclareOption{normalmargins} {\setlength{\margin@base}{1.00in}}
361 \DeclareOption{widemargins} {\setlength{\margin@base}{1.25in}}
362 \DeclareOption{extrawidemargins}{\setlength{\margin@base}{1.50in}}
363 % \end{macrocode}
364 %
365 % Setting the margins either equal or unequal:
366 %
367 % \begin{macrocode}
368 \DeclareOption{equalmargins}{\margins@equaltrue}
369 \DeclareOption{unequalmargins}{\margins@equalfalse}
370 % \end{macrocode}
371 %
372 % \subsubsection{Line Spacing}\label{imp:opt:spacing}
373 %
374 % We're using the |setspace| package.
375 % We simply call one of the spacing commands after the class is loaded.
376 % So, be careful to place any line spacing commands within a group,
377 % or the global setting can be changed in the middle of the document.
378 %
379 % \begin{macrocode}
380 \DeclareOption{doublespacing}{%
381 \AtEndOfClass{\doublespacing}
382 }
383 \DeclareOption{onehalfspacing}{%
384 \AtEndOfClass{\onehalfspacing}
385 }
386 \DeclareOption{singlespacing}{%
387 \AtEndOfClass{\singlespacing}
388 }
389 % \end{macrocode}
390 %
391 % \subsubsection{Book Options}\label{imp:opt:misc}
392 %
393 % We need to redeclare the |oneside| option from |book| so that
394 % it can be used as a default:
395 %
396 % \begin{macrocode}
397 \DeclareOption{oneside}{\PassOptionsToClass{oneside}{book}}
398 % \end{macrocode}
399 %
400 % Finally, we try to process all remaining options using the |book| class,
401 % so the usual options and default values should be defined, like:
402 % \begin{itemize}
403 % \item font size: e.g. |10pt|, |11pt|, |12pt|
404 % \item sides: e.g. |oneside|, |twoside|
405 % \item open side for twoside: e.g. |openright|, |openany|
406 % \end{itemize}
407 %
408 % \begin{macrocode}
409 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
410 % \end{macrocode}
411 %
412 % \subsubsection{Default Options \& Processing}\label{imp:opt:proc}
413 %
414 % Executing the default options and processing.
415 % Any remaining options should now raise an error like:
416 % |LaTeX Warning: Unused global option(s): ...|
417 %
418 % \begin{macrocode}
419 \ExecuteOptions{onehalfspacing,normalmargins,equalmargins,oneside}
420 \ProcessOptions\relax
421 % \end{macrocode}
422 %
423 % \subsection{Loading Dependencies}\label{imp:load}
424 %
425 % We load the |book| class and the required packages.
426 %
427 % \begin{macrocode}
428 \LoadClass{book}
429 \RequirePackage{geometry} % for margins etc.
430 \RequirePackage{setspace} % for line spacing
431 % \end{macrocode}
432 %
433 % \subsection{Author Information}\label{imp:author}
434 %
435 % Getting the user inputs.
436 %
437 % \begin{macrocode}
438 \renewcommand*{\author} [1]{\gdef\@author{#1}}
439 \renewcommand*{\title} [1]{\gdef\@title{#1}}
440 \newcommand*{\degree} [1]{\gdef\@degree{#1}}
441 \newcommand*{\gradyear} [1]{\gdef\@gradyear{#1}}
442 \newcommand*{\department}[2][Department of]%
443 {\gdef\@deptpre{#1}\gdef\@deptname{#2}}
444 \newcommand*{\copyrighttext}[1]{\gdef\@copyrighttext{#1}}
445 % \end{macrocode}
446 %
447 % Setting default values that will mostly be overwritten.
448 %
449 % \begin{macrocode}
450 \author {(author)}
451 \title {(title)}
452 \degree {(degree)}
453 \gradyear {(gradyear)}
454 \department{(department)}
455 \copyrighttext{{\copyright} Copyright {\@gradyear} by {\@author}}
456 % \end{macrocode}
457 %
458 % \subsection{Front Matter}\label{imp:front}
459 %
460 % \subsubsection{Matter Commands}\label{imp:front:pp}
461 %
462 % We enforce that the |\frontmatter| and |\mainmatter| use the right
463 % page numbering and styles.
464 %
465 % \begin{macrocode}
466 \g@addto@macro\frontmatter{\pagenumbering{roman}\pagestyle{plain}}
467 \g@addto@macro\mainmatter {\pagenumbering{arabic}\pagestyle{headings}}
468 % \end{macrocode}
469 %
470 % \subsubsection{Title Page}\label{imp:front:title}
471 %
472 % We don't enforce firm distances between lines,
473 % but use |\vfill| to stretch and fill the space evenly,
474 % except for a double-sized gap after the author name.
475 % There is one part of space above the title,
476 % while the copyright is pushed all the way to the bottom.
477 %
478 % \begin{macrocode}
479 \renewcommand*{\maketitle}%
480 {\thispagestyle{empty}
481 \begin{center}
482 \large
483 \singlespacing
484 \null
485 \vfill
486 \textsc{\@title}
487 \vfill
488 by
489 \vfill
490 {\@author}
491 \vfill
492 \vfill
493 A thesis submitted in conformity with the requirements\\
494 for the degree of {\@degree}\\[1ex]
495 {\@deptpre} {\@deptname}\\
496 University of Toronto\\
497 \vfill
498 {\@copyrighttext}
499 \end{center}
500 {{\pagestyle{empty}\ocleardoublepage}}
501 }
502 % \end{macrocode}
503 %
504 % \subsubsection{Abstract Page}\label{imp:front:abs}
505 %
506 % The abstract is an environment, but it creates its own page
507 % (and possibly an extra empty page if using |twoside|).
508 % The author and title info is centered and singlespaced.
509 % The word ``Abstract'' uses the |\section*| style, without any numbering.
510 % The abstract content is doublespaced.
511 %
512 % \begin{macrocode}
513 \newenvironment*{abstract}%
514 {\thispagestyle{plain}
515 \begin{center}
516 \singlespacing
517 {\@title}\\[2ex]
518 {\@author}\\
519 {\@degree}\\[1ex]
520 {\@deptpre} {\@deptname}\\
521 University of Toronto\\
522 {\@gradyear}\\
523 \section*{Abstract}
524 \end{center}
525 \begingroup
526 \doublespacing}%
527 {\par\endgroup\cleardoublepage}
528 % \end{macrocode}
529 %
530 % \subsubsection{Dedication}\label{imp:front:ded}
531 %
532 % As described above.
533 %
534 % \begin{macrocode}
535 \newenvironment*{dedication}%
536 {\thispagestyle{plain}
537 \null
538 \vfill
539 \begin{flushright}}%
540 {\end{flushright}
541 \vfill
542 \vfill
543 \clearpage}
544 % \end{macrocode}
545 %
546 % \subsubsection{Acknowledgements}\label{imp:front:ackn}
547 %
548 % As described above.
549 %
550 % \begin{macrocode}
551 \newenvironment*{acknowledgements}%
552 {\thispagestyle{plain}
553 \begin{center}
554 \section*{Acknowledgements}
555 \end{center}
556 \begingroup}%
557 {\endgroup\clearpage}
558 % \end{macrocode}
559 %
560 % \subsection{Page Styles}\label{imp:hf}
561 %
562 % \subsubsection{Blank Pages}\label{imp:hf:blank}
563 %
564 % By default, all blank pages will have page style |plain|,
565 % but the original definition is stored in |\ocleardoublepage|.
566 %
567 % \begin{macrocode}
568 \let\ocleardoublepage\cleardoublepage
569 \def\cleardoublepage{{\newpage\pagestyle{plain}\ocleardoublepage}}
570 % \end{macrocode}
571 %
572 % \subsubsection{Headers \& Footers}\label{imp:hf:hf}
573 %
574 % We redefine the |headings| page style
575 % with a new formatting hook |\headerstyle{}|,
576 % but is otherwise similar to the original |headings|.
577 %
578 % \begin{macrocode}
579 \newcommand{\headerstyle}[1]{\footnotesize\MakeUppercase{#1}}
580 \if@twoside
581 \renewcommand*{\ps@headings}%
582 {\let\@mkboth\markboth
583 \let\@oddfoot\@empty
584 \let\@evenfoot\@empty
585 \def\@oddhead{\headerstyle{\rightmark\hfil\thepage}}%
586 \def\@evenhead{\headerstyle{\thepage\hfil\leftmark}}%
587 \def\chaptermark##1{\markboth{%
588 \if@mainmatter\headerstyle{\@chapapp\ \thechapter.\ ##1}\fi}{}}
589 \def\sectionmark##1{\markright{%
590 \if@mainmatter\headerstyle{\thesection.\ ##1}\fi}}}
591 \else
592 \renewcommand*{\ps@headings}%
593 {\let\@mkboth\markboth
594 \let\@oddfoot\@empty
595 \let\@evenfoot\@empty
596 \def\@oddhead{\headerstyle{\rightmark\hfil\thepage}}%
597 \def\chaptermark##1{\markright{%
598 \if@mainmatter\headerstyle{\@chapapp\ \thechapter.\ ##1}\fi}}}
599 \fi
600 % \end{macrocode}
601 %
602 % Default page style.
603 %
604 % \begin{macrocode}
605 \pagestyle{headings}
606 % \end{macrocode}
607 %
608 % \subsection{Spacing Adjustments}\label{imp:adj}
609 %
610 % The default spacing below captions is too small
611 % for captions on top of floats (e.g.\ for tables),
612 % so we make it consistent above and below.
613 %
614 % \begin{macrocode}
615 \setlength\abovecaptionskip{1ex}
616 \setlength\belowcaptionskip{1ex}
617 % \end{macrocode}
618 %
619 \endinput