-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreamble.tex
421 lines (348 loc) · 14.5 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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pre4.tex -- LaTeX Preamble %
% %
% Author: Mathias Dannesbo <[email protected]> %
% Time-stamp: <2016-01-12 18:43:35 (neic)> %
% %
% LuaLaTeX preamble with modern packages. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The special requirements for this to work is:
% - the serif fontface Arno Pro from Adobe,
% - the sans serif fontface Gill Sans Nova,
% - the math fontface Cambria Math from Microsoft and
% - python with
% - Pygments.
% The TeX-engine should also be run with -shell-escape.
%\includeonly{resultsdiscussion}
\RequirePackage[l2tabu, orthodox]{nag}
%\listfiles
\documentclass[a4paper,12pt,twoside,article,table,english,draft]{memoir}[2016/05/16]
% Include etoolbox and luacode for various tools used throughout the preamble
\usepackage{etoolbox, luacode}
%%%%%%%%%%%%%%%%
%%% Geometry %%%
%%%%%%%%%%%%%%%%
% Bringhurst 2.4.8 Never begin a page with the last line of a
% multi-line paragraph. Memoir 3.5 Sloppybottom.
\setlength{\topskip}{1.6\topskip} % memoir
\checkandfixthelayout % memoir
\sloppybottom % memoir
% Bringhurst 4.3.3 [Notes:] Use superscripts in the text but full-size
% numbers in the notes themselves. Memoir 12.1.2 [Footnotes:] Styling.
\setlength{\footmarkwidth}{-1sp} % memoir
\setlength{\footmarksep}{0em} % memoir
\footmarkstyle{#1 } % memoir
% Use the same footmarkstyle with threeparttable
\usepackage[online]{threeparttable}
\appto\TPTnoteSettings{\footnotesize} % threeparttable (etoolbox)
% Setup the use of subfloats in figures and tables. Use
% \subbottom[<caption>]{\includegraphics{…} \label{…}} for a subfigure with a
% caption beneath. Use \subtop[…]{…} for one above. Use \subcaption{<caption>}
% in a minipage.
% Memoir 10.9 Subcaptions
\newsubfloat{figure} % memoir
\newsubfloat{table} % memoir
% Use sans-serif for captions and subcaptions. Make the caption name and counter
% smallcaps.
% Memoir 10.6 Caption styling and 10.9 Subcaptions.
\captionnamefont{\sffamily\scshape} % memoir
\captiontitlefont{\sffamily} % memoir
\subcaptionlabelfont{\sffamily} % memoir
\subcaptionfont{\sffamily} % memoir
% Make the sub* counter letters without any parentheses. Also make it smallcaps
% for \*ref.
\renewcommand{\thesubfigure}{\scshape\alph{subfigure}}
\renewcommand{\thesubtable}{\scshape\alph{subtable}}
% However this also changes the label printed right before the caption to
% smallcaps. To revert this we overwrite the memoir-internals \@thesub*. The
% default is to have \@thesubfigure defined as
% \thesubfigure\if@tightsubcap\hskip\subfloatlabelskip\else\space\fi. We change
% out \thesubfigure (which we just made smallcaps) with \Alph{subfigure} to get
% uppercase letters. This is undocumented in the memoir, but the memoir manual
% states that the subcaptions is copied from the subfigure packages with some
% name changes. Section 5.5 Subfigure Constants of the subfigure manual
% describes \thesubfigure, \@thesubfigure et. al. The default (with few a few
% name changes) is taken from memoir.dtx.
\makeatletter
\def\@thesubfigure{\Alph{subfigure}%
\if@tightsubcap\hskip\subfloatlabelskip\else\space\fi}
\def\@thesubtable{\Alph{subtable}%
\if@tightsubcap\hskip\subfloatlabelskip\else\space\fi}
\makeatother
% Use micro-typography.
% Bringhurst 9.4.1 Use the best available justification engine
\usepackage{microtype}
\microtypesetup{final} % microtype
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Fonts and misc. typography %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fontspec}
% Create a flag, fancyfonts. If this is set to false, Arno, Gill Sans Nova and
% Cambria Math is not used. This is helpful if you (or your collaborators) don't
% have the fonts installed. If this is set to false, the functionality of the
% preamble is uncertain and untested.
\newtoggle{fancyfonts} % (etoolbox)
% Uncomment the line you want to use.
\toggletrue{fancyfonts} % (etoolbox)
%\togglefalse{fancyfonts} % (etoolbox)
\iftoggle{fancyfonts}{% etoolbox
% Set Arno Pro as the main font and Gill Sans as the sans font.
\setmainfont{Arno Pro}[Ligatures=TeX,Numbers=OldStyle] % fontspec
\setsansfont{Gill Sans Nova}[Scale=MatchUppercase,Numbers=OldStyle] % fontspec
% Use \lining to get lining numbers in a scope. Use \swash to get
% swash style in a scope.
\newcommand{\lining}{\addfontfeature{Numbers=Lining}} % fontspec
\newfontface\swash[Ligatures=TeX,Numbers=OldStyle,Style=Swash]{Arno Pro Italic} % fontspec
}{
% If fancyfonts is not set to true. Fail silently on \lining and \swash.
\newcommand{\lining}{}
\newcommand{\swash}{}
} % end \iftoggle{fancyfonts}
% Use \abbr with uppercase instead of \textsc with lowercase for abbreviations.
% E.g. \abbr{NATO} instead of \textsc{nato}. This makes the copyable text
% uppercase and also works in headings when hyperref or bookmark generates a pdf
% bookmark tree. Bringhurst 3.2.2 For abbreviations and acronyms in the midst of
% normal text, use spaced small caps.
\newcommand{\abbr}[1]{\texorpdfstring{%
{\iftoggle{fancyfonts}{%
\addfontfeature{Letters=UppercaseSmallCaps}#1}{%
\luaexec{tex.print((string.gsub('#1','\%u+','\\textsc{\\lowercase{\%0}}')))}}%
}}{#1}} % hyperref, fontspec, (etoolbox, luacode)
%%%%%%%%%%%%%%%%%%%%
%%% Localization %%%
%%%%%%%%%%%%%%%%%%%%
% Bringhurst 2.1.4 Use a single word space between sentences.
% Bringhurst 2.4.1 At hyphenated line-ends, leave at least two
% characters behind and take at least three forward.
% Bringhurst 2.4.5 Hypenate according to the conventions of the
% language.
\usepackage{polyglossia}
\setdefaultlanguage{english} % polyglossia
%%%%%%%%%%%%%%%%%%
%%% Math setup %%%
%%%%%%%%%%%%%%%%%%
\usepackage{amsmath,unicode-math,mathtools}
\unimathsetup{math-style=ISO,bold-style=ISO} % unicode-math
\iftoggle{fancyfonts}{% (etoolbox)
% Set Arno Pro as the main math font for the glyphs it has. Use Cambria Math as
% fallback for the rest. \setmathfont with range={…} and
% (s)script-features={…} are from unicode-math. Script=Latin is directly from
% fontspec.
% Script=Latin tells fontspec to use the OpenType script 'Latin' instead
% of the expected 'Math'. The 'Math' script is not defined in Arno or Gill
% Sans Nova as they are not math types.
% (s)script-features={} refer to script unrelated the OpenType script above.
% It overwrites unicode-maths normal OpenType feature flags for super- and
% subscript. It defaults to '+ssty', which is also missing from Arno and Gill
% Sans Nova.
\setmathfont{Cambria Math}[Scale=MatchLowercase]
\setmathfont{Arno Pro}[range={up/{num,latin,Latin,greek,Greek},%
% Below are all the symbols defined in unicode-math which are also present
% in Arno Pro, have the right metrics and have no similar symbols missing.
\mathexclam,\mathplus,\pm,\div,\dagger,\ddagger,\minus,\mathoctothorpe,%
\mathdollar,\mathpercent,\mathampersand,\mathquestion,\mathatsign,%
\mathsterling,\mathyen,\euro,\increment,\infty,\checkmark,%
\less,\equal,\greater,\ne,\leq,\geq,\matheth,\ell,\partial,},%
Script=Latin, script-features={}, sscript-features={}]
\setmathfont{Arno Pro Italic}[range={it/{latin,Latin,greek,Greek}},%
Script=Latin, script-features={}, sscript-features={}]
\setmathfont{Arno Pro Bold}[range = {bfup/{num,latin,Latin,greek,Greek}},%
Script=Latin, script-features={}, sscript-features={}]
\setmathfont{Arno Pro Bold Italic}[range={bfit/{latin,Latin,greek,Greek}},%
Script=Latin, script-features={}, sscript-features={}]
% Set Gill Sans Nova as the sf math font.
\setmathfont{Gill Sans Nova Book}[Scale=MatchUppercase,
range={sfup/{num,latin,Latin}},% missing greek,Greek
Script=Latin, script-features={}, sscript-features={}]
\setmathfont{Gill Sans Nova Book Italic}[Scale=MatchUppercase,%
range={sfit/{latin,Latin}},% missing num,greek,Greek
Script=Latin, script-features={}, sscript-features={}]
\setmathfont{Gill Sans Nova Bold}[Scale=MatchUppercase,%
range={bfsfup/{num,latin,Latin}},% missing greek,Greek
Script=Latin, script-features={}, sscript-features={}]
\setmathfont{Gill Sans Nova Bold Italic}[Scale=MatchUppercase,%
range={bfsfit/{latin,Latin,greek,Greek}},% missing num
Script=Latin, script-features={}, sscript-features={}]
% Set Arno Pro with the swash style as the math cal font
\setmathfont{Arno Pro Italic}[range={cal,bfcal}, RawFeature={+swsh},
Script=Latin, script-features={}, sscript-features={}]
}{} % end \iftoggle{fancyfonts}
% Use siunitx to typeset numbers and units with \num{}, \si{}, \SI{}{} etc.
\usepackage{siunitx}
\sisetup{%
% With detect-all, the siunitx macros automatically detects the font around it
% and changes its output accordingly.
detect-all,
% The -micro setup is to appropriate µ when using fontspec and an incompatible
% font. Arno and Gill Sans Nova works, but the fonts used with
% fancyfonts=false, does not. See section 7.6 Symbols and XeTeX in
% siunitx.pdf. \angstrom and \ohm works without any modification.
text-micro = {µ}, math-micro=\text{µ},
} % siunitx
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Colors and graphics %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xxcolor} % xxcolor is an extension for xcolor which is an extension
% for color. xxcolor is shipped with pgf.
% The Tableau 20 color palette is a nice list of colors for data visualization.
\definecolor{tblue}{RGB}{31,119,180} \definecolor{tlightblue}{RGB}{174,199,232}
\definecolor{torange}{RGB}{255,127,14} \definecolor{tlightorange}{RGB}{255,187,120}
\definecolor{tgreen}{RGB}{44,160,44} \definecolor{tlightgreen}{RGB}{152,223,138}
\definecolor{tred}{RGB}{214,39,40} \definecolor{tlightred}{RGB}{255,152,150}
\definecolor{tpurple}{RGB}{148,103,189} \definecolor{tlightpurple}{RGB}{197,176,213}
\definecolor{tbrown}{RGB}{140,86,75} \definecolor{tlightbrown}{RGB}{196,156,148}
\definecolor{tpink}{RGB}{227,119,194} \definecolor{tlightpink}{RGB}{247,182,210}
\definecolor{tgray}{RGB}{127,127,127} \definecolor{tlightgray}{RGB}{199,199,199}
\definecolor{tolive}{RGB}{188,189,34} \definecolor{tlightolive}{RGB}{219,219,141}
\definecolor{tteal}{RGB}{23,190,207} \definecolor{tlightteal}{RGB}{158,218,229}
% all (xx)color
% Use tikz for drawing and pgfplots for plotting.
\usepackage{tikz,pgfplots}
% Freeze the pgfplots features
\pgfplotsset{compat=1.15} % pgfplots
% Save the tikz and pgfplots figures as external files for faster compilation.
\usetikzlibrary{external} % tikz
\tikzexternalize[prefix=tikz/] % tikz
% Create a cyclelist of the first ten Tableau 20 colors for pgfplots.
\pgfplotscreateplotcyclelist{tcolor}{%
{solid, color=tblue}, {solid, color=torange}, {solid, color=tgreen},
{solid, color=tred}, {solid, color=tpurple}, {solid, color=tbrown},
{solid, color=tpink}, {solid, color=tgray}, {solid, color=tolive},
{solid, color=tteal}%
} % pgfplots
% And set that cyclelist as a global standard
\pgfplotsset{cycle list name={tcolor}} % pgfplots
% Transfer siunitx setting to pgf for identical number representation in text
% and figures. See section 7.10 'Transferring settings to pgf' of the siunitx
% manual.
\SendSettingsToPgf % siunitx
%%%%%%%%%%%%%%%%%%%%
%%% TÅGEKAMMERET %%%
%%%%%%%%%%%%%%%%%%%%
%\usepackage{tket}
%\TKsetup{C = {\kern-0.1ex\scalebox{0.94}{\raisebox{-0.08ex}{\ensuremath{ℂ}}}}} % med Arno Pro og TeX Gyre Pagella math
%\newfontface\bbface[Scale=0.87]{TeX Gyre Termes Math} \TKsetup{C = {\bbface\kern-0.1exℂ}} % fontspec,tket
%\TKsetup{dollar={\$}} % tket
% lining KA$$
%%%%%%%%%%%%%%%%%
%%% Titlepage %%%
%%%%%%%%%%%%%%%%%
% TODO
\setlength{\droptitle}{-3em}
\pretitle{\LARGE\par} \posttitle{\vskip 0.5em}
\newcommand{\supertitle}[1]{\gdef\suP{#1}}
\renewcommand{\maketitlehooka}{\ifx\suP\undefined\begin{center}\else\begin{center} {\scshape\suP}\fi}
\newcommand{\subtitle}[1]{\gdef\suB{#1}}
\renewcommand{\maketitlehookb}{\ifx\suB\undefined \end{center}\else\par {\large\scshape\suB}\par\end{center}\fi}
%%%%%%%%%%%%%%
%%% Header %%%
%%%%%%%%%%%%%%
% TODO
\newcommand{\stunum}[1]{\gdef\stuN{#1}}
\copypagestyle{articlehead}{plain}
\makeoddhead{articlehead}{\color{gray}\suB}{}{\color{gray}\thedate}
\pagestyle{articlehead}
%%%%%%%%%%%%%%
%%% resten %%%
%%%%%%%%%%%%%%
% TODO
% Include mhchem to typeset chemistry easily.
\usepackage[version=4]{mhchem}
\usepackage{pdfpages,xspace}
% \usepackage{minted} % requires minted > 2.0-alpha2
% \usemintedstyle{tango}
\usepackage{ragged2e}
\usepackage{csquotes}
% TODO
\DeclarePairedDelimiterX\Set[2]{\lbrace}{\rbrace}{#1\,\delimsize\vert\, #2}
%%%%%%%%%%%%
%%% Help %%%
%%%%%%%%%%%%
% TODO
\usepackage{lipsum}
\usepackage[margin,draft]{fixme}
\fxusetheme{color} % fixme
%%%%%%%%%%%%%%%%%%%%
%%% Bibliography %%%
%%%%%%%%%%%%%%%%%%%%
\usepackage[
backend=biber,
sortlocale=auto,
sortcites=true,
hyperref=true,
maxbibnames=99,
style=numeric,
sorting=none,
]{biblatex}
\addbibresource{literatur.bib} % biblatex
%%%%%%%%%%%%%%%%%%
%%% References %%%
%%%%%%%%%%%%%%%%%%
% Use \vref, \Vref or some other macro from varioref for references.
% varioref, hyperref, cleverref and bookmarks need to be loaded in this order.
% See cleverref doc. section 13.
\usepackage{varioref}
\usepackage[unicode=true,
pdfusetitle,
pdfkeywords={},
pdfdisplaydoctitle=true,
]{hyperref}
\usepackage{cleveref}
%%%%%%%%%%%%%%%%%%%%%%%%
%%% Table of Content %%%
%%%%%%%%%%%%%%%%%%%%%%%%
% Generate a pdf outline with bookmarks.
\usepackage{bookmark}
\usepackage[hyphenation, lastparline, nosingleletter,homeoarchy,rivers,draft]{impnattypo}
\maxtocdepth{section} % memoir
%%%%%%%%%%%%%%%%%%%%%%
%%% Custom changes %%%
%%%%%%%%%%%%%%%%%%%%%%
% Add you custom changes here
\begin{document}
%%%%%%%%%%%%%%%%%%%
%%% Frontmatter %%%
%%%%%%%%%%%%%%%%%%%
\frontmatter
%\thispagestyle{empty}
\supertitle{A super title}
\title{A title}
\subtitle{A sub title}
\author{An-Author}
\stunum{12345678}
\date{\today}
\maketitle
\clearpage
%\include{acknowledgements}
%\include{abstract}
%\include{abbreviations}
\tableofcontents
%%%%%%%%%%%%%%%%%%
%%% Mainmatter %%%
%%%%%%%%%%%%%%%%%%
\mainmatter
\include{test-typography}
%\include{introduction}
%\include{materialmethods}
%\include{resultsdiscussion}
%\include{conclusion}
\raggedright
\defbibheading{chapter}[\refname]{\chapter*{#1}\addcontentsline{toc}{chapter}{\refname}}
\printbibliography[heading=chapter]
\clearpage \appendix
%\include{appendix/consetrationcalculations}
%\include{appendix/additionalmeasurements}
%%%%%%%%%%%%%%%%%%
%%% Backmatter %%%
%%%%%%%%%%%%%%%%%%
\clearpage
\backmatter
% \listoftables
% \listoffigures
% \listoflistings
\end{document}
%%% Local Variables:
%%% coding: utf-8
%%% mode: latex
%%% End: