-
Notifications
You must be signed in to change notification settings - Fork 0
/
preamble.tex
executable file
·380 lines (346 loc) · 19.9 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
\documentclass[12pt, twoside, openright, fleqn, a4paper]{book} %fleqn is for left aligned equations
%TODO Change these
\newcommand{\authorFullName}{Author name}
\newcommand{\titleFull}{A title}
%%General
\usepackage[includehead, margin=2.5cm]{geometry}
\usepackage{graphicx,amsmath} % no amssymb,amsfonts since we load mathdesign below which should provide everything
% \usepackage{amsthm} %Theorem environments, currently unused
\usepackage[space]{grffile} %Better filename support for graphicx
\usepackage[group-separator={,},group-four-digits]{siunitx}
\sisetup{detect-all}
% \usepackage[mathletters]{ucs} % Unicode in math environments, currently unused
\usepackage[usenames, dvipsnames]{xcolor}
%%Colors
\definecolor{titlecolor}{HTML}{9D102D} %equiv RGB 157, 16, 45
%%Encoding, locals, font
\usepackage[english]{babel}
\frenchspacing
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{calligra} %Only for the dedication
\usepackage{XCharter} %Heavier font
% \usepackage{MinionPro} %Alternative font (part of debian package 'texlive-fonts-extra')
% \usepackage{bookman} %Alternative font
\usepackage[scaled]{helvet} %Set sans serif font to Helvetica
\usepackage[charter, expert]{mathdesign} %Set math font to charter (same as serif document font)
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype} %Use larger letterspacing with lsstyle, requires mathdesign.sty (debian package texlive-fonts-extra)
\SetExtraKerning[unit=space]
{encoding={*}, family={bch}, series={*}, size={footnotesize,small,normalsize}}
{\textendash={400,400}, % en-dash, add more space around it
% "28={ ,150}, % left bracket, add space from right
% "29={150, }, % right bracket, add space from left
\textquotedblleft={ ,150}, % left quotation mark, space from right
\textquotedblright={150, }} % right quotation mark, space from left
\SetTracking{encoding={*}, shape=sc}{40} % some amount of tracking, around small caps
%%Table of contents layout
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\bfseries\lsstyle\scshape\Huge} %Redefine look of the word 'Contents' to match with the style used for other chapters (defined below at titlesec setup)
\usepackage{titletoc}
\titlecontents{chapter}
[0pt]
{\addvspace{1pc}}%
{\contentsmargin{0pt}%
\usefont{T1}{bch}{b}{n}\selectfont
\bfseries\lsstyle
\makebox[0pt][r]{\huge\thecontentslabel\enspace}\large}
{\contentsmargin{0pt}\large}
% {\quad\thepage}
{}
%Use below if sections are long enough to mark them more prominently in the toc
% \titlecontents{section}
% [0pt]
% {\addvspace{.5pc}}%
% {\contentsmargin{0pt}%
% \usefont{T1}{bch}{b}{n}\selectfont
% \makebox[0pt][r]{\thecontentslabel\enspace}}
% {\contentsmargin{0pt}\large}
% {\dotfill\thepage}
% []
%%% No vertical space between entries from different chapters in LOF and LOT (added by book class by default)
\newcommand*{\noaddvspace}{\renewcommand*{\addvspace}[1]{}}
\addtocontents{lof}{\protect\noaddvspace}
\addtocontents{lot}{\protect\noaddvspace}
%%Headline layout
\usepackage[sc]{titlesec}
\newcommand{\chaptersize}{\fontsize{10cm}{1em}\selectfont}
% \renewcommand{\thechapter}{\Roman{chapter}}
\titleformat{\chapter}[display]
{\bfseries\lsstyle\scshape\Huge}
% {\filleft\Large\chaptertitlename\hspace{0.8cm}\Huge\thechapter} % No color
{\filleft\Large\color{titlecolor}\chaptertitlename\hspace{0.8cm}\Huge\color{titlecolor}\thechapter} % Colored chapter text and number
{2.5ex}
{\filright}
[\vspace{2ex}\titlerule]
\titlespacing*{\chapter}{0pt}{-15pt}{40pt} % To decrease vertical space. Make sure it lines up with the epigraph space
\titleformat{\section}[hang]{
\usefont{T1}{bch}{b}{n}\selectfont} % "bch" - Bitstream Charter, "b" - bold
{} % label
{0em} % horizontal separation between label and title body
{\hspace{-0.4pt}\large \thesection\hspace{0.6em}} % code preceding the title
[] % optional code following the title body
\titleformat{\subsection}[hang]{\usefont{T1}{bch}{b}{n}\selectfont}{}{0em}{\hspace{-0.4pt}\normalsize \thesubsection\hspace{0.6em}}[]
\titleformat{\subsubsection}[hang]{\usefont{T1}{bch}{b}{n}\selectfont}{}{0em}{}[]
% \titleformat{\subsubsubsection}[hang]{\usefont{T1}{bch}{b}{n}\selectfont}{}{0em}{\hspace{-0.4pt}\normalsize \thesubsubsubsection\hspace{0.6em}}[]
%%Tables
\usepackage{lscape, longtable}
\usepackage{pgfplotstable} % Read tables from files
\pgfplotstableset{
every head row/.style={before row=\toprule,after row=\midrule}, % add top and midrule
every last row/.style={after row=\bottomrule}, % add bottom rule
%Begin header bold
column type={>{\fontseries{bx}\selectfont}l},
postproc cell content/.append style={ % see sec 3.2
/pgfplots/table/@cell content/.add={\fontseries{\seriesdefault}\selectfont}{}}
%End header bold
}
\pgfplotsset{compat=1.9} %Set pgfplots compatibility to 1.9 (will give a warning of nothing is set here)
\usepackage{booktabs} %gives \toprule, \midrule and \bottomrule for professional looking tables
\usepackage[para]{threeparttable} %Provides notes in tables (in addition to the caption)
\usepackage{tabularx} %Defines column type X for tables with auto linebreaks. For REALLY big tables use one of the more specialized packages
\usepackage{pdflscape} % For landscape pages (not necessarily just for tables)
%%Various other things
\usepackage{pgf}
\newcommand\inputpgf[2]{{
\let\pgfimageWithoutPath\pgfimage
\renewcommand{\pgfimage}[2][]{\pgfimageWithoutPath[##1]{#1/##2}}
\input{#1/#2}
}} % Use like \inputpgf{path/to/figures}{figure.pgf} for pfg images which contain raster parts
\usepackage{varioref} % This has to be loaded before hyperref and before cleverref
\usepackage{rotating}
\usepackage[update,prepend]{epstopdf} %Automatic eps to pdf conversion when using .eps in includegraphics
\usepackage{setspace} %Allow different line spacings
\usepackage[titletoc]{appendix} %Provides an environment for the appendix
\usepackage{pdfpages} %To include PDFs
\usepackage{epigraph}
\setlength{\epigraphrule}{0pt}
\setlength{\epigraphwidth}{0.8\textwidth}
\usepackage{enumitem} % Horizontal inline lists
\newlist{inlinelist}{enumerate*}{1}
\setlist*[inlinelist,1]{label=(\roman*)}
\usepackage{chngcntr}
\counterwithout{footnote}{chapter}
\usepackage{caption} %Neat things with captions like the reference in bold and smaller fonts
\usepackage{subcaption} %The subfigure package is deprecated. Also gives us subtables
\captionsetup{margin=0.8cm,aboveskip=8mm,labelfont=bf,labelformat=default,labelsep=period,textfont=small} %Explicit labelformat=default necessary for varioref/hyperref/caption combination
\DeclareCaptionLabelFormat{boldparens}{\textbf{(#2)}}
\captionsetup[sub]{subrefformat=boldparens,belowskip=6mm}
\setcounter{tocdepth}{2} %2 should be default anyway
\setlength{\parskip}{1ex plus 0.5ex minus 0.5ex} %Space of a paragraph, note the variability, gives latex more room for optimization
\setlength{\parindent}{0pt} %Basically a whole lot of \noindents before every paragraph ;)
\usepackage{nicefrac} %fraction style (a/b) useful for inline fractions
\setlength{\headheight}{15pt}
\usepackage{emptypage} %Empty pages are really empty, no header or anything
\usepackage{nomencl} %Create nomenclature (abbreviations) list, leave away intoc option because see thesis.tex and leave away pageref, because we use custom commands that do this (see below)
%This requires makeindex during compilation see nomencl manual for commandline
\makenomenclature
\renewcommand{\nomname}{Abbreviations}
\widowpenalty=300
\clubpenalty=300
\usepackage{fancyhdr}
%\addtolength{\headwidth}{\marginparsep}
%\addtolength{\headwidth}{\marginparwidth}
%\addtolength{\headwidth}{-0.5in}
\setlength{\headwidth}{\textwidth}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection.\ #1}{}}
\fancyhf{} %delete old header settings
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\fancyhead[LE,RO]{\bfseries\thepage}
\renewcommand{\headrulewidth}{0.8pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.8pt} %make space for the rule
%%Bibliography
\usepackage{natbib}
\bibliographystyle{natbib.bst} %Not sure where this came from (Oxford Bioinformatics Journal?), slightly edited in particular to use websites
\setlength{\bibsep}{2pt} %Spacing between entries in the bibliography, zero is too hard
%%Listings
\usepackage{minted} %Better sourcecode highlighting, requires shellescape during compilation
\renewcommand\listingscaption{Code} %Call listings Code not Listing
%% Versioning and reviewing
\usepackage{gitinfo2} %Allows access to git information from within latex
%See the manual for how to set it up https://ftp.gwdg.de/pub/ctan/macros/latex/contrib/gitinfo2/gitinfo2.pdf
\usepackage[xcolor]{changebar} %Needs to be defined after minted!
\cbcolor{red}
\usepackage{todonotes}
\newcounter{todocounter}
\newcommand{\todonum}[2][]
{\stepcounter{todocounter}\todo[#1,tickmarkheight=0.2cm,size=\small]{\thetodocounter: #2}}
\reversemarginpar
\setlength{\marginparwidth}{2.6cm}
%%Hyperref
\usepackage[bookmarks=true, linktocpage=true, backref=page]{hyperref} % linktocpage will put the links in toc on the section numbers not on the whole text.
% That will force the line not to break which would make it very ugly
\hypersetup{
unicode=true, % non-Latin characters in Acrobats bookmarks
pdftoolbar=true, % show Acrobats toolbar?
pdfmenubar=true, % show Acrobats menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={Fit}, % fits the width of the page to the window
pdftitle={\titleFull}, % the title
pdfauthor={\authorFullName}, % the author
%pdfsubject={Subject}, % subject of the document
%pdfcreator={Creator}, % creator of the document
%pdfproducer={Producer}, % producer of the document
pdfkeywords={some, keys}, % TODO list of keywords
pdfnewwindow=true, % links in new window
colorlinks=false, % false: boxed links; true: colored links
linkcolor=red, % color of internal links
citecolor=green, % color of links to bibliography
citebordercolor=green, % color of the box around links to bibliography
urlcolor=blue, % color of external links
urlbordercolor=blue % color of the box around external links
}
%%%% these patches ensure that the backrefs point to the actual occurrences of the citations in the text, not just the page or section in which they appeared
%%%% http://tex.stackexchange.com/questions/54541/precise-back-reference-target-with-hyperref-and-backref
%%%% BEGIN BACKREF DIRECT PATCH, apply these AFTER loading hyperref package with appropriate backref option
% The following options are provided for the patch, currently with a poor interface!
% * If there are multiple cites on the same (page|section) (depending on backref mode),
% should we show only the first one or should we show them all?
\newif\ifbackrefshowonlyfirst
% \backrefshowonlyfirstfalse
\backrefshowonlyfirsttrue
%%%% end of options
%
% hyperref is essential for this patch to make any sense, so it is not unreasonable to request it be loaded before applying the patch
\makeatletter
% 1. insert a phantomsection before every cite, so hyperref has something to target
% * in case natbib is loaded. hyperref provides an appropriate hook so this should be safe, and we don't even need to check if natbib is loaded!
\let\BR@direct@old@hyper@natlinkstart\hyper@natlinkstart
\renewcommand*{\hyper@natlinkstart}{\phantomsection\BR@direct@old@hyper@natlinkstart}% note that the anchor will appear after any brackets at the start of the citation, but that's not really a big issue?
% * if natbib isn't used, backref lets \@citex to \BR@citex during \AtBeginDocument
% so just patch \BR@citex
\let\BR@direct@oldBR@citex\BR@citex
\renewcommand*{\BR@citex}{\phantomsection\BR@direct@oldBR@citex}%
% 2. if using page numbers, show the page number but still hyperlink to the phantomsection instead of just the page!
\long\def\hyper@page@BR@direct@ref#1#2#3{\hyperlink{#3}{#1}}
% check which package option the user loaded (pages (hyperpageref) or sections (hyperref)?)
\ifx\backrefxxx\hyper@page@backref
% they wanted pages! make sure they get our re-definition
\let\backrefxxx\hyper@page@BR@direct@ref
\ifbackrefshowonlyfirst
%\let\backrefxxxdupe\hyper@page@backref% test only the page number
\newcommand*{\backrefxxxdupe}[3]{#1}% test only the page number
\fi
\else
\ifbackrefshowonlyfirst
\newcommand*{\backrefxxxdupe}[3]{#2}% test only the section name
\fi
\fi
% 3. now make sure that even if there is no numbered section, the hyperref's still work instead of going to the start of the document!
\RequirePackage{etoolbox}
\patchcmd{\Hy@backout}{Doc-Start}{\@currentHref}{}{\errmessage{I can't seem to patch backref}}
\makeatother
%%%% END BACKREF PATCHES
\usepackage[capitalise,noabbrev]{cleveref} %Use \cref and \Cref to automatically writhe 'Table' part of the reference, also use varioref for even more automatism
\Crefname{minted}{Code}{Listings}
\makeatletter
\if@cref@capitalise
\crefname{minted}{code}{listings}
\else
\crefname{minted}{Code}{Listings}
\fi
\makeatother
\Crefname{listing}{Code}{Listings}
\makeatletter
\if@cref@capitalise
\crefname{listing}{code}{listings}
\else
\crefname{listing}{Code}{Listings}
\fi
\makeatother
\Crefname{subsection}{Subsection}{Subsections}
\makeatletter
\if@cref@capitalise
\crefname{subsection}{Subsection}{Subsections}
\else
\crefname{subsection}{subsection}{subsections}
\fi
\makeatother
%%Custom commands
\newcommand{\citeme}[1]{\Large\textsuperscript{\textbf{\textcolor{Blue}{citation needed}(#1)}}\normalsize}
\newcommand{\al}[0]{$\alphaup$} %Since the math font is also charter, this will look good
\newcommand{\alimp}[0]{\al-IMP\ }
\newcommand{\alimps}[0]{\al-IMPs\ }
\newcommand{\be}[0]{$\betaup$}
\newcommand{\beimp}[0]{\be-IMP\ }
\newcommand{\beimps}[0]{\be-IMPs\ }
\newcommand{\supp}[0]{Supplementary Material\ }
\newcommand{\angs}[0]{\,\AA}
\newcommand{\method}[1]{\textbf{#1}}
\newcommand{\ie}[0]{i.e.,\ } % In AE almost all style guides recommend putting a comma after so let's follow that (also before btw)
\newcommand{\eg}[0]{e.g.,\ } % Same here
\newcommand{\cf}[0]{cf.\ } % 'Compare', not 'see'. Ideally comparison of multiple points. When in doubt, don't use
\newcommand{\asf}[0]{asf.\ }
\newcommand{\chap}[0]{cp.\ }
\newcommand{\Naive}[0]{Na{\"i}ve\ }
\newcommand{\id}[0]{ID\ }
\newcommand{\ids}[0]{IDs\ }
\newcommand{\pv}[0]{$p$-value\ }
\newcommand{\pvs}[0]{$p$-values\ }
\newcommand{\ev}[0]{E-value\ }
\newcommand{\invitro}{\textit{in vitro\ }}
\newcommand{\invivo}{\textit{in vivo\ }}
\newcommand{\insilico}{\textit{in silico\ }}
\newcommand{\dbid}[1]{{\fontfamily{phv}\selectfont\lowercase{#1}}}
\newcommand{\seq}[1]{{\fontfamily{phv}\selectfont{#1}}}
\newcommand{\mut}[1]{{\fontfamily{phv}\selectfont\uppercase{#1}}}
\newcommand{\proteingenename}[1]{\lowercase{#1}} %cf. https://en.wikipedia.org/wiki/Gene_nomenclature and HUGO
\newcommand{\proteingeneabbr}[1]{\textit{\uppercase{#1}}} %cf. https://en.wikipedia.org/wiki/Gene_nomenclature and HUGO
\newcommand{\dmsstudyid}[1]{{#1}}
\newcommand{\figintro}[1]{\textbf{#1}} %Use for first sentence (short summary) in captions
\newcommand{\organism}[1]{\textit{#1}} %Capitalize first letter. Write the full name first like Escherichia coli and later abbreviate to E. coli. Note the space between the two words
\newcommand{\abbr}[2]{\phantomsection\label{abbr:#1}\nomenclature{#1}{#2, page \pageref{abbr:#1}\phantomsection\label{abbr:#1bbbb}}\hyperref[abbr:#1bbbb]{#1}} %List pages in Abbreviations list
% \newcommand{\abbr}[2]{\phantomsection\label{abbr:#1}\nomenclature{#1}{#2 \phantomsection\label{abbr:#1bbbb}}\mbox{\hyperref[abbr:#1bbbb]{#1}}} %Don't list pages
\newcommand{\abref}[1]{\mbox{\hyperref[abbr:#1bbbb]{#1}}}
\newenvironment{dedication}
{%\clearpage % we want a new page
\thispagestyle{empty}% no header and footer
\vspace*{\stretch{1}}% some space at the top
\itshape % the text is in italics
\raggedleft % flush to the right margin
}
{\par % end the paragraph
\vspace{\stretch{3}} % space at bottom is three times that at the top
\clearpage % finish off the page
}
%%Writing Guidelines
% Use past tense (use present tense when talking about published papers (they are 'facts'), so basically intro present, methods past, results past (also mix as in: 'did not contain, indicating')
% cf. here: http://services.unimelb.edu.au/__data/assets/pdf_file/0009/471294/Using_tenses_in_scientific_writing_Update_051112.pdf
% Use we (if any personal pronoun, ideally use none). 'One' also sounds dull, so limit usage.
% Use active verbs more often
% No 'as is well known' asf
% No might/may/would, sounds like not wanting to make a clear statement
% Don't abbreviate units when used in text (without preceding numbers)
% No contractions
% this also goes for genitive ideally
% Brevity, and keep sentences short
% Apart from % and deg, there is a space between number and unit (see siunitx package)
% “the fact that ...” (delete); “In order to ...” (shorten to simply “To ...”); utilize/ation (use)
% No ()(), rewrite sentences to avoid if necessary
% A paragraph should begin with a topic sentence that sets the stage clearly for what will follow
% Rather than telling the reader that a result is interesting or significant, show them how it is interesting or significant. cf. http://course1.winona.edu/mdelong/ecolab/21%20suggestions.html
% When preparing to write your results, decide on the elements of the story you wish to tell, then choose the subset of text, figures, and tables that most effectively and concisely coveys your message
% You should use the tables and figures to illustrate points in the text, rather than making them the subject of your text. (so NOT ``Figure 4 shows'')
% No Dangling modifiers such as: Having finished the assignment, the TV was turned on. (the subject of having finished,is not the TV! name who it was)
% If sections/subsections or indentions of any kind, there should be at least two of it on that level
% At least three sentences per paragraph. If not long enough and really nothing else to say, merge nonetheless and make the best out of it
% The first non-greek letter after a greek letter at the beginning of a sentence should be capitalized: http://www.amamanualofstyle.com/browse;jsessionid=9EA19219781ADA8A8629B69513B122D5?t1=AMAMOS_SECTIONS:med-9780195176339-div1-183#
% Abbreviations must be used 3 times or more to validate their existence
% Try to put citations at the end of the sentence unless that would make the association unclear
%%Rough correction guidelines%%
%American English (but Oxford comma)
%%Figures%%
% Barplots, should not be too small in terms of the data they present, 2 groups is borderline
% Do not wrap text around figures, it looks horrible. If it is important enough to get a Figure, it is important enough not to be buried in text
% Denote sample sizes
% The dependent variable goes on the Y axis (in particular in scatterplots)
% Only connect data points, when the values in-between make sense (i.e. could potentially exist, we just don't have them)
%%Spelling
% aforementioned
% therefore adv. 'darum' <--> therefor adv. [form.] [law] 'dafür'
% Verbs (not to) use: https://drive.google.com/file/d/1QueG8qtFT0w_KGXSS0ZjsR9ltSTK85UV/view