-
Notifications
You must be signed in to change notification settings - Fork 0
/
preamble.tex
executable file
·197 lines (181 loc) · 6.76 KB
/
preamble.tex
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
%%%--------------------------------------------------------------------------%%%
%%%---------------------- PACKAGE LOADING AND DEFAULTS ----------------------%%%
%%%--------------------------------------------------------------------------%%%
% Set the typographic rules for English and choose a latin modern font
\usepackage{lmodern}
\usepackage{tgpagella}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
% Provide a one inch margin for all pages
\usepackage[margin=1in, lmargin=1.5in]{geometry}
\frenchspacing % better looking spacing
\usepackage{setspace}
\setlength{\headheight}{15pt}
% Formatting for the running head
\usepackage{fancyhdr}
%\usepackage{lastpage}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
%\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ \ #1}{}}
%\renewcommand{\footrulewidth}{0.4pt}
%\fancyfoot[C]{Page \thepage{} of \pageref*{LastPage}}
\fancyfoot[C]{\thepage{}}
\fancyhead{}
\fancyhead[LE,RO]{\nouppercase{\scshape \rightmark}}
\fancyhead[LO,RE]{\nouppercase{\scshape \leftmark}}
\usepackage{xcolor} % Allow access to multiple colours
\definecolor{TitleColor}{HTML}{9D0F2C}
\usepackage{graphicx} % enables loading of graphics
\usepackage{tikz} % drawing vector graphics in latex
\usepackage{pgfplots}
% Load the ams-tex packages.
% mathtools is an extension for amsmath finetuning and bug fixes
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{amstext}
\usepackage{ctable}
\usepackage[noadjust]{cite}
\usepackage{filecontents}
% Formatting for the chapter headings
\usepackage{titlesec}
% 'display' puts the label in a separate paragraph. (Like the standard \chapter.)
% scshape (smallcaps) is applied to the label and the text
% The label colour is 'TitleColor' and is a lowercase sc title a gap and then a size 64x64 chapter number in the normal font
% The horizontal separation is 4ex (4 times the height of an 'x' in the current font)
% Before the title body put a vertical gap of 1ex and then left align the title
% After the title body put a vertical gap of 2ex and then a ruled line
\titleformat{\chapter}[display]
{\Huge\scshape}
{\filleft{\color{TitleColor}\large\normalfont%
\textsc{\MakeLowercase{\chaptertitlename}}}\ \ %
{\color{TitleColor}\fontsize{64}{64}\selectfont\normalfont\thechapter}}
{4ex}
{\vspace{1ex}\filright}
[\vspace{2ex}\titlerule]
% Modify the typesetting of appendix titles
% toc: Put a header (e.g., ÔAppendicesÕ) into the Table of Contents (the ToC)
% before listing the appendices.
% page: Puts a title (e.g., ÔAppendicesÕ) into the document at the point
% where the appendices environment is begun.
\usepackage[toc,page]{appendix}
%%%--------------------------------------------------------------------------%%%
%%%------------------------- MAIN THESIS DEFINITION -------------------------%%%
%%%--------------------------------------------------------------------------%%%
%% The following five commands set the respective field values so we can
%% generate the title page and abstract page automatically.
\makeatletter
\newcommand*{\degree}[1]%
{\ifx\empty#1\empty\else\gdef\@degree{#1}\fi}
\newcommand*{\department}[1]%
{\ifx\empty#1\empty\else\gdef\@department{#1}\fi}
\newcommand*{\gradyear}[1]%
{\ifx\empty#1\empty\else\gdef\@gradyear{#1}\fi}
\newcommand*{\gradmonth}[1]%
{\ifx\empty#1\empty\else\gdef\@gradmonth{#1}\fi}
\renewcommand*{\author}[1]%
{\ifx\empty#1\empty\else\gdef\@author{#1}\fi}
\renewcommand*{\title}[1]%
{\ifx\empty#1\empty\else\gdef\@title{#1}\fi}
\newcommand*{\faculty}[1]%
{\ifx\empty#1\empty\else\gdef\@faculty{#1}\fi}
\newcommand*{\supervisor}[1]%
{\ifx\empty#1\empty\else\gdef\@supervisor{#1}\fi}
\newcommand*{\university}[1]%
{\ifx\empty#1\empty\else\gdef\@university{#1}\fi}
\makeatother
%% Default values for the required fields.
\makeatletter
\degree{\emph{(degree)}} \let\Degree\@degree
\department{\emph{(department)}} \let\Department\@department
\gradyear{\emph{(year of graduation)}} \let\Gradyear\@gradyear
\gradmonth{\emph{(month)}} \let\Gradmonth\@gradmonth
\author{\emph{(author)}} \let\Author\@author
\title{Thesis Template} \let\Title\@title
\faculty{\emph{(faculty)}} \let\Faculty\@faculty
\supervisor{\emph{(supervisor)}} \let\Supervisor\@supervisor
\university{\emph{(university)}} \let\University\@university
\makeatother
\makeatletter
\usepackage
[
%------------- Color Links ------------------------------
colorlinks=true,
urlcolor=red,
linkcolor=black, % COLOUR FOR THE TOC LINES
linktoc=all, % RE-COLOR THE NUMBERS AS WELL
%------------- Doc Info ---------------------------------
pdftitle={{\@university} - {\@title}},
pdfauthor={{\@author}},
pdfsubject={{\@title}},
%pdfkeywords={keyword1} {key2} {key3},
%------------ Doc View ----------------------------------
bookmarksopen=false,
pdfpagemode=UseNone]{hyperref}
\makeatother
%%%%%% New formatting environments and commands.
%% \begin{preliminary} sets the pagestyle and page numbering for the
%% preliminary sections; \end{preliminary} resets the page numbering.
%% The default page style is used outside of the preliminary block.
\newenvironment*{preliminary}%
{\pagestyle{plain}\pagenumbering{roman}}%
{\cleardoublepage\pagenumbering{arabic}}
%% Change \maketitle to follow SGS guidelines.
\makeatletter
\renewcommand*{\maketitle}{
\begingroup
\renewcommand{\baselinestretch}{1}
\begin{titlepage}
\begin{large}
% A pair of horizontal rules about the title of the thesis in small caps at size 48
\begin{center}
\mbox{}\vfill\rule{\linewidth}{0.1pt} \\%[2ex]
\begingroup
%\linespread{1.8}\selectfont
\fontsize{44}{44}\selectfont
\textcolor{TitleColor}{\textsc{\@title}}\\
\endgroup
\rule{\linewidth}{0.1pt} \\
%
\vfill by \\ \vfill {\@author}\\
%
\vfill \vfill
A Thesis Submitted in Partial Fulfillment\\
of the Requirements for the Degree of\\
{\@degree}\\
in the\\
Faculty of {\@faculty}\\{\@department}\\
\vfill \vfill
{\@university}\\
\vfill \vfill
{\@gradmonth} {\@gradyear}\\
\vfill \vfill
{\copyright} {\@author} {\@gradyear}\\
\vspace{.2in}
\mbox{}
\end{center}
\end{large}
% Force the title page to be page i of the thesis
\setcounter{page}{1}
\end{titlepage}
\endgroup
\setcounter{page}{2}
}
\renewenvironment*{abstract}%
{\begin{center}
\textsc{\Huge Abstract}
\end{center}
\begin{center}
{\@title}\\[2ex]
{\@author}\\
Faculty of {\@faculty} ({\@department})\\
{\@university}\\
{\@gradyear}\\
\end{center}}%
{\par\newpage}
\makeatother
\numberwithin{equation}{section}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}