summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/utexasthesis/utexasthesis.cls
blob: 18e3c69a090456e2e57ccbd4554d63d4b1da0f16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
% UT Austin graduate thesis style. https://github.com/linguistics/utexas-latex
% License: CC0 (https://creativecommons.org/publicdomain/zero/1.0/)
\NeedsTeXFormat{LaTeX2e}%[1994/06/01]
\ProvidesClass{utexasthesis}[2018/08/21 v1.0 University of Texas at Austin graduate thesis style]

% prepare boolean variables and set defaults
\newif\if@masters\@mastersfalse
\newif\if@copyright\@copyrightfalse
\newif\if@draft\@draftfalse
% handle optional arguments
\DeclareOption{masters}{\@masterstrue}
\DeclareOption{copyright}{\@copyrighttrue}
\DeclareOption{draft}{\@drafttrue\PassOptionsToClass{draft}{report}}
% capture the basic setspace package options for passing into setspace later
\def\@setspaceoption{onehalfspacing}
\DeclareOption{singlespacing}{\gdef\@setspaceoption{singlespacing}}
\DeclareOption{onehalfspacing}{\gdef\@setspaceoption{onehalfspacing}}
\DeclareOption{doublespacing}{\gdef\@setspaceoption{doublespacing}}
% handle font size, warning for 10pt and 11pt, defaulting to 12pt
\def\@sizeoption{12pt}
\newcommand{\@sizeoption@warning}{%
  \ClassWarningNoLine{utexasthesis}{The formatting guidelines recommend using 12pt}}
\DeclareOption{10pt}{\gdef\@sizeoption{10pt}\@sizeoption@warning}
\DeclareOption{11pt}{\gdef\@sizeoption{11pt}\@sizeoption@warning}
\DeclareOption{12pt}{\gdef\@sizeoption{12pt}}
% cascade any other options into the \LoadClass[...]{report} call
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
% process options and load report.cls
\ProcessOptions\relax
\LoadClass[\@sizeoption]{report}

% 1.25 inch margins except for the page number, which should be 1in from the bottom
\RequirePackage[letterpaper,hmargin=1.25in,top=1.25in,bottom=1in,includefoot]{geometry}
\RequirePackage[T1]{fontenc}
\RequirePackage[\@setspaceoption]{setspace}
% The indentfirst package ensures that every paragraph is indented,
% even those at the beginning of chapters/sections
\RequirePackage{indentfirst}
% > Paragraph indentions may be five to ten spaces.
% The width of a space for the normal font is 3pt, making the legal range 15pt to 30pt.
% The official Word template uses .5 inch (≈36pt)
% LaTeX's default \parindent is 1.5em (=18pt), which falls within the legal range.
% \setlength{\parindent}{1.5em}

\RequirePackage{natbib}
\setcitestyle{round,comma,yysep={;}}

% table of contents configuration
\RequirePackage[nottoc]{tocbibind}
\RequirePackage{tocloft}
\renewcommand{\contentsname}{Table of Contents} % default: Contents
\renewcommand{\cftdotsep}{0.25} % default: 4.5
% Prefix chapter numbers with "Chapter " and add space as needed
\renewcommand{\cftchappresnum}{\@chapapp\ }
\newlength{\cftchappresnum@width}
\settowidth{\cftchappresnum@width}{\cftchappresnum}
\addtolength{\cftchapnumwidth}{\cftchappresnum@width}

\RequirePackage[hyphens]{url}
\RequirePackage[pdfusetitle]{hyperref}
% hyperlink DOIs in bibliography (for BibTeX entries with doi fields)
\RequirePackage{doi}

% > Headings may be bolded and no more than 2 points larger than the rest of the text.
% When the 12pt option is used, \large is actually 14.4pt, but, close enough?
\newcommand{\headingsize}{\large}
\renewcommand{\Large}{\headingsize}
\renewcommand{\LARGE}{\headingsize}
\renewcommand{\huge}{\headingsize}
\renewcommand{\Huge}{\headingsize}

% chapter heading configuration
% simplified version of the original from report.cls
\def\@makechapterhead#1{{%
  \centering\headingsize
  % print "Chapter N"
  \@chapapp\space\thechapter
  \par\nobreak
  \vskip.25\baselineskip
  \@makeschapterhead{#1}
}}
% star-chapter variation
\def\@makeschapterhead#1{{
  \centering\headingsize
  % prevent page break between following lines at all costs
  \interlinepenalty=10000
  \bfseries #1\par\nobreak
  \vskip\baselineskip
}}

% toc/lot/lof heading configuration
\setlength{\cftbeforetoctitleskip}{\z@}
\setlength{\cftaftertoctitleskip}{.25\baselineskip}
\renewcommand{\cfttoctitlefont}{\headingsize\bfseries\hspace*{\fill}}
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}}
% copy toc to lot
\setlength{\cftbeforelottitleskip}{\cftbeforetoctitleskip}
\setlength{\cftafterlottitleskip}{\cftaftertoctitleskip}
\renewcommand{\cftlottitlefont}{\cfttoctitlefont}
\renewcommand{\cftafterlottitle}{\cftaftertoctitle}
% copy toc to lof
\setlength{\cftbeforeloftitleskip}{\cftbeforetoctitleskip}
\setlength{\cftafterloftitleskip}{\cftaftertoctitleskip}
\renewcommand{\cftloftitlefont}{\cfttoctitlefont}
\renewcommand{\cftafterloftitle}{\cftaftertoctitle}

% Set up default values and setters
\def\@university{University of Texas at Austin}
\newcommand{\graduationdate}[2]{\gdef\@graduationmonth{#1}\gdef\@graduationyear{#2}}
\newcommand{\supervisor}[1]{\gdef\@supervisor{#1}}
\newcommand{\cosupervisor}[1]{\gdef\@cosupervisor{#1}}
\def\@othercommitteemembers{}
\newcommand{\othercommitteemembers}[1]{\gdef\@othercommitteemembers{#1}}

% handle PhD vs. masters based on optional masters argument, which defaults to false
\if@masters
  \gdef\@doctype{Thesis}
  \gdef\@degree{Master of Arts}
  \gdef\@degreeabbr{M.A.}
\else
  \gdef\@doctype{Dissertation}
  \gdef\@degree{Doctor of Philosophy}
  \gdef\@degreeabbr{Ph.D.}
\fi

\newenvironment{middlecenter}{\vspace*{\fill}\begin{center}}%
                             {\end{center}\vspace*{\fill}}

\newcommand{\@signature}[1]{%
  \vskip2\baselineskip\par\rule{\textwidth}{.7pt}%
  \vskip-4.4pt\par#1}
% this question is one of the best and only sources on \@for I could find: https://tex.stackexchange.com/q/2933
\newcommand{\@makesignatures}{%
  \@signature{\@supervisor, Supervisor}
  \@ifundefined{@cosupervisor}{}{%
    \@signature{\@cosupervisor, Co-Supervisor}}
  \@for\@i:=\@othercommitteemembers\do{\@signature{\@i}}%
}

\renewcommand{\maketitle}{%
  % The copyright, signature, title and dedication pages are counted but not numbered,
  % and so they all get the empty pagestyle
  % Generate the copyright page if specified as an option
  \if@copyright
    \clearpage\thispagestyle{empty}
    \begin{middlecenter}
      \begin{spacing}{4}
        \bfseries
        Copyright

        by

        \@author

        \@graduationyear
      \end{spacing}
    \end{middlecenter}
  \fi

  % generate signature page, which differs between Masters and Dissertation
  \clearpage\thispagestyle{empty}
  \if@masters
    \begin{center}
      \begin{doublespace}
        \textbf{\small The \@doctype{} committee for \@author{} certifies that this is the approved
        version of the following \MakeLowercase\@doctype:}

        \hbox

        \hbox

        \textbf{\headingsize\@title}

        \hbox

        \hbox
      \end{doublespace}
    \end{center}
    \hspace{.5\textwidth}\begin{minipage}{.5\textwidth}
      \begin{doublespace}
        \textbf{APPROVED BY}

        \textbf{SUPERVISING COMMITTEE:}

        \@makesignatures
      \end{doublespace}
    \end{minipage}
  \else
    \begin{center}
      \begin{singlespace}
        The \@doctype{} Committee for \@author{} certifies that this is the approved
        version of the following \MakeLowercase\@doctype:

        \hbox
      \end{singlespace}
      \begin{doublespace}
        \textbf{\headingsize\@title}
      \end{doublespace}
    \end{center}
    \hspace{.5\textwidth}\begin{minipage}{.5\textwidth}
      \begin{singlespace}
        \textbf{Committee:}
        \vskip1.5\baselineskip

        \@makesignatures
      \end{singlespace}
    \end{minipage}
  \fi

  % generate the actual title page
  \clearpage\thispagestyle{empty}
  \begin{center}
    \begin{doublespace}
      \textbf{\headingsize\@title}

      \hbox

      by

      \hbox

      \textbf{\@author}

      \hbox

      \textbf{\@doctype}

      \hbox

      Presented to the Faculty of the Graduate School

      of the \@university

      in Partial Fulfillment

      of the Requirements

      for the Degree of

      \hbox

      \textbf{\@degree}

      \hbox

      The \@university

      \@graduationmonth{} \@graduationyear{}
    \end{doublespace}
  \end{center}
  \clearpage
}

% Optional dedication page is triggered by using the dedication environment in the right place
\newenvironment{dedication}{\thispagestyle{empty}\begin{middlecenter}}{\end{middlecenter}}

% Optional acknowledgments page is triggered by using the acknowledgments environment in the right place
\newenvironment{acknowledgments}{%
  \chapter*{Acknowledgments}
}{}

% Required abstract page is triggered by using the abstract environment in the right place
\renewenvironment{abstract}{%
  \clearpage
  \begin{center}
    \begin{doublespace}
      {\headingsize\textbf{Abstract}}

      \hbox

      {\headingsize\textbf{\@title}}

      \hbox

      by

      \hbox

      \@author, \@degreeabbr

      The \@university, \@graduationyear

      \@ifundefined{@cosupervisor}{
        Supervisor: \@supervisor{}
      }{
        Supervisors: \@supervisor{} and \@cosupervisor{}
      }
    \end{doublespace}
  \end{center}

  \indent\ignorespaces%
}{}

\pagenumbering{roman}

\newcommand{\maketableofcontents}{%
  \clearpage
  \tableofcontents
  \clearpage
  \listoftables
  \clearpage
  \listoffigures
  \clearpage\pagenumbering{arabic}
}

\newcommand{\makeappendix}{%
  \appendix
  % ensure that the TOC picks up the redefined value of \@chapapp
  \addtocontents{toc}{\protect\renewcommand\protect\cftchappresnum{\@chapapp\ }}
}

\newcommand{\makebibliography}[1]{%
  \clearpage%
  \bibliography{#1}
}

% Optional vita page is triggered by using the vita environment in the right place
\newenvironment{vita}{%
  \clearpage%
  \addcontentsline{toc}{chapter}{Vita}%
  \chapter*{Vita}
  \noindent\ignorespaces%
}{}

\newenvironment{address}{%
  \setlength{\parskip}{1\baselineskip}\par\noindent%
  \makebox[1in][l]{Address:}%
  \begin{minipage}[t]{5in}%
}{\end{minipage}}

\newcommand{\declaretypist}[1]{\setlength{\parskip}{1.7\baselineskip}\par\noindent%
  This \MakeLowercase\@doctype{} was typed by #1.}

% overrides in draft mode:
\if@draft
  \renewcommand{\maketitle}{}
  \renewcommand{\maketableofcontents}{%
    % Just like \maketableofcontents but without the \tableofcontents
    \clearpage\pagenumbering{arabic}
  }
  % instead of clearing the page, just insert a bit of space
  \renewcommand{\chapter}{\vskip\baselineskip\thispagestyle{plain}\secdef\@chapter\@schapter}
\fi