forked from sidcode/bits-pilani-thesis-template-latex
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathThesis.cls
525 lines (486 loc) · 17.6 KB
/
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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Thesis LaTeX Template - THESIS CLASS FILE
%
% The original template was downloaded from:
% http://www.latextemplates.com
%
% The current version of the class file borrows heavily from the one available
% on latextemplates.com but has been modified to meet the needs of those trying
% to create a report for presentation in BITS Pilani.
%
% This class file defines the structure and design of the template.
%
% There is one part that needs to be filled out - the variables
% dictating the document particulars such as the author name, university
% name, etc. You will find these in the variables.tex file.
%
% The other two easily-editable sections are the margin sizes and abstract.
% These have both been commented for easy editing. Advanced LaTeX
% users will have no trouble editing the rest of the document to their liking.
%
% Original header:
%% This is file `Thesis.cls', based on 'ECSthesis.cls', by Steve R. Gunn
%% generated with the docstrip utility.
%%
%% Created by Steve R. Gunn, modified by Sunil Patel: www.sunilpatel.co.uk
%% Further modified by www.latextemplates.com. Later modified by Darshit Shah
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------------------------------------------------------------
% Base Class Definition
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
[2007/22/02 v1.0
LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
\edef\@curroptions{\@ptionlist{\@currname.\@currext}}
\@tempswafalse
\@tfor\@this:=#2\do{
\@expandtwoargs\in@{,\@this,}{,\@curroptions,}
\ifin@ \@tempswatrue \@break@tfor \fi}
\let\@this\@empty
\if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}
%-------------------------------------------------------------------------------
\RequirePackage[utf8]{inputenc} % Allows the use of international characters (e.g. Umlauts)
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}
\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % New command to make the lines in the title page
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space \number\year}
%-------------------------------------------------------------------------------
% SPACING RULES
%-------------------------------------------------------------------------------
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% MARGINS
%-------------------------------------------------------------------------------
\usepackage{vmargin}
\setmarginsrb { 1.0in} % left margin
{ 0.6in} % top margin
{ 1.0in} % right margin
{ 0.8in} % bottom margin
{ 20pt} % head height
{0.25in} % head sep
{ 9pt} % foot height
{ 0.3in} % foot sep
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% DECLARATION OF AUTHORSHIP
%
% Use the \Declaration command to print the Declaration of Authorship page
%-------------------------------------------------------------------------------
\newcommand\Declaration{
\btypeout{Declaration of Authorship}
\addtotoc{Declaration of Authorship}
\addtocontents{toc}{\vspace{1em}} % Add gap in the Contents, for aesthetics
\thispagestyle{plain}
\null\vfil
\begin{center}{\huge\bf Declaration of Authorship\par}\end{center}
{\normalsize
I, \authornames, declare that this \doctype{} titled, `\ttitle' and the work
presented in it are my own. I confirm that:
\begin{itemize}
\item[\tiny{$\blacksquare$}] This work was done wholly or mainly while in
candidature for a research degree at this University.
\item[\tiny{$\blacksquare$}] Where any part of this thesis has previously
been submitted for a degree or any other qualification at this
University or any other institution, this has been clearly stated.
\item[\tiny{$\blacksquare$}] Where I have consulted the published work of
others, this is always clearly attributed.
\item[\tiny{$\blacksquare$}] Where I have quoted from the work of others,
the source is always given. With the exception of such quotations, this
thesis is entirely my own work.
\item[\tiny{$\blacksquare$}] I have acknowledged all main sources of help.
\item[\tiny{$\blacksquare$}] Where the thesis is based on work done by
myself jointly with others, I have made clear exactly what was done by
others and what I have contributed myself.\\
\end{itemize}
Signed:\\
\rule[1em]{25em}{0.5pt} % This prints a line for the signature
Date:\\
\rule[1em]{25em}{0.5pt} % This prints a line to write the date
}
\vfil\vfil\null
\clearpage % Start a new page
}
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% CERTIFICATE PAGE
%
% Use the \Certificate command to print the Certificate in the document
%-------------------------------------------------------------------------------
\newcommand\Certificate{
\btypeout{Certificate}
\addtotoc{Certificate}
\addtocontents{toc}{\vspace{1em}}
\thispagestyle{plain}
\null\vfil
\begin{center}{\huge\bf Certificate\par}\end{center}
{\normalsize
This is to certify that the thesis entitled, ``\emph{\ttitle}'' and submitted by
\underline{\authornames} ID No. \underline{\idnum} in partial fulfillment of the
requirements of \ccode{} \cname{} embodies the work done by him under my
supervision.\\[2.5cm]
\begin{minipage}{0.5\textwidth}
\begin{flushleft} \large
\vspace{2cm}
\rule[0.5em]{13em}{0.5pt}\\
\emph{Supervisor}\\
\supname\\
\suppos,\\
\supinst\\
Date:\\
\end{flushleft}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{flushleft} \large
\vspace{2cm}
\rule[0.5em]{13em}{0.5pt}\\
\emph{Co-Supervisor} \\
\cosupname\\
\cosuppos,\\
\cosupinst\\
Date:\\
\end{flushleft}
\end{minipage}\\[3cm]
}
\vfil\vfil\null
\clearpage
}
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% QUOTATION PAGE
%
% Use the command \Quotation{Quote}{Author} to create a single page with a
% quotation in the document.
%-------------------------------------------------------------------------------
\newcommand\Quotation[2]{
\btypeout{Quotation}
\pagestyle{empty} % No headers or footers for the following pages
\null\vfill % Add some space to move the quote down the page a bit
\textit{``#1''}
\begin{flushright}
#2
\end{flushright}
% Add some space at the bottom to position the quote just right
\vfill\vfill\vfill\vfill\vfill\vfill\null
\clearpage % Start a new page
}
%-------------------------------------------------------------------------------
\raggedbottom
\setlength{\topskip}{1\topskip \@plus 5\p@}
\doublehyphendemerits=10000 % No consecutive line hyphens.
\brokenpenalty=10000 % No broken words across columns/pages.
\widowpenalty=9999 % Almost no widows at bottom of page.
\clubpenalty=9999 % Almost no orphans at top of page.
\interfootnotelinepenalty=9999 % Almost never break footnotes.
\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace,mathtools}
\theoremstyle{plain}
\newtheorem{example}{Example}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{axiom}[theorem]{Axiom}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\usepackage[centerlast,small,sc]{caption}
\setlength{\captionmargin}{20pt}
\newcommand{\fref}[1]{Figure~\ref{#1}}
\newcommand{\tref}[1]{Table~\ref{#1}}
\newcommand{\eref}[1]{Equation~\ref{#1}}
\newcommand{\cref}[1]{Chapter~\ref{#1}}
\newcommand{\sref}[1]{Section~\ref{#1}}
\newcommand{\aref}[1]{Appendix~\ref{#1}}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\dbltopfraction}{.85}
\renewcommand{\floatpagefraction}{0.75}
\renewcommand{\dblfloatpagefraction}{.75}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{enumitem}
\usepackage{listings}
\usepackage{lstpatch}
\usepackage{microtype}
\lstset{captionpos=b,
frame=tb,
basicstyle=\scriptsize\ttfamily,
showstringspaces=false,
keepspaces=true}
\lstdefinestyle{matlab} {
language=Matlab,
keywordstyle=\color{blue},
commentstyle=\color[rgb]{0.13,0.55,0.13}\em,
stringstyle=\color[rgb]{0.7,0,0} }
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
colorlinks,linkcolor={blue},citecolor={red},urlcolor={black},
pdfstartview={FitV},unicode,breaklinks=true]{hyperref}
\usepackage[toc]{glossaries}
\glossarystyle{long}
\makeglossaries
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\pdfstringdefDisableCommands{
\let\\\space
}
\newcommand*{\thesistitle}[1]{\def\ttitle{#1}}
\newcommand*{\supervisor}[1]{\def\supname{#1}}
\newcommand*{\cosupervisor}[1]{\def\cosupname{#1}}
\newcommand*{\documenttype}[1]{\def\doctype{#1}}
\newcommand*{\coursecode}[1]{\def\ccode{#1}}
\newcommand*{\coursename}[1]{\def\cname{#1}}
\newcommand*{\examiner}[1]{\def\examname{#1}}
\newcommand*{\degree}[1]{\def\degreename{#1}}
\newcommand*{\authors}[1]{\def\authornames{#1}}
\newcommand*{\IDNumber}[1]{\def\idnum{#1}}
\newcommand*{\addresses}[1]{\def\addressnames{#1}}
\newcommand*{\university}[1]{\def\univname{#1}}
\newcommand*{\UNIVERSITY}[1]{\def\UNIVNAME{#1}}
%adding campus option
\newcommand*{\campus}[1]{\def\campusname{#1}}
\newcommand*{\CAMPUS}[1]{\def\CAMPUSNAME{#1}}
\newcommand*{\department}[1]{\def\deptname{#1}}
\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
\newcommand*{\group}[1]{\def\groupname{#1}}
\newcommand*{\GROUP}[1]{\def\GROUPNAME{#1}}
\newcommand*{\faculty}[1]{\def\facname{#1}}
\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
\newcommand*{\supervisorposition}[1]{\def\suppos{#1}}
\newcommand*{\supervisorinstitute}[1]{\def\supinst{#1}}
\newcommand*{\cosupervisorposition}[1]{\def\cosuppos{#1}}
\newcommand*{\cosupervisorinstitute}[1]{\def\cosupinst{#1}}
\newcommand*{\subject}[1]{\def\subjectname{#1}}
\newcommand*{\keywords}[1]{\def\keywordnames{#1}}
%-------------------------------------------------------------------------------
% TITLE PAGE
%
% Redefine the \maketitle command to create a custom title page
% ------------------------------------------------------------------------------
\renewcommand\maketitle{
\btypeout{Title Page}
% PDF meta-data
\hypersetup{pdftitle={\ttitle}}
\hypersetup{pdfsubject=\subjectname}
\hypersetup{pdfauthor=\authornames}
\hypersetup{pdfkeywords=\keywordnames}
\begin{titlepage}
\begin{center}
%\textsc{\LARGE \univname}\\[1.5cm] % University name
%\textsc{\Large \doctype}\\[0.5cm] % Thesis type
\HRule \\[0.4cm] % Horizontal line
{\huge \bfseries \ttitle}\\[0.4cm] % Thesis title
\HRule \\[1.5cm] % Horizontal line
\textsc{\Large \doctype}\\[0.5cm] % Thesis type
\large \textit{Submitted in partial fulfillment of the
requirements of\\\ccode{} \cname}\\[1cm] % University requirement text
\begin{center}
\emph{By}\\[0.3cm]
\authornames\\
ID No. \idnum\\
\vspace{1cm}
\emph{Under the supervision of:} \\[0.3cm]
\supname \\ % The supervisor's name
\& \\
\cosupname\\[1cm] % The co-supervisor's name
\end{center}
\includegraphics{Figures/bits-logo.pdf} % University/department logo
\\[1cm]
\UNIVNAME, \CAMPUSNAME\\
{\large \today}\\[4cm] % Date
\vfill
\end{center}
\end{titlepage}
}
% ------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% ABSTRACT PAGE DESIGN
%-------------------------------------------------------------------------------
\newenvironment{abstract}
{
\btypeout{Abstract Page}
\addtotoc{Abstract}
\addtocontents{toc}{\vspace{1em}}
\thispagestyle{empty}
\null\vfil
\begin{center}
\setlength{\parskip}{0pt}
{\normalsize \UNIVNAME, \CAMPUSNAME \par} % University name in capitals
\bigskip
{\huge{\textit{Abstract}} \par}
\bigskip
{\normalsize \degreename\par} % Degree name
\bigskip
{\normalsize\bf \@title \par} % Thesis title
\medskip
{\normalsize by \authornames \par} % Author name
\bigskip
\end{center}
}
{\clearpage}
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% ACKNOWLEDGEMENTS
%-------------------------------------------------------------------------------
\newenvironment{acknowledgements}
{
\btypeout{Acknowledgements}
\addtotoc{Acknowledgements}
\addtocontents{toc}{\vspace{1em}}
\setstretch{1.3}
\thispagestyle{plain}
\begin{center}{\huge{\textit{Acknowledgements}} \par}\end{center}
\normalsize
}
{
\vfil\vfil\null
\clearpage
}
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% DEDICATORY
%-------------------------------------------------------------------------------
\newcommand\Dedicatory[1]{
\btypeout{Dedicatory}
\thispagestyle{plain}
\null\vfil
\vskip 60\p@
\begin{center}{\Large \sl #1}\end{center}
\vfil\null
\cleardoublepage
}
%-------------------------------------------------------------------------------
\addtocounter{secnumdepth}{1}
\setcounter{tocdepth}{3}
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}
\renewcommand\tableofcontents{
\btypeout{Table of Contents}
\addtotoc{Contents}
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\@starttoc{toc}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\renewcommand\listoffigures{
\btypeout{List of Figures}
\addtotoc{List of Figures}
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listfigurename
\@mkboth{\MakeUppercase\listfigurename}
{\MakeUppercase\listfigurename}}
\@starttoc{lof}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\renewcommand\listoftables{
\btypeout{List of Tables}
\addtotoc{List of Tables}
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listtablename
\@mkboth{
\MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
\@starttoc{lot}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\newcommand\listsymbolname{Abbreviations}
\usepackage{longtable}
\newcommand\listofsymbols[2]{
\btypeout{\listsymbolname}
\addtotoc{\listsymbolname}
\chapter*{\listsymbolname
\@mkboth{
\MakeUppercase\listsymbolname}{\MakeUppercase\listsymbolname}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
\cleardoublepage
}
\newcommand\listconstants{Physical Constants}
\usepackage{longtable}
\newcommand\listofconstants[2]{
\btypeout{\listconstants}
\addtotoc{\listconstants}
\chapter*{\listconstants
\@mkboth{
\MakeUppercase\listconstants}{\MakeUppercase\listconstants}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
\cleardoublepage
}
\newcommand\listnomenclature{Nomenclature}
\newcommand\listofnomenclature[0]{
\printglossaries
\cleardoublepage
}
\renewcommand\backmatter{
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\addtotoc{\bibname}
\btypeout{\bibname}
\@mainmatterfalse}
\endinput