-
Notifications
You must be signed in to change notification settings - Fork 0
/
phiri-thesis.cls
408 lines (400 loc) · 11.4 KB
/
phiri-thesis.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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{phiri-thesis}
[2012/08/19 v1.0 University of Cape Town Dissertation class]
\RequirePackage{setspace}
\newcounter{subyear}
\setcounter{subyear}{\number\year}
\def\submitted#1{\gdef\@submitted{#1}}
\def\@submittedyear{\ifnum\month>10 \stepcounter{subyear}\thesubyear
\else\thesubyear\fi}
\def\@submittedmonth{\ifnum\month>10 January\else\ifnum\month>5 November
\else June\fi\fi}
\def\copyrightyear#1{\gdef\@copyrightyear{#1}}
\def\@copyrightyear{\number\year}
\def\adviser#1{\gdef\@adviser{#1}}
\long\def\@abstract{\@latex@error{No \noexpand\abstract given}\@ehc}
\newcommand*{\frontmatter}{
\pagenumbering{roman}
}
\newcommand*{\mainmatter}{\pagenumbering{arabic}}
\newcommand*{\makelot}{}
\newcommand*{\makelof}{}
\newcommand*{\makelos}{}
\newcommand*{\makelogs}{}
\newcommand*{\maketoc}{
% Add ToC to the pdfbookmarks as a section, but not to the ToC itself.
% only if we have the hyperref command that is necessary
%
% Uncomment code block below to show toc in pdfbookmark
%
\ifdefined\pdfbookmark
\phantomsection
%%%%%\pdfbookmark[1]{\contentsname}{Table of Contents} % flip number to show in bookmark
\pdfbookmark[1]{\contentsname}{Contents}
\else
\fi
\tableofcontents
\clearpage
}
%% Setup a command to add extra space only if in singlespacing mode
\newcommand*{\extravspace}[1]{\vspace{0in}}
%% Setup a command to set spacing for body text; also used to restore spacing after long tables in document
\newcommand*{\bodyspacing}{
\doublespacing
}
%% Setup a command to set spacing for long tables, to be used manually in document
\newcommand*{\tablespacing}{
\singlespacing
}
%% Command inserted into the document immediately after \begin{document} to place all frontmatter
%% This was formerly named 'begincmd' and called below in \AtBeginDocument{}
%% However, that is not compatible with package 'hyperref'. \tableofcontents needs
%% to be declared from within the document itself.
\newcommand*{\makefrontmatter}{
\bodyspacing
\frontmatter
\maketitlepage
\makecopyrightpage
\makedeclarationpage
\makeacknowledgements
\makededication
\makeabstract
\maketoc
\makelot
\clearpage
\makelof
\clearpage
\makelos
\clearpage
\makelogs
\clearpage
\mainmatter
}
\def\@submitted{\@submittedmonth~\@submittedyear}
\def\@dept{Computer Science}
\def\@deptpref{Department of }
\def\departmentprefix#1{\gdef\@deptpref{#1}}
\def\department#1{\gdef\@dept{#1}}
\long\def\declaration#1{\gdef\@declaration{#1}} % understand this brother...
\long\def\acknowledgements#1{\gdef\@acknowledgements{#1}}
\def\dedication#1{\gdef\@dedication{#1}}
%%%\newcommand{\maketitlepage}{{
%%%\thispagestyle{empty}
%%%\sc
%%%\vspace*{0in}
%%%\begin{center}
%%%\LARGE \@title
%%%\end{center}
%%%\vspace{.5in}
%%%\extravspace{.2in}
%%%\begin{center}
%%%%%by \\
%%%%%\vspace{.1in}
%%%\@author \\
%%%\vspace{.1in}
%%%%Supervised By: \\
%%%%\@adviser
%%%\end{center}
%%%\vspace{.5in}
%%%\extravspace{.2in}
%%%\begin{center}
%%%\begin{center}
%%% \includegraphics[scale=0.65]{figures/UCTcircular_logo_CMYK.eps}
%%%\end{center}
%%%\vspace{.5in}
%%%A Thesis submitted in partial fulfillment of the \\
%%%requirements for the degree of \\
%%%\vspace{.3in}
%%%Master of Science \\
%%%\vspace{.05in}
%%%in \\
%%%\vspace{.05in}
%%%Computer Science \\
%%%\vspace{.3in}
%%%Supervised by \\
%%%Hussein Suleman \\
%%%\end{center}
%%%\vspace{.2in}
%%%\extravspace{.2in}
%%%\begin{center}
%%%\@deptpref \@dept \\
%%%Faculty of Science \\
%%%University of Cape Town
%%%\end{center}
%%%\vspace{.3in}
%%%\extravspace{.3in}
%%%\begin{center}
%%%\@submitted
%%%\end{center}
%%%\clearpage
%%%}}
\newcommand{\maketitlepage}{{
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
%%%%%\pdfbookmark[1]{Title Page}{titlepage}
\else
\fi
\thispagestyle{empty}
\sc
\vspace*{0in}
\begin{center}
\LARGE \@title
\end{center}
\vspace{1in}
\extravspace{1in}
\begin{center}
\@author
\end{center}
\vspace{1in}
\extravspace{1in}
\begin{center}
A Dissertation Submitted \\
in Partial Fulfilment of the \\
Requirements for the degree of \\
Master of Science in \\
Computer Science \\
\end{center}
\vspace{1in}
\extravspace{1in}
\begin{center}
Department of Computer Science \\
Faculty of Science \\
University of Cape Town \\
\vspace{.7in}
Supervised by \\
\@adviser
\end{center}
\vspace{.9in}
\extravspace{.7in}
\begin{center}
\@submitted
\end{center}
\clearpage
}}
\newcommand*{\makecopyrightpage}{
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
%%%%%\pdfbookmark[1]{Copyright Page}{copyright}
\else
\fi
\thispagestyle{empty}
\vspace*{0in}
\begin{center}
%\Large \textbf{Copyright Statement}\\ % November 23, 2012 --phiri.
%Title on copyright page
\vspace{2.0in}
%\copyright\ Copyright by \@author, \@copyrightyear. \\
%All rights reserved.
\begin{center}
\includegraphics{figures/cc-by.eps} % creative commons licence image
\end{center}
\vspace{.2in}
\normalsize{This work is licensed under a \href{http://creativecommons.org/licenses/by/3.0/deed.en_GB} {Creative Commons Attribution 3.0 Unported Licence}}
\end{center}
\clearpage}
%\newcommand*{\makedeclarationpage}{
% \thispagestyle{empty}
% \vspace*{0in}
% \begin{center}
% \Large \textbf{Plaigirism Declaration}\\
% \vspace{.5in}
% \normalsize{I know the meaning of plagiarism and declare that all the work
%in the document, save for which is properly acknowledged, is my own.}\\
%\vspace{.5in}
%\normalsize{\textbf{Lighton Phiri}}
% \end{center}
% \clearpage}
\def\makedeclarationpage{
\ifx\@declaration\undefined
\else
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
\else
\fi
%\addcontentsline{toc}{section}{Plaigirism Declaration}
%%%%%\chapter*{Declaration}
%%%%%%%%%%\begin{center}
%%%%%%%%%%\Large \textbf{Declaration}
%%%%%%%%%%\end{center}
%%\begin{center}
%%\Large \textbf{Declaration}
%%\vspace{.2in}
%%\end{center}
\begin{center}
\line(1,0){430}\\
\vspace{.2in}
%%%%%\large {Simple Digital Libraries}\\
\Large \textbf{Simple Digital Libraries} \\
\vspace{.3in}
\Large \textbf{by} \\
\vspace{.3in}
\Large \textbf{Lighton Phiri} \\
\vspace{.2in}
\line(1,0){430}\\
\vspace{.8in}
%%%%%\section*{Plagiarism Declaration}
\Large \textbf{Plagiarism Declaration} \\
\vspace{.2in}
\end{center}
\@declaration
\thispagestyle{empty}
\vspace*{0in}
\clearpage
\fi
}
\def\makeabstract{
\ifx\@abstract\undefined
\else
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
\pdfbookmark[1]{Abstract}{abstract}
\else
\fi
% to include acknowledgements in toc, uncomment line below
%%%%%\addcontentsline{toc}{section}{Abstract}
%%%%%\chapter*{Abstract}
\begin{center}
\Large \textbf{Abstract}
\vspace{.1in}
\end{center}
%%\begin{center}
%%\Large \textbf{Abstract}\\
%%\vspace{.2in}
%%\large \textbf{Simple Digital Libraries}\\
%%\vspace{.1in}
%%\large{Lighton Phiri}\\
%%\vspace{.1in}
%%\large{Department of Computer Science}\\
%%\large{University of Cape Town}\\
%%\large{\href{mailto:[email protected]}{\nolinkurl{[email protected]}}}\\
%%\vspace{.2in}
%\Large \textbf{Abstract}
%\vspace{.2in}
%%\end{center}
\@abstract
\clearpage
}
\def\makeacknowledgements{
\ifx\@acknowledgements\undefined
\else
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
\pdfbookmark[1]{Acknowledgements}{acknowledgements}
\else
\fi
% to include acknowledgements in toc, uncomment line below
%%%%%\addcontentsline{toc}{section}{Acknowledgements}
%%%%%\chapter*{Acknowledgements}
\begin{center}
\Large \textbf{Acknowledgements}
\vspace{.1in}
\end{center}
%%\begin{center}
%%\Large \textbf{Acknowledgements}
%%\vspace{.2in}
%%\end{center}
\@acknowledgements
\clearpage
\fi
}
\def\makededication{
\ifx\@dedication\undefined
\else
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
%%%%%\pdfbookmark[1]{Dedication Page}{dedication}
\else
\fi
\vspace*{1.5in}
\begin{flushright}
\@dedication
\end{flushright}
\clearpage
\fi
}
\DeclareOption{lot}{\renewcommand*{\makelot}{
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
\else
\fi
\addcontentsline{toc}{section}{List of Tables}\listoftables}}
\DeclareOption{logs}{\renewcommand*{\makelogs}{
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
\else
\fi
\addcontentsline{toc}{section}{List of Abbreviations}\glsaddall\printglossary[style=long]}}
\DeclareOption{lof}{\renewcommand*{\makelof}{
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
\else
\fi
\addcontentsline{toc}{section}{List of Figures}\listoffigures}}
\DeclareOption{los}{
\renewcommand*{\makelos}{
\RequirePackage{losymbol}
\section*{List of Symbols\@mkboth {LIST OF SYMBOLS}{LIST OF SYMBOLS}}
\@starttoc{los}
\ifdefined\phantomsection
% makes hyperref recognize this section properly for pdf links
\phantomsection
\else
\fi
\addcontentsline{toc}{section}{List of Symbols}
}
}
\DeclareOption{singlespace}{
\renewcommand*{\bodyspacing}{
\singlespacing
}
%% Add extra space only if in singlespacing mode
\renewcommand*{\extravspace}[1]{\vspace{#1}}
}
% August 10, 2013
% http://www.cl.cam.ac.uk/local/phd/typography/
\DeclareOption{onehalfspace}{
\renewcommand*{\bodyspacing}{
\singlespacing
}
% Add extra space only if in singlespacing mode
% http://www.cl.cam.ac.uk/local/phd/typography/
\renewcommand{\baselinestretch}{1.2}
}
%% Doublespacing is the default for the thesis -- need not be declared.
\DeclareOption{doublespacing}{
\renewcommand*{\bodyspacing}{
\doublespacing
}
}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions
%% Not necessary to specify the point size - we inherit it from above
%% \LoadClass[12pt]{report}
\LoadClass{report}
%\setlength{\oddsidemargin}{.5in} %{.4375in}
%\setlength{\evensidemargin}{.5in} %{.4375in}
\setlength{\topmargin}{-.5in} %{-.5625in}
\setlength{\footskip}{.25in} % to put page number 3/4" from the bottom of the page (1/4" from bottom of body text)
\setlength{\textheight}{9in}
\setlength{\textwidth}{6in}
%%% Alter LaTeX defaults to try to eliminate all widows and orphans
\clubpenalty=10000
\widowpenalty=10000
%%% try to avoid overfull lines by limiting how far it is okay to exceed the margins
%%% http://www.tex.ac.uk/cgi-bin/texfaq2html?label=overfull
\setlength{\emergencystretch}{2em}
\long\def\abstract#1{\gdef\@abstract{#1}}
%% 'begincmd' no longer used -- insert \makefrontmatter in the document instead. See above.
%\AtBeginDocument{\begincmd}
\endinput
%%
%% End of file `phiri-thesis.cls'.