-\usepackage[
- inner=25mm,
- outer=20mm,
- marginparsep=3mm,
- marginparwidth=13mm,
- top=25mm,
- bottom=20mm,
- paperwidth=17cm,
- paperheight=24cm]{geometry} % Papersize
+\usepackage[utf8]{inputenc} % Input encoding
+\usepackage[X2,T1]{fontenc} % Font encoding
+\usepackage{ifxetex}
+\ifxetex%
+ \usepackage{amsmath} % extra math
+ \usepackage{fontspec}
+ \usepackage{polyglossia}
+ \setmainlanguage[variant=british]{english}
+ \setotherlanguage{dutch}
+ \setotherlanguage{russian}
+ \newfontfamily{\cyrillicfont}{Liberation Serif}
+\else
+ \usepackage{lmodern} % Nicer font
+ \usepackage{microtype} % Better kerning
+ \usepackage{amsmath} % extra math
+ \usepackage{amssymb} % extra math symbols
-\usepackage[british]{babel} % Internationalization
-\usepackage[titletoc]{appendix} % Appendices
-\usepackage[pagebackref,hidelinks]{hyperref} % Hyperlinks
-\usepackage{graphicx} % Graphics
-\usepackage{booktabs} % Better looking tables
-\usepackage{etoolbox} % Patch chapter command
-\usepackage[nodayofweek]{datetime} % Use a fixed document date
-\usepackage{listings} % Code
-\usepackage[acronym,nonumberlist]{glossaries} % Glossaries and acronyms
-\usepackage[algochapter]{algorithm2e} % Pseudocode
-\usepackage{makeidx} % Index
-\usepackage[inline,shortlabels]{enumitem} % Customized enumerations
-\setlist{noitemsep}
-\setlist[description]{leftmargin=\parindent}
-\usepackage{epigraph}
+ \usepackage[dutch,russian,british]{babel}
+% \babelfont[russian]{rm}{Liberation Serif}
+\fi
-\usepackage[
- height={1.5cm},
- width={12mm},
- distance={1.55cm},
- topthumbmargin={auto},
- bottomthumbmargin={auto},
- eventxtindent={.5cm},
- oddtxtexdent={.3cm}]{thumbs}
+% Typography, widows, orphans, fonts
+\input{preamble/typography}
-\usepackage{lipsum}
+% Internationalisation
+\input{preamble/internationalisation}
-\usepackage{fancyhdr}
-\pagestyle{fancy}
+% Papersize and layout
+\input{preamble/layout}
-% Have better page numbering in chapters
-\patchcmd{\chapter}{plain}{headings}{}{}
+% Tables
+\input{preamble/table}
-% Images directory
-\graphicspath{{img/}}
+% Listings
+\input{preamble/listings}
-% Fix list of listings title
-\renewcommand{\lstlistlistingname}{List of Listings}
+% Graphics
+\input{preamble/graphics}
-% Fix list of listings chapter separator
-\makeatletter
-\let\my@chapter\@chapter%
-\renewcommand*{\@chapter}{%
- \addtocontents{lol}{\protect\addvspace{10pt}}%
- \my@chapter}
-\makeatother
+% Crossreferences, urls and hyperlinks
+\input{preamble/crossref}
-% Setup pdf parameters
-\hypersetup{%
- pdftitle={},
- pdfauthor={},
- pdfsubject={},
- pdfcreator={},
- pdfproducer={},
- pdfkeywords={},
-}
+% Bibliography
+\input{preamble/bibliography}
-% Fix gls in hyperlink errors
-\pdfstringdefDisableCommands{%
- \def\acrlong#1{}%
- \def\acrlongpl#1{}%
- \def\acrshort#1{}%
- \def\acrshortpl#1{}%
- \def\acrfull#1{}%
- \def\acrfullpl#1{}%
- \def\Acrlong#1{}%
- \def\Acrlongpl#1{}%
- \def\Acrshort#1{}%
- \def\Acrshortpl#1{}%
- \def\Acrfull#1{}%
- \def\Acrfullpl#1{}%
- \def\gls#1{}%
- \def\glspl#1{}%
- \def\Gls#1{}%
- \def\Glspl#1{}%
-}
-% General listings settings
-\lstset{%
- breakatwhitespace=false,
- breaklines=true,
- captionpos=b,
- keepspaces=true,
- basicstyle=\ttfamily\fontseries{l}\footnotesize,
- commentstyle=\slshape\fontseries{m},
- keywordstyle=\bfseries\fontseries{b},
- stringstyle=\ttfamily,
- showspaces=false,
- showstringspaces=false,
- showtabs=false,
- tabsize=4,
- frame=L,
-}
+% Custom commands
+\input{preamble/commands}
-% Increase the depth for the table of contenst
-\setcounter{secnumdepth}{3}
+% Glossaries and acronyms
+\input{preamble/glossaries}
-% Fix the algorithm font
-\renewcommand\AlCapFnt{\normalfont}
+% File structure, this must be last of the preamble
+\usepackage{subfiles}
-\renewcommand{\contentsname}{Table of Contents} % change the name of the TOC
-\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}} % to remove page numbering from the TOC
-
-% Initialize the glossaries
-\makeglossaries%
-\input{glossaries}
-
-% Enable the index
-\makeindex%
+% Metadata (only works in main document) and should go after subfiles
+\input{preamble/metadata}