-
Notifications
You must be signed in to change notification settings - Fork 0
/
phdstyle.sty
243 lines (201 loc) · 8.49 KB
/
phdstyle.sty
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{phdstyle}[2020/05/11 Custom LaTeX style]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Standalone
\RequirePackage{standalone}
%% Encoding
\RequirePackage[utf8]{inputenx}
\RequirePackage[T1]{fontenc}
%% Fonts and typography
\RequirePackage{lmodern} % Latin Modern
\renewcommand{\sfdefault}{phv} % Helvetica
% \RequirePackage{helvet} % this works better than the line above.
% \renewcommand{\familydefault}{\sfdefault}
\RequirePackage[scaled]{beramono} % Bera Mono (Bitstream Vera Sans Mono)
\RequirePackage[final]{microtype} % Improved typography
\pretolerance = 1000 % Relaxes parameters for line breaks
\tolerance = 2000 % Relaxes parameters for line breaks
\setlength{\emergencystretch}{1em} % Relaxes parameters for line breaks
\RequirePackage{siunitx} % Typesetting units
\RequirePackage{listings} % Typesetting code
\lstset
{
basicstyle = \ttfamily\footnotesize,
keywordstyle = \color{uiored},
commentstyle = \color{uiogrey},
stringstyle = \itshape,
showstringspaces = false
}
%% Mathematics
\RequirePackage{amssymb} % Extra symbols
\RequirePackage{amsthm} % Theorem-like environments
\RequirePackage{thmtools} % Theorem-like environments, extends amsthm
\RequirePackage{mathtools} % Fonts and environments for mathematical formulae
\RequirePackage{mathrsfs} % Script font with \mathscr{}
\RequirePackage{dsfont} % Double stroke font with \mathds{}
\RequirePackage{cancel} % Cancel terms with \cancel, \bcancel or \xcancel
\RequirePackage{stmaryrd} % Brackets
\everymath
{
\ifodd\value{page} % Allow multiline equations
\allowdisplaybreaks[1] % to break across two pages:
\else % - Breaks from odd to even pages are allowed,
\allowdisplaybreaks[4] % but discouraged.
\fi % - Breaks from even to odd pages are allowed.
}
%% add glossaries
\RequirePackage{glossaries}
\makeglossaries
% \renewcommand*{\glsclearpage}{}
%% Language
\RequirePackage{babel}
\RequirePackage{csquotes}
%% Tables
\RequirePackage{multirow} % Rows spanning multiple lines in tables
\RequirePackage{rotating}
\RequirePackage{tablefootnote} % Footnotes for tables
%% Lists
\RequirePackage{enumitem}
\setlist[itemize] {font = \upshape, before = \leavevmode}
\setlist[enumerate] {font = \upshape, before = \leavevmode}
\setlist[description]{font = \bfseries\sffamily, before = \leavevmode}
\foreach \env in {theorem, corollary, lemma, proposition, observation,
conjecture, definition, example, notation, remark}
{
\AtBeginEnvironment{\env}
{
\setlist[enumerate, 1]{wide,
label = \thetheorem.\arabic{*}.,
ref = \thetheorem.\arabic{*}}
}
}
%% Drawing
\usetikzlibrary{intersections}
\usetikzlibrary{decorations.markings}
%% Organising tools
\RequirePackage{comment} % Multiline comments
\RequirePackage[notref, notcite]{showkeys} % Labels in margins
\renewcommand{\showkeyslabelformat}[1]
{
\parbox[t]{16mm}{\centering\normalfont\tiny\ttfamily \path{#1}}
}
\RequirePackage[obeyFinal,
color = LightGray,
bordercolor = LightGray,
textsize = tiny,
textwidth = 25mm,
figwidth = 0.99\linewidth]{todonotes} % Marginal notes
%% Miscellaneous
\RequirePackage{etoolbox} % Hooks
\RequirePackage{pgffor} % For-loops
\RequirePackage{xspace} % Clever space
\RequirePackage{titletoc} % Partial table of contents
%% Cross references and links
\RequirePackage[obeyspaces, spaces, hyphens]{url} % Format URLs
\urlstyle{sf}
\RequirePackage{varioref} % \vref
\RequirePackage[pdfusetitle]{hyperref} % Clickable links
\RequirePackage[nameinlink, capitalize, noabbrev]{cleveref} % \cref
\RequirePackage{doi} % Ignore LaTeX syntax in DOI links
\renewcommand{\doitext}{DOI:\space}
%% Bibliography
\RequirePackage{mathscinet}
\RequirePackage[backend = bibtex,
sortcites = true,
giveninits = true,
uniquename = init, % keep initals in unique name instead of fullname
doi = true,
isbn = false,
url = false,
sortlocale = nb_NO,
style = authoryear,
maxnames = 2,
natbib = true,
refsection = chapter]{biblatex}
\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{default}{family-given}
\DeclareFieldFormat[article]{volume}{\bibstring{jourvol}\addnbspace#1}
\DeclareFieldFormat[article]{number}{\bibstring{number}\addnbspace#1}
\renewbibmacro*{volume+number+eid}
{
\printfield{volume}
\setunit{\addcomma\space}
\printfield{number}
\setunit{\addcomma\space}
\printfield{eid}
}
\addbibresource{bibliographies/chapter2.bib}
\addbibresource{bibliographies/chapter4.bib}
% \addbibresource{bibliographies/Paper.bib}
% \addbibresource{bibliographies/paper1.bib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% USER-DEFINED MACROS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Environments
\declaretheoremstyle[headfont = \bfseries\sffamily,
notefont = \normalfont,
bodyfont = \itshape,
spaceabove = 6pt,
spacebelow = 6pt]{plain}
\declaretheoremstyle[headfont = \bfseries\sffamily,
notefont = \normalfont,
spaceabove = 6pt,
spacebelow = 6pt]{definition}
\declaretheorem[style = plain, numberwithin = section]{theorem}
\declaretheorem[style = plain, sibling = theorem]{corollary}
\declaretheorem[style = plain, sibling = theorem]{lemma}
\declaretheorem[style = plain, sibling = theorem]{proposition}
\declaretheorem[style = plain, sibling = theorem]{observation}
\declaretheorem[style = plain, sibling = theorem]{conjecture}
\declaretheorem[style = definition, sibling = theorem]{definition}
\declaretheorem[style = definition, sibling = theorem]{example}
\declaretheorem[style = definition, sibling = theorem]{notation}
\declaretheorem[style = remark, sibling = theorem]{remark}
\declaretheorem[style = definition, numbered = no]{acknowledgements}
\crefname{observation}{Observation}{Observations}
\Crefname{observation}{Observation}{Observations}
\crefname{conjecture}{Conjecture}{Conjectures}
\Crefname{conjecture}{Conjecture}{Conjectures}
\crefname{notation}{Notation}{Notations}
\Crefname{notation}{Notation}{Notations}
\crefname{paper}{Paper}{Papers}
\Crefname{paper}{Paper}{Papers}
%% Operators
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\DeclareMathOperator{\im}{im}
\DeclareMathOperator{\rank}{rank}
%% Delimiters
\DeclarePairedDelimiter{\p}{\lparen}{\rparen} % Parenthesis
\DeclarePairedDelimiter{\set}{\lbrace}{\rbrace} % Set
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert} % Absolute value
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert} % Norm
\DeclarePairedDelimiter{\ip}{\langle}{\rangle} % Inner product, ideal
\DeclarePairedDelimiter{\sqb}{\lbrack}{\rbrack} % Square brackets
\DeclarePairedDelimiter{\ssqb}{\llbracket}{\rrbracket} % Double brackets
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil} % Ceiling
\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor} % Floor
%% Blackboard bold
\newcommand{\N}{\mathbb{N}} % Natural numbers
\newcommand{\Z}{\mathbb{Z}} % Integers
\newcommand{\Q}{\mathbb{Q}} % Rational numbers
\newcommand{\R}{\mathbb{R}} % Real numbers
\newcommand{\C}{\mathbb{C}} % Complex numbers
\newcommand{\A}{\mathbb{A}} % Affine space
\renewcommand{\P}{\mathbb{P}} % Projective space
%% Bold face
\renewcommand{\a}{\mathbf{a}}
\renewcommand{\b}{\mathbf{b}}
\newcommand{\x}{\mathbf{x}}
\newcommand{\y}{\mathbf{y}}
\newcommand{\0}{\mathbf{0}}
\newcommand{\1}{\mathbf{1}}
%% Miscellaneous
\renewcommand{\qedsymbol}{\(\blacksquare\)}
\newcommand{\arxiv}[1]{arXiv:\space\href{http://arxiv.org/abs/#1}{#1}\xspace}
\newcommand{\ie}{\leavevmode\unskip, i.e.,\xspace}
\newcommand{\eg}{\leavevmode\unskip, e.g.,\xspace}
\newcommand{\dash}{\textthreequartersemdash\xspace}
\newcommand{\TikZ}{Ti\textit{k}Z\xspace}
\newcommand{\matlab}{\textsc{Matlab}\xspace}
\let\citet\cite
\let\citep\parencite
\providecommand{\keywords}[1]{\textbf{\textit{Keywords}:} #1}
\endinput