-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv_dissertation.mkiv
More file actions
353 lines (313 loc) · 11.1 KB
/
Copy pathenv_dissertation.mkiv
File metadata and controls
353 lines (313 loc) · 11.1 KB
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
\startenvironment env_dissertation
\usepath[{parts}]
\enableregime[utf-8]
\mainlanguage[en]
\setuplanguage[en][spacing=packed] % no double space after sentences
% Interoperability: Unifying/connecting methods through frameworks
% Discoverability: Best practice tools pre-selected
% Stabilization: Focus on interpretation by having reproducibility and frameworks instead of glue code
% “Frameworks of interpretation”
% “Codifying the tools of the trade”
\def\doctitle{Frameworks of interpretation: stabilizing scRNA-Seq data processing for discovery}
\def\author{Philipp J.G.F. Angerer}
\def\kindofwork{Ph.D. Thesis}
\def\topicofwork{Computational Biology}
% Page layout
\setuplayout[
alternative=doublesided,
width=middle,
headerdistance=0cm,
header=1cm,
footerdistance=0cm,
footer=0cm,
]
% Page numbering
\setuppagenumbering[
state=start,
alternative=singlesided,
location={header, right},
style=sans,
way=bypart,
sectionnumber=no,
strut=yes,
]
% Headers & footers
\setupheader[text][after=\vskip 4pt \hrule]
\setupheadertexts
[{\userpagenumber}]
[{\getmarking[chapternumber]\ \getmarking[chapter]}]
[{\userpagenumber}]
[{\getmarking[chapternumber]\ \getmarking[chapter]}]
% Allow colors
\setupcolors[state=start]
\setupbar[color=black]
% Links & document metadata
\setupinteraction[
state=start,
color=,
contrastcolor=,
% Document metadata
title=\doctitle,
subtitle={\kindofwork\ in \topicofwork},
author=\author,
% Don’t switch to fit page mode on link click
focus=standard,
]
% \setupsynctex[state=start] % Takes time and doesn’t seem to work in Kile
% keep track of the number but don’t show it
\setuphead[title][incrementnumber=yes, number=no]
% Make all section titles interactive, and show titles too
\setupcombinedlist[content][interaction=all,list={chapter,section,subsection,subsubsection,title}]
% Which PDF bookmarks to create and which ones to open
\placebookmarks[chapter,title,section,subsection,subsubsection][chapter,title,section][force=yes]
\setupinteractionscreen[option=bookmark]
\enabledirectives[interaction.identity.preroll] % prevent TeX from appering in title metadata
\enabledirectives[references.bookmarks.preroll] % prevent TeX from appering in PDF bookmarks
% % Vim syntax highlighting
%\usemodule[vim]
%\definevimtyping[python][syntax=python, strip=yes, lines=split, escape=on]
%\definevimtyping[R][syntax=r, strip=yes]
% Typography settings
\setupalign[hz, hanging, tolerant] % Breaks: Font expansion, Protruding punct., tolerance
\definefontfeature[default][default][ % https://docs.microsoft.com/en-us/typography/opentype/spec/features_ae
liga=yes, tlig=yes, ccmp=yes, % ligatures and glyph composition/decomposition
kern=yes, % kerning
onum=yes, % oldstyle numbers
expansion=quality, protrusion=quality,
trep=no, mode=node, % text replacement like '→’
]
\setupbodyfontenvironment[default][em=italic] %italic instead of slanted
\setupindenting[yes, medium] % Indent paragraph starts
\setbreakpoints[compound] % Allow breaking after dashes
% hyphenation
\hyphenation{chan-ges}
\hyphenation{u-bi-qui-tous}
\hyphenation{me-thy-la-tion}
\hyphenation{he-te-ro-ge-ne-i-ty}
\hyphenation{mar-kers}
% Font settings, need to be after typography
%\usetypescriptfile[type-imp-euler.mkiv]
%\usetypescript[eulernova]
%\usetypescriptfile[type-luxi]
%\usetypescript[type-luxi]
\definefontfamily[myfonts][serif][TeX Gyre Pagella] % Palatino
\definefontfamily[myfonts][math][TeX Gyre Pagella Math] % AMS Euler or TeX Gyre Pagella Math or XITS Math
\definefontfamily[myfonts][sans][TeX Gyre Heros] %Helvetica
\definefontfamily[myfonts][mono][Luxi Mono][rscale=0.86] % or: Tex Gyre Cursor
\setupbodyfont[myfonts, 12pt]
% small caps
\def\n#1{\smallcaps{#1}}
% Heading style
\setuphead[chapter] [style=\ss\bfc, align=flushleft]
\setuphead[section] [style=\ss\bfb, align=flushleft]
\setuphead[subsection] [style=\ss\bfa, align=flushleft]
\setuphead[subsubsection][style=\ss\bf, align=flushleft]
\setuplabeltext[en][appendix=Appendix~]
\define[2]\AppendixHeader
{\framed[frame=off,width=broad,align=flushleft]{\ss\bfc#1\crlf#2}}
\startsectionblockenvironment[appendix]
\setuphead[chapter][command=\AppendixHeader]
\stopsectionblockenvironment
% List environments
\definedescription[desc][
headstyle=bold, style=normal,
align=justify, alternative=hanging,
width=broad, margin=1cm,
]
% Floating environments
\setupcombinations[location=top, alternative=text]
\definefloat[listing][listings]
\setupcaption[figure][hang=yes, indentnext=no]
\definefloat[subfigure][subfigures]
\setupfloat[subfigure][local=yes]
\setupcaption[subfigure][number=yes, numberconversion=a, style=bold, location=right]
\setuplabeltext[subfigure=]
\appendvalue{stopplacefigure}{\resetcounter[subfigure]}
\definefloat[narrowfigure][figures][figure]
\setupcaption[narrowfigure][location=right, hang=no]
% Tables
\setupTABLE[c][each][align={middle,lohi},frame=off]
\usemodule[database]
\defineseparatedlist
[TSV]
[separator=tab,first=\bTR,last=\eTR,left=\bTD,right=\eTD]
\defineseparatedlist
[CSV]
[separator=comma,first=\bTR,last=\eTR,left=\bTD,right=\eTD]
%\startseparatedlist[TSV]
%\startTSV
%\processseparatedfile[TSV][filename]
% references
\setupreferencing[left=, right=]
% Citations/Bibliography
% http://pragma-ade.nl/general/manuals/mkiv-publications.pdf
\definebtxdataset[main]
\usebtxdataset[main][bib/\jobname.bib]
\setupbtx[dataset=main] % make \cite use this by default
\setupbtx[default:cite][alternative=authoryear] % default so the shortcut \cite[ref] can be used
\usebtxdefinitions[apa] % load apa styles for bib entry and \cite rendering
\setupbtx[apa:cite][otherstext={ et al.}, etallimit=3]
\setupbtx[apa:list][etallimit=, etaldisplay=]
\definebtxrendering[main][apa][dataset=main, pagestate=start] % define a bib entry rendering to use with \placebtxrendering (sorting, numbering=no, …)
% \newbibfield[timestamp]
% \setuppublicationlayout[electronic]{%
% \insertauthors{}{. }{}%
% \inserttitle{}{ }{}%
% \inserturl{\bgroup\tt}{\egroup\ }{}%
% \inserttimestamp{accessed:}{ }{}%
% \insertnote{ }{.}{}%
% }
\def\inlinecite[#1]{\cite[authoryears][#1]}
\def\inbracecite[#1]{\cite[authoryear,left=,right=][#1]}
% command to extract titles
\startluacode
local luadata = publications.datasets.main.luadata
--for tag, entry in next, luadata do
-- if entry.title then
-- logs.report("btx", "tag: %a, title: %a", entry.tag, entry.title)
-- end
--end
userdata = userdata or {}
function userdata.cite_title(tag)
tex.print(luadata[tag].title)
end
\stopluacode
\def\placecitationtitle#1{\ctxlua{userdata.cite_title([==[#1]==])}}
\def\titlecite#1{\placecitationtitle{#1} \cite[#1]}
\def\embedappendix{\dosingleempty\doEmbedappendix}
\def\doEmbedappendix[#1]#2{\page[odd]
\startchapter[title={\titlecite{#2}}, #1]
\cite[alternative=entry, left=, right=][#2]
\page
\copypages[publications/#2.pdf][][scale=900]
\stopchapter}
% \usemodule[res-08] \setups[rl:manipulate]
\setupexternalfigures[directory=imgs,conversion=pdf]
% Modules
%\usemodule[newmat]
%\usemodule[chemic]
\usemodule[tikz]
\usemodule[pgfplots] % needs to be before \usetikzlibrary calls
\pgfplotsset{compat=1.14}
% \usepgfplotslibrary[groupplots]
\unexpanded\def\startgroupplot{\groupplot}
\unexpanded\def\stopgroupplot{\endgroupplot}
% \usemodule[pgfplotstable]
%\usepgfplotslibrary[groupplots]
% https://tikz.dev/pgfplots/pgfplotstable-load-data
% Applies to both `\pgfplotstableread` and `\addplot table`
\pgfplotsset{
table/search path={data},
}
\usetikzlibrary[positioning] % needs to be after pgfplots
\usetikzlibrary[decorations.pathreplacing]
\usetikzlibrary[backgrounds] %\tikz[framed] for debugging
\usetikzlibrary[shapes]
%\usetikzlibrary[shadings]
\usetikzlibrary[arrows.meta]
\usetikzlibrary[fadings]
\usetikzlibrary[calc]
%\usetikzlibrary[external]
%\tikzexternalize[prefix=imgs/]
\usemodule[logos]
\catcode`√=13\def√{\sqrt}
\catcode`∜=13\def∜{\sqrt[4]}
%\definemathfunction[cdf][mathlimits=auto]
%\definemathfunction[Cov][mathlimits=auto]
%\definemathfunction[Var][mathlimits=auto]
\definemathfunction[mean][mathlimits=auto]
\definemathfunction[argmin][mathlimits=auto]
\definemathfunction[argmax][mathlimits=auto]
\definemathfunction[LR][mathlimits=no]
\definemathfunction[GR][mathlimits=no]
\definemathfunction[rank][mathlimits=no]
% References
\definereferenceformat[ineq][text={Equation }] %left=(,right=),
\definereferenceformat[infig][text={Figure }]
\definereferenceformat[insec][text={Section }]
\definereferenceformat[andsec][text={and }]
% % http://tex.stackexchange.com/questions/60950/how-to-draw-cdf-of-normal-distribution-in-tikz
%\tikzset{
% declare function={
% normcdf(\x,\mu,\s)=1/(1 + exp(-0.07056*((\x-\mu)/\s)^3 - 1.5976*(\x-\mu)/\s));
% }
%}
%\pgfmathdeclarefunction{gauss}{2}{%
% \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
%}
% % for i in range(11): print('rgb({}mm)=({s[0]},{s[1]},{s[2]});'.format(i*8, s=Spectral(i, bytes=False)))
%\pgfplotsset{
% every axis title/.style={at={(0.5,1)},above,yshift=6pt,font=\bold},
% colormap={spectral}{%
% rgb(0mm)=(0.61,0.0,0.25);
% rgb(8mm)=(0.82,0.23,0.3);
% rgb(16mm)=(0.95,0.42,0.26);
% rgb(24mm)=(0.98,0.67,0.37);
% rgb(32mm)=(0.99,0.87,0.54);
% rgb(40mm)=(0.99,0.99,0.74);
% rgb(48mm)=(0.9,0.96,0.59);
% rgb(56mm)=(0.66,0.86,0.64);
% rgb(64mm)=(0.4,0.76,0.64);
% rgb(72mm)=(0.19,0.52,0.73);
% rgb(80mm)=(0.36,0.3,0.63)},
% colormap={purd}{%
% rgb255=(103,0,31)
% rgb255=(152,0,67)
% rgb255=(206,18,86)
% rgb255=(231,41,138)
% rgb255=(223,101,176)
% rgb255=(201,148,199)
% rgb255=(212,185,218)
% rgb255=(231,225,239)
% rgb255=(247,244,249)},
%}
%\pgfplotsset{
% % this transformation ensures that every input argument is
% % transformed from -0.2 : 0.5 -> -0.5,0.5
% % and every tick label is transformed back:
% nonlinear colormap trafo/.code 2 args={
% \def\nonlinearscalefactor{((#2)/(#1))}%
% \pgfkeysalso{%
% y coord trafo/.code={%
% \pgfmathparse{##1 < 0 ? -1*##1*\nonlinearscalefactor : ##1}%
% },
% y coord inv trafo/.code={%
% \pgfmathparse{##1 < 0 ? -1*##1/\nonlinearscalefactor : ##1}%
% },
% }%
% },
% nonlinear colormap around 0/.code 2 args={
% \def\nonlinearscalefactor{((#2)/(#1))}%
% \pgfkeysalso{
% colorbar style={
% nonlinear colormap trafo={#1}{#2},
% %
% % OVERRIDE this here. The value is *only* used to
% % generate a nice axis, it does not affect the data.
% % Note that these values will be mapped through the
% % colormap trafo as defined above.
% point meta min={#1},
% point meta max={#2},
% },
% %
% % this here is how point meta is computed for the plot.
% % It means that a point meta of -0.2 will actually become -0.5
% % Thus, the *real* point meta min is -0.5... but we
% % override it above.
% point meta={y < 0 ? -y*\nonlinearscalefactor : y},
% }%
% },
%}
% Front and body part definitions
\definestructureconversionset[frontpart:pagenumber][][romannumerals]
\definestructureconversionset[bodypart:pagenumber] [][numbers]
\setuplist[chapter][pageconversionset=pagenumber]
\startsectionblockenvironment[frontpart]
\setupuserpagenumber[numberconversion=romannumerals]
\setcounter[userpage][1]
\stopsectionblockenvironment
\startsectionblockenvironment[bodypart]
\setupuserpagenumber[numberconversion=numbers]
\setcounter[userpage][1]
\stopsectionblockenvironment
\stopenvironment