source: doc/theses/andrew_beach_MMath/uw-ethesis.cls@ 6387f07

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 6387f07 was 912cc7d7, checked in by Andrew Beach <ajbeach@…>, 5 years ago

In Andrew/MMath; added a configuration command.

  • Property mode set to 100644
File size: 6.3 KB
Line 
1% A document class built from the uw-ethesis template, 2017-06-14 version.
2% This link should get to the regulations:
3% https://uwaterloo.ca/graduate-studies/thesis.
4%
5% WIP I am still moving things out of the provided template.
6%
7% This is approximately (check regulations to be sure) the required set up for
8% a thesis at UW. It also adds some other pieces that are likely to be useful.
9%
10% There are several formats you may choose from. These adjust the settings so
11% the document comes out a little better for different uses. "digital" is for
12% pdf documents that will remain on a computer while "print" is for printing
13% paper copies.
14%
15% Options:
16% <format>
17% All the formats are options, sets the document's format to that format.
18% If no format is given digital is the default.
19%
20% Exported Names:
21% \ethesissetup{<key-value-pairs>}
22% Preforms set-up (or a reconfiguration) of the document class. See the
23% Set-Up Keys section for the keys that may be passed in. Use commas to
24% seperate key-value-pairs.
25%
26% \ifformat{<format>}{<true>}{<false>}
27% If the document's format is <format> than expands to <true> otherwise
28% expands to <false>.
29%
30% \usehyperrefpackage[<options>]{<setup>}
31% Loads the hyperref package with <options> and preforms set up. The
32% initial setup depends on the document format but they can be overriden
33% with options in <setup> (set hyperref's \hypersetup for details).
34%
35% \eprint{<key>}
36% Expands to a human readable value tracked by the ethesis class. This
37% can be used to retreave and format values set during set up.
38%
39% Set-Up Keys:
40% author=<text>
41% title=<text>
42% program=<text>
43% subject=<text>
44% keywords=<text>
45% degree=masters|phd
46% faculty=ahs|arts|eng|env|math|sci
47\NeedsTeXFormat{LaTeX2e}
48\ProvidesClass{uw-ethesis}[2020/10/25 v0.2 UW-eThesis Template Document Class]
49
50\RequirePackage{etoolbox}
51\RequirePackage{xkeyval}
52
53% Requested Format:
54\newrobustcmd*{\ethesis@@format}{digital}
55\DeclareOption{print}{\renewrobustcmd*{\ethesis@@format}{print}}
56\DeclareOption{digital}{\renewrobustcmd*{\ethesis@@format}{digital}}
57
58\ProcessOptions\relax
59
60\newcommand\ifformat[3]{\ifdefstring{\ethesis@format}{#1}{#2}{#3}}
61
62\ifformat{print}{%
63 \LoadClass[letterpaper,12pt,titlepage,openright,twoside,final]{book}%
64}{%
65 \LoadClass[letterpaper,12pt,titlepage,twoside,final]{book}%
66}
67
68% Setting up the page margins. These are the minimum margins in the uWaterloo
69% thesis requirements. 1in (72pt) on the top, bottom and outside and
70% 1 1/8in (81pt) on the inside/gutter/binding side. Only required for
71% printing but here set for all formats.
72
73% If margin notes are used, you must adjust \textwidth, \marginparwidth and
74% \marginparsep so space between the margin notes and page edge is less than
75% 15mm (0.6in). I don't actually understand that instruction.
76
77\setlength{\marginparwidth}{0pt}
78
79% Width of space between body text and margin notes.
80\setlength{\marginparsep}{0pt}
81
82% Set width of margin on binding side. With oneside all pages are odd.
83\setlength{\evensidemargin}{0.125in}
84\setlength{\oddsidemargin}{0.125in}
85
86% Assuming US letter paper (8.5 in. x 11 in.) and side margins as above.
87\setlength{\textwidth}{6.375in}
88\raggedbottom
89
90% The following statement specifies the amount of space between paragraphs.
91% Other reasonable specifications are \bigskipamount and \smallskipamount.
92\setlength{\parskip}{\medskipamount}
93
94% The following statement controls the line spacing. You should not change
95% this value significantly (e.g. perhaps "1.2").
96\renewcommand{\baselinestretch}{1}
97
98% Normally every chapter will start on a recto (right-hand side) page. This
99% command is used to make sure the each section of the front pages starts on
100% a recto page. This will often require an empty verso (left-hand side) page
101% that should not have the page number printed on it.
102\let\ethesis@origdoublepage\cleardoublepage
103\newcommand{\clearemptydoublepage}{%
104 \clearpage{\pagestyle{empty}\ethesis@origdoublepage}}
105\let\cleardoublepage\clearemptydoublepage
106
107% Change the default name of the bibliography.
108\renewcommand*{\bibname}{References}
109
110\newrobustcmd*\ethesissetup[1]{\setkeys{ethesis}{#1}}
111
112\define@cmdkeys{ethesis}[ethesis@@]{%
113 author,title,program,subject,keywords}
114
115\define@choicekey{ethesis}{degree}{masters,phd}{\def\ethesis@@degree{#1}}
116\define@choicekey{ethesis}{faculty}{ahs,arts,eng,env,math,sci}%
117 {\def\ethesis@@faculty{#1}}
118
119\newrobustcmd*\eprint[1]{
120 \ifcsdef{ethesis@long#1}{\csuse{ethesis@long#1}}{%
121 \ifcsdef{ethesis@@#1}{\csuse{ethesis@@#1}}{%
122 % ERROR: (Check for a way to emit an actual error.)
123 [UW-eThesis doesn't know how to print: #1 ]
124 }
125 }
126}
127
128\newrobustcmd*\ethesis@longdegree{%
129 \ifdefstring{\ethesis@@degree}{phd}{Doctor of Philosophy}{Masters}}
130
131% Includes the hyperref package loading a number of defaults.
132\newrobustcmd*{\usehyperrefpackage}[2][]{%
133 \usepackage[#1]{hyperref}
134 \hypersetup{
135 plainpages=false, % Needed for Roman numbers in frontpages.
136 unicode=false, % Non-Latin characters in Acrobat ^ ^ s bookmarks.
137 pdftoolbar=true, % Show Acrobat ^ ^ s toolbar?
138 pdfmenubar=true, % Show Acrobat ^ ^ s menu?
139 pdffitwindow=false, % Window is not fit to page when opened.
140 pdfstartview={FitH}, % Fits the width of the page to the window.
141 }
142 \ifdef{\ethesis@@title}{\hypersetup{pdftitle={\ethesis@@title}}}{}
143 \ifdef{\ethesis@@author}{\hypersetup{pdfauthor={\ethesis@@author}}}{}
144 \ifdef{\ethesis@@subject}{\hypersetup{pdfsubject={\ethesis@@subject}}}{}
145 \ifdef{\ethesis@@keywords}{\hypersetup{pdfkeywords={\ethesis@@keywords}}}{}
146 \ifformat{print}{
147 \hypersetup{
148 %colorlinks=false,
149 colorlinks=true, % I think there is a style difference here.
150 citecolor=black,
151 filecolor=black,
152 linkcolor=black,
153 urlcolor=black
154 }
155 }{
156 \hypersetup{
157 colorlinks=true, % false: boxed links; true: colored links
158 linkcolor=blue, % colour of internal links
159 citecolor=green, % colour of links to bibliography
160 filecolor=magenta, % colour of file links
161 urlcolor=cyan % colour of external links
162 }
163 }
164 \notblank{#2}{\hypersetup{#2}}{}
165}
166
167% Includes the glossaries-extra package and sets up some helpers.
168% Except right now I don't really have any helpers to add.
169%\newrobustcmd*{\useglossariesextrapackage}[2][]{%
170% \usepackage[#1]{glossaries-extra}
171%}
172
173\let\colour=\color
Note: See TracBrowser for help on using the repository browser.