├── .gitignore ├── Makefile ├── README.md ├── bibliography.bib ├── defaults.yaml ├── flake.lock ├── flake.nix ├── img ├── R │ └── graph.R ├── dot │ └── graph.dot ├── logs │ └── demo.log ├── png │ └── graph.png ├── python │ └── graph.py └── svg │ └── graph.svg ├── src ├── chapter_1.md └── chapter_2.md ├── template.tex ├── thesis.tex └── thesis.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | thesis.pdf 2 | tmp/ 3 | result 4 | 5 | # Created by https://www.toptal.com/developers/gitignore/api/latex 6 | # Edit at https://www.toptal.com/developers/gitignore?templates=latex 7 | *.aux 8 | *.lof 9 | *.log 10 | *.lot 11 | *.fls 12 | *.out 13 | *.toc 14 | *.fmt 15 | *.fot 16 | *.cb 17 | *.cb2 18 | .*.lb 19 | 20 | ## Intermediate documents: 21 | *.dvi 22 | *.xdv 23 | *-converted-to.* 24 | # these rules might exclude image files for figures etc. 25 | # *.ps 26 | # *.eps 27 | # *.pdf 28 | 29 | ## Generated if empty string is given at "Please type another file name for output:" 30 | .pdf 31 | 32 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 33 | *.bbl 34 | *.bcf 35 | *.blg 36 | *-blx.aux 37 | *-blx.bib 38 | *.run.xml 39 | 40 | ## Build tool auxiliary files: 41 | *.fdb_latexmk 42 | *.synctex 43 | *.synctex(busy) 44 | *.synctex.gz 45 | *.synctex.gz(busy) 46 | *.pdfsync 47 | 48 | ## Build tool directories for auxiliary files 49 | # latexrun 50 | latex.out/ 51 | 52 | ## Auxiliary and intermediate files from other packages: 53 | # algorithms 54 | *.alg 55 | *.loa 56 | 57 | # achemso 58 | acs-*.bib 59 | 60 | # amsthm 61 | *.thm 62 | 63 | # beamer 64 | *.nav 65 | *.pre 66 | *.snm 67 | *.vrb 68 | 69 | # changes 70 | *.soc 71 | 72 | # comment 73 | *.cut 74 | 75 | # cprotect 76 | *.cpt 77 | 78 | # elsarticle (documentclass of Elsevier journals) 79 | *.spl 80 | 81 | # endnotes 82 | *.ent 83 | 84 | # fixme 85 | *.lox 86 | 87 | # feynmf/feynmp 88 | *.mf 89 | *.mp 90 | *.t[1-9] 91 | *.t[1-9][0-9] 92 | *.tfm 93 | 94 | #(r)(e)ledmac/(r)(e)ledpar 95 | *.end 96 | *.?end 97 | *.[1-9] 98 | *.[1-9][0-9] 99 | *.[1-9][0-9][0-9] 100 | *.[1-9]R 101 | *.[1-9][0-9]R 102 | *.[1-9][0-9][0-9]R 103 | *.eledsec[1-9] 104 | *.eledsec[1-9]R 105 | *.eledsec[1-9][0-9] 106 | *.eledsec[1-9][0-9]R 107 | *.eledsec[1-9][0-9][0-9] 108 | *.eledsec[1-9][0-9][0-9]R 109 | 110 | # glossaries 111 | *.acn 112 | *.acr 113 | *.glg 114 | *.glo 115 | *.gls 116 | *.glsdefs 117 | *.lzo 118 | *.lzs 119 | 120 | # uncomment this for glossaries-extra (will ignore makeindex's style files!) 121 | # *.ist 122 | 123 | # gnuplottex 124 | *-gnuplottex-* 125 | 126 | # gregoriotex 127 | *.gaux 128 | *.gtex 129 | 130 | # htlatex 131 | *.4ct 132 | *.4tc 133 | *.idv 134 | *.lg 135 | *.trc 136 | *.xref 137 | 138 | # hyperref 139 | *.brf 140 | 141 | # knitr 142 | *-concordance.tex 143 | # TODO Comment the next line if you want to keep your tikz graphics files 144 | *.tikz 145 | *-tikzDictionary 146 | 147 | # listings 148 | *.lol 149 | 150 | # luatexja-ruby 151 | *.ltjruby 152 | 153 | # makeidx 154 | *.idx 155 | *.ilg 156 | *.ind 157 | 158 | # minitoc 159 | *.maf 160 | *.mlf 161 | *.mlt 162 | *.mtc 163 | *.mtc[0-9]* 164 | *.slf[0-9]* 165 | *.slt[0-9]* 166 | *.stc[0-9]* 167 | 168 | # minted 169 | _minted* 170 | *.pyg 171 | 172 | # morewrites 173 | *.mw 174 | 175 | # nomencl 176 | *.nlg 177 | *.nlo 178 | *.nls 179 | 180 | # pax 181 | *.pax 182 | 183 | # pdfpcnotes 184 | *.pdfpc 185 | 186 | # sagetex 187 | *.sagetex.sage 188 | *.sagetex.py 189 | *.sagetex.scmd 190 | 191 | # scrwfile 192 | *.wrt 193 | 194 | # sympy 195 | *.sout 196 | *.sympy 197 | sympy-plots-for-*.tex/ 198 | 199 | # pdfcomment 200 | *.upa 201 | *.upb 202 | 203 | # pythontex 204 | *.pytxcode 205 | pythontex-files-*/ 206 | 207 | # tcolorbox 208 | *.listing 209 | 210 | # thmtools 211 | *.loe 212 | 213 | # TikZ & PGF 214 | *.dpth 215 | *.md5 216 | *.auxlock 217 | 218 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | svgs := $(patsubst img/svg/%.svg,tmp/svg/%.pdf,$(wildcard img/svg/*.svg)) 2 | python := $(patsubst img/python/%.py,tmp/python/%.pdf,$(wildcard img/python/*.py)) 3 | dots := $(patsubst img/dot/%.dot,tmp/dot/%.tex,$(wildcard img/dot/*.dot)) 4 | Rs := $(patsubst img/R/%.R,tmp/R/%.tex,$(wildcard img/R/*.R)) 5 | 6 | thesis.pdf: thesis.tex 7 | latexmk -pdflatex thesis.tex 8 | 9 | thesis.tex: src/*.md template.tex thesis.yaml img/**/*.* $(svgs) $(python) $(dots) $(Rs) bibliography.bib 10 | pandoc \ 11 | -d defaults.yaml \ 12 | src/chapter_*.md \ 13 | | \ 14 | sed -r \ 15 | -e 's/ \\autocite/~\\autocite/g' \ 16 | -e 's/\. /.\n/g' \ 17 | > thesis.tex 18 | 19 | tmp/svg/%.pdf: img/svg/%.svg 20 | inkscape -C --export-latex -o $@ $< 21 | 22 | tmp/dot/%.tex: img/dot/%.dot | tmp/dot 23 | dot2tex --figonly $< > $@ 24 | 25 | tmp/python/%.pdf: img/python/%.py | tmp/python 26 | python3 $< > $@ 27 | 28 | tmp/R/%.tex: img/R/%.R | tmp/R 29 | Rscript $< > $@ 30 | 31 | tmp/dot: 32 | @mkdir -p tmp/dot 33 | 34 | tmp/python: 35 | @mkdir -p tmp/python 36 | 37 | tmp/R: 38 | @mkdir -p tmp/R 39 | 40 | .PHONY: clean distclean upload open 41 | clean: 42 | latexmk -C -quiet thesis.tex 43 | rm -rf thesis.tex 44 | 45 | distclean: clean 46 | rm -rf tmp/ "$(shell biber --cache)" 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # An Over-Engineered Thesis Template 2 | 3 | The first step in actually *writing* a thesis is to procrastinate and create a thesis document setup. 4 | 5 | ![A screenshot from the output](https://jngb.lt/images/thesis.png) 6 | 7 | This repository is a starting point with a few neat (and some might rightfully say unnecessary) features. You might also 8 | want to check out [the post](https://jngb.lt/posts/overengineering-thesis-template/) about this repository 9 | with slightly more information. 10 | 11 | ## Features 12 | 13 | - Easy building with Nix or alternatively with a plain Makefile 14 | - Markdown input with Pandoc: references, LaTeX passthrough, ... 15 | - Dynamic image conversion: edit images and have the result in your document, immediately 16 | - Generate plots from data 17 | 18 | ## Installing and Usage 19 | 20 | ### Using Nix 21 | 22 | It builds as a [Nix](https://nixos.org/) flake. If you have Nix installed, try it! It is as easy as `nix build 23 | github:pascalj/thesis-template`. Or clone the repository and use `nix build `. Locally, just use `nix 24 | build`. 25 | 26 | ### Git and Makefile 27 | 28 | Clone the repository, install all dependencies and call `make`. 29 | 30 | #### Dependencies 31 | 32 | - Pandoc, `pandoc-crossref` and `pandoc-fignum` 33 | - A complete LaTeX environment 34 | - make 35 | 36 | Optionally for the image conversion: 37 | 38 | - Inkscape 39 | - Graphviz 40 | - Python 41 | - numpy 42 | - matplotlib 43 | - R 44 | - tidyverse 45 | - tikzDevice 46 | 47 | ## About 48 | 49 | It uses Pandoc **Markdown** files as **input** and produces a **PDF** file via LaTeX as the **output**. Pandoc Markdown lets you 50 | use LaTeX inline, should you ever have to. 51 | 52 | Images are creates from "source" where possible. For example, graphs described in the dot language are compiled to Tex, 53 | SVGs are converted with Inkscape and you can even generate images with Python and R, e.g. with data from CSV files. 54 | 55 | ## Contributing 56 | 57 | If you find anything not working or missing, just send me a PR! 58 | -------------------------------------------------------------------------------- /bibliography.bib: -------------------------------------------------------------------------------- 1 | @misc{moore_cramming_1965, 2 | title = {Cramming More Components onto Integrated Circuits}, 3 | author = {Moore, Gordon E.}, 4 | date = {1965}, 5 | publisher = {{McGraw-Hill New York}}, 6 | } 7 | -------------------------------------------------------------------------------- /defaults.yaml: -------------------------------------------------------------------------------- 1 | cite-method: biblatex 2 | filters: 3 | - pandoc-crossref 4 | - pandoc-fignos 5 | from: markdown+citations 6 | metadata-file: thesis.yaml 7 | template: template.tex 8 | to: latex 9 | verbosity: ERROR 10 | wrap: none 11 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-utils": { 4 | "inputs": { 5 | "systems": "systems" 6 | }, 7 | "locked": { 8 | "lastModified": 1726560853, 9 | "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", 10 | "owner": "numtide", 11 | "repo": "flake-utils", 12 | "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", 13 | "type": "github" 14 | }, 15 | "original": { 16 | "owner": "numtide", 17 | "repo": "flake-utils", 18 | "type": "github" 19 | } 20 | }, 21 | "nixpkgs": { 22 | "locked": { 23 | "lastModified": 1669833724, 24 | "narHash": "sha256-/HEZNyGbnQecrgJnfE8d0WC5c1xuPSD2LUpB6YXlg4c=", 25 | "owner": "NixOS", 26 | "repo": "nixpkgs", 27 | "rev": "4d2b37a84fad1091b9de401eb450aae66f1a741e", 28 | "type": "github" 29 | }, 30 | "original": { 31 | "owner": "NixOS", 32 | "ref": "22.11", 33 | "repo": "nixpkgs", 34 | "type": "github" 35 | } 36 | }, 37 | "root": { 38 | "inputs": { 39 | "flake-utils": "flake-utils", 40 | "nixpkgs": "nixpkgs" 41 | } 42 | }, 43 | "systems": { 44 | "locked": { 45 | "lastModified": 1681028828, 46 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 47 | "owner": "nix-systems", 48 | "repo": "default", 49 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 50 | "type": "github" 51 | }, 52 | "original": { 53 | "owner": "nix-systems", 54 | "repo": "default", 55 | "type": "github" 56 | } 57 | } 58 | }, 59 | "root": "root", 60 | "version": 7 61 | } 62 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "thesis"; 3 | 4 | inputs = { 5 | nixpkgs.url = github:NixOS/nixpkgs/22.11; 6 | flake-utils.url = github:numtide/flake-utils; 7 | }; 8 | 9 | outputs = { self, nixpkgs, flake-utils }: 10 | with flake-utils.lib; eachSystem allSystems (system: 11 | let 12 | pkgs = nixpkgs.legacyPackages.${system}; 13 | tex = pkgs.texlive.combine { 14 | inherit (pkgs.texlive) 15 | scheme-basic 16 | latex-bin 17 | latexmk 18 | 19 | # Add tex packages below 20 | biber 21 | biblatex 22 | booktabs 23 | caption 24 | cleveref 25 | courier 26 | ec 27 | enumitem 28 | environ 29 | etoolbox 30 | fancyvrb 31 | float 32 | fontaxes 33 | footnotehyper 34 | graphics 35 | ifoddpage 36 | import 37 | inter 38 | koma-script 39 | listings 40 | mathtools 41 | multirow 42 | ms 43 | pgf 44 | preview 45 | relsize 46 | subfig 47 | transparent 48 | xkeyval 49 | xpatch 50 | xstring; 51 | }; 52 | in rec { 53 | packages = { 54 | document = pkgs.stdenvNoCC.mkDerivation rec { 55 | name = "thesis"; 56 | src = self; 57 | buildInputs = [ 58 | # Add packages below 59 | pkgs.bash 60 | pkgs.coreutils 61 | pkgs.gnumake 62 | pkgs.gnused 63 | pkgs.graphviz-nox 64 | pkgs.dot2tex 65 | pkgs.haskellPackages.pandoc-crossref 66 | pkgs.inkscape 67 | pkgs.pandoc 68 | pkgs.pandoc-fignos 69 | pkgs.python3 70 | pkgs.python310Packages.numpy 71 | pkgs.python310Packages.matplotlib 72 | pkgs.R 73 | pkgs.rPackages.ggplot2 74 | pkgs.rPackages.tidyverse 75 | pkgs.rPackages.tikzDevice 76 | tex 77 | ]; 78 | phases = ["unpackPhase" "buildPhase" "installPhase"]; 79 | buildPhase = '' 80 | export PATH="${pkgs.lib.makeBinPath buildInputs}"; 81 | export HOME="$TMP" ; 82 | export FONTCONFIG_FILE="${pkgs.fontconfig.out}/etc/fonts/fonts.conf"; 83 | export FONTCONFIG_PATH="${pkgs.fontconfig.out}/etc/fonts/"; 84 | mkdir -p .cache/texmf-var 85 | mkdir -p .config/inkscape 86 | env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \ 87 | make 88 | ''; 89 | installPhase = '' 90 | mkdir -p $out 91 | cp thesis.pdf $out/ 92 | ''; 93 | }; 94 | }; 95 | defaultPackage = packages.document; 96 | }); 97 | } 98 | -------------------------------------------------------------------------------- /img/R/graph.R: -------------------------------------------------------------------------------- 1 | library(tidyverse) 2 | library(ggplot2) 3 | library(tikzDevice) 4 | 5 | data = read_csv("img/logs/demo.log") 6 | 7 | tikz(console = TRUE, width=5, height=4, timestamp = FALSE, verbose = FALSE) 8 | ggplot(data, aes(x = x, y = y)) + 9 | geom_line() + 10 | theme_bw() 11 | null = dev.off() 12 | -------------------------------------------------------------------------------- /img/dot/graph.dot: -------------------------------------------------------------------------------- 1 | digraph { 2 | // texlbl label are only needed for math mode. 3 | // See dot2tex documentation! 4 | D [texlbl="$D_1$"] 5 | O [texlbl="$O_2$"] 6 | T [texlbl="$T_3$"] 7 | D -> T 8 | D -> O 9 | O -> T 10 | } 11 | -------------------------------------------------------------------------------- /img/logs/demo.log: -------------------------------------------------------------------------------- 1 | x,y 2 | 1,1 3 | 2,2 4 | 3,4 5 | 4,8 6 | 5,16 7 | 6,32 8 | 7,64 9 | 8,128 10 | 9,256 11 | 10,512 12 | -------------------------------------------------------------------------------- /img/png/graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pascalj/thesis-template/7765470c8c17ad4c1ce4e4c771c758cb46fe6325/img/png/graph.png -------------------------------------------------------------------------------- /img/python/graph.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | import os, sys 4 | 5 | dir = os.path.dirname(os.path.abspath(__file__)) 6 | arr = np.genfromtxt(dir + "/../logs/demo.log", delimiter=",", dtype=int) 7 | 8 | y = arr[:,1:2] 9 | 10 | plt.plot(y) 11 | plt.savefig(sys.stdout.buffer, format='pdf') 12 | -------------------------------------------------------------------------------- /img/svg/graph.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 51 | 56 | 57 | 58 | 63 | 69 | $S_1$ 80 | 86 | $V_2$ 97 | 103 | $G_3$ 114 | 118 | 122 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /src/chapter_1.md: -------------------------------------------------------------------------------- 1 | # Introduction {#ch:introduction} 2 | 3 | This is an overengineered thesis template. 4 | 5 | It uses: 6 | 7 | - [Nix](https://nixos.org/) 8 | - [Pandoc](https://pandoc.org/) 9 | - \LaTeX 10 | - [dot](https://graphviz.org/) 11 | - [Inkscape](https://inkscape.org) 12 | - [Python](https://www.python.org/) 13 | 14 | ![A graph from a PNG file](img/png/graph.png){#fig:png} 15 | 16 | It can embed PNG images (see [@fig:png]), SVG images via Inkscape (see [@fig:svg]) or DOT graphs (see [@fig:dot]). You can also cite references like [@moore_cramming_1965], use inline math like $\frac{1}{n}$ or display math: 17 | 18 | \begin{align} 19 | 0 + 1 + 2 + 3 + 4 + \dotsb + n = 20 | \sum_{k=0}^n k = \frac{n(n+1)}{2} = \frac{n^2+n}{2} 21 | \end{align} 22 | 23 | Just include it like seen in [@lst:display]. 24 | 25 | ```{#lst:display .latex caption="Display math example"} 26 | \begin{align} 27 | 0 + 1 + 2 + 3 + 4 + \dotsb + n = 28 | \sum_{k=0}^n k = \frac{n(n+1)}{2} = \frac{n^2+n}{2} 29 | \end{align} 30 | ``` 31 | 32 | \begin{figure}[h] 33 | \centering 34 | \import{tmp/svg}{graph.pdf_tex} 35 | \caption{A graph from an SVG file with embedded text} 36 | \label{fig:svg} 37 | \end{figure} 38 | 39 | \begin{figure}[h] 40 | \centering 41 | \import{tmp/dot}{graph.tex} 42 | \caption{A graph from a dot file} 43 | \label{fig:dot} 44 | \end{figure} 45 | 46 | 47 | [@Fig:python] shows a graph generated by Python and [@fig:R] shows a graph generated with R using the same data. 48 | 49 | \begin{figure}[h] 50 | \centering 51 | \includegraphics{tmp/python/graph} 52 | \caption{A graph from Python} 53 | \label{fig:python} 54 | \end{figure} 55 | 56 | \begin{figure}[h] 57 | \centering 58 | \include{tmp/R/graph.tex} 59 | \caption{A graph from R} 60 | \label{fig:R} 61 | \end{figure} 62 | -------------------------------------------------------------------------------- /src/chapter_2.md: -------------------------------------------------------------------------------- 1 | # Other Chapter {#ch:other} 2 | # Bibliography 3 | -------------------------------------------------------------------------------- /template.tex: -------------------------------------------------------------------------------- 1 | % Options for packages loaded elsewhere 2 | \PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} 3 | \PassOptionsToPackage{hyphens}{url} 4 | $if(colorlinks)$ 5 | \PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor} 6 | $endif$ 7 | $if(CJKmainfont)$ 8 | \PassOptionsToPackage{space}{xeCJK} 9 | $endif$ 10 | % 11 | \documentclass[ 12 | $if(fontsize)$ 13 | $fontsize$, 14 | $endif$ 15 | $if(papersize)$ 16 | $papersize$paper, 17 | $endif$ 18 | $if(beamer)$ 19 | ignorenonframetext, 20 | $if(handout)$ 21 | handout, 22 | $endif$ 23 | $if(aspectratio)$ 24 | aspectratio=$aspectratio$, 25 | $endif$ 26 | $endif$ 27 | $for(classoption)$ 28 | $classoption$$sep$, 29 | $endfor$ 30 | ]{$documentclass$} 31 | $if(beamer)$ 32 | $if(background-image)$ 33 | \usebackgroundtemplate{% 34 | \includegraphics[width=\paperwidth]{$background-image$}% 35 | } 36 | $endif$ 37 | \usepackage{pgfpages} 38 | \setbeamertemplate{caption}[numbered] 39 | \setbeamertemplate{caption label separator}{: } 40 | \setbeamercolor{caption name}{fg=normal text.fg} 41 | \beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$ 42 | $for(beameroption)$ 43 | \setbeameroption{$beameroption$} 44 | $endfor$ 45 | % Prevent slide breaks in the middle of a paragraph 46 | \widowpenalties 1 10000 47 | \raggedbottom 48 | $if(section-titles)$ 49 | \setbeamertemplate{part page}{ 50 | \centering 51 | \begin{beamercolorbox}[sep=16pt,center]{part title} 52 | \usebeamerfont{part title}\insertpart\par 53 | \end{beamercolorbox} 54 | } 55 | \setbeamertemplate{section page}{ 56 | \centering 57 | \begin{beamercolorbox}[sep=12pt,center]{part title} 58 | \usebeamerfont{section title}\insertsection\par 59 | \end{beamercolorbox} 60 | } 61 | \setbeamertemplate{subsection page}{ 62 | \centering 63 | \begin{beamercolorbox}[sep=8pt,center]{part title} 64 | \usebeamerfont{subsection title}\insertsubsection\par 65 | \end{beamercolorbox} 66 | } 67 | \AtBeginPart{ 68 | \frame{\partpage} 69 | } 70 | \AtBeginSection{ 71 | \ifbibliography 72 | \else 73 | \frame{\sectionpage} 74 | \fi 75 | } 76 | \AtBeginSubsection{ 77 | \frame{\subsectionpage} 78 | } 79 | $endif$ 80 | $endif$ 81 | $if(beamerarticle)$ 82 | \usepackage{beamerarticle} % needs to be loaded first 83 | $endif$ 84 | \usepackage{amsmath,amssymb} 85 | $if(fontfamily)$ 86 | \usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} 87 | $else$ 88 | \usepackage{lmodern} 89 | $endif$ 90 | $if(linestretch)$ 91 | \usepackage{setspace} 92 | $endif$ 93 | \usepackage{iftex} 94 | \ifPDFTeX 95 | \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} 96 | \usepackage[utf8]{inputenc} 97 | \usepackage{textcomp} % provide euro and other symbols 98 | \else % if luatex or xetex 99 | $if(mathspec)$ 100 | \ifXeTeX 101 | \usepackage{mathspec} 102 | \else 103 | \usepackage{unicode-math} 104 | \fi 105 | $else$ 106 | \usepackage{unicode-math} 107 | $endif$ 108 | \defaultfontfeatures{Scale=MatchLowercase} 109 | \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} 110 | $if(mainfont)$ 111 | \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} 112 | $endif$ 113 | $if(sansfont)$ 114 | \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} 115 | $endif$ 116 | $if(monofont)$ 117 | \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$} 118 | $endif$ 119 | $for(fontfamilies)$ 120 | \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$} 121 | $endfor$ 122 | $if(mathfont)$ 123 | $if(mathspec)$ 124 | \ifXeTeX 125 | \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} 126 | \else 127 | \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} 128 | \fi 129 | $else$ 130 | \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} 131 | $endif$ 132 | $endif$ 133 | $if(CJKmainfont)$ 134 | \ifXeTeX 135 | \usepackage{xeCJK} 136 | \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} 137 | \fi 138 | $endif$ 139 | $if(luatexjapresetoptions)$ 140 | \ifLuaTeX 141 | \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset} 142 | \fi 143 | $endif$ 144 | $if(CJKmainfont)$ 145 | \ifLuaTeX 146 | \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec} 147 | \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} 148 | \fi 149 | $endif$ 150 | \fi 151 | $if(zero-width-non-joiner)$ 152 | %% Support for zero-width non-joiner characters. 153 | \makeatletter 154 | \def\zerowidthnonjoiner{% 155 | % Prevent ligatures and adjust kerning, but still support hyphenating. 156 | \texorpdfstring{% 157 | \TextOrMath{\nobreak\discretionary{-}{}{\kern.03em}% 158 | \ifvmode\else\nobreak\hskip\z@skip\fi}{}% 159 | }{}% 160 | } 161 | \makeatother 162 | \ifPDFTeX 163 | \DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner} 164 | \else 165 | \catcode`^^^^200c=\active 166 | \protected\def ^^^^200c{\zerowidthnonjoiner} 167 | \fi 168 | %% End of ZWNJ support 169 | $endif$ 170 | $if(beamer)$ 171 | $if(theme)$ 172 | \usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} 173 | $endif$ 174 | $if(colortheme)$ 175 | \usecolortheme{$colortheme$} 176 | $endif$ 177 | $if(fonttheme)$ 178 | \usefonttheme{$fonttheme$} 179 | $endif$ 180 | $if(mainfont)$ 181 | \usefonttheme{serif} % use mainfont rather than sansfont for slide text 182 | $endif$ 183 | $if(innertheme)$ 184 | \useinnertheme{$innertheme$} 185 | $endif$ 186 | $if(outertheme)$ 187 | \useoutertheme{$outertheme$} 188 | $endif$ 189 | $endif$ 190 | % Use upquote if available, for straight quotes in verbatim environments 191 | \IfFileExists{upquote.sty}{\usepackage{upquote}}{} 192 | \IfFileExists{microtype.sty}{% use microtype if available 193 | \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype} 194 | \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts 195 | }{} 196 | $if(indent)$ 197 | $else$ 198 | \makeatletter 199 | \@ifundefined{KOMAClassName}{% if non-KOMA class 200 | \IfFileExists{parskip.sty}{% 201 | \usepackage{parskip} 202 | }{% else 203 | \setlength{\parindent}{0pt} 204 | \setlength{\parskip}{6pt plus 2pt minus 1pt}} 205 | }{% if KOMA class 206 | \KOMAoptions{parskip=half}} 207 | \makeatother 208 | $endif$ 209 | $if(verbatim-in-note)$ 210 | \usepackage{fancyvrb} 211 | $endif$ 212 | \usepackage{xcolor} 213 | $if(geometry)$ 214 | $if(beamer)$ 215 | \geometry{$for(geometry)$$geometry$$sep$,$endfor$} 216 | $else$ 217 | \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} 218 | $endif$ 219 | $endif$ 220 | $if(beamer)$ 221 | \newif\ifbibliography 222 | $endif$ 223 | $if(listings)$ 224 | \usepackage{listings} 225 | \newcommand{\passthrough}[1]{#1} 226 | \lstset{defaultdialect=[5.3]Lua} 227 | \lstset{defaultdialect=[x86masm]Assembler} 228 | $endif$ 229 | $if(lhs)$ 230 | \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} 231 | $endif$ 232 | $if(highlighting-macros)$ 233 | $highlighting-macros$ 234 | $endif$ 235 | $if(tables)$ 236 | \usepackage{longtable,booktabs,array} 237 | $if(multirow)$ 238 | \usepackage{multirow} 239 | $endif$ 240 | \usepackage{calc} % for calculating minipage widths 241 | $if(beamer)$ 242 | \usepackage{caption} 243 | % Make caption package work with longtable 244 | \makeatletter 245 | \def\fnum@table{\tablename~\thetable} 246 | \makeatother 247 | $else$ 248 | % Correct order of tables after \paragraph or \subparagraph 249 | \usepackage{etoolbox} 250 | \makeatletter 251 | \patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{} 252 | \makeatother 253 | % Allow footnotes in longtable head/foot 254 | \IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}} 255 | \makesavenoteenv{longtable} 256 | $endif$ 257 | $endif$ 258 | $if(graphics)$ 259 | \usepackage{graphicx} 260 | \makeatletter 261 | \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} 262 | \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} 263 | \makeatother 264 | % Scale images if necessary, so that they will not overflow the page 265 | % margins by default, and it is still possible to overwrite the defaults 266 | % using explicit options in \includegraphics[width, height, ...]{} 267 | \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} 268 | % Set default figure placement to htbp 269 | \makeatletter 270 | \def\fps@figure{htbp} 271 | \makeatother 272 | $endif$ 273 | $if(strikeout)$ 274 | $-- also used for underline 275 | \usepackage[normalem]{ulem} 276 | $endif$ 277 | \setlength{\emergencystretch}{3em} % prevent overfull lines 278 | \providecommand{\tightlist}{% 279 | \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} 280 | $if(numbersections)$ 281 | \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$} 282 | $else$ 283 | \setcounter{secnumdepth}{-\maxdimen} % remove section numbering 284 | $endif$ 285 | $if(beamer)$ 286 | $else$ 287 | $if(block-headings)$ 288 | % Make \paragraph and \subparagraph free-standing 289 | \ifx\paragraph\undefined\else 290 | \let\oldparagraph\paragraph 291 | \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} 292 | \fi 293 | \ifx\subparagraph\undefined\else 294 | \let\oldsubparagraph\subparagraph 295 | \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} 296 | \fi 297 | $endif$ 298 | $endif$ 299 | $if(pagestyle)$ 300 | \pagestyle{$pagestyle$} 301 | $endif$ 302 | $if(csl-refs)$ 303 | \newlength{\cslhangindent} 304 | \setlength{\cslhangindent}{1.5em} 305 | \newlength{\csllabelwidth} 306 | \setlength{\csllabelwidth}{3em} 307 | \newlength{\cslentryspacingunit} % times entry-spacing 308 | \setlength{\cslentryspacingunit}{\parskip} 309 | \newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing 310 | {% don't indent paragraphs 311 | \setlength{\parindent}{0pt} 312 | % turn on hanging indent if param 1 is 1 313 | \ifodd #1 314 | \let\oldpar\par 315 | \def\par{\hangindent=\cslhangindent\oldpar} 316 | \fi 317 | % set entry spacing 318 | \setlength{\parskip}{#2\cslentryspacingunit} 319 | }% 320 | {} 321 | \usepackage{calc} 322 | \newcommand{\CSLBlock}[1]{#1\hfill\break} 323 | \newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}} 324 | \newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break} 325 | \newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1} 326 | $endif$ 327 | $if(lang)$ 328 | \ifLuaTeX 329 | \usepackage[bidi=basic]{babel} 330 | \else 331 | \usepackage[bidi=default]{babel} 332 | \fi 333 | $if(babel-lang)$ 334 | \babelprovide[main,import]{$babel-lang$} 335 | $endif$ 336 | $for(babel-otherlangs)$ 337 | \babelprovide[import]{$babel-otherlangs$} 338 | $endfor$ 339 | % get rid of language-specific shorthands (see #6817): 340 | \let\LanguageShortHands\languageshorthands 341 | \def\languageshorthands#1{} 342 | $endif$ 343 | \ifLuaTeX 344 | \usepackage{selnolig} % disable illegal ligatures 345 | \fi 346 | $if(dir)$ 347 | \ifPDFTeX 348 | \TeXXeTstate=1 349 | \newcommand{\RL}[1]{\beginR #1\endR} 350 | \newcommand{\LR}[1]{\beginL #1\endL} 351 | \newenvironment{RTL}{\beginR}{\endR} 352 | \newenvironment{LTR}{\beginL}{\endL} 353 | \fi 354 | $endif$ 355 | $if(natbib)$ 356 | \usepackage[$natbiboptions$]{natbib} 357 | \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} 358 | $endif$ 359 | $if(biblatex)$ 360 | \usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex} 361 | $for(bibliography)$ 362 | \addbibresource{$bibliography$} 363 | $endfor$ 364 | $endif$ 365 | $if(nocite-ids)$ 366 | \nocite{$for(nocite-ids)$$it$$sep$, $endfor$} 367 | $endif$ 368 | $if(csquotes)$ 369 | \usepackage{csquotes} 370 | $endif$ 371 | \IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} 372 | $for(header-includes)$ 373 | $header-includes$ 374 | $endfor$ 375 | \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available 376 | \urlstyle{same} % disable monospaced font for URLs 377 | $if(links-as-notes)$ 378 | % Make links footnotes instead of hotlinks: 379 | \DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}} 380 | $endif$ 381 | $if(verbatim-in-note)$ 382 | \VerbatimFootnotes % allow verbatim text in footnotes 383 | $endif$ 384 | \hypersetup{ 385 | $if(title-meta)$ 386 | pdftitle={$title-meta$}, 387 | $endif$ 388 | $if(author-meta)$ 389 | pdfauthor={$author-meta$}, 390 | $endif$ 391 | $if(lang)$ 392 | pdflang={$lang$}, 393 | $endif$ 394 | $if(subject)$ 395 | pdfsubject={$subject$}, 396 | $endif$ 397 | $if(keywords)$ 398 | pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$}, 399 | $endif$ 400 | $if(colorlinks)$ 401 | colorlinks=true, 402 | linkcolor={$if(linkcolor)$$linkcolor$$else$Maroon$endif$}, 403 | filecolor={$if(filecolor)$$filecolor$$else$Maroon$endif$}, 404 | citecolor={$if(citecolor)$$citecolor$$else$Blue$endif$}, 405 | urlcolor={$if(urlcolor)$$urlcolor$$else$Blue$endif$}, 406 | $else$ 407 | $if(boxlinks)$ 408 | $else$ 409 | hidelinks, 410 | $endif$ 411 | $endif$ 412 | pdfcreator={LaTeX via pandoc}} 413 | 414 | $if(title)$ 415 | \title{$title$$if(thanks)$\thanks{$thanks$}$endif$} 416 | $endif$ 417 | $if(subtitle)$ 418 | $if(beamer)$ 419 | $else$ 420 | \usepackage{etoolbox} 421 | \makeatletter 422 | \providecommand{\subtitle}[1]{% add subtitle to \maketitle 423 | \apptocmd{\@title}{\par {\large #1 \par}}{}{} 424 | } 425 | \makeatother 426 | $endif$ 427 | \subtitle{$subtitle$} 428 | $endif$ 429 | \author{$for(author)$$author$$sep$ \and $endfor$} 430 | \date{$date$} 431 | $if(beamer)$ 432 | $if(institute)$ 433 | \institute{$for(institute)$$institute$$sep$ \and $endfor$} 434 | $endif$ 435 | $if(titlegraphic)$ 436 | \titlegraphic{\includegraphics{$titlegraphic$}} 437 | $endif$ 438 | $if(logo)$ 439 | \logo{\includegraphics{$logo$}} 440 | $endif$ 441 | $endif$ 442 | 443 | \begin{document} 444 | $if(has-frontmatter)$ 445 | \frontmatter 446 | $endif$ 447 | $if(title)$ 448 | $if(beamer)$ 449 | \frame{\titlepage} 450 | $else$ 451 | \maketitle 452 | $endif$ 453 | $if(abstract)$ 454 | \begin{abstract} 455 | $abstract$ 456 | \end{abstract} 457 | $endif$ 458 | $endif$ 459 | 460 | $for(include-before)$ 461 | $include-before$ 462 | 463 | $endfor$ 464 | $if(toc)$ 465 | $if(toc-title)$ 466 | \renewcommand*\contentsname{$toc-title$} 467 | $endif$ 468 | $if(beamer)$ 469 | \begin{frame}[allowframebreaks] 470 | $if(toc-title)$ 471 | \frametitle{$toc-title$} 472 | $endif$ 473 | \tableofcontents[hideallsubsections] 474 | \end{frame} 475 | $else$ 476 | { 477 | $if(colorlinks)$ 478 | \hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$} 479 | $endif$ 480 | \setcounter{tocdepth}{$toc-depth$} 481 | \tableofcontents 482 | } 483 | $endif$ 484 | $endif$ 485 | $if(lof)$ 486 | \listoffigures 487 | $endif$ 488 | $if(lot)$ 489 | \listoftables 490 | $endif$ 491 | $if(linestretch)$ 492 | \setstretch{$linestretch$} 493 | $endif$ 494 | $if(has-frontmatter)$ 495 | \mainmatter 496 | $endif$ 497 | $body$ 498 | 499 | $if(has-frontmatter)$ 500 | \backmatter 501 | $endif$ 502 | $if(natbib)$ 503 | $if(bibliography)$ 504 | $if(biblio-title)$ 505 | $if(has-chapters)$ 506 | \renewcommand\bibname{$biblio-title$} 507 | $else$ 508 | \renewcommand\refname{$biblio-title$} 509 | $endif$ 510 | $endif$ 511 | $if(beamer)$ 512 | \begin{frame}[allowframebreaks]{$biblio-title$} 513 | \bibliographytrue 514 | $endif$ 515 | \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} 516 | $if(beamer)$ 517 | \end{frame} 518 | $endif$ 519 | 520 | $endif$ 521 | $endif$ 522 | $if(biblatex)$ 523 | $if(beamer)$ 524 | \begin{frame}[allowframebreaks]{$biblio-title$} 525 | \bibliographytrue 526 | \printbibliography[heading=none] 527 | \end{frame} 528 | $else$ 529 | \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ 530 | $endif$ 531 | 532 | $endif$ 533 | $for(include-after)$ 534 | $include-after$ 535 | 536 | $endfor$ 537 | \end{document} 538 | -------------------------------------------------------------------------------- /thesis.tex: -------------------------------------------------------------------------------- 1 | % Options for packages loaded elsewhere 2 | \PassOptionsToPackage{unicode}{hyperref} 3 | \PassOptionsToPackage{hyphens}{url} 4 | % 5 | \documentclass[ 6 | ]{scrbook} 7 | \usepackage{amsmath,amssymb} 8 | \usepackage{lmodern} 9 | \usepackage{iftex} 10 | \ifPDFTeX 11 | \usepackage[T1]{fontenc} 12 | \usepackage[utf8]{inputenc} 13 | \usepackage{textcomp} % provide euro and other symbols 14 | \else % if luatex or xetex 15 | \usepackage{unicode-math} 16 | \defaultfontfeatures{Scale=MatchLowercase} 17 | \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} 18 | \fi 19 | % Use upquote if available, for straight quotes in verbatim environments 20 | \IfFileExists{upquote.sty}{\usepackage{upquote}}{} 21 | \IfFileExists{microtype.sty}{% use microtype if available 22 | \usepackage[]{microtype} 23 | \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts 24 | }{} 25 | \makeatletter 26 | \@ifundefined{KOMAClassName}{% if non-KOMA class 27 | \IfFileExists{parskip.sty}{% 28 | \usepackage{parskip} 29 | }{% else 30 | \setlength{\parindent}{0pt} 31 | \setlength{\parskip}{6pt plus 2pt minus 1pt}} 32 | }{% if KOMA class 33 | \KOMAoptions{parskip=half}} 34 | \makeatother 35 | \usepackage{xcolor} 36 | \usepackage{color} 37 | \usepackage{fancyvrb} 38 | \newcommand{\VerbBar}{|} 39 | \newcommand{\VERB}{\Verb[commandchars=\\\{\}]} 40 | \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} 41 | % Add ',fontsize=\small' for more characters per line 42 | \newenvironment{Shaded}{}{} 43 | \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}} 44 | \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} 45 | \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}} 46 | \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} 47 | \newcommand{\BuiltInTok}[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}} 48 | \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} 49 | \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{#1}}} 50 | \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} 51 | \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}} 52 | \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} 53 | \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{#1}} 54 | \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} 55 | \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{#1}}} 56 | \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}} 57 | \newcommand{\ExtensionTok}[1]{#1} 58 | \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} 59 | \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{#1}} 60 | \newcommand{\ImportTok}[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}} 61 | \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} 62 | \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} 63 | \newcommand{\NormalTok}[1]{#1} 64 | \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} 65 | \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} 66 | \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}} 67 | \newcommand{\RegionMarkerTok}[1]{#1} 68 | \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} 69 | \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}} 70 | \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} 71 | \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}} 72 | \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} 73 | \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} 74 | \usepackage{longtable,booktabs,array} 75 | \usepackage{calc} % for calculating minipage widths 76 | % Correct order of tables after \paragraph or \subparagraph 77 | \usepackage{etoolbox} 78 | \makeatletter 79 | \patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{} 80 | \makeatother 81 | % Allow footnotes in longtable head/foot 82 | \IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}} 83 | \makesavenoteenv{longtable} 84 | \usepackage{graphicx} 85 | \makeatletter 86 | \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} 87 | \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} 88 | \makeatother 89 | % Scale images if necessary, so that they will not overflow the page 90 | % margins by default, and it is still possible to overwrite the defaults 91 | % using explicit options in \includegraphics[width, height, ...]{} 92 | \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} 93 | % Set default figure placement to htbp 94 | \makeatletter 95 | \def\fps@figure{htbp} 96 | \makeatother 97 | \setlength{\emergencystretch}{3em} % prevent overfull lines 98 | \providecommand{\tightlist}{% 99 | \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} 100 | \setcounter{secnumdepth}{-\maxdimen} % remove section numbering 101 | \ifLuaTeX 102 | \usepackage{selnolig} % disable illegal ligatures 103 | \fi 104 | \usepackage[style=numeric,]{biblatex} 105 | \addbibresource{bibliography.bib} 106 | \IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} 107 | \usepackage{import} 108 | \usepackage{tikz} 109 | \makeatletter 110 | \@ifpackageloaded{subfig}{}{\usepackage{subfig}} 111 | \@ifpackageloaded{caption}{}{\usepackage{caption}} 112 | \captionsetup[subfloat]{margin=0.5em} 113 | \AtBeginDocument{% 114 | \renewcommand*\figurename{Figure} 115 | \renewcommand*\tablename{Table} 116 | } 117 | \AtBeginDocument{% 118 | \renewcommand*\listfigurename{List of Figures} 119 | \renewcommand*\listtablename{List of Tables} 120 | } 121 | \newcounter{pandoccrossref@subfigures@footnote@counter} 122 | \newenvironment{pandoccrossrefsubfigures}{% 123 | \setcounter{pandoccrossref@subfigures@footnote@counter}{0} 124 | \begin{figure}\centering% 125 | \gdef\global@pandoccrossref@subfigures@footnotes{}% 126 | \DeclareRobustCommand{\footnote}[1]{\footnotemark% 127 | \stepcounter{pandoccrossref@subfigures@footnote@counter}% 128 | \ifx\global@pandoccrossref@subfigures@footnotes\empty% 129 | \gdef\global@pandoccrossref@subfigures@footnotes{{##1}}% 130 | \else% 131 | \g@addto@macro\global@pandoccrossref@subfigures@footnotes{, {##1}}% 132 | \fi}}% 133 | {\end{figure}% 134 | \addtocounter{footnote}{-\value{pandoccrossref@subfigures@footnote@counter}} 135 | \@for\f:=\global@pandoccrossref@subfigures@footnotes\do{\stepcounter{footnote}\footnotetext{\f}}% 136 | \gdef\global@pandoccrossref@subfigures@footnotes{}} 137 | \@ifpackageloaded{float}{}{\usepackage{float}} 138 | \floatstyle{ruled} 139 | \@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]} 140 | \floatname{codelisting}{Listing} 141 | \newcommand*\listoflistings{\listof{codelisting}{List of Listings}} 142 | \@ifpackageloaded{cleveref}{}{\usepackage{cleveref}} 143 | \crefname{figure}{fig.}{figs.} 144 | \Crefname{figure}{Fig.}{Figs.} 145 | \crefname{table}{tbl.}{tbls.} 146 | \Crefname{table}{Tbl.}{Tbls.} 147 | \crefname{equation}{eq.}{eqns.} 148 | \Crefname{equation}{Eq.}{Eqns.} 149 | \crefname{listing}{lst.}{lsts.} 150 | \Crefname{listing}{Lst.}{Lsts.} 151 | \crefname{section}{sec.}{secs.} 152 | \Crefname{section}{Sec.}{Secs.} 153 | \crefname{codelisting}{\cref@listing@name}{\cref@listing@name@plural} 154 | \Crefname{codelisting}{\Cref@listing@name}{\Cref@listing@name@plural} 155 | \makeatother 156 | \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available 157 | \urlstyle{same} % disable monospaced font for URLs 158 | \hypersetup{ 159 | pdftitle={Thesis Template}, 160 | pdfauthor={John Doe}, 161 | hidelinks, 162 | pdfcreator={LaTeX via pandoc}} 163 | 164 | \title{Thesis Template} 165 | \usepackage{etoolbox} 166 | \makeatletter 167 | \providecommand{\subtitle}[1]{% add subtitle to \maketitle 168 | \apptocmd{\@title}{\par {\large #1 \par}}{}{} 169 | } 170 | \makeatother 171 | \subtitle{Over-Engineering as a Craft} 172 | \author{John Doe} 173 | \date{} 174 | 175 | \begin{document} 176 | \frontmatter 177 | \maketitle 178 | 179 | { 180 | \setcounter{tocdepth}{2} 181 | \tableofcontents 182 | } 183 | \mainmatter 184 | \hypertarget{ch:introduction}{% 185 | \chapter{Introduction}\label{ch:introduction}} 186 | 187 | This is an overengineered thesis template. 188 | 189 | It uses: 190 | 191 | \begin{itemize} 192 | \tightlist 193 | \item 194 | \href{https://nixos.org/}{Nix} 195 | \item 196 | \href{https://pandoc.org/}{Pandoc} 197 | \item 198 | \LaTeX 199 | \item 200 | \href{https://graphviz.org/}{dot} 201 | \item 202 | \href{https://inkscape.org}{Inkscape} 203 | \item 204 | \href{https://www.python.org/}{Python} 205 | \end{itemize} 206 | 207 | \begin{figure} 208 | \hypertarget{fig:png}{% 209 | \centering 210 | \includegraphics{img/png/graph.png} 211 | \caption{A graph from a PNG file}\label{fig:png} 212 | } 213 | \end{figure} 214 | 215 | It can embed PNG images (see \cref{fig:png}), SVG images via Inkscape (see \cref{fig:svg}) or DOT graphs (see \cref{fig:dot}). 216 | You can also cite references like~\autocite{moore_cramming_1965}, use inline math like \(\frac{1}{n}\) or display math: 217 | 218 | \begin{align} 219 | 0 + 1 + 2 + 3 + 4 + \dotsb + n = 220 | \sum_{k=0}^n k = \frac{n(n+1)}{2} = \frac{n^2+n}{2} 221 | \end{align} 222 | 223 | Just include it like seen in \cref{lst:display}. 224 | 225 | \begin{codelisting} 226 | 227 | \caption{Display math example} 228 | 229 | \hypertarget{lst:display}{% 230 | \label{lst:display}}% 231 | \begin{Shaded} 232 | \begin{Highlighting}[] 233 | \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{align}\NormalTok{\}} 234 | \SpecialStringTok{ 0 + 1 + 2 + 3 + 4 + }\SpecialCharTok{\textbackslash{}dotsb}\SpecialStringTok{ + n =} 235 | \SpecialStringTok{ }\SpecialCharTok{\textbackslash{}sum}\SpecialStringTok{\_\{k=0\}\^{}n k = }\SpecialCharTok{\textbackslash{}frac}\SpecialStringTok{\{n(n+1)\}\{2\} = }\SpecialCharTok{\textbackslash{}frac}\SpecialStringTok{\{n\^{}2+n\}\{2\}} 236 | \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{align}\NormalTok{\}} 237 | \end{Highlighting} 238 | \end{Shaded} 239 | 240 | \end{codelisting} 241 | 242 | \begin{figure}[h] 243 | \centering 244 | \import{tmp/svg}{graph.pdf_tex} 245 | \caption{A graph from an SVG file with embedded text} 246 | \label{fig:svg} 247 | \end{figure} 248 | 249 | \begin{figure}[h] 250 | \centering 251 | \includegraphics{tmp/dot/graph} 252 | \caption{A graph from a dot file} 253 | \label{fig:dot} 254 | \end{figure} 255 | 256 | \Cref{fig:python} shows a graph generated by Python and \cref{fig:R} shows a graph generated with R using the same data. 257 | 258 | \begin{figure}[h] 259 | \centering 260 | \includegraphics{tmp/python/graph} 261 | \caption{A graph from Python} 262 | \label{fig:python} 263 | \end{figure} 264 | 265 | \begin{figure}[h] 266 | \centering 267 | \include{tmp/R/graph.tex} 268 | \caption{A graph from R} 269 | \label{fig:R} 270 | \end{figure} 271 | 272 | \hypertarget{ch:other}{% 273 | \chapter{Other Chapter}\label{ch:other}} 274 | 275 | \backmatter 276 | \printbibliography[title=Bibliography] 277 | 278 | \end{document} 279 | -------------------------------------------------------------------------------- /thesis.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | biblio-style: numeric 3 | bibliography: bibliography.bib 4 | chapters: true 5 | cref: true 6 | documentclass: scrbook 7 | title: Thesis Template 8 | subtitle: Over-Engineering as a Craft 9 | author: 10 | - John Doe 11 | toc: true 12 | header-includes: 13 | - \usepackage{import} 14 | - \usepackage{tikz} 15 | ... 16 | --------------------------------------------------------------------------------