-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreamble.tex
282 lines (237 loc) · 6.93 KB
/
preamble.tex
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
%%
% If they're installed, use Bergamo and Chantilly from www.fontsite.com.
% They're clones of Bembo and Gill Sans, respectively.
%\IfFileExists{bergamo.sty}{\usepackage[osf]{bergamo}}{}% Bembo
%\IfFileExists{chantill.sty}{\usepackage{chantill}}{}% Gill Sans
\usepackage[protrusion=true,expansion,babel=true]{microtype}
%%
% Just some sample text
\usepackage{lipsum}
%%
% For nicely typeset tabular material
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[export]{adjustbox}
\usepackage{array}
\usepackage{color}
\usepackage{tabularray}
\newcolumntype{L}[1]{>{\noindent\RaggedRight\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\noindent\RaggedLeft\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{C}[1]{>{\noindent\Centering\arraybackslash\hspace{0pt}}p{#1}}
%%
% For graphics / images
\usepackage{graphicx}
\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
\graphicspath{{media/}}
% What
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
% Bibliography
\usepackage[
style=ieee,
citestyle=numeric-comp,
autocite=inline,
autopunct=true,
backend=biber,
maxbibnames=99,
maxcitenames=2,
mincitenames=1,
]{biblatex}
%%
% Maths
\usepackage{amsmath}
% Prints a trailing space in a smart way.
\usepackage{xspace}
% Inserts a blank page
\newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage}
% Referencing
\usepackage[unicode]{hyperref}
\usepackage[nameinlink]{cleveref}
\hypersetup{%
bookmarksnumbered = true, % Show section numbering in the PDF table of contents. Allows easier browsing of the document
colorlinks = true, % uncomment this line if you prefer colored hyperlinks (e.g., for onscreen viewing)
% pdfborder = {0 0 0},
bookmarksdepth = subsection,
% citecolor = DarkGreen,
% linkcolor = DarkBlue,
% urlcolor = DarkGreen,
}
%\AtBeginDocument{%
% \hypersetup{
% pdfauthor={\plainauthor}
% pdftitle={\plaintitle},
% }%
%}
\usepackage[binary-units=true]{siunitx}
% Modifications to the default tufte template to make it more applicable to a thesis
% Credit goes to Tiffany Tseng, lalider, see https://github.com/lalider/tufte-latex-thesis
\usepackage[parfill]{parskip}
% remove paragraph indentation
\makeatletter
% Paragraph indentation and separation for normal text
\renewcommand{\@tufte@reset@par}{%
\setlength{\RaggedRightParindent}{0.0pc}%
\setlength{\JustifyingParindent}{0.0pc}%
\setlength{\parindent}{0pc}%
\setlength{\parskip}{\baselineskip}%
}
\@tufte@reset@par
% Paragraph indentation and separation for marginal text
\renewcommand{\@tufte@margin@par}{%
\setlength{\RaggedRightParindent}{0.0pc}%
\setlength{\JustifyingParindent}{0.0pc}%
\setlength{\parindent}{0.0pc}%
\setlength{\parskip}{10pt}%
}
\makeatother
\titleformat{\section}%
[hang]% shape
{\normalfont\Large}% format applied to label+text
{\thesection}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
%\titlespacing*{\section}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
%\titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus.2ex}
\titlespacing*{\section}{0pt}{30pt}{20pt}
\titlespacing*{\subsection}{0pt}{20pt}{5pt}
% Disable adding empty pages without a purpose (not intended for printing in a book format...)
\makeatletter
\def\cleardoublepage{
\clearpage%
}
\makeatother
% Acronyms
\usepackage{acro}
\acsetup{
use-id-as-short,
make-links=false,
case-sensitive=false,
patch/floats=false,
patch/caption=false,
patch/tabularx=false
}
\input{acronyms.tex}
\input{commands.tex}
\NewAcroTemplate[list]{glossary}{%
\begin{description}
\acronymsmapF{%
\item[\sffamily\textbf{\acrowrite{short}}] \acrowrite{long}%
\acroifanyT {foreign,extra} {~(}%
\acrowrite {foreign}%
\acroifallT {foreign,extra} {,~}%
\acrowrite {extra}%
\acroifanyT {foreign,extra} {)}%
\acropagefill%
\acropages%
{ \acrotranslate {page} \nobreakspace }%
{ \acrotranslate {pages} \nobreakspace }%
}%
{ \item \AcroRerun{list} }%
\end {description}
}
% Various utilities
\usepackage{tabularx}
\usepackage[singlelinecheck=false]{caption}
\usepackage{subcaption}
\usepackage{comment}
% Generates the index
\usepackage{makeidx}
\makeindex
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.3}
\usetikzlibrary{pie}
\usepackage{physics}
\let\Re=\relax
\let\Im=\relax
% Colours
\definecolor{off}{HTML}{e53935}
\definecolor{on}{HTML}{43a047}
\usepackage{xcolor-solarized}
\usepackage{xcolor-material}
\usepackage{colortbl}
%\usepackage{todonotes}
\usepackage{enumitem}
\usepackage[absolute,overlay]{textpos}
% Code
\usepackage{minted}
\usepackage{xpatch,letltxmacro}
\LetLtxMacro{\cminted}{\minted}
\let\endcminted\endminted
\xpretocmd{\cminted}{\RecustomVerbatimEnvironment{Verbatim}{BVerbatim}{}}{}{}
\definecolor{mintedbg}{rgb}{1,1,1}
\setminted{
bgcolor=mintedbg,
tabsize=2,
fontsize=\footnotesize,
linenos,
breaklines
}
\setminted[text]{baselinestretch=0.8}
% Git magic
\makeatletter
\write18{git log --pretty='format:\@percentchar Creset\@percentchar s' --no-merges -1 > \jobname.git1.tmp}
\write18{git rev-parse --short HEAD > \jobname.git2.tmp}
\def\gitcommit{\input{\jobname.git2.tmp}\unskip}
\def\gitcommitmessage{\input{\jobname.git1.tmp}\unskip}
\makeatother
% Smart citations
\makeatletter
%\def\blx@imc@mkbibquote{\blx@enquote}
\newbibmacro*{cite:title}{%
\printtext[bibhyperref]{%
\printfield[citetitle]{labeltitle}}%
\finentry}
\newbibmacro*{cite:shorthand}{%
\printtext[bibhyperref]{\printfield{shorthand}}}
\newbibmacro*{cite:full}{%
\iffieldundef{shorthand}
{\printnames{labelname}%
\setunit*{\printdelim{nametitledelim}}%
\usebibmacro{cite:title}}%
{\usebibmacro{cite:shorthand}}}
\newbibmacro*{cite:marginnote}{%
\marginnote{%
% \mkbibbrackets should be used here probably
[%
\printfield{labelprefix}%
\printfield{labelnumber}%
]
\usebibmacro{cite:full}%
}%
}
\DeclareCiteCommand{\dualcite}[\mkbibbrackets]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:marginnote}%
\usebibmacro{cite:comp}}%
{}
{\usebibmacro{cite:dump}%
\usebibmacro{postnote}}
\def\tuftecite{
\iffootnote{footnote}{text}
}
% Patching commands that enter information in margins, so that we can detect which
% citation should be used
\newtoggle{inmargin}
\pretocmd{\marginpar}{\toggletrue{inmargin}}{}{}
\apptocmd{\@xympar}{\togglefalse{inmargin}}{}{}
\pretocmd{\@tufte@float}{\toggletrue{inmargin}}{}{}
\pretocmd{\end@tufte@float}{\togglefalse{inmargin}}{}{}
\pretocmd{\@tufte@margin@float}{\toggletrue{inmargin}}{}{}
\pretocmd{\end@tufte@margin@float}{\togglefalse{inmargin}}{}{}
\def\autocite{%
\iftoggle{inmargin}\parencite\dualcite%
}
% Tufte disables subparagraphs. This brings them back.
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{-1em}%
{\hspace{1em}\normalfont\normalsize\itshape}}
% \acuse command that also adds the current page
%\NewAcroTemplate{fdirthesisempty}{}
%\NewAcroCommand\acusepage{m}{}
\let\acusepage\acuse
\makeatother