-
Notifications
You must be signed in to change notification settings - Fork 0
/
mythesis.cls
470 lines (442 loc) · 15.2 KB
/
mythesis.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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mythesis}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions
\LoadClass[a4paper,12pt,twoside]{book} % choose single or double page style
%% All the languages you need go here
\RequirePackage[utf8]{inputenc}
\RequirePackage[portuguese,british]{babel} % Last one listed is the one initially used
\addto\captionsbritish{% Replace "british" with the language you use
\renewcommand{\contentsname}{Contents} % rename 'Contents'
\renewcommand{\listfigurename}{List of figures} % rename 'List of Figures' in ToC
\renewcommand{\listtablename}{List of tables} % rename 'List of Tables' in ToC
}
\RequirePackage{setspace} %% Space between lines of text for main text and bibliography
\setstretch{1.5} % Use 1.241 for 1.5 spacing at 12pt font following https://www.overleaf.com/learn/latex/Articles/How_to_change_paragraph_spacing_in_LaTeX#Understanding_and_calculating_values_for_\baselinestretch
% Font configuration for captions
\RequirePackage[font={singlespacing}]{caption}
\DeclareCaptionFont{myfont}{\fontsize{9pt}{11pt}\selectfont}
\captionsetup{font=myfont}
\RequirePackage{subcaption}
\subcaptionsetup{font=myfont, position=top, skip=0pt}
\parindent 1cm % Indentation space
\raggedbottom % Avoid correction of text spacing
%% FONTS
%% This loads a font for both text and math modes. The website https://tug.org/FontCatalogue/ lists all available fonts.
% \usepackage[sc]{example_font}
% Loads text fonts
\RequirePackage[T1]{fontenc}
% One option is loading directly Times News Roman-like fonts
\RequirePackage{newtxtext,newtxmath}
% Another option uses fontspec package (only with LuaLaTeX or XeLaTeX)
% \RequirePackage{fontspec}
% Set the main font to a Times New Roman-like font
% \setmainfont{Times New Roman} % or another Times New Roman-like font
% Select font families. Select according to University rules
%\renewcommand*{\sfdefault}{ptm}
%\newcommand*{\numfont}{\fontfamily{ptm}\selectfont}
%\newcommand*{\headfont}{\bfseries\fontfamily{ptm}\selectfont}
%\newcommand*{\secfont}{\bfseries\fontfamily{ptm}\selectfont}
% add lowercase black-board letters
\DeclareFontFamily{U}{stix2bb}{\skewchar\font127 }
\DeclareFontShape{U}{stix2bb}{m}{n} {<-> stix2-mathbb}{}
\DeclareMathAlphabet{\mathbb}{U}{stix2bb}{m}{n}
\RequirePackage{xcolor}
% custom colours definitions
\definecolor{violet}{rgb}{0.38, 0.31, 0.86}
\definecolor{mauve}{RGB}{161, 164, 209}
\definecolor{black}{rgb}{0.0, 0.0, 0.0}
\definecolor{reddish}{HTML}{C70039}
\definecolor{lightblue}{HTML}{2D77A8}
\definecolor{burgundy}{rgb}{0.3,0,0}
\definecolor{softblue}{HTML}{3D4AAF}
\definecolor{light-gray}{gray}{0.5}
% To make cites and references
\RequirePackage[hidelinks, pdfusetitle, pdfdisplaydoctitle, breaklinks=true, linktoc=all]{hyperref} % If you want clickable links in the .pdf file
% select colours in hyperlinks
\hypersetup{
colorlinks=true,
linkcolor=softblue,
citecolor=softblue,
filecolor=.,
urlcolor=softblue% color we defined above
}
% Glossary and acronyms
\RequirePackage[acronym, abbreviations, symbols, nogroupskip, sort=standard, hyperfirst=true, shortcuts, nonumberlist]{glossaries-extra}
\setabbreviationstyle[acronym]{long-short}
\setabbreviationstyle[abbreviation]{long-short}
\glssetcategoryattribute{general}{glossdesc}{firstuc} % first letter upper case in LoG
\glssetcategoryattribute{acronym}{glossdesc}{firstuc} % first letter upper case in LoG
\glssetcategoryattribute{symbol}{glossdesc}{firstuc} % first letter upper case in LoG
\setlength{\glsdescwidth}{0.8\textwidth}
\newcommand*\myglsentry[1]{%
\protect\ifglsused{#1}{%
\glsentryshort{#1}%
}{%
\glsentrylong{#1}%
}%
}
\newcommand\@shorttitle{}
% define \theshorttitle to what is given
\newcommand\shorttitle[1]{\renewcommand\@shorttitle{#1}}
% Define Chapter, Section, and Subsection headings
% There are no regulations for these configurations,
% Thus, users can change them as wanted.
\RequirePackage{titlesec}
\RequirePackage{etoolbox}
\RequirePackage{fix-cm} % Helps in fixing paging issues
%Customize chapter headings
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}
{\vspace{-2.5cm}\filleft{\fontsize{50}{20}\selectfont\textnormal{\thechapter}}} % Include chapter number
{0pt}
{\vspace*{-1cm}\color{black}\rule{\textwidth}{1pt}\vspace*{-0.35cm}\\\filcenter}
[\vspace*{-0.75cm}\color{black}\rule{\textwidth}{1pt}\vspace*{-1cm}]
%Customize numberless chapter headings
\titleformat{name=\chapter, numberless}[display]
{\normalfont\huge\bfseries}
{} % Do not include chapter number
{0pt}
{\vspace*{-5.3cm}\color{black}\rule{\textwidth}{1pt}\vspace*{-0.35cm}\\\filcenter}
[\vspace*{-0.75cm}\color{black}\rule{\textwidth}{1pt}\vspace*{-1cm}]
% Customize sections and subsections (if needed)
\titleformat{\section}[hang]
{\normalfont\LARGE\bfseries}
{\thesection}
{1em}
{}
[]
\titleformat{\subsection}[hang]
{\normalfont\Large\bfseries}
{\thesubsection}
{1em}
{}
[]
\titleformat{\subsubsection}[hang]
{\normalfont\large\bfseries}
{}
{1em}
{}
[]
%% Bibliography at the end of the thesis:
\RequirePackage[natbib=true, sorting=nymt, backend=biber, maxcitenames=2, maxbibnames=3, minbibnames=2, mincitenames=1, style=authoryear-comp, sortcites=ymn, uniquename=false, uniquelist=false, giveninits=true, citetracker=true, backref=true, eprint=false]{biblatex}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\bibfont}{\normalfont\footnotesize}
\renewcommand*{\compcitedelim}{\addcomma\space} %semicolon and non-breaking space between compressed multiple citations by the same author
\DefineBibliographyExtras{british}{\def\finalandcomma{\addcomma}} % Oxford comma
\DefineBibliographyStrings{british}{citedas = {hereafter}}
\addbibresource{PhD_thesis_FCUL_template.bib} % Bibliography file!!
%\AtEveryBibitem{\clearfield{eprint}}
\DeclareDelimFormat{nameyeardelim}{\addspace}
\DeclareDelimFormat[textcite]{postnotedelim}{\addcolon\space}
\DeclareDelimFormat[textcites]{postnotedelim}{\addcolon\space}
\DeclareDelimFormat[parencite]{postnotedelim}{\addsemicolon\space}
\DeclareDelimFormat[parencites]{postnotedelim}{\addsemicolon\space}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}
%% If you need one bibliography per chapter add the following at the end of each chapter
%\printbibliography[heading=subbibintoc]
% Show DOI. If not availabe, show URL (when present)
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:url}
{\iffieldundef{doi}{\usebibmacro{url+urldate}}
{}} {}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}} {}%
\newunit\newblock
\iftoggle{bbx:doi}
{\printfield{doi}}
{}}
% Re-defiine cedilla for bibliography entries
\newcommand\cedilla{}
\let\cedilla\c
\DeclareUnicodeCharacter{0229}{\c{e}}
% Use following commands to break long url links
\setcounter{biburllcpenalty}{7000}
\setcounter{biburlucpenalty}{8000}
% If want to show the pages of citation in bibliography entries (with backref=true in hyperref call) and change text
%\DefineBibliographyStrings{british}{%
% backrefpage = {page},% originally "cited on page"
% backrefpages = {pages},% originally "cited on pages"
%}
% Non-default sorting option instead of nyt. It now includes month.
\DeclareSortingTemplate{nymt}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sortyear}
\field{year}
}
\sort{
\field[padside=left,padwidth=2,padchar=0]{month}
\literal{00}
}
\sort{
\field{sorttitle}
\field{title}
}
\sort{
\field[padside=left,padwidth=4,padchar=0]{volume}
\literal{0000}
}
}
\DeclareSortingTemplate{ymn}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{sortyear}
\field{year}
}
\sort{
\field[padside=left,padwidth=2,padchar=0]{month}
\literal{00}
}
\sort{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title}
}
}
% Allows put list of tables and figures as all caps in ToC
\let\oldaddcontentsline\addcontentsline
\newcommand{\ADDCONTENTSLINE}[3]{%
\oldaddcontentsline{#1}{#2}{\MakeUppercase{#3}}%
}
\newcommand{\CAPinToC}{\let\addcontentsline\ADDCONTENTSLINE}
\newcommand{\noCAPinToC}{\let\addcontentsline\oldaddcontentsline}
% Define headers and footers
\RequirePackage{fancyhdr}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\space#1}{}} % Remove "CHAPTER" in header
%\renewcommand{\chaptermark}[1]{\markboth{#1}{}} % Remove Chapter number in header
\fancypagestyle{MyThesisStyle}{%
\fancyhead{} %Clean headers
\fancyfoot[C]{\thepage}
\fancyhead[LE]{\LastMark{2e-left}} % \leftmark
\fancyhead[RO]{\FirstMark{2e-right}} % \rightmark
\fancyhead[LO]{A. NAME}
\fancyhead[RE]{}
}
\fancypagestyle{FirstPages}{%
\fancyhead{} %Clean headers
\fancyhead[LE, RO, LO, RE]{} % empty headers
\fancyfoot[C]{\the\year{}} % \fancyfoot[C]{\Romanyear}
\renewcommand{\headrule}{\hrule height 0pt \vspace{0mm}\hrule height 0pt}
\renewcommand{\headrulewidth}{0.0pt}
}
\fancypagestyle{NoNumberChapStyle}{%
\fancyhead{} %Clean headers
\fancyfoot[C]{\thepage}
\fancyhead[LE]{\LastMark{2e-left}}
\fancyhead[RO]{}
\fancyhead[LO]{A. NAME}
\fancyhead[RE]{}
}
\fancypagestyle{ReferencesStyle}{%
\fancyhead{} %Clean headers
\fancyfoot[C]{\thepage}
\fancyhead[LE]{\LastMark{2e-left}}
\fancyhead[RO]{\FirstMark{2e-right}}
\fancyhead[LO,RE]{}
}
% Redefinition of "\cleardoublepage" to add the message "This page intentionally left blank"
\makeatletter
\def\cleardoublepage{\clearpage%
\if@twoside
\ifodd\c@page\else
\vspace*{\fill}
\hfill
\begin{center}
This page intentionally left blank.
\end{center}
\vspace{\fill}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi
\fi
\fi
}
\makeatother
\RequirePackage[page, toc, header]{appendix} %Extremely useful if you need appendices in some of the chapters, otherwise they will not be numbered properly!
\renewcommand{\appendixtocname}{APPENDICES} % rename 'Appendices' in ToC
\renewcommand{\appendixpagename}{Appendices} % rename name in first Appendices page
\renewcommand*{\appendixname}{APPENDIX} % rename each appendix in ToC
% Add the message "This page intentionally left blank" after first Appendix page (if page=true)
\makeatletter
\renewcommand{\@chap@pppage}{%
\clear@ppage
\thispagestyle{plain}%
\if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi
\null\vfil
\markboth{}{}%
{\centering
\interlinepenalty \@M
\normalfont
\Huge \bfseries \appendixpagename\par}
\if@dotoc@pp
\addappheadtotoc
\fi
\vfil\newpage
\if@twoside
\if@openright
\vspace*{\fill}
\hfill
\begin{center}
This page intentionally left blank.
\end{center}
\vspace{\fill}
\thispagestyle{plain}%
\newpage
\fi
\fi
\if@tempswa
\twocolumn
\fi
}
\makeatother
%% Additional commands commonly used
\newcommand*\centerstack[2]{%
\ensuremath{%
\mathrel{%
\mathchoice{%
\vcenter{%
\offinterlineskip
\halign{\hfil$\displaystyle##$\hfil\cr#1\cr#2\cr}%
}%
}
{%
\vcenter{%
\offinterlineskip
\halign{\hfil$\textstyle##$\hfil\cr#1\cr#2\cr}%
}%
}
{%
\vcenter{%
\offinterlineskip
\halign{\hfil$\scriptstyle##$\hfil\cr#1\cr#2\cr}%
}%
}
{%
\vcenter{%
\offinterlineskip
\halign{\hfil$\scriptscriptstyle##$\hfil\cr#1\cr#2\cr}%
}%
}%
}%
}%
}
\newcommand*\centerstackskip[6]{%
\ensuremath{%
\mathrel{%
\mathchoice{%
\vcenter{%
\offinterlineskip
\halign{\hfil$\displaystyle##$\hfil\cr
#1\cr\noalign{\vskip#3}#2\cr}%
}%
}
{%
\vcenter{%
\offinterlineskip
\halign{\hfil$\textstyle##$\hfil\cr
#1\cr\noalign{\vskip#4}#2\cr}%
}%
}
{%
\vcenter{%
\offinterlineskip
\halign{\hfil$\scriptstyle##$\hfil\cr
#1\cr\noalign{\vskip#5}#2\cr}%
}%
}
{%
\vcenter{%
\offinterlineskip
\halign{\hfil$\scriptscriptstyle##$\hfil\cr
#1\cr\noalign{\vskip#6}#2\cr}%
}%
}%
}%
}%
}
\let\olddiameter\diameter
%% Define units (with siunitx)
% Useful in tables and alignment
\RequirePackage{siunitx}
\sisetup{table-figures-uncertainty=1, table-alignment=center, uncertainty-mode = separate, list-final-separator={,\, \text{and}\, }, group-digits=integer}
\DeclareSIUnit\erg{erg}
\DeclareSIUnit\magnitude{mag}
\DeclareSIUnit\jansky{Jy}
\DeclareSIUnit\beam{beam}
\DeclareSIUnit\dex{dex}
\DeclareSIUnit{\deg}{deg}
\DeclareSIUnit{\asec}{arcsec}
\DeclareSIUnit{\yr}{yr}
\DeclareSIUnit{\msun}{\ensuremath{\mathrm{M}_{\odot}}}
\DeclareSIUnit\cpu{CPU}
\DeclareSIUnit\angstrom{\text{Å}}
\DeclareSIUnit\parsec{pc}
%% Astronomical commands
\newcommand{\esp}[1]{\mbox{\large{e}}^{#1}}
\newcommand{\leaveblank}{\newpage\thispagestyle{empty}\mbox{}}
\newcommand{\micron}{\mu\mbox{m}}
%\newcommand{\url}[1]{\sf{#1}}
\newcommand{\tauboo}{$\tau$ Bo{\"o}tis}
\newcommand{\kepler}{{\sl Kepler}}
\newcommand*\sun{\ensuremath{\odot}}
\newcommand*\degr{\ensuremath{^\circ}}
\newcommand*\arcmin{\ensuremath{^\prime}}
\newcommand*\arcsec{\ensuremath{^{\prime\prime}}}
\def\utw{\ensuremath{\smash{\rlap{\lower5pt\hbox{$\sim$}}}}}
\def\udtw{\ensuremath{\smash{\rlap{\lower6pt\hbox{$\approx$}}}}}
\newcommand*\fd{\ensuremath{\overset{\text{d}}{.}}}
\newcommand*\fh{\ensuremath{\overset{\text{h}}{.}}}
\newcommand*\fm{\ensuremath{\overset{\text{m}}{.}}}
\newcommand*\fs{\ensuremath{\overset{\text{s}}{.}}}
\newcommand*\fdg{\ensuremath{\overset{\circ}{.}}}
\newcommand*\farcm{\ensuremath{\overset{\prime}{.}}}
\newcommand*\farcs{\ensuremath{\overset{\prime\prime}{.}}}
\newcommand*\fp{\ensuremath{\overset{\scriptscriptstyle\text{p}}{.}}}
\newcommand*\cor{\ensuremath{\mathrel{\widehat{=}}}}
\newcommand*\la{\centerstack{<}{\sim}}
\newcommand*\ga{\centerstack{>}{\sim}}
\newcommand*\sol{\centerstack{\sim}{<}}
\newcommand*\sog{\centerstack{\sim}{>}}
\newcommand*\lse{\centerstack{<}{\simeq}}
\newcommand*\gse{\centerstack{>}{\simeq}}
\newcommand*\grole{\centerstackskip{>}{<}{-1.5\p@}{-1.5\p@}{-1\p@}{-.5\p@}}
\newcommand*\leogr{\centerstackskip{<}{>}{-1.5\p@}{-1.5\p@}{-1\p@}{-.5\p@}}
\newcommand*\loa{\centerstack{<}{\approx}}
\newcommand*\goa{\centerstack{>}{\approx}}
\newcommand*\getsto{\centerstack{\gets}{\to}}
\newcommand*\lid{\centerstackskip{<}{=}{1.2\p@}{1.2\p@}{1\p@}{0.9\p@}}
\newcommand*\gid{\centerstackskip{>}{=}{1.2\p@}{1.2\p@}{1\p@}{0.9\p@}}
\newcommand\smion[2]{#1$\;$\protect \footnotesize{\rmfamily\@Roman{#2}}\small}%
\newcommand\scion[2]{#1$\;$\protect \tiny{\rmfamily\@Roman{#2}}\scriptsize}%
% \ion{<element symbol>}{<degree of ionization>}
\DeclareRobustCommand{\ion}[2]{\textup{#1\,\textsc{\lowercase{#2}}}}
% \element[<electrical charge>][<number of nucleons>][<number of protons>][<number of neutrons>]{<element symbol>}
\newcommand*\element[1][]{%
\def\aa@element@tr{#1}%
\aa@element
}
\endinput