directory structure
[phd-thesis.git] / preamble.tex
index 94383b2..b285f89 100644 (file)
@@ -1,6 +1,8 @@
+% chktex-file 17
+% chktex-file 15
 % Fonts
 \usepackage[utf8]{inputenc} % Input encoding
-\usepackage[T1]{fontenc}    % Font encoding
+\usepackage[T2A,T1]{fontenc}    % Font encoding
 \usepackage{lmodern}        % Nicer font
 \usepackage{microtype}      % Better kerning
 \usepackage{tipa}           % IPA symbols
@@ -11,6 +13,7 @@
 \usepackage{amssymb}        % extra math symbols
 \usepackage{relsize}        % \smaller command
 \usepackage{siunitx}        % typeset units
+\usepackage{xcolor}         % colors
 \DeclareSIUnit\noop{\relax}
 \DeclareSIUnit\celcius{{}^{\circ}\kern-\scriptspace\mathsf{C}}
 %\usepackage{atveryend}        % \smaller command
 \renewcommand\partname{Movement}                   % Rename parts to movements (rhapsody uhu)
 \addto\captionsbritish{\renewcommand{\partname}{Movement}}
 \usepackage{titlesec}
-\makeatletter
 \titleformat{\part}[block]
        {\Huge}
        {\partname~\thepart:}
        {20pt}
        {}
-
-\newenvironment{chapterabstract}
-       {\begin{quote}}
-       {\end{quote}}
+% This is required to make \nameref work (https://tex.stackexchange.com/questions/211035/problems-with-nameref-not-refering-to-the-correct-label-x-titlesec)
+\makeatletter
+\let\titlesec@part\part%
+\renewcommand{\part}{\@ifstar\part@star\part@nostar}
+\def\part@star#1{\NR@gettitle{#1}\titlesec@part*{#1}}
+\def\part@nostar{\@ifnextchar[\part@nostar@opt\part@nostar@nopt} % chktex 9
+\def\part@nostar@nopt#1{\NR@gettitle{#1}\titlesec@part{#1}}
+\def\part@nostar@opt[#1]#2{\NR@gettitle{#1}\titlesec@part[#1]{#2}}
+\makeatother
+\newenvironment{chapterabstract}{\begin{quotation}}{\end{quotation}}
 
 % Increase the depth for the table of contents
 \setcounter{secnumdepth}{3}
 
 % (file) structure
 \usepackage[subpreambles=true]{standalone} % standalone figures
-\usepackage{morewrites}                    % fix no more room for a new \write
+%\usepackage{morewrites}                    % fix no more room for a new \write
 \usepackage{appendix}                      % subappendices, appendices per chapter
 
 % Bibliography
 \nobibliography*
 \usepackage{natbib} % Cite bib entry completely
 \setlength{\bibsep}{0.0pt}
+\def\bibfont{\small}
 %\bibliographystyle{alpha}
 \bibliographystyle{abbrvnat}
+\apptocmd{\thebibliography}{\raggedright}{}{}
 
 % Graphics
 \usepackage{graphicx} % Images
-\graphicspath{{img/},{introduction/img}}
-\graphicspath{{img/},{introduction/img},{tiered_vs._tierless_programming/img}}
+\graphicspath{{img/},{intro/img},{top/img},{tvt/img}}
 \usepackage{caption}  % subfigures
 \usepackage{subcaption}
 \usepackage{rotating}
 \newcommand{\orcid}[1]{\href{https://orcid.org/#1}{\hspace{1mm}\includegraphics[width=1em]{orcid}\hspace{2mm} https://orcid.org/#1}}
+\usepackage{tikz}
 
 % Tables
 \usepackage{booktabs}  % Nicer tables
 % Fix the algorithm font
 \renewcommand\AlCapFnt{\normalfont}
 \usepackage{listings}
+% https://tex.stackexchange.com/questions/149056/how-can-i-define-additional-literate-replacements-without-deleting-existing-ones
+\makeatletter
+\def\addToLiterate#1{\edef\lst@literate{\unexpanded\expandafter{\lst@literate}\unexpanded{#1}}}
+\lst@Key{moreliterate}{}{\addToLiterate{#1}}
+\makeatother
 % General listings settings
 \lstset{%
        basewidth=0.5em,
        breaklines=true,
        captionpos=b,
        columns=[c]fixed,
-%      columns=flexible,
        commentstyle=\sl,
        escapeinside={[+}{+]},  % chktex 9
        frame=L,
 }
 \usepackage{lstlangclean}
 \usepackage{lstlanghaskell}
-\usepackage{lstlanghaskelllhstex}
 \usepackage{lstlangarduino}
+\lstloadlanguages{%
+       {[Arduino]C++},%
+       {c},%
+       {Python},%
+       {Clean},%
+       {[Regular]Haskell},
+       {[Lhs2Tex]Haskell}}
 \newcommand{\cinline}[1]{\lstinline[language=c,basicstyle=\tt,postbreak=]|#1|}
 \newcommand{\arduinoinline}[1]{\lstinline[language={[Arduino]C++},basicstyle=\tt,postbreak=]|#1|}
 \newcommand{\pythoninline}[1]{\lstinline[language=Python,basicstyle=\tt,postbreak=]|#1|}
 \newcommand{\cleaninline}[1]{\lstinline[language=Clean,basicstyle=\tt,postbreak=]|#1|}
-\newcommand{\haskellinline}[1]{\lstinline[language=Haskell,style=haskell,basicstyle=\tt,postbreak=]|#1|}
-\newcommand{\haskelllhstexinline}[1]{\lstinline[language=Haskell,style=haskelllhstex,basicstyle=\tt,postbreak=]|#1|}
+\newcommand{\haskellinline}[1]{\lstinline[language={[Regular]Haskell},basicstyle=\tt,postbreak=]|#1|}
+\newcommand{\haskelllhstexinline}[1]{\lstinline[language={[Lhs2Tex]Haskell},basicstyle=\tt,postbreak=]|#1|}
 %For storing listings in footnotes
 \newsavebox{\LstBox}
 % Fix list of listings title
        {}
 \lstnewenvironment{lstHaskell}[1][]
        {%
-               \lstset{language=Haskell,style=haskell,#1}%
+               \lstset{language={[Regular]Haskell},#1}%
                \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})}
        }
        {}
 \lstnewenvironment{lstHaskellLhstex}[1][]
        {%
-               \lstset{language=Haskell,style=haskelllhstex,#1}%
+               \lstset{language={[Lhs2Tex]Haskell},#1}%
                \renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})}
        }
        {}
 \usepackage[noabbrev]{cleveref} % Easy references
 \crefname{part}{movement}{movements}
 \crefname{lstlisting}{listing}{listings}
+\usepackage{nameref} % to reference names of chapters
+\newcommand{\fullref}[1]{\Cref{#1}: \nameref{#1}}
 
 % Glossaries and acronyms
-\usepackage[acronym,nonumberlist]{glossaries}
+\usepackage[nolangwarn,acronym,nonumberlist]{glossaries}
 \Addlcwords{of}
 % Titlecase glossary commands
 \newcommand{\glst}[1]{\titlecap{\glsentrylong{#1}}}
 
 % Custom commands
 \newcommand{\GHCmod}[1]{\texttt{#1}}
-\newcommand{\requiresGHCmod}[1]{\footnote{Requires \GHCmod{#1} to be enabled.}}
+\newcommand{\requiresGHCmod}[2][]{\footnote{Requires \GHCmod{#1} to be enabled.#2}}
 \newcommand{\etc}{{\fontfamily{cmr}\selectfont{\itshape\/\&c}}}
 \newcommand{\rdmentry}[6]{#1: #2 (#3): #4. #5.\ \href{https://doi.org/#6}{#6}}
 \newcommand{\mlubbers}{Lubbers, M.\ (Radboud University)}
 \newcommand{\pkoopman}{Koopman, dr.\ P.\ (Radboud University)}
 \newcommand{\rplasmeijer}{Plasmeijer, prof.\ dr.\ ir.\ R.\ (Radboud University)}
 
-\newcommand{\mychapter}[2]{
-       \chapter{#2}%
-       \label{#1}%
-}
-\newcommand{\myappendix}[2]{
-       \chapter{#2}%
-       \label{#1}%
-}
-\newcommand{\mybackmatter}[2]{
-       \chapter{#2}%
-       \label{#1}%
+\newcommand{\mypart}[3]{
+       \part[#2: #3]{#2\\[2ex]\smaller{}#3}%
+       \label{#1}
 }
-\newcommand{\mypart}[3]{\part[#2: #3]{#2\\[2ex]\smaller{}#3}\label{#1}}