many updates
[phd-thesis.git] / preamble.tex
1 % Fonts
2 \usepackage[utf8]{inputenc} % Input encoding
3 \usepackage[T1]{fontenc} % Font encoding
4 \usepackage{lmodern} % Nicer font
5 \usepackage{microtype} % Better kerning
6 \usepackage{tipa} % IPA symbols
7 \usepackage{stmaryrd} % short arrows
8 \usepackage{textcomp} % upquote
9 \usepackage{titlecaps} % titlecase commands
10 \usepackage{amsmath} % extra math
11 \usepackage{amssymb} % extra math symbols
12 \everymath{\it\/}
13 \DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39} %chktex 18
14
15 % Internationalisation
16 \usepackage[dutch,russian,british]{babel}
17 %\babelfont[russian]{rm}{Liberation Serif}
18
19 % Papersize and layout
20 \usepackage{geometry}
21 \geometry{
22 inner=25mm,
23 outer=20mm,
24 marginparsep=3mm,
25 marginparwidth=13mm,
26 top=25mm,
27 bottom=20mm,
28 paperwidth=17cm,
29 paperheight=24cm,
30 }
31 \usepackage[
32 height={1.5cm},
33 width={12mm},
34 distance={1.55cm},
35 topthumbmargin={auto},
36 bottomthumbmargin={auto},
37 eventxtindent={.5cm},
38 oddtxtexdent={.3cm}]{thumbs} % thumb marks
39 \usepackage{fancyhdr} % Custom headers and footers
40 %\pagestyle{fancy}
41 \pagestyle{headings}
42 \usepackage{etoolbox} % To patch the chapter command
43 % Have better page numbering in chapters
44 \patchcmd{\chapter}{plain}{headings}{}{}
45 \usepackage{epigraph} % Epigraph
46 \renewcommand\partname{Movement} % Rename parts to movements (rhapsody uhu)
47 \newenvironment{chapterabstract}
48 {\begin{quote}}
49 {\end{quote}}
50
51 % Increase the depth for the table of contents
52 \setcounter{secnumdepth}{3}
53 \renewcommand{\contentsname}{Table of Contents} % change the name of the TOC
54 \AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}} % to remove page numbering from the TOC
55
56 % (file) structure
57 \usepackage[subpreambles=true]{standalone} % standalone figures
58 \usepackage{morewrites} % fix no more room for a new \write
59 \usepackage{appendix} % subappendices, appendices per chapter
60
61 % Bibliography
62 \usepackage{bibentry} % Cite bib entry completely
63 \nobibliography*
64 \bibliographystyle{alpha}
65
66 % Hyperlinks and metadata
67 \usepackage[pagebackref]{hyperref} % hyperlinks
68 \renewcommand*{\backref}[1]{}
69 \renewcommand*{\backrefalt}[4]{[{%
70 \ifcase #1 not cited.\or p.~#2.\else pp. #2.\fi%chktex 1
71 }]}
72 \hypersetup{%
73 pdftitle={\mytitle},
74 pdfauthor={\myauthor},
75 pdfkeywords={task-oriented programming, functional programming, domain specific languages, internet of things},
76 hidelinks,
77 }
78 \usepackage[nodayofweek]{datetime} % Use a fixed document date
79 \urlstyle{same}
80 \usepackage{bookmark}
81 \usepackage{cleveref} % Easy references
82 \crefname{part}{movement}{movements}
83 \crefname{lstlisting}{listing}{listing}
84
85 % Graphics
86 \usepackage{graphicx} % Images
87 \graphicspath{{img/},{introduction/img}}
88 \usepackage{caption} % subfigures
89 \usepackage{subcaption}
90 \newcommand{\orcid}[1]{\href{https://orcid.org/#1}{\hspace{1mm}\includegraphics[width=1em]{orcid}\hspace{2mm} https://orcid.org/#1}}
91
92 % Tables
93 \usepackage{booktabs} % Nicer tables
94 \usepackage{multirow} % Multirow cells
95 \usepackage{tabularx} % Automatically wrapping tables
96 \usepackage{longtable} % Tables spanning pages
97
98 % Code
99 % Pseudocode
100 \usepackage[algochapter]{algorithm2e}
101 % Fix the algorithm font
102 \renewcommand\AlCapFnt{\normalfont}
103 \usepackage{listings}
104 % General listings settings
105 \lstset{%
106 basewidth=0.5em,
107 basicstyle=\tt\small,
108 breakatwhitespace=false,
109 breaklines=true,
110 captionpos=b,
111 columns=[c]fixed,
112 commentstyle=\sl,
113 % escapeinside={(+}{+)}, % chktex 9
114 frame=L,
115 keepspaces=true,
116 keywordstyle=\bf,
117 postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
118 showspaces=false,
119 showstringspaces=false,
120 showtabs=false,
121 stringstyle=\it,
122 tabsize=4,
123 upquote=true,
124 }
125 \usepackage{lstlangclean}
126 \usepackage{lstlanghaskell}
127 \usepackage{lstlanghaskelllhstex}
128 \usepackage{lstlangarduino}
129 \newcommand{\cinline}[1]{\lstinline[language=c,postbreak=]|#1|}
130 \newcommand{\arduinoinline}[1]{\lstinline[language={[Arduino]C++},postbreak=]|#1|}
131 \newcommand{\cleaninline}[1]{\lstinline[language=Clean,postbreak=]|#1|}
132 \newcommand{\haskellinline}[1]{\lstinline[language=Haskell,style=haskell,postbreak=]|#1|}
133 \newcommand{\haskelllhstexinline}[1]{\lstinline[language=Haskell,style=haskelllhstex,postbreak=]|#1|}
134 % Fix list of listings title
135 \renewcommand{\lstlistlistingname}{List of Listings}
136 % Fix list of listings chapter separator
137 \makeatletter
138 \let\my@chapter\@chapter%
139 \renewcommand*{\@chapter}{%
140 \addtocontents{lol}{\protect\addvspace{10pt}}%
141 \my@chapter}
142 \makeatother
143
144 \lstnewenvironment{lstClean}[1][]
145 {%
146 \lstset{language=Clean, #1}
147 \renewcommand*{\lstlistingname}{Listing (\gls{CLEAN})}
148 }
149 {}
150 \lstnewenvironment{lstArduino}[1][]
151 {%
152 \lstset{language={[Arduino]C++}, #1}
153 \renewcommand*{\lstlistingname}{Listing (\gls{ARDUINO})}
154 }
155 {}
156 \lstnewenvironment{lstHaskell}[1][]
157 {%
158 \lstset{language=Haskell,style=haskell,#1}%
159 \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})}
160 }
161 {}
162 \lstnewenvironment{lstHaskellLhstex}[1][]
163 {%
164 \lstset{language=Haskell,style=haskelllhstex,#1}%
165 \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})}
166 }
167 {}
168
169 % Glossaries and acronyms
170 \usepackage[acronym,nonumberlist]{glossaries}
171 \Addlcwords{of}
172 % Titlecase glossary commands
173 \newcommand{\glst}[1]{\titlecap{\glsentrylong{#1}}}
174 \newcommand{\Glst}[1]{\glst{#1}}
175 % Fix gls in hyperlink errors
176 \pdfstringdefDisableCommands{%
177 \def\acrlong#1{}%
178 \def\acrlongpl#1{}%
179 \def\acrshort#1{}%
180 \def\acrshortpl#1{}%
181 \def\acrfull#1{}%
182 \def\acrfullpl#1{}%
183 \def\Acrlong#1{}%
184 \def\Acrlongpl#1{}%
185 \def\Acrshort#1{}%
186 \def\Acrshortpl#1{}%
187 \def\Acrfull#1{}%
188 \def\Acrfullpl#1{}%
189 \def\gls#1{}%
190 \def\glspl#1{}%
191 \def\glsentrytext#1{}%
192 \def\Gls#1{}%
193 \def\Glspl#1{}%
194 \def\Glsentrytext#1{}%
195 \def\titlecap#1{}%
196 }
197
198 % Index
199 \usepackage{makeidx}
200 \makeindex% Enable the index
201
202 % Custom enumerations
203 \usepackage[inline,shortlabels]{enumitem}
204 \setlist{noitemsep}
205 \setlist[description]{leftmargin=\parindent}
206
207 % Initialize the glossaries
208 \makeglossaries%
209 \input{glossaries}
210
211 \usepackage{subfiles}
212
213 \ifSubfilesClassLoaded{}{
214 \usepackage{xmpincl}
215 \includexmp{CC_Attribution-NoDerivatives_4.0_International}
216 }
217
218 % Custom commands
219 \newcommand{\GHCmod}[1]{\texttt{#1}}
220 \newcommand{\requiresGHCmod}[1]{\footnote{Requires \GHCmod{#1} to be enabled.}}
221 \newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&c}}}
222 \newcommand{\rdmentry}[6]{#1: #2 (#3): #4. #5.\ \href{https://doi.org/#6}{#6}}
223 \newcommand{\mlubbers}{Lubbers, M.\ (Radboud University)}
224 \newcommand{\pkoopman}{Koopman, dr.\ P.\ (Radboud University)}
225 \newcommand{\rplasmeijer}{Plasmeijer, prof.\ dr.\ ir.\ R.\ (Radboud University)}