1 |
125 |
guanucolui |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2 |
|
|
%% %%
|
3 |
|
|
%% Class ``PhD Thesis PSnPDF'' %%
|
4 |
|
|
%% %%
|
5 |
|
|
%% A PhD thesis LaTeX template for Cambridge University Engineering Department%%
|
6 |
|
|
%% %%
|
7 |
|
|
%% Version: v1.0 %%
|
8 |
|
|
%% Authors: Krishna Kumar %%
|
9 |
|
|
%% Date: 2013/11/16 (inception) %%
|
10 |
|
|
%% License: MIT License (c) 2013 Krishna Kumar %%
|
11 |
|
|
%% GitHub Repo: https://github.com/kks32/phd-thesis-template/ %%
|
12 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
13 |
|
|
|
14 |
|
|
% ************************** Class Identification ******************************
|
15 |
|
|
\NeedsTeXFormat{LaTeX2e}
|
16 |
|
|
\ProvidesClass{PhDThesisPSnPDF}[2013/12/10 version 1.0 by Krishna Kumar]
|
17 |
|
|
\typeout{https://github.com/kks32/phd-thesis-template/}
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
% ******************************************************************************
|
21 |
|
|
% **************************** Class Definition ********************************
|
22 |
|
|
% ******************************************************************************
|
23 |
|
|
|
24 |
|
|
% *********************** Define a Print/Online Version ************************
|
25 |
|
|
\newif\if@print\@printfalse
|
26 |
|
|
\DeclareOption{print}{\@printtrue}
|
27 |
|
|
|
28 |
|
|
% ****************************** Define index **********************************
|
29 |
|
|
\newif\ifPHD@index\PHD@indexfalse
|
30 |
|
|
\DeclareOption{index}{\PHD@indextrue}
|
31 |
|
|
|
32 |
|
|
% ******************************* Font Option **********************************
|
33 |
|
|
\newif\ifsetFont\setFontfalse % Font is not set
|
34 |
|
|
|
35 |
|
|
\newif\ifPHD@times\PHD@timesfalse % Times with Math Support
|
36 |
|
|
\DeclareOption{times}{\PHD@timestrue}
|
37 |
|
|
|
38 |
|
|
\newif\ifPHD@fourier\PHD@fourierfalse % Fourier with Math Support
|
39 |
|
|
\DeclareOption{fourier}{\PHD@fouriertrue}
|
40 |
|
|
|
41 |
|
|
\newif\ifPHD@customfont\PHD@customfontfalse % Custom Font with Math Support
|
42 |
|
|
\DeclareOption{customfont}{\PHD@customfonttrue}
|
43 |
|
|
|
44 |
|
|
% ******************************* Bibliography *********************************
|
45 |
|
|
\newif\ifsetBib\setBibfalse % Using Custom Bibliography
|
46 |
|
|
|
47 |
|
|
\newif\ifPHD@authoryear\PHD@authoryearfalse % Author-Year citation
|
48 |
|
|
\DeclareOption{authoryear}{\PHD@authoryeartrue}
|
49 |
|
|
|
50 |
|
|
\newif\ifPHD@numbered\PHD@numberedfalse % Numbered citiation
|
51 |
|
|
\DeclareOption{numbered}{\PHD@numberedtrue}
|
52 |
|
|
|
53 |
|
|
\newif\ifPHD@custombib\PHD@custombibfalse % Custom Bibliography
|
54 |
|
|
\DeclareOption{custombib}{\PHD@custombibtrue}
|
55 |
|
|
|
56 |
|
|
% ************************* Header / Footer Styling ****************************
|
57 |
|
|
\newif\ifPHD@pageStyleI\PHD@pageStyleIfalse % Set Page StyleI
|
58 |
|
|
\DeclareOption{PageStyleI}{\PHD@pageStyleItrue}
|
59 |
|
|
|
60 |
|
|
\newif\ifPHD@pageStyleII\PHD@pageStyleIIfalse % Set Page StyleII
|
61 |
|
|
\DeclareOption{PageStyleII}{\PHD@pageStyleIItrue}
|
62 |
|
|
|
63 |
|
|
% ***************************** Custom Margins ********************************
|
64 |
|
|
\newif\ifsetMargin\setMarginfalse % Margins are not set
|
65 |
|
|
|
66 |
|
|
\newif\ifPHD@custommargin\PHD@custommarginfalse % Custom margin
|
67 |
|
|
\DeclareOption{custommargin}{\PHD@custommargintrue}
|
68 |
|
|
|
69 |
|
|
% **************************** Separate Abstract ******************************
|
70 |
|
|
\newif \ifdefineAbstract\defineAbstractfalse %To enable Separate abstract
|
71 |
|
|
|
72 |
|
|
\newif\ifPHD@abstract\PHD@abstractfalse % Enable Separate Abstract
|
73 |
|
|
\DeclareOption{abstract}{
|
74 |
|
|
\PHD@abstracttrue
|
75 |
|
|
\ClassWarning{PhDThesisPSnPDF}{You have chosen an option that generates only
|
76 |
|
|
the Title page and an abstract with PhD title and author name, if this was
|
77 |
|
|
intentional, ignore this warning. Congratulations on submitting your thesis!!
|
78 |
|
|
If not, please remove the option `abstract' from the document class and
|
79 |
|
|
recompile. Good luck with your writing!}
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
\ProcessOptions\relax%
|
83 |
|
|
|
84 |
|
|
% *************************** Pre-defined Options ******************************
|
85 |
|
|
|
86 |
|
|
% Font Size
|
87 |
|
|
\newcommand\PHD@ptsize{12pt} %Set Default Size as 12
|
88 |
|
|
|
89 |
|
|
\DeclareOption{10pt}{
|
90 |
|
|
\ClassWarning{PhDThesisPSnPDF}{The Cambridge University PhD thesis guidelines
|
91 |
|
|
recommend using a minimum font size of 11pt (12pt is preferred) and 10pt for
|
92 |
|
|
footnotes.}
|
93 |
|
|
\renewcommand\PHD@ptsize{10pt}
|
94 |
|
|
}
|
95 |
|
|
\DeclareOption{11pt}{\renewcommand\PHD@ptsize{11pt}}%
|
96 |
|
|
\DeclareOption{12pt}{\renewcommand\PHD@ptsize{12pt}}%
|
97 |
|
|
\PassOptionsToClass{\PHD@ptsize}{book}%
|
98 |
|
|
|
99 |
|
|
% Page Size
|
100 |
|
|
\newcommand\PHD@papersize{a4paper} % Set Default as a4paper
|
101 |
|
|
|
102 |
|
|
\DeclareOption{a4paper}{\renewcommand\PHD@papersize{a4paper}}
|
103 |
|
|
\DeclareOption{a5paper}{\renewcommand\PHD@papersize{a5paper}}
|
104 |
|
|
\DeclareOption{letterpaper}{
|
105 |
|
|
\ClassWarning{PhDThesisPSnPDF}{The Cambridge University Engineering Deparment
|
106 |
|
|
PhD thesis guidelines recommend using A4 or A5paper}
|
107 |
|
|
\renewcommand\PHD@papersize{letterpaper}
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
\PassOptionsToClass{\PHD@papersize}{book}%
|
111 |
|
|
|
112 |
|
|
% Column layout
|
113 |
|
|
\DeclareOption{oneside}{\PassOptionsToClass{\CurrentOption}{book}}%
|
114 |
|
|
\DeclareOption{twoside}{\PassOptionsToClass{\CurrentOption}{book}}%
|
115 |
|
|
|
116 |
|
|
% Draft Mode
|
117 |
|
|
\DeclareOption{draft}{\PassOptionsToClass{\CurrentOption}{book}}%
|
118 |
|
|
|
119 |
|
|
% Generates Warning for unknown options
|
120 |
|
|
\DeclareOption*{
|
121 |
|
|
\ClassWarning{PhDThesisPSnPDF}{Unknown or non-standard option
|
122 |
|
|
'\CurrentOption'. I'll see if I can load it from the book class. If you get a
|
123 |
|
|
warning unused global option(s): `\CurrentOption` then the option is not
|
124 |
|
|
supported!}
|
125 |
|
|
\PassOptionsToClass{\CurrentOption}{book}
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
% Determine whether to run pdftex or dvips
|
129 |
|
|
\ProcessOptions\relax%
|
130 |
|
|
\newif\ifsetDVI\setDVIfalse
|
131 |
|
|
\ifx\pdfoutput\undefined
|
132 |
|
|
% we are not running PDFLaTeX
|
133 |
|
|
\setDVItrue
|
134 |
|
|
\LoadClass[dvips,fleqn,openright]{book}%
|
135 |
|
|
\else % we are running PDFLaTeX
|
136 |
|
|
\ifnum \pdfoutput>0
|
137 |
|
|
%PDF-Output
|
138 |
|
|
\setDVIfalse
|
139 |
|
|
\LoadClass[pdftex,fleqn,openright]{book}%
|
140 |
|
|
\else
|
141 |
|
|
%DVI-output
|
142 |
|
|
\setDVItrue
|
143 |
|
|
\LoadClass[fleqn,openright]{book}%
|
144 |
|
|
\fi
|
145 |
|
|
\fi
|
146 |
|
|
|
147 |
|
|
%* ***************************** Print / Online ********************************
|
148 |
|
|
% Defines a print / online version to define page-layout and hyperrefering
|
149 |
|
|
\ifsetDVI
|
150 |
|
|
\special{papersize=\the\paperwidth,\the\paperheight}
|
151 |
|
|
\RequirePackage[dvips,unicode=true]{hyperref}
|
152 |
|
|
\else
|
153 |
|
|
\RequirePackage[unicode=true]{hyperref}
|
154 |
|
|
\pdfpagewidth=\the\paperwidth
|
155 |
|
|
\pdfpageheight=\the\paperheight
|
156 |
|
|
\fi
|
157 |
|
|
|
158 |
|
|
\if@print
|
159 |
|
|
% For Print version
|
160 |
|
|
\hypersetup{
|
161 |
|
|
plainpages=false,
|
162 |
|
|
pdfstartview=FitV,
|
163 |
|
|
pdftoolbar=true,
|
164 |
|
|
pdfmenubar=true,
|
165 |
|
|
bookmarksopen=true,
|
166 |
|
|
bookmarksnumbered=true,
|
167 |
|
|
breaklinks=true,
|
168 |
|
|
linktocpage,
|
169 |
|
|
colorlinks=true,
|
170 |
|
|
linkcolor=black,
|
171 |
|
|
urlcolor=black,
|
172 |
|
|
citecolor=black,
|
173 |
|
|
anchorcolor=black
|
174 |
|
|
}
|
175 |
|
|
\ifPHD@custommargin
|
176 |
|
|
\setMarginfalse
|
177 |
|
|
\else
|
178 |
|
|
\ifsetDVI
|
179 |
|
|
% Odd and Even side Margin for binding and set viewmode for PDF
|
180 |
|
|
\RequirePackage[dvips,paper=\PHD@papersize,hmarginratio=1:1,vmarginratio=1:1,scale=0.75,bindingoffset=5mm]{geometry}
|
181 |
|
|
\else
|
182 |
|
|
\RequirePackage[pdftex,paper=\PHD@papersize,hmarginratio=1:1,vmarginratio=1:1,scale=0.75,bindingoffset=5mm]{geometry}
|
183 |
|
|
\fi
|
184 |
|
|
\setMargintrue
|
185 |
|
|
\fi
|
186 |
|
|
|
187 |
|
|
\if@twoside
|
188 |
|
|
\hypersetup{pdfpagelayout=TwoPageRight}
|
189 |
|
|
\else
|
190 |
|
|
\hypersetup{pdfpagelayout=OneColumn}
|
191 |
|
|
\fi
|
192 |
|
|
|
193 |
|
|
\else
|
194 |
|
|
% For PDF Online version
|
195 |
|
|
\hypersetup{
|
196 |
|
|
plainpages=false,
|
197 |
|
|
pdfstartview=FitV,
|
198 |
|
|
pdftoolbar=true,
|
199 |
|
|
pdfmenubar=true,
|
200 |
|
|
bookmarksopen=true,
|
201 |
|
|
bookmarksnumbered=true,
|
202 |
|
|
breaklinks=true,
|
203 |
|
|
linktocpage,
|
204 |
|
|
colorlinks=true,
|
205 |
|
|
linkcolor=blue,
|
206 |
|
|
urlcolor=blue,
|
207 |
|
|
citecolor=blue,
|
208 |
|
|
anchorcolor=green
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
\ifPHD@custommargin
|
212 |
|
|
\setMarginfalse
|
213 |
|
|
\else
|
214 |
|
|
% No Margin staggering on Odd and Even side
|
215 |
|
|
\ifsetDVI
|
216 |
|
|
\RequirePackage[dvips,paper=\PHD@papersize,hmarginratio=1:1,vmarginratio=1:1,scale=0.75]{geometry}
|
217 |
|
|
\else
|
218 |
|
|
\RequirePackage[pdftex,paper=\PHD@papersize,hmarginratio=1:1,vmarginratio=1:1,scale=0.75]{geometry}
|
219 |
|
|
\fi
|
220 |
|
|
\setMargintrue
|
221 |
|
|
\fi
|
222 |
|
|
|
223 |
|
|
\hypersetup{pdfpagelayout=OneColumn}
|
224 |
|
|
\fi
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
% ******************************************************************************
|
229 |
|
|
% ******************************** Packages ************************************
|
230 |
|
|
% ******************************************************************************
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
% ************************** Layout and Formatting *****************************
|
234 |
|
|
\def\pdfshellescape{1}
|
235 |
|
|
\RequirePackage{lscape} % Supports Landscape Layout
|
236 |
|
|
\RequirePackage{setspace} % Define line spacing in paragraph
|
237 |
|
|
\RequirePackage{calc} % To calculate vertical spacing
|
238 |
|
|
|
239 |
|
|
% ************************* Conditional Statements *****************************
|
240 |
|
|
\RequirePackage{ifthen} % Used in LaTeX Class files for conditional statements
|
241 |
|
|
\RequirePackage{ifpdf} % Check for pdfLaTeX
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
% *********************** Table of Contents & Appendices ***********************
|
245 |
|
|
% add Bibliography, List of figures and tables to contents
|
246 |
|
|
\RequirePackage{tocbibind}
|
247 |
|
|
% Add appendices
|
248 |
|
|
\RequirePackage[title,titletoc]{appendix}
|
249 |
|
|
|
250 |
|
|
% *************************** Graphics and Figures *****************************
|
251 |
|
|
\RequirePackage[usenames, dvipsnames]{color}
|
252 |
|
|
\ifpdf
|
253 |
|
|
% Convert eps figures to pdf
|
254 |
|
|
\RequirePackage{epstopdf}
|
255 |
|
|
\RequirePackage[pdftex]{graphicx}
|
256 |
|
|
\DeclareGraphicsExtensions{.png, .jpg, .pdf}
|
257 |
|
|
\pdfcompresslevel=9
|
258 |
|
|
\graphicspath{{Figs/Raster/}{Figs/}}
|
259 |
|
|
\else
|
260 |
|
|
\RequirePackage{graphicx}
|
261 |
|
|
\DeclareGraphicsExtensions{.eps, .ps}
|
262 |
|
|
\graphicspath{{Figs/Vector/}{Figs/}}
|
263 |
|
|
\fi
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
% ************************ URL Package and Definition **************************
|
267 |
|
|
\RequirePackage{url}
|
268 |
|
|
% Redefining urlstyle to use smaller fontsize in References with URLs
|
269 |
|
|
\newcommand{\url@leostyle}{%
|
270 |
|
|
\@ifundefined{selectfont}{\renewcommand{\UrlFont}{\sf}}
|
271 |
|
|
{\renewcommand{\UrlFont}{\small\ttfamily}}}
|
272 |
|
|
\urlstyle{leo}
|
273 |
|
|
|
274 |
|
|
% ******************************* Bibliography *********************************
|
275 |
|
|
\ifPHD@authoryear
|
276 |
|
|
\RequirePackage[round, sort, numbers, authoryear]{natbib} %author year
|
277 |
|
|
\setBibtrue
|
278 |
|
|
\else
|
279 |
|
|
\ifPHD@numbered
|
280 |
|
|
\RequirePackage[numbers,sort&compress]{natbib} % numbered citation
|
281 |
|
|
\setBibtrue
|
282 |
|
|
\else
|
283 |
|
|
\ifPHD@custombib
|
284 |
|
|
\setBibfalse
|
285 |
|
|
\else
|
286 |
|
|
\RequirePackage[numbers,sort&compress]{natbib} % Default - numbered
|
287 |
|
|
\setBibtrue
|
288 |
|
|
\ClassWarning{PhDThesisPSnPDF}{No bibliography style was specified.
|
289 |
|
|
Default numbered style is used. If you would like to use a different style, use
|
290 |
|
|
`authoryear' or `numbered' in the options in documentclass or use `custombib`
|
291 |
|
|
and define the natbibpackage with required style in the Preamble.tex file}
|
292 |
|
|
\fi
|
293 |
|
|
\fi
|
294 |
|
|
\fi
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
% *********************** To copy ligatures and Fonts **************************
|
299 |
|
|
\RequirePackage{textcomp}
|
300 |
|
|
\RequirePackage[utf8]{inputenc}
|
301 |
|
|
\RequirePackage[T1]{fontenc}
|
302 |
|
|
|
303 |
|
|
% Font Selection
|
304 |
|
|
\ifPHD@times
|
305 |
|
|
\RequirePackage{mathptmx} % times roman, including math (where possible)
|
306 |
|
|
\setFonttrue
|
307 |
|
|
\else
|
308 |
|
|
\ifPHD@fourier
|
309 |
|
|
\RequirePackage{fourier} % Fourier
|
310 |
|
|
\setFonttrue
|
311 |
|
|
\else
|
312 |
|
|
\ifPHD@customfont
|
313 |
|
|
\setFontfalse
|
314 |
|
|
\else
|
315 |
|
|
\ClassWarning{PhDThesisPSnPDf}{Using default font Latin Modern. If you
|
316 |
|
|
would like to use other pre-defined fonts use `times' (The Cambridge University
|
317 |
|
|
PhD thesis guidelines recommend using Times font) or `fourier' or load a custom
|
318 |
|
|
font in the preamble.tex file by specifying `customfont' in the class options}
|
319 |
|
|
\RequirePackage{lmodern}
|
320 |
|
|
\setFonttrue
|
321 |
|
|
\fi
|
322 |
|
|
\fi
|
323 |
|
|
\fi
|
324 |
|
|
|
325 |
|
|
\input{glyphtounicode}
|
326 |
|
|
\pdfglyphtounicode{f_f}{FB00}
|
327 |
|
|
\pdfglyphtounicode{f_i}{FB01}
|
328 |
|
|
\pdfglyphtounicode{f_l}{FB02}
|
329 |
|
|
\pdfglyphtounicode{f_f_i}{FB03}
|
330 |
|
|
\pdfglyphtounicode{f_f_l}{FB04}
|
331 |
|
|
\pdfgentounicode=1
|
332 |
|
|
|
333 |
|
|
% ******************************************************************************
|
334 |
|
|
% **************************** Pre-defined Settings ****************************
|
335 |
|
|
% ******************************************************************************
|
336 |
|
|
|
337 |
|
|
% *************************** Setting PDF Meta-Data ****************************
|
338 |
|
|
\ifpdf
|
339 |
|
|
\AtBeginDocument{
|
340 |
|
|
\hypersetup{
|
341 |
|
|
pdftitle = {\@title},
|
342 |
|
|
pdfauthor = {\@author},
|
343 |
|
|
pdfsubject={\@subject},
|
344 |
|
|
pdfkeywords={\@keywords}
|
345 |
|
|
}
|
346 |
|
|
}
|
347 |
|
|
\fi
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
% ************************** TOC and Hide Sections *****************************
|
351 |
|
|
\newcommand{\nocontentsline}[3]{}
|
352 |
|
|
\newcommand{\tochide}[2]{
|
353 |
|
|
\bgroup\let
|
354 |
|
|
\addcontentsline=\nocontentsline#1{#2}
|
355 |
|
|
\egroup}
|
356 |
|
|
% Removes pagenumber appearing from TOC
|
357 |
|
|
\addtocontents{toc}{\protect\thispagestyle{empty}}
|
358 |
|
|
|
359 |
|
|
|
360 |
|
|
% ***************************** Header Formatting ******************************
|
361 |
|
|
% Custom Header with Chapter Number, Page Number and Section Numbering
|
362 |
|
|
|
363 |
|
|
\RequirePackage{fancyhdr} % Define custom header
|
364 |
|
|
|
365 |
|
|
% Set Fancy Header Command is defined to Load FancyHdr after Geometry is defined
|
366 |
|
|
\newcommand{\setFancyHdr}{
|
367 |
|
|
|
368 |
|
|
\pagestyle{fancy}
|
369 |
|
|
\ifPHD@pageStyleI
|
370 |
|
|
% Style 1: Sets Page Number at the Top and Chapter/Section Name on LE/RO
|
371 |
|
|
\renewcommand{\chaptermark}[1]{\markboth{##1}{}}
|
372 |
|
|
\renewcommand{\sectionmark}[1]{\markright{\thesection\ ##1\ }}
|
373 |
|
|
\fancyhf{}
|
374 |
|
|
\fancyhead[RO]{\nouppercase \rightmark\hspace{0.25em} | \hspace{0.25em} \bfseries{\thepage}}
|
375 |
|
|
\fancyhead[LE]{ {\bfseries\thepage} \hspace{0.25em} | \hspace{0.25em} \nouppercase \leftmark}
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
\else
|
379 |
|
|
\ifPHD@pageStyleII
|
380 |
|
|
% Style 2: Sets Page Number at the Bottom with Chapter/Section Name on LO/RE
|
381 |
|
|
\renewcommand{\chaptermark}[1]{\markboth{##1}{}}
|
382 |
|
|
\renewcommand{\sectionmark}[1]{\markright{\thesection\ ##1}}
|
383 |
|
|
\fancyhf{}
|
384 |
|
|
\fancyhead[RO]{\bfseries\nouppercase \rightmark}
|
385 |
|
|
\fancyhead[LE]{\bfseries \nouppercase \leftmark}
|
386 |
|
|
\fancyfoot[C]{\thepage}
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
\else
|
390 |
|
|
% Default Style: Sets Page Number at the Top (LE/RO) with Chapter/Section Name
|
391 |
|
|
% on LO/RE and an empty footer
|
392 |
|
|
\renewcommand{\chaptermark}[1]{\markboth {##1}{}}
|
393 |
|
|
\renewcommand{\sectionmark}[1]{\markright{\thesection\ ##1}}
|
394 |
|
|
\fancyhf{}
|
395 |
|
|
\fancyhead[LO]{\nouppercase \rightmark}
|
396 |
|
|
\fancyhead[LE,RO]{\bfseries\thepage}
|
397 |
|
|
\fancyhead[RE]{\nouppercase \leftmark}
|
398 |
|
|
\fi
|
399 |
|
|
|
400 |
|
|
\fi
|
401 |
|
|
|
402 |
|
|
}
|
403 |
|
|
|
404 |
|
|
\setlength{\headheight}{14.5pt}
|
405 |
|
|
%\renewcommand{\headrulewidth}{0.5pt}
|
406 |
|
|
%\renewcommand{\footrulewidth}{0pt}
|
407 |
|
|
\fancypagestyle{plain}{
|
408 |
|
|
\fancyhead{}
|
409 |
|
|
\renewcommand{\headrulewidth}{0pt}
|
410 |
|
|
}
|
411 |
|
|
|
412 |
|
|
% If Margin has been set (default margin print/online version)
|
413 |
|
|
\ifsetMargin
|
414 |
|
|
\setFancyHdr % Apply fancy header settings otherwise apply it in preamble
|
415 |
|
|
\fi
|
416 |
|
|
|
417 |
|
|
% **************** Clear Header Style on the Last Empty Odd pages **************
|
418 |
|
|
\renewcommand{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else%
|
419 |
|
|
\hbox{}%
|
420 |
|
|
\thispagestyle{empty} % Empty header styles
|
421 |
|
|
\newpage%
|
422 |
|
|
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
|
423 |
|
|
|
424 |
|
|
|
425 |
|
|
% ******************************** Roman Pages *********************************
|
426 |
|
|
% The romanpages environment set the page numbering to lowercase roman one
|
427 |
|
|
% for the contents and figures lists. It also resets
|
428 |
|
|
% page-numbering for the remainder of the dissertation (arabic, starting at 1).
|
429 |
|
|
|
430 |
|
|
\newenvironment{romanpages}{
|
431 |
|
|
\setcounter{page}{1}
|
432 |
|
|
\renewcommand{\thepage}{\roman{page}}}
|
433 |
|
|
{\newpage\renewcommand{\thepage}{\arabic{page}}}
|
434 |
|
|
|
435 |
|
|
|
436 |
|
|
% ******************************************************************************
|
437 |
|
|
% **************************** Macro Definitions *******************************
|
438 |
|
|
% ******************************************************************************
|
439 |
|
|
% These macros are used to declare arguments needed for the
|
440 |
|
|
% construction of the title page and other preamble.
|
441 |
|
|
|
442 |
|
|
% The year and term the degree will be officially conferred
|
443 |
|
|
\newcommand{\@degreedate}{}
|
444 |
|
|
\newcommand{\degreedate}[1]{\renewcommand{\@degreedate}{#1}}
|
445 |
|
|
|
446 |
|
|
% The full (unabbreviated) name of the degree
|
447 |
|
|
\newcommand{\@degree}{}
|
448 |
|
|
\newcommand{\degree}[1]{\renewcommand{\@degree}{#1}}
|
449 |
|
|
|
450 |
|
|
% The name of your department(eg. Engineering, Maths, Physics)
|
451 |
|
|
\newcommand{\@dept}{}
|
452 |
|
|
\newcommand{\dept}[1]{\renewcommand{\@dept}{#1}}
|
453 |
|
|
|
454 |
|
|
% The name of your college (eg. King's)
|
455 |
|
|
\newcommand{\@college}{}
|
456 |
|
|
\newcommand{\college}[1]{\renewcommand{\@college}{#1}}
|
457 |
|
|
|
458 |
|
|
% The name of your University
|
459 |
|
|
\newcommand{\@university}{}
|
460 |
|
|
\newcommand{\university}[1]{\renewcommand{\@university}{#1}}
|
461 |
|
|
|
462 |
|
|
% Defining the crest
|
463 |
|
|
\newcommand{\@crest}{}
|
464 |
|
|
\newcommand{\crest}[1]{\renewcommand{\@crest}{#1}}
|
465 |
|
|
|
466 |
|
|
% Submission Text
|
467 |
|
|
\newcommand{\submissiontext}{This dissertation is submitted for the degree of }
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
% keywords (These keywords will appear in the PDF meta-information
|
471 |
|
|
% called `pdfkeywords`.)
|
472 |
|
|
\newcommand{\@keywords}{}
|
473 |
|
|
\newcommand{\keywords}[1]{\renewcommand{\@keywords}{#1}}
|
474 |
|
|
|
475 |
|
|
% subjectline (This subject will appear in the PDF meta-information
|
476 |
|
|
% called `pdfsubject`.)
|
477 |
|
|
\newcommand{\@subject}{}
|
478 |
|
|
\newcommand{\subject}[1]{\renewcommand{\@subject}{#1}}
|
479 |
|
|
|
480 |
|
|
|
481 |
|
|
% These macros define an environment for front matter that is always
|
482 |
|
|
% single column even in a double-column document.
|
483 |
|
|
\newenvironment{alwayssingle}{%
|
484 |
|
|
\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
|
485 |
|
|
\else\newpage\fi}
|
486 |
|
|
{\if@restonecol\twocolumn\else\newpage\fi}
|
487 |
|
|
|
488 |
|
|
% Set single column even under two column layout
|
489 |
|
|
\newcommand{\setsinglecolumn}{
|
490 |
|
|
\if@twocolumn
|
491 |
|
|
\onecolumn
|
492 |
|
|
\else
|
493 |
|
|
\fi
|
494 |
|
|
}
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
% ******************************************************************************
|
498 |
|
|
% *************************** Front Matter Layout ******************************
|
499 |
|
|
% ******************************************************************************
|
500 |
|
|
|
501 |
|
|
% ******************************** Title Page **********************************
|
502 |
|
|
\renewcommand{\maketitle}{
|
503 |
|
|
|
504 |
|
|
% To compute the free vertical space in Title page
|
505 |
|
|
\computeTitlePageSpacing
|
506 |
|
|
|
507 |
|
|
\begin{singlespace}
|
508 |
|
|
\begin{center}
|
509 |
|
|
% Title
|
510 |
|
|
{\Huge \bfseries{\@title} \par}
|
511 |
|
|
\vspace{.25\PHD@titlepagespacing}
|
512 |
|
|
|
513 |
|
|
% Crest
|
514 |
|
|
{\@crest \par}
|
515 |
|
|
\vspace{.2\PHD@titlepagespacing}
|
516 |
|
|
|
517 |
|
|
% Author
|
518 |
|
|
{\Large \bfseries{\@author} \par}
|
519 |
|
|
\vspace*{1ex}
|
520 |
|
|
|
521 |
|
|
% Department and University
|
522 |
|
|
{\large \@dept \par}
|
523 |
|
|
\vspace*{1ex}
|
524 |
|
|
{\large \@university \par}
|
525 |
|
|
\vspace{.2\PHD@titlepagespacing}
|
526 |
|
|
|
527 |
|
|
% Submission Text
|
528 |
|
|
{\large \submissiontext \par}
|
529 |
|
|
\vspace*{1ex}
|
530 |
|
|
{\large \it {\@degree} \par}
|
531 |
|
|
|
532 |
|
|
|
533 |
|
|
\end{center}
|
534 |
|
|
\vfill
|
535 |
|
|
\large
|
536 |
|
|
\begin{minipage}{0.49\textwidth}
|
537 |
|
|
\flushleft\hspace*{\oddsidemargin}\@college
|
538 |
|
|
\end{minipage}
|
539 |
|
|
\begin{minipage}{0.49\textwidth}
|
540 |
|
|
\flushright \@degreedate
|
541 |
|
|
\end{minipage}
|
542 |
|
|
\end{singlespace}
|
543 |
|
|
}
|
544 |
|
|
|
545 |
|
|
|
546 |
|
|
% ********************************* Dedication *********************************
|
547 |
|
|
% The dedication environment makes sure the dedication gets its
|
548 |
|
|
% own page, centered
|
549 |
|
|
|
550 |
|
|
\newenvironment{dedication}
|
551 |
|
|
{
|
552 |
|
|
\cleardoublepage
|
553 |
|
|
\setsinglecolumn
|
554 |
|
|
\vspace*{0.2\textheight}
|
555 |
|
|
\thispagestyle{empty}
|
556 |
|
|
\centering
|
557 |
|
|
}
|
558 |
|
|
|
559 |
|
|
|
560 |
|
|
|
561 |
|
|
% ******************************* Declaration **********************************
|
562 |
|
|
% The declaration environment puts a large, bold, centered
|
563 |
|
|
% "Declaration" label at the top of the page.
|
564 |
|
|
|
565 |
|
|
\newenvironment{declaration}{
|
566 |
|
|
\cleardoublepage
|
567 |
|
|
\setsinglecolumn
|
568 |
|
|
\chapter*{\centering \Large Declaration}
|
569 |
|
|
\thispagestyle{empty}
|
570 |
|
|
}{
|
571 |
|
|
\flushright
|
572 |
|
|
\@author{}\\
|
573 |
|
|
\@degreedate{}
|
574 |
|
|
\vfill
|
575 |
|
|
}
|
576 |
|
|
|
577 |
|
|
|
578 |
|
|
|
579 |
|
|
% ****************************** Acknowledgements ********************************
|
580 |
|
|
% The acknowledgements environment puts a large, bold, centered
|
581 |
|
|
% "Acknowledgements" label at the top of the page.
|
582 |
|
|
|
583 |
|
|
\newenvironment{acknowledgements}{
|
584 |
|
|
\cleardoublepage
|
585 |
|
|
\setsinglecolumn
|
586 |
|
|
\chapter*{\centering \Large Acknowledgements}
|
587 |
|
|
\thispagestyle{empty}
|
588 |
|
|
}
|
589 |
|
|
|
590 |
|
|
|
591 |
|
|
|
592 |
|
|
% ******************************* Nomenclature *********************************
|
593 |
|
|
\usepackage{nomencl}
|
594 |
|
|
\makenomenclature
|
595 |
|
|
\renewcommand{\nomgroup}[1]{%
|
596 |
|
|
\ifthenelse{\equal{#1}{A}}{\item[\textbf{Roman Symbols}]}{%
|
597 |
|
|
\ifthenelse{\equal{#1}{G}}{\item[\textbf{Greek Symbols}]}{%
|
598 |
|
|
\ifthenelse{\equal{#1}{Z}}{\item[\textbf{Acronyms / Abbreviations}]}{%
|
599 |
|
|
\ifthenelse{\equal{#1}{R}}{\item[\textbf{Superscripts}]}{%
|
600 |
|
|
\ifthenelse{\equal{#1}{S}}{\item[\textbf{Subscripts}]}{%
|
601 |
|
|
\ifthenelse{\equal{#1}{X}}{\item[\textbf{Other Symbols}]}
|
602 |
|
|
{}
|
603 |
|
|
}% matches mathematical symbols > X
|
604 |
|
|
}% matches Subscripts > S
|
605 |
|
|
}% matches Superscripts > R
|
606 |
|
|
}% matches Abbreviations > Z
|
607 |
|
|
}% matches Greek Symbols > G
|
608 |
|
|
}% matches Roman Symbols > A
|
609 |
|
|
|
610 |
|
|
% To add nomenclature in the header
|
611 |
|
|
\renewcommand{\nompreamble}{\markboth{\nomname}{\nomname}}
|
612 |
|
|
|
613 |
|
|
% Add nomenclature to contents and print out nomenclature
|
614 |
|
|
\newcommand{\printnomencl}[1][]{
|
615 |
|
|
\ifthenelse{\equal {#1}{}}
|
616 |
|
|
{\printnomenclature}
|
617 |
|
|
{\printnomenclature[#1]}
|
618 |
|
|
\addcontentsline{toc}{chapter}{\nomname}
|
619 |
|
|
}
|
620 |
|
|
|
621 |
|
|
|
622 |
|
|
% ***************************** Create the index *******************************
|
623 |
|
|
\ifPHD@index
|
624 |
|
|
\RequirePackage{makeidx}
|
625 |
|
|
\makeindex
|
626 |
|
|
\newcommand{\printthesisindex}{
|
627 |
|
|
\cleardoublepage
|
628 |
|
|
\phantomsection
|
629 |
|
|
\printindex}
|
630 |
|
|
\else
|
631 |
|
|
\newcommand{\printthesisindex}{}
|
632 |
|
|
\fi
|
633 |
|
|
|
634 |
|
|
|
635 |
|
|
% ******************************** Abstract ************************************
|
636 |
|
|
% The abstract environment puts a large, bold, centered "Abstract" label at
|
637 |
|
|
% the top of the page. Defines both abstract and separate abstract environment
|
638 |
|
|
|
639 |
|
|
% To include only the Title and the abstract pages for submission to BoGS
|
640 |
|
|
\ifPHD@abstract
|
641 |
|
|
\defineAbstracttrue
|
642 |
|
|
% Disable the table of contents, figures, tables, index and nomenclature
|
643 |
|
|
\renewcommand{\tableofcontents}{}
|
644 |
|
|
\renewcommand{\listoffigures}{}
|
645 |
|
|
\renewcommand{\listoftables}{}
|
646 |
|
|
\renewcommand{\printnomencl}{}
|
647 |
|
|
\renewcommand{\printthesisindex}{}
|
648 |
|
|
\renewcommand{\bibname}{}
|
649 |
|
|
\renewcommand{\bibliography}[1]{\thispagestyle{empty}}
|
650 |
|
|
\else
|
651 |
|
|
\defineAbstractfalse
|
652 |
|
|
\fi
|
653 |
|
|
|
654 |
|
|
|
655 |
|
|
\newenvironment{abstract} {
|
656 |
|
|
\ifPHD@abstract
|
657 |
|
|
% Separate abstract as per Student Registry guidelines
|
658 |
|
|
\thispagestyle{empty}
|
659 |
|
|
\setsinglecolumn
|
660 |
|
|
\begin{center}
|
661 |
|
|
{ \Large {\bfseries {\@title}} \par}
|
662 |
|
|
{{\large \vspace*{1em} \@author} \par}
|
663 |
|
|
\end{center}
|
664 |
|
|
|
665 |
|
|
\else
|
666 |
|
|
% Normal abstract in the thesis
|
667 |
|
|
\cleardoublepage
|
668 |
|
|
\setsinglecolumn
|
669 |
|
|
\chapter*{\centering \Large Abstract}
|
670 |
|
|
\thispagestyle{empty}
|
671 |
|
|
\fi
|
672 |
|
|
}
|
673 |
|
|
|
674 |
|
|
|
675 |
|
|
% ******************************** Line Spacing ********************************
|
676 |
|
|
% Set spacing as 1.5 line spacing for the PhD Thesis
|
677 |
|
|
\onehalfspace
|
678 |
|
|
|
679 |
|
|
|
680 |
|
|
% ******************** To compute empty space in title page ********************
|
681 |
|
|
% Boxes below are used to space differt contents on the title page
|
682 |
|
|
\newcommand{\computeTitlePageSpacing}{
|
683 |
|
|
|
684 |
|
|
|
685 |
|
|
% Title Box
|
686 |
|
|
\newsavebox{\PHD@Title}
|
687 |
|
|
\begin{lrbox}{\PHD@Title}
|
688 |
|
|
\begin{minipage}[c]{0.98\textwidth}
|
689 |
|
|
\centering \Huge \bfseries{\@title}
|
690 |
|
|
\end{minipage}
|
691 |
|
|
\end{lrbox}
|
692 |
|
|
|
693 |
|
|
% University Crest Box
|
694 |
|
|
\newsavebox{\PHD@crest}
|
695 |
|
|
\begin{lrbox}{\PHD@crest}
|
696 |
|
|
\@crest
|
697 |
|
|
\end{lrbox}
|
698 |
|
|
|
699 |
|
|
% Author Box
|
700 |
|
|
\newsavebox{\PHD@author}
|
701 |
|
|
\begin{lrbox}{\PHD@author}
|
702 |
|
|
\begin{minipage}[c]{\textwidth}
|
703 |
|
|
\centering \Large \bfseries{\@author}
|
704 |
|
|
\end{minipage}
|
705 |
|
|
\end{lrbox}
|
706 |
|
|
|
707 |
|
|
% Department Box
|
708 |
|
|
\newsavebox{\PHD@dept}
|
709 |
|
|
\begin{lrbox}{\PHD@dept}
|
710 |
|
|
\begin{minipage}[c]{\textwidth}
|
711 |
|
|
\centering {\large \@dept \par}
|
712 |
|
|
\vspace*{1ex}
|
713 |
|
|
{\large \@university \par}
|
714 |
|
|
\end{minipage}
|
715 |
|
|
\end{lrbox}
|
716 |
|
|
|
717 |
|
|
% Submission Box
|
718 |
|
|
\newsavebox{\PHD@submission}
|
719 |
|
|
\begin{lrbox}{\PHD@submission}
|
720 |
|
|
\begin{minipage}[c]{\textwidth}
|
721 |
|
|
\begin{center}
|
722 |
|
|
\large \submissiontext \par
|
723 |
|
|
\vspace*{1ex}
|
724 |
|
|
\large \it {\@degree} \par
|
725 |
|
|
\end{center}
|
726 |
|
|
\end{minipage}
|
727 |
|
|
\end{lrbox}
|
728 |
|
|
|
729 |
|
|
% College and Date Box
|
730 |
|
|
\newsavebox{\PHD@collegedate}
|
731 |
|
|
\begin{lrbox}{\PHD@collegedate}
|
732 |
|
|
\begin{minipage}[c]{\textwidth}
|
733 |
|
|
\large
|
734 |
|
|
\begin{minipage}{0.45\textwidth}
|
735 |
|
|
\flushleft\@college
|
736 |
|
|
\end{minipage}
|
737 |
|
|
\begin{minipage}{0.45\textwidth}
|
738 |
|
|
\flushright \@degreedate
|
739 |
|
|
\end{minipage}
|
740 |
|
|
\end{minipage}
|
741 |
|
|
\end{lrbox}
|
742 |
|
|
|
743 |
|
|
% Now to compute the free vertical space
|
744 |
|
|
\newlength{\PHD@titlepagespacing}
|
745 |
|
|
\setlength{\PHD@titlepagespacing}{ \textheight %
|
746 |
|
|
- \totalheightof{\usebox{\PHD@Title}}
|
747 |
|
|
- \totalheightof{\usebox{\PHD@crest}}
|
748 |
|
|
- \totalheightof{\usebox{\PHD@author}}
|
749 |
|
|
- \totalheightof{\usebox{\PHD@dept}}
|
750 |
|
|
- \totalheightof{\usebox{\PHD@submission}}
|
751 |
|
|
- \totalheightof{\usebox{\PHD@collegedate}}
|
752 |
|
|
}
|
753 |
|
|
}
|