-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqutad.cls
387 lines (335 loc) · 11.4 KB
/
qutad.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
%% qutad.cls
%% Copyright 2020-present Naheel Faisal <[email protected]>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Naheel Faisal.
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{qutad}[2020/02/28 QU LaTeX class by Naheel Faisal]
\LoadClass[12pt]{report}
\newcommand{\mybibstyle}{apa}
\newcommand{\numsections}{0}
\DeclareOption{ieee}{\renewcommand{\mybibstyle}{ieee}}
\DeclareOption{numsec}{\renewcommand{\numsections}{1}}
\ProcessOptions\relax
\usepackage{geometry}
\geometry{a4paper,lmargin=1.5in,rmargin=1in,tmargin=1in,bmargin=1in,includehead,includefoot}
\usepackage{setspace} % set the stretching
\usepackage{newtxtext} % Times New Roman
\usepackage{titling} % to use \theauthor, \thetitle, ...
\usepackage{indentfirst} % indent first line of every paragraph
\usepackage{lipsum} % for testing...
% chapter header style
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-25pt}{0pt}
\titleformat{\chapter}
{\normalfont\centering}
{\MakeUppercase{\chaptertitlename}\ \thechapter:\ }
{0cm}
{\MakeUppercase}
\if\numsections1
\titleformat{\section}
{\normalfont\centering}{\thesection.\ }{0cm}{}
\titleformat{\subsection}
{\normalfont\centering\itshape}{\thesubsection.\ }{0cm}{}
\titleformat{\subsubsection}
{\normalfont\itshape}{\thesubsubsection.\ }{0cm}{}
\else
\titleformat{\section}
{\normalfont\centering}{}{0cm}{}
\titleformat{\subsection}
{\normalfont\centering\itshape}{}{0cm}{}
\titleformat{\subsubsection}
{\normalfont\itshape}{}{0cm}{}
\fi
% table of content styles
\usepackage{titletoc}
\titlecontents{chapter}[0em]
{}{\@chapapp\ \thecontentslabel: }{}
{\titlerule*{.}\contentspage}
\titlecontents{section}[1em]
{}{}{}
{\titlerule*{.}\contentspage}
\titlecontents{subsection}[2em]
{}{\itshape}{}
{\titlerule*{.}\contentspage}
\titlecontents{table}[0em]
{}{Table \thecontentslabel. }{}
{\titlerule*{.}\contentspage\nobreak}
\titlecontents{figure}[0em]
{}{Figure \thecontentslabel. }{}
{\titlerule*{.}\contentspage}
% For the appendices https://tex.stackexchange.com/a/148573/167019
\usepackage{appendix}
\g@addto@macro\appendices{
\addtocontents{toc}{\protect\renewcommand{\protect\@chapapp}{\appendixname}}
}
% lists styles
\renewcommand{\contentsname}{\hfill\normalfont\fontsize{14pt}{12pt}\selectfont TABLE OF CONTENTS\hfill}
\renewcommand{\listtablename}{\hfill\normalfont\normalsize LIST OF TABLES\hfill}
\renewcommand{\listfigurename}{\hfill\normalfont\normalsize LIST OF FIGURES\hfill}
% page numbers style
\usepackage{fancyhdr}
\pagestyle{fancy} % turn it on
\fancyhf{} % clears them
\renewcommand{\headrulewidth}{0pt} % remove top bar
\fancyfoot[R]{\thepage\\} % set page number to the right
\fancypagestyle{plain} { % to work with chapter pages
\fancyhf{} % clears them
\renewcommand{\headrulewidth}{0pt} % remove top bar
\fancyfoot[R]{\thepage} % set page number to the right
}
% Thicker tables hlines
\setlength{\arrayrulewidth}{1.4pt}
% Left align captions
\usepackage{caption}
\captionsetup{
justification=raggedright,
singlelinecheck=false,
belowskip=12pt,
aboveskip=10pt}
% Parts of this section are borrowed from:
% https://github.com/rriley/qu-thesis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Tweak float placements
% From: http://mintaka.sdsu.edu/GF/bibliog/latex/floats.html "Controlling LaTeX Floats"
% and based on: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=floats
% LaTeX defaults listed at: http://people.cs.uu.nl/piet/floats/node1.html
% Alter some LaTeX defaults for better treatment of figures:
% See p.105 of "TeX Unbound" for suggested values.
% See pp. 199-200 of Lamport's "LaTeX" book for details.
% General parameters, for ALL pages:
\renewcommand{\topfraction}{0.85} % max fraction of floats at top
\renewcommand{\bottomfraction}{0.6} % max fraction of floats at bottom
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4} % 2 may work better
\setcounter{dbltopnumber}{2} % for 2-column pages
\renewcommand{\dbltopfraction}{0.66} % fit big float above 2-col. text
\renewcommand{\textfraction}{0.15} % allow minimal text w. figs
% Parameters for FLOAT pages (not text pages):
\renewcommand{\floatpagefraction}{0.66} % require fuller float pages
% N.B.: floatpagefraction MUST be less than topfraction !!
\renewcommand{\dblfloatpagefraction}{0.66} % require fuller float pages
% The documentclass already sets parameters to make a high penalty for widows and orphans.
%%%% Use packages
%%% For figures
\usepackage{graphicx}
%\usepackage{subfig,rotate}
%%% for comments
\usepackage{verbatim}
%%% For tables
\usepackage{multirow}
% Longtable lets you have tables that span multiple pages.
\usepackage{longtable}
% Booktabs produces far nicer tables than the standard LaTeX tables.
% see: http://en.wikibooks.org/wiki/LaTeX/Tables
\usepackage{booktabs}
%set parameters for longtable:
% default caption width is 4in for longtable, but wider for normal tables
\setlength{\LTcapwidth}{\textwidth}
% url package understands urls (with proper line-breaks) without hyperlinking them
\usepackage{url}
\usepackage{tikz, color, graphics, xcolor, booktabs, rotating, floatpag, fancyhdr}
\usetikzlibrary{shapes, backgrounds, chains}
\usetikzlibrary{fadings, decorations.pathreplacing,angles,quotes}
\usepackage{tikz}
\usetikzlibrary{plotmarks}
\usetikzlibrary{shapes}
\usetikzlibrary{calc}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.17} % fix the version of pgfplots
\usepackage[backend=biber,natbib=true,style=\mybibstyle]{biblatex}
\usepackage{float}
\usepackage{enumitem}
\usepackage{longtable}
\newcolumntype{x}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
% To allow for clickable (hyper-referencing) in-text citations, figure #s,
% and sections in-text referencing
% By default, colors are off because your thesis should stand-alone
% when printed. However, it is nice to have the TOC clickable in the PDF.
\usepackage[hidelinks,pdfusetitle]{hyperref}
\hypersetup{
colorlinks=false, % set true if you want colored links
linktoc=all, % set to all if you want both sections and subsections linked
linkcolor=blue, % choose some color if you want links to stand out
citecolor=green,
urlcolor=blue,
linktocpage,
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% more math symbols and commands
\usepackage{amsmath}
% pdf keywords
\hypersetup{
pdfkeywords={Qatar University, TAD, https://github.com/Naheel-Azawy/qu-tad-template}
}
\long\def\abstract#1{\gdef\@abstract{#1}}
\newcommand*{\makefrontmatter}{
\newgeometry{lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in,includefoot}
% COVER PAGE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\thispagestyle{empty}
\begin{center}
\setstretch{2.8}
QATAR UNIVERSITY \\
\MakeUppercase{\college} \\
\MakeUppercase{\thetitle} \\
BY \\
\MakeUppercase{\theauthor}
\end{center}
\vspace*{\fill}
\begin{center}
\setstretch{2}
A \degreetype\ Submitted to \\
the \college \\
in Partial Fulfillment of the Requirements for the Degree of \\
\degree
\end{center}
\vspace{0.5cm}
\begin{center}
\submittedmonth\, \submittedyear \\ \vspace{0.4cm}
\copyright\ \copyrightyear. \theauthor. All Rights Reserved.
\end{center}
\vspace{1.7cm}
\newpage
\newgeometry{lmargin=1.5in,rmargin=1in,tmargin=1in,bmargin=1in,includehead,includefoot}
% page numbering
\pagenumbering{roman}
\setcounter{page}{2}
% COMITTEE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\fontsize{14pt}{12pt}\selectfont
COMMITTEE PAGE
\end{center}
\begin{center}
\setstretch{1.5}
The members of the Committee approve the \degreetype\ of \\
\theauthor\ defended on \defensedate.
\end{center}
\begin{flushright}
\setstretch{1.15}
\ifdefined\adviser
\noindent \makebox[2.5in]{\hrulefill} \\
\adviser \\
\degreetype\ Supervisor \\~\\
\fi
\ifdefined\coadviser
\noindent \makebox[2.5in]{\hrulefill} \\
\coadviser \\
\degreetype\ Co-Supervisor \\~\\
\fi
\ifdefined\committeeone
\noindent \makebox[2.5in]{\hrulefill} \\
\committeeone \\
Committee Member \\~\\
\fi
\ifdefined\committeetwo
\noindent \makebox[2.5in]{\hrulefill} \\
\committeetwo \\
Committee Member \\~\\
\fi
\ifdefined\committeethree
\noindent \makebox[2.5in]{\hrulefill} \\
\committeethree \\
Committee Member \\~\\
\fi
\ifdefined\committeefour
\noindent \makebox[2.5in]{\hrulefill} \\
\committeefour \\
Committee Member \\~\\
\fi
\end{flushright}
\vfill
\noindent \ \ Approved: \\
\noindent \makebox[\linewidth]{\hrulefill} \\
\noindent \collegedean, Dean, \college
\newpage
% ABSTRACT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\fontsize{14pt}{12pt}\selectfont
ABSTRACT
\end{center}
\authorabstract, \ifthenelse{\equal{\degreetype}{Thesis}}{Masters}{Doctorate} : \submittedmonth : \submittedyear, \degree \\
\noindent Title: \thetitle \\
\noindent Supervisor of \degreetype: \adviser. \\
\@abstract
\newpage
% DEDICATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\addcontentsline{toc}{chapter}{DEDICATION}
DEDICATION
\end{center}
\vfill
\begin{center}
\emph{\dedication}
\end{center}
\vfill
\vspace*{2in}
\newpage
% ACKNOWLEDGMENTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\addcontentsline{toc}{chapter}{ACKNOWLEDGMENTS}
ACKNOWLEDGMENTS
\end{center}
\acknowledgments
%\newpage
% TOC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
\vspace*{-2.5cm}
\setstretch{2}
\let\bfseries\mdseries
\tableofcontents
}
%\newpage
% LOT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace*{-2cm}
\addcontentsline{toc}{chapter}{LIST OF TABLES}
\listoftables
%\newpage
% LOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace*{-2.2cm}
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\listoffigures
\newpage
% LOP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifdefined\publications
\begin{refsection}
\nocite{\publications}
\printbibliography[title = {LIST OF PUBLICATIONS}]
\end{refsection}
\newpage
\fi
% page numbering
\pagenumbering{arabic}
\setcounter{page}{1}
% TODO: Fix this workaround
\newgeometry{lmargin=1.5in,rmargin=1in,tmargin=1in,bmargin=0.75in,includefoot}
}
% global double spacing
\setstretch{2}
% single spacing for verbatim
\let\oldv\verbatim
\def\verbatim{\par\setstretch{1}\oldv}
% \printbibliography but to match the template
\newcommand{\printreferences} {
{
% add the Bibliography to the Table of Contents
\cleardoublepage
\ifdefined\phantomsection
\phantomsection % makes hyperref recognize this section properly for pdf link
\else
\fi
\addcontentsline{toc}{chapter}{References}
}
\printbibliography[title = {REFERENCES}]
}