-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dissertate.cls
369 lines (325 loc) · 9.69 KB
/
Dissertate.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
% -------------------------------------------------------------------
% @LaTeX-class-file{
% filename = "Dissertate.cls",
% codetable = "ISO/ASCII",
% keywords = "LaTeX, Dissertate",
% docstring = "Class for a dissertation."
% --------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{Dissertate}[Dissertate Class]
\LoadClass[12pt, twoside, openright, a4paper]{book}
%
% Options
%
\RequirePackage{etoolbox}
% Line spacing: dsingle/ddouble
% Whether to use single- or doublespacing.
\newtoggle{DissertateSingleSpace}
\toggletrue{DissertateSingleSpace}
\DeclareOption{dsingle}{
\toggletrue{DissertateSingleSpace}
\ClassWarning{Dissertate}{Single-spaced mode on.}
}
\DeclareOption{ddouble}{\togglefalse{DissertateSingleSpace}}
\ProcessOptions\relax
% Line Spacing
% Define two line spacings: one for the body, and one that is more compressed.
\iftoggle{DissertateSingleSpace}{
\newcommand{\dnormalspacing}{1.2}
\newcommand{\dcompressedspacing}{1.0}
}{
\newcommand{\dnormalspacing}{2.0}
\newcommand{\dcompressedspacing}{1.2}
}
% Block quote with compressed spacing
\let\oldquote\quote
\let\endoldquote\endquote
\renewenvironment{quote}
{\begin{spacing}{\dcompressedspacing}\oldquote}
{\endoldquote\end{spacing}}
% Itemize with compressed spacing
\let\olditemize\itemize
\let\endolditemize\enditemize
\renewenvironment{itemize}
{\begin{spacing}{\dcompressedspacing}\olditemize}
{\endolditemize\end{spacing}}
% Enumerate with compressed spacing
\let\oldenumerate\enumerate
\let\endoldenumerate\endenumerate
\renewenvironment{enumerate}
{\begin{spacing}{\dcompressedspacing}\oldenumerate}
{\endoldenumerate\end{spacing}}
% Text layout.
\RequirePackage[outer=1.2in, inner=1.2in, twoside, a4paper]{geometry}
\usepackage{ragged2e}
%\RaggedRight
\RequirePackage{graphicx}
\usepackage{fixltx2e}
\parindent 12pt
\RequirePackage{lettrine}
\RequirePackage{setspace}
\RequirePackage{verbatim}
\usepackage{amsmath}
\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\usepackage{siunitx}
% Fonts.
\RequirePackage{color}
%\RequirePackage{xcolor}
\usepackage{hyperref}
\RequirePackage{url}
\usepackage{url}
\Urlmuskip = 0mu plus 1mu
\RequirePackage{amssymb}
\RequirePackage{mathspec}
%\setmathsfont(Digits,Latin,Greek)[Numbers={Proportional}]{EB Garamond}
%\setmathrm{EB Garamond}
\AtBeginEnvironment{tabular}{\addfontfeature{RawFeature=+tnum}}
\widowpenalty=300
\clubpenalty=300
\setromanfont[Numbers=OldStyle, Ligatures={Common, TeX}, Scale=1.0]{EB Garamond}
\newfontfamily{\smallcaps}[RawFeature={+c2sc,+scmp}]{EB Garamond}
\setsansfont[Scale=MatchLowercase, BoldFont={Lato Bold}]{Lato Regular}
\setmonofont[Scale=MatchLowercase]{Source Code Pro}
\RequirePackage[labelfont={bf,sf,footnotesize,singlespacing},
textfont={sf,footnotesize,singlespacing},
justification={justified,RaggedRight},
singlelinecheck=false,
margin=0pt,
figurewithin=chapter,
tablewithin=chapter]{caption}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\RequirePackage{microtype}
% Tikz
\usepackage[table,xcdraw]{xcolor}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{plot coordinates/math parser=false}
\newlength\fheight
\newlength\fwidth
\usepackage{booktabs}
\usepackage{multirow}
%\usepackage{multicolumn}
\usepackage{subcaption}
\usetikzlibrary{patterns,decorations.pathreplacing,backgrounds,calc}
\usepackage{afterpage}
\usepackage{tabulary}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\usepackage[table,xcdraw]{xcolor}
% Pseudocode
\usepackage{algorithm}
\usepackage{algorithmic}
%\usepackage[noend]{algpseudocode}
\renewcommand\algorithmicthen{}
\renewcommand\algorithmicdo{}
\@addtoreset{algorithm}{chapter}% algorithm counter resets every chapter
\usepackage{lscape}
\renewcommand{\thealgorithm}{\thechapter.\arabic{algorithm}}% Algorithm # is <chapter>.<algorithm>
% Abbreviations
\newcommand{\abbrlabel}[1]{\makebox[3cm][l]{\textbf{#1}\ \dotfill}}
\newenvironment{abbreviations}{\begin{list}{}{\renewcommand{\makelabel}{\abbrlabel}}}{\end{list}}
% Headings and headers.
\RequirePackage{fancyhdr}
\RequirePackage[medium, md, sc]{titlesec} % format for the title of the sections
\setlength{\headheight}{15pt}
\pagestyle{plain}
\RequirePackage{titling}
% Front matter.
\setcounter{tocdepth}{2}
\usepackage[titles]{tocloft}
\usepackage[titletoc]{appendix}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapfont}{\normalsize \scshape}
\renewcommand\listfigurename{Listing of figures}
\renewcommand\listtablename{Listing of tables}
% Endmatter
\renewcommand{\setthesection}{\arabic{chapter}.A\arabic{section}}
% References.
\renewcommand\bibname{References}
%\RequirePackage[super,comma,numbers]{natbib}
\RequirePackage[comma,numbers]{natbib}
\renewcommand{\bibnumfmt}[1]{[#1]}
\RequirePackage[palatino]{quotchap}
\renewcommand*{\chapterheadstartvskip}{\vspace*{-0.5\baselineskip}}
\renewcommand*{\chapterheadendvskip}{\vspace{1.3\baselineskip}}
\bibliographystyle{IEEEtran}
% An environment for paragraph-style section.
\providecommand\newthought[1]{%
\addvspace{1.0\baselineskip plus 0.5ex minus 0.2ex}%
\noindent\textsc{#1}%
}
% Align reference numbers so that they do not cause an indent.
\newlength\mybibindent
\setlength\mybibindent{0pt}
\renewenvironment{thebibliography}[1]
{\chapter*{\bibname}%
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\list{\@biblabel{\@arabic\c@enumiv}}
{\settowidth\labelwidth{\@biblabel{999}}
\leftmargin\labelwidth
\advance\leftmargin\dimexpr\labelsep+\mybibindent\relax\itemindent-\mybibindent
\@openbib@code
\usecounter{enumiv}
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}
\endlist}
% Some definitions.
\def\advisor#1{\gdef\@advisor{#1}}
\def\mastername#1{\gdef\@mastername{#1}}
\def\coadvisorOne#1{\gdef\@coadvisorOne{#1}}
\def\coadvisorOneUniversity#1{\gdef\@coadvisorOneUniversity{#1}}
\def\academicYear#1{\gdef\@academicYear{#1}}
\def\department#1{\gdef\@department{#1}}
\def\university#1{\gdef\@university{#1}}
% School color
\definecolor{SchoolColor}{rgb}{0.71, 0, 0.106} % UNIPD red
\definecolor{chaptergrey}{rgb}{0.61, 0, 0.09} % dialed back a little
\definecolor{midgrey}{rgb}{0.4, 0.4, 0.4}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black,
}
\renewcommand{\frontmatter}{
\pagenumbering{roman}
\input{frontmatter/personalize}
\maketitle
\frontispiece
% \dedicationpage
\abstractpage
\tableofcontents
\phantomsection
\clearpage
% figure listing - required if you have any figures
\phantomsection
\addcontentsline{toc}{chapter}{List of figures}
\listoffigures
\cleardoublepage
% table listing - required if you have any tables
\phantomsection
\addcontentsline{toc}{chapter}{List of tables}
\listoftables
\cleardoublepage
\acronyms
\cleardoublepage
\setcounter{page}{1}
\pagenumbering{arabic}
}
\newcommand{\cover}{
\pagenumbering{roman}
\input{frontmatter/personalize}
\makecover
}
\renewcommand{\maketitle}{
\thispagestyle{empty}
\setcounter{page}{1}
\begin{center}
\vbox to0pt{\vbox to\textheight{\vfill \includegraphics[width=11.5cm]{resources/unipd-light} \vfill}\vss}
%\vspace*{\fill}
\begin{figure}
\centering
\includegraphics[height=2.5cm]{resources/unipd-bn}
\end{figure}
\setstretch{1.5}
\scshape{\huge{\bfseries{\@university}}} \\
\line(1, 0){400} \\
\scshape{\large{Department of \@department}} \\
\vspace{3pt}
\scshape{\large{\textit{Master Thesis in \@mastername}}} \\
\vspace{2pt}
\setstretch{2.5}
\vspace{10pt}
\scshape{\LARGE{\bfseries{\textcolor{SchoolColor}{\thetitle}}}} \normalsize \\
\vspace{15pt}
\setstretch{1.2}
\vfill
\begin{normalsize}
\begin{flushleft}
\textit{Supervisor} \hfill \textit{Master Candidate}\\
\vspace{1pt}
\@advisor \hfill \@author\\
\@university \\
\vspace{6pt}
\textit{Co-supervisor} \\
\@coadvisorOne \\
\@coadvisorOneUniversity\\
\vspace{30pt}
\centering
\large{\textit{Academic Year} \\ \@academicYear}
\end{flushleft}
\end{normalsize}
\end{center}
\vspace*{\fill}
\singlespacing
\cleardoublepage
}
\newcommand{\copyrightpage}{
\newpage
\thispagestyle{empty}
\vspace*{25pt}
\begin{center}
\scshape \noindent \small \copyright \ \small \theauthor \\
all rights reserved, \@degreeyear
\end{center}
\newpage
\rm
}
\newcommand{\frontispiece}{
\newpage
\thispagestyle{empty}
\setcounter{page}{3}
\vspace*{\fill}
\begin{center}
\end{center}
\vspace*{\fill}
}
\newcommand{\dedicationpage}{
\phantomsection
\setcounter{page}{3}
\vspace*{\fill}
\scshape \noindent \input{frontmatter/dedication}
\vspace*{\fill}
\cleardoublepage
\rm
}
\newcommand{\acknowledgments}{
\phantomsection
\chapter*{Acknowledgments}
\noindent
\input{frontmatter/thanks}
\vspace*{\fill} \newpage
}
\newcommand{\acronyms}{
\phantomsection
\addcontentsline{toc}{chapter}{Listing of acronyms}
\chapter*{Listing of acronyms}
\input{frontmatter/abbr.tex}
}
\newcommand{\abstractpage}{
\phantomsection
\setcounter{page}{3}
\addcontentsline{toc}{chapter}{Abstract}
\chapter*{Abstract}
\input{frontmatter/abstract}
}
\renewcommand{\backmatter}{
\begin{appendices}
\include{chapters/appendixA}
\end{appendices}
\input{endmatter/personalize}
\clearpage
\bibliography{references}
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{apalike2}
\include{endmatter/colophon}
}