better structure with subfiles
[phd-thesis.git] / preamble.tex
1 % Input encoding
2 \usepackage[utf8]{inputenc}
3
4 % Papersize
5 \usepackage{geometry}
6 \geometry{
7 inner=25mm,
8 outer=20mm,
9 marginparsep=3mm,
10 marginparwidth=13mm,
11 top=25mm,
12 bottom=20mm,
13 paperwidth=17cm,
14 paperheight=24cm,
15 }
16
17 % Font encoding
18 \usepackage[T1,T2A]{fontenc}
19
20 % standalone figures
21 \usepackage[subpreambles=true]{standalone}
22
23 % Less bad boxes
24 \usepackage{microtype}
25
26 % No more room for a new \write
27 \usepackage{morewrites}
28
29 % Internationalisation
30 \usepackage[dutch,russian,british]{babel}
31 %\babelfont[russian]{rm}{Liberation Serif}
32
33 % Appendices
34 % TODO is this necessary?
35 \usepackage[titletoc]{appendix}
36
37 % Hyperlinks
38 %\usepackage[pagebackref]{hyperref}
39 \usepackage[pagebackref]{hyperref}
40 % Setup pdf parameters: TODO
41 \hypersetup{%
42 pdftitle={\mytitle},
43 pdfauthor={\myauthor},
44 pdfsubject={},
45 % pdfcreator={},
46 % pdfproducer={},
47 pdfkeywords={task oriented programming, functional programming, domain specific languages, internet of things},
48 hidelinks,
49 }
50 \urlstyle{same}
51
52 % Graphics
53 \usepackage{graphicx}
54 % Images directory
55 \graphicspath{{img/}}
56 %subfigures
57 \usepackage{caption}
58 \usepackage{subcaption}
59
60 % Nice tables
61 \usepackage{booktabs}
62
63 % Automatically wrapping tables
64 \usepackage{tabularx}
65
66 % Use a fixed document date
67 \usepackage[nodayofweek]{datetime}
68
69 % Code
70 \usepackage{stmaryrd} % Short arrow
71 \usepackage{listings}
72 % General listings settings
73 \lstset{%
74 basewidth=0.45em,
75 basicstyle=\linespread{0.9}\tt\footnotesize,
76 breakatwhitespace=false,
77 breaklines=true,
78 captionpos=b,
79 columns=[c]fixed,
80 commentstyle=\sl,
81 escapeinside={(+}{+)}, % chktex 9
82 frame=L,
83 keepspaces=true,
84 keywordstyle=\bf,
85 postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space},
86 showspaces=false,
87 showstringspaces=false,
88 showtabs=false,
89 stringstyle=\it,
90 tabsize=4,
91 % literate=%
92 % {a0}{{a\textsubscript{0}}}2
93 % {a1}{{a\textsubscript{1}}}2
94 % {a2}{{a\textsubscript{2}}}2
95 %% {an}{{a\textsubscript{n}}}2
96 % {c0}{{c\textsubscript{0}}}2
97 % {c1}{{c\textsubscript{1}}}2
98 % {c2}{{c\textsubscript{2}}}2
99 % {cn}{{c\textsubscript{n}}}2
100 % {f0}{{f\textsubscript{0}}}2
101 % {f1}{{f\textsubscript{1}}}2
102 % {f2}{{f\textsubscript{2}}}2
103 % {fn}{{f\textsubscript{n}}}2
104 % {t0}{{t\textsubscript{0}}}2
105 % {t1}{{t\textsubscript{1}}}2
106 % {t2}{{t\textsubscript{2}}}2
107 % {tn}{{t\textsubscript{n}}}2
108 % {v0}{{v\textsubscript{0}}}2
109 % {v1}{{v\textsubscript{1}}}2
110 % {v2}{{v\textsubscript{2}}}2
111 % {vn}{{v\textsubscript{n}}}2
112 % {C0}{{C\textsubscript{0}}}2
113 % {C1}{{C\textsubscript{1}}}2
114 % {C2}{{C\textsubscript{2}}}2
115 % {Cn}{{C\textsubscript{n}}}2
116 % {R0}{{R\textsubscript{0}}}2
117 % {R1}{{R\textsubscript{1}}}2
118 % {R2}{{R\textsubscript{2}}}2
119 % {Rn}{{R\textsubscript{n}}}2
120 }
121 \usepackage{lstlangclean}
122 \usepackage{lstlanghaskell}
123 \newcommand{\cleaninline}[1]{\lstinline[language=Clean,postbreak=]|#1|}
124 \newcommand{\haskellinline}[1]{\lstinline[language=Haskell,style=haskell,postbreak=]|#1|}
125 % Fix list of listings title
126 \renewcommand{\lstlistlistingname}{List of Listings}
127 % Fix list of listings chapter separator
128 \makeatletter
129 \let\my@chapter\@chapter%
130 \renewcommand*{\@chapter}{%
131 \addtocontents{lol}{\protect\addvspace{10pt}}%
132 \my@chapter}
133 \makeatother
134
135 \lstnewenvironment{lstClean}[1][]
136 {%
137 \lstset{language=Clean, #1}
138 \renewcommand*{\lstlistingname}{Listing (Clean)}
139 }
140 {}
141 \lstnewenvironment{lstHaskell}[1][]
142 {%
143 \lstset{language=Haskell,style=haskell,#1}%
144 \renewcommand*{\lstlistingname}{Listing (Haskell)}
145 }
146 {}
147
148 % Glossaries and acronyms
149 \usepackage[acronym,nonumberlist]{glossaries}
150 % Fix gls in hyperlink errors
151 \pdfstringdefDisableCommands{%
152 \def\acrlong#1{}%
153 \def\acrlongpl#1{}%
154 \def\acrshort#1{}%
155 \def\acrshortpl#1{}%
156 \def\acrfull#1{}%
157 \def\acrfullpl#1{}%
158 \def\Acrlong#1{}%
159 \def\Acrlongpl#1{}%
160 \def\Acrshort#1{}%
161 \def\Acrshortpl#1{}%
162 \def\Acrfull#1{}%
163 \def\Acrfullpl#1{}%
164 \def\gls#1{}%
165 \def\glspl#1{}%
166 \def\glsentrytext#1{}%
167 \def\Gls#1{}%
168 \def\Glspl#1{}%
169 \def\Glsentrytext#1{}%
170 \def\titlecap#1{}%
171 }
172
173 % Titlecase commands
174 \usepackage{titlecaps}
175 \Addlcwords{of}
176 % Titlecase glossary command
177 \newcommand{\glst}[1]{\titlecap{\glsentrylong{#1}}}
178 \newcommand{\Glst}[1]{\glst{#1}}
179
180 % Pseudocode
181 \usepackage[algochapter]{algorithm2e}
182 % Fix the algorithm font
183 \renewcommand\AlCapFnt{\normalfont}
184
185 % Index
186 \usepackage{makeidx}
187 % Enable the index
188 \makeindex%
189
190 % Custom enumerations
191 \usepackage[inline,shortlabels]{enumitem}
192 \setlist{noitemsep}
193 \setlist[description]{leftmargin=\parindent}
194
195 % Epigraph (lovecraft)
196 \usepackage{epigraph}
197
198 % Thumb marks on the page
199 \usepackage[
200 height={1.5cm},
201 width={12mm},
202 distance={1.55cm},
203 topthumbmargin={auto},
204 bottomthumbmargin={auto},
205 eventxtindent={.5cm},
206 oddtxtexdent={.3cm}]{thumbs}
207
208 % Custom headers and footers
209 \usepackage{fancyhdr}
210 \pagestyle{fancy}
211
212 % Tables spanning pages
213 \usepackage{longtable}
214
215 % Easy references
216 \usepackage{cleveref}
217
218 % To patch the chapter command
219 \usepackage{etoolbox}
220 % Have better page numbering in chapters
221 \patchcmd{\chapter}{plain}{headings}{}{}
222
223 % Increase the depth for the table of contents
224 \setcounter{secnumdepth}{3}
225 \renewcommand{\contentsname}{Table of Contents} % change the name of the TOC
226 \AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}} % to remove page numbering from the TOC
227
228 % Initialize the glossaries
229 \makeglossaries%
230 \input{glossaries}
231
232 % Custom commands
233 \newcommand{\GHCmod}[1]{\texttt{#1}}
234 \newcommand{\requiresGHCmod}[1]{\footnote{Requires \GHCmod{#1} to be enabled.}}
235 \newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&c}}}
236 \newcommand{\rdmentry}[6]{#1: #2 (#3): #4. #5.\ \href{https://doi.org/#6}{#6}}
237 \newcommand{\mlubbers}{Lubbers, M.\ (Radboud University)}
238 \newcommand{\pkoopman}{Koopman, dr.\ P.\ (Radboud University)}
239 \newcommand{\rplasmeijer}{Plasmeijer, prof.\ dr.\ ir.\ R.\ (Radboud University)}
240
241 \bibliographystyle{alpha}
242
243 \usepackage{subfiles}