Skip to content
Snippets Groups Projects
preamble.tex 3.63 KiB
Newer Older
%%%
% Font and Language
%%%
\usepackage{fontspec}
\IfFontExistsTF{Fira Code}{
    \setmonofont{Fira Code}[RawFeature={+onum, +ss07}]
}{
    \setmonofont{FiraCode-Regular.ttf}[%
        Path = ../fonts/,%
        BoldFont = ../fonts/FiraCode-Bold.ttf,%
        % FiraCode has no italics itself, so we borrow from FiraMono:
        ItalicFont = ../fonts/FiraMono-RegularItalic.otf,%
        BoldItalicFont = ../fonts/FiraMono-BoldItalic.otf,%
        RawFeature={+onum, +ss07}
    ]
}
\setmainfont[Numbers={Proportional, OldStyle}]{Latin Modern Roman}

\usepackage{polyglossia}
\usepackage{csquotes} % Suggested addition
\setdefaultlanguage{english}
\setotherlanguage{german}

%%%
% Styling
%%%
\usepackage[
    % Combine Markdown and LaTeX
    hybrid,
    % Allow pandoc definition lists of the form
    % ⟨Definiendum⟩
    % : ⟨Definiens⟩
    definitionLists,
    fencedCode,
    footnotes,
    % Usage: `note^[footnote]`
    inlineFootnotes,
    % Use `#.` instead of `1.` etc for ordered lists
    hashEnumerators,
    % Add YAML Metadata in the form
    % ---
    % title: 'This is the title'
    % ---
    pipeTables,
    % Usage: `: Caption`
    tableCaptions,
    % Disable _emphasis_, only *emphasis* is allowed
    underscores=false
]{markdown}

\usepackage{xcolor}
\usepackage{minted}
\setminted{autogobble, mathescape}


\usepackage{listings}
\lstdefinelanguage{Rust}{%
sensitive,%
alsoletter={!},%
morestring=[b]{"},%
morecomment=[l]{//},%
morecomment=[n]{/*}{*/},%
moredelim=[s][]{\#[}{]},%
moredelim=[s][]{\#![}{]},%
morekeywords={as,async,await,break,const,continue,crate,dyn,else,enum,extern,false,fn,for,if,impl,in,let,loop,match,mod,move,mut,pub,ref,return,Self,self,static,struct,super,trait,true,type,union,unsafe,use,where,while},% Current keywords
morekeywords={abstract,become,box,do,final,macro,override,priv,try,typeof,unsized,virtual,yield},% Reserved
morekeywords=[2]{bool,i8,i16,i32,i64,i128,isize,u8,u16,u32,u64,u128,usize,f32,f64,bool,char,str},% primitive types
}
\lstdefinestyle{color}{%
    basicstyle={\ttfamily\small},
    identifierstyle=\color{brown!60!black},%
    commentstyle={\color[gray]{0.8}},%
    stringstyle={\color{orange!80!brown}},%
    keywordstyle={\bfseries\color{blue}},%
    keywordstyle=[2]{\color{teal}},%
    % Add in for linenumbers?
    %numbers=left,%
    %numberstyle=\tiny,%
    %stepnumber=3,%
    %firstnumber=1,%
    columns=flexible,%
    frame=leftline,% Or maybe frame=lines?
    captionpos=b
}
\lstset{style=color}

% We use `~' as delimiter for the listing because braces don’t
% behave well if there are also braces in th source code. I hope
% that `~' is sufficiently rare in Rust to never encounter it.
\newcommand{{\inline}}[1]{{{\lstinline[language=Rust]~#1~}}}

% Caption formatting; I can’t get it to align the whole
% caption to the left, only the paragraphs within the caption.
\usepackage[font=footnotesize]{caption}

% Bibliography and TOC
%%%
\usepackage[style=alphabetic]{biblatex}
\addbibresource{../phd_jasper.bib}
\maxtocdepth{subsubsection}
\setsecnumdepth{subsection}
\usepackage{titlesec}
\titleformat{\subsubsection}[runin]{\normalfont\bfseries}{\thesubsection}{1em}{}

%%%
% Helpers
%%%
\usepackage[ngerman]{todonotes}
\usepackage{hyperref}
\hypersetup{%
    colorlinks=true,%
    linkcolor=.%
\usepackage[printonlyused,withpage]{acronym}
\usepackage{relsize}
\renewcommand*{\acsfont}[1]{\textsmaller[0.5]{#1}}

%%%
% Math
%%%
\usepackage{mathtools}
\usepackage{amssymb}
Jasper Clemens Gräflich's avatar
Jasper Clemens Gräflich committed
\usepackage{unicode-math}
Jasper Clemens Gräflich's avatar
Jasper Clemens Gräflich committed
\usepackage{braket} % \Set macro
Jasper Clemens Gräflich's avatar
Jasper Clemens Gräflich committed

%%%
% Graphics
%%%
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows}