-
Notifications
You must be signed in to change notification settings - Fork 0
/
glasgowthesis.cls
324 lines (299 loc) · 10.4 KB
/
glasgowthesis.cls
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
% University of Bristol thesis templats
% Date: 15/11/2021
% Author: Matthew Lee, [email protected]
%
% This template is adapted from thesidown: https://github.com/ismayc/thesisdown
% Bristol Uni thesis regulations: http://www.bristol.ac.uk/academic-quality/pg/pgrcode/annex4/
%
%%% Probably best to leave this bit as is
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{glasgowthesis}[]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\LoadClass{book}
\RequirePackage{fancyhdr}
\RequirePackage{fancyvrb}
\usepackage{ifxetex,ifluatex}
\setlength{\parindent}{0pt} % comment out for indentation globally
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
\usepackage{mathspec}
\usepackage{xltxtra,xunicode}
\else
\usepackage{fontspec}
\fi
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\newcommand{\euro}{b,}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage{color}
%\newcommand{\VerbBar}{|}
%\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{verbatim}{Verbatim}{xleftmargin=-1em}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
% \newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
% \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{{#1}}}}
% \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{{#1}}}
% \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
% \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
% \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
% \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
% \newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
% \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
% \newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
% \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
% \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
% \newcommand{\ImportTok}[1]{{#1}}
% \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{{#1}}}}
% \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{{#1}}}
% \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
% \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
% \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{{#1}}}}
% \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{{#1}}}}
% \newcommand{\BuiltInTok}[1]{{#1}}
% \newcommand{\ExtensionTok}[1]{{#1}}
% \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{{#1}}}}
% \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{{#1}}}
% \newcommand{\RegionMarkerTok}[1]{{#1}}
% \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{{#1}}}}}
% \newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{{#1}}}
% \newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{{#1}}}}
% \newcommand{\NormalTok}[1]{{#1}}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
% End of CII add
% This gives us rules below the headers
\AtBeginDocument{%
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\slshape \nouppercase \leftmark} % This makes the headers on the RIGHT side pages be italic and use lowercase With Capitals When Specified. I dont think this works.
\fancyhead[LO]{\slshape \nouppercase \rightmark} % This does the same thing to the LEFT side pages
\pagestyle{fancy}
\let\oldthebibliography=\thebibliography
\let\endoldthebibliography=\endthebibliography
\renewenvironment{thebibliography}[1]{
\oldthebibliography{#1}
\addcontentsline{toc}{chapter}{\bibname}
}{\endoldthebibliography}
\let\oldtheindex=\theindex
\let\endoldtheindex=\endtheindex
\renewenvironment{theindex}{
\oldtheindex
\addcontentsline{toc}{chapter}{\indexname}
}{\endoldtheindex}
}
% Stolen from book.cls and modified
\let\RToldchapter\chapter
\renewcommand{\chapter}{\if@openright\RTcleardoublepage
\else\clearpage\fi
\thispagestyle{empty}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
% Using this to actually show "Chapter 1" in TOC instead of "1"
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\@chapapp\space\thechapter:\space#1}%
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\newcommand{\RTcleardoublepage}{
\clearpage\if@twoside \ifodd\c@page\else
\thispagestyle{empty}\hbox{}\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\let\RToldcleardoublepage\cleardoublepage
\renewcommand{\cleardoublepage}{\RTcleardoublepage}
%%% Margins
\usepackage[top=1.8cm, bottom=1.8cm,left=4.0cm,right=1.5cm]{geometry}
%\usepackage[margin=1in]{geometry} % 1 inch margin across all sides
% \oddsidemargin 0truemm % add for printing
\evensidemargin 15truemm % add for printing
%%
%% Defined terms
\def\university#1{\gdef \@university{#1}}
\def\college#1{\gdef \@college{#1}}
\def\school#1{\gdef \@school{#1}}
\def\quals#1{\gdef \@quals{#1}}
\def\logo#1{\gdef \@logo{#1}}
\def\degree#1{\gdef \@degree{#1}}
\def\wordcount#1{\gdef \@wordcount{#1}}
%%
\renewcommand\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\normalfont
\leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
\nobreak\hb@xt@\@pnumwidth{\bfseries \hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
%%% Preface pages
% in order
%% Title page
\renewcommand{\maketitle}{%
{\pagestyle{empty}
\fontsize{14}{25}\selectfont
\begin{titlepage}
\newpage
\begin{center}
\vspace*{1.5cm}
\setcounter{page}{1}
\includegraphics[scale=0.140] \@logo
\\
\vspace{1.5cm}
{\bfseries\Huge \@title}\\
\vspace{1.5cm}
%\centerline{\hbox to \wd0 {\hbox{}\hrulefill\hbox{}}}
\normalfont\large
\@author \\
\@quals \\
%\@school \\
%Faculty of \@faculty \\
%\@university
\vspace{1.5cm}
Submitted in fulfilment of the requirements of the Degree of \\ \@degree \\
\vspace{1.5cm}
%{\fontsize{12}{14}\selectfont \lineskip .5em
%\begin{tabular}[t]{c}%
%\end{tabular}\par}
%\vskip 1em
\@school \\
\@college \\
\@university \\
\vspace{1.5cm}
\@date \\
\end{center}\par
\end{titlepage}
}
}
%% Abstract
\newenvironment{abstract}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{Abstract}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%% COVID
\newenvironment{covid}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{COVID-19 statement}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%% Acknowledgments
\newenvironment{acknowledgements}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{Acknowledgements}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%% Declaration
\newenvironment{declaration}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{Declaration}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%% Abbreviations/accronyms
\newenvironment{abbreviations}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{Abbreviations}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%% Publications
\newenvironment{publications}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{Research Output}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%% Outline
\newenvironment{outline}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{Outline}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%% Contributions
\newenvironment{contributions}{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{Contributions}
\fontsize{12}{14}\selectfont
}{\clearpage \if@restonecol\twocolumn\fi}%
%%% Other things
\renewcommand{\title}[1]{\def\@title{#1}}
\newcommand{\Abstract}[1]{\def\@Abstract{#1}}
\newcommand{\COVID}[1]{\def\@COVID{#1}}
\newcommand{\Acknowledgements}[1]{\def\@Acknowledgements{#1}}
\newcommand{\Publications}[1]{\def\@Publications{#1}}
\newcommand{\Contributions}[1]{\def\@Contributions{#1}}
\newcommand{\Declaration}[1]{\def\@Declaration{#1}}
\newcommand{\Abbreviations}[1]{\def\@Abbreviations{#1}}
\newcommand{\Outline}[1]{\def\@Outline{#1}}