morewrites, backrefs, structure
[phd-thesis.git] / preamble.tex
1 % Papersize
2 \usepackage{geometry}
3 \geometry{
4 inner=25mm,
5 outer=20mm,
6 marginparsep=3mm,
7 marginparwidth=13mm,
8 top=25mm,
9 bottom=20mm,
10 paperwidth=17cm,
11 paperheight=24cm,
12 }
13
14 % Font encoding
15 \usepackage[T1]{fontenc}
16
17 % Less bad boxes
18 \usepackage{microtype}
19
20 % No more room for a new \write
21 \usepackage{morewrites}
22
23 % Internationalisation
24 \usepackage[british]{babel}
25
26 % Appendices
27 % TODO is this necessary?
28 \usepackage[titletoc]{appendix}
29
30 % Hyperlinks
31 %\usepackage[pagebackref]{hyperref}
32 \usepackage[pagebackref]{hyperref}
33 % Setup pdf parameters: TODO
34 \hypersetup{%
35 pdftitle={\mytitle},
36 pdfauthor={\myauthor},
37 pdfsubject={},
38 % pdfcreator={},
39 % pdfproducer={},
40 pdfkeywords={task oriented programming, functional programming, domain specific languages, internet of things},
41 hidelinks,
42 }
43
44 % Graphics
45 \usepackage{graphicx}
46 % Images directory
47 \graphicspath{{img/}}
48
49 % Nice tables
50 \usepackage{booktabs}
51
52 % Automatically wrapping tables
53 \usepackage{tabularx}
54
55 % Use a fixed document date
56 \usepackage[nodayofweek]{datetime}
57
58 % Code
59 \usepackage{listings}
60 % General listings settings
61 \lstset{%
62 breakatwhitespace=false,
63 breaklines=true,
64 captionpos=b,
65 keepspaces=true,
66 basicstyle=\ttfamily\fontseries{l}\footnotesize,
67 commentstyle=\slshape\fontseries{m},
68 keywordstyle=\bfseries\fontseries{b},
69 stringstyle=\ttfamily,
70 showspaces=false,
71 showstringspaces=false,
72 showtabs=false,
73 tabsize=4,
74 frame=L,
75 }
76 % Fix list of listings title
77 \renewcommand{\lstlistlistingname}{List of Listings}
78 % Fix list of listings chapter separator
79 \makeatletter
80 \let\my@chapter\@chapter%
81 \renewcommand*{\@chapter}{%
82 \addtocontents{lol}{\protect\addvspace{10pt}}%
83 \my@chapter}
84 \makeatother
85
86 % Glossaries and acronyms
87 \usepackage[acronym,nonumberlist]{glossaries}
88 % Fix gls in hyperlink errors
89 \pdfstringdefDisableCommands{%
90 \def\acrlong#1{}%
91 \def\acrlongpl#1{}%
92 \def\acrshort#1{}%
93 \def\acrshortpl#1{}%
94 \def\acrfull#1{}%
95 \def\acrfullpl#1{}%
96 \def\Acrlong#1{}%
97 \def\Acrlongpl#1{}%
98 \def\Acrshort#1{}%
99 \def\Acrshortpl#1{}%
100 \def\Acrfull#1{}%
101 \def\Acrfullpl#1{}%
102 \def\gls#1{}%
103 \def\glspl#1{}%
104 \def\Gls#1{}%
105 \def\Glspl#1{}%
106 \def\titlecap#1{}%
107 }
108
109 % Titlecase commands
110 \usepackage{titlecaps}
111 \Addlcwords{of}
112 % Titlecase glossary command
113 \newcommand{\glst}[1]{\titlecap{\glsentrylong{#1}}}
114 \newcommand{\Glst}[1]{\glst{#1}}
115
116 % Pseudocode
117 \usepackage[algochapter]{algorithm2e}
118 % Fix the algorithm font
119 \renewcommand\AlCapFnt{\normalfont}
120
121 % Index
122 \usepackage{makeidx}
123 % Enable the index
124 \makeindex%
125
126 % Custom enumerations
127 \usepackage[inline,shortlabels]{enumitem}
128 \setlist{noitemsep}
129 \setlist[description]{leftmargin=\parindent}
130
131 % Epigraph (lovecraft)
132 \usepackage{epigraph}
133
134 % Thumb marks on the page
135 \usepackage[
136 height={1.5cm},
137 width={12mm},
138 distance={1.55cm},
139 topthumbmargin={auto},
140 bottomthumbmargin={auto},
141 eventxtindent={.5cm},
142 oddtxtexdent={.3cm}]{thumbs}
143
144 % Custom headers and footers
145 \usepackage{fancyhdr}
146 \pagestyle{fancy}
147
148 % To patch the chapter command
149 \usepackage{etoolbox}
150 % Have better page numbering in chapters
151 \patchcmd{\chapter}{plain}{headings}{}{}
152
153 % Increase the depth for the table of contents
154 \setcounter{secnumdepth}{3}
155 \renewcommand{\contentsname}{Table of Contents} % change the name of the TOC
156 \AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}} % to remove page numbering from the TOC
157
158 % Initialize the glossaries
159 \makeglossaries%
160 \input{glossaries}