\documentclass{thesis}

\hypersetup{
  pdftitle    = {Control-Flow Refinement in a Framework for Automated (Probabilistic) Complexity Analysis},
  % pdfsubject  = {},
  pdfauthor   = {Yoann Maurice Kehler},
  pdfkeywords = {KoAT2, Control-Flow Refinment, iRankFinder, Aprove} ,
  pdfcreator  = {xelatex},
  pdfproducer = {XeLaTeX}
}

% Tikz
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=1.18}
\usetikzlibrary{external,shapes.symbols,calc,automata,positioning,arrows.meta,decorations.pathmorphing,datavisualization.formats.functions,patterns}
% \tikzexternalize
\tikzset{helplines/.style=very thin}
\tikzset{program/.style={
    shorten >=1pt,
    >={Stealth[round]},
    node distance=1.5cm,
    every state/.style={minimum size=0.7cm,inner sep=2pt},
    semithick,
    on grid,
    auto,
    initial text=,
    initial above
}}
\tikzset{tree/.style={
    program,
    % every state/.style={draw=none,rectangle,minimum size=0pt,inner sep=2pt},
    node distance=1.8cm
    }}

\usepackage{optidef}

\usepackage{cleveref}

% todo notes
\usepackage{todonotes}
\makeatletter
\renewcommand{\todo}[2][]{\tikzexternaldisable\@todo[#1]{#2}\tikzexternalenable}
\makeatother

\urlstyle{same}

% Theorems
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem} % Needs proof, and is central to this thesis.
\newtheorem{apdxtheoreminner}{Theorem}
\newenvironment{apdxtheorem}[1]{%
  \renewcommand\theapdxtheoreminner{#1}%
  \apdxtheoreminner
}{\endapdxtheoreminner}
\newtheorem{lemma}{Lemma} % Needs proof, and works towards a theorem
\newtheorem{apdxlemmainner}{Lemma}
\newenvironment{apdxlemma}[1]{%
  \renewcommand\theapdxlemmainner{#1}%
  \apdxlemmainner
}{\endapdxlemmainner}
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}
\theoremstyle{remark}
\newtheorem*{rem}{Remark} % Trivial stuff.

% algorithms
\usepackage[ruled,linesnumbered]{algorithm2e}

% Bibliography
\addbibresource{literature.bib}

% Acronyms with glossaries
\input{acronyms}
\makeglossaries

\begin{document}
    \frontmatter
    \input{abbrv}
    \input{ch0_frontmatter}
    \mainmatter
    \chapter{Introduction}\label{ch:introduction}
    \input{ch1_introduction}
    \chapter{Preliminaries} \label{ch:preliminaries}
    \input{ch2_preliminaries}
    \chapter{Theory}\label{ch:theory}
    \input{ch3_theory}
    \chapter{Implementation}\label{ch:implementation}
    \input{ch4_implementation}
    \chapter{Conclusion}\label{ch:conclusion}
    \input{ch5_conclusion}

    \backmatter
    \printbibliography[title={References}]
    \printacronyms
    \chapter{Appendix}\label{ch:appendix}
    \input{ch6_appendix}
\end{document}