% @file     thesis.cls
%
% @brief  Document class for theses.
%
% @author   Stefan Nothaas, Arbeitsgruppe Betriebssysteme, Institut für Informatik, HHU Düsseldorf
% @author Filip Krakowski, Arbeitsgruppe Betriebssyteme, Institut für Informatik, HHU Düsseldorf
%
% @since  2021/04/29 (major refactoring, minted, university logo)
% @since  2019/04/29 (bugfix, wrong page number for reference section)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{class/thesis}[2021/04/29 Template for theses]

% Use book class as base
\LoadClass[12pt,twoside,a4paper]{book}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage[left=3cm,right=2.5cm,top=3cm,bottom=2.5cm]{geometry}

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[english,ngerman]{babel}
\RequirePackage{mathtools}
% \RequirePackage{amssymb} % Produces some errors I don't understand
\RequirePackage[minted]{tcolorbox}
% \RequirePackage{minted}
\RequirePackage{fancyhdr} % For headers
\RequirePackage{color}
% \RequirePackage[usenames,dvipsnames]{xcolor} % Option Clash, already loaded by sth else
\RequirePackage{graphicx}
\RequirePackage{tikz}
\RequirePackage{subcaption} % Floats in floats
\RequirePackage{float}
\RequirePackage{multirow} % For tables
% \RequirePackage{todonotes}
\RequirePackage{hyperref} % [hidelinks]
\RequirePackage{algorithm2e}
\RequirePackage{tocloft}
\RequirePackage{listings}
\RequirePackage{textcomp}
\RequirePackage{ifthen}
\RequirePackage{pgf} % Not sure if pgf was meant, but pgffor doesn't exist (at least not in my texlive?)
\RequirePackage{enumitem}

% Some additions

% Borders around svg figures
\RequirePackage{svg}
\RequirePackage{float}
\floatstyle{boxed}
\restylefloat{figure}

\RequirePackage{csquotes}
\RequirePackage{tabularx}

% Extra chapters
\RequirePackage[acronym,automake,nonumberlist,nogroupskip]{glossaries} % Must be loaded after hyperref, [toc]
\RequirePackage[page]{appendix} % [toc]
% \RequirePackage{tocbibind} % Add lists to toc, still needs [heading=bibintoc] for some reason, [nottoc]?

% Font
\RequirePackage{beton} % Computer Concrete font
\DeclareFontSeriesDefault[rm]{bf}{sbc} % Computer Concrete does not have bold font
\RequirePackage{eulerpx} % Math font
\RequirePackage{inconsolata} % Code font

% Group listings by chapter, pretocmd prepends something to a command
\RequirePackage{etoolbox}
\pretocmd{\chapter}{\addtocontents{listings}{\protect\addvspace{10pt}}}{}{}

% Control lot/lof parskip
\RequirePackage{tocloft}

% Allow referencing subsubsections (don't have those anymore)
% \setcounter{secnumdepth}{3}
% \setcounter{tocdepth}{3}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Package settings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\tcbuselibrary{skins, breakable}
\usetikzlibrary{shadings, backgrounds}

\fancypagestyle{plain}{%
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[RO,LE]{\thepage}
}

\fancypagestyle{thesis}{%
  \fancyhf{}
  \renewcommand{\headrulewidth}{0.4pt}
  \fancyfoot[RO,LE]{\thepage}
  \fancyhead[LO,RE]{\slshape \leftmark}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bibliography
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage[style=ieee,backend=biber]{biblatex}
\addbibresource{references.bib}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Translations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\translatemastersthesis}{}
\newcommand{\translatebachelorsthesis}{}
\newcommand{\translateprojectwork}{}
\newcommand{\translateprimaryreviewer}{}
\newcommand{\translatesecondaryreviewer}{}
\newcommand{\translatesupervisor}{}
\newcommand{\translatesubmittedby}{}
\newcommand{\translatefrom}{}
\newcommand{\translateuniversityname}{}
\newcommand{\translatedepartment}{}
\newcommand{\translatedeclaration}{}
\newcommand{\translatedeclarationtitle}{}

\addto\captionsenglish{
  \SetAlgorithmName{Algorithm}{Algorithm}{List of Algorithms}
  \renewcommand{\chaptername}{Chapter}
  \renewcommand{\translatemastersthesis}{Master's Thesis}
  \renewcommand{\translatebachelorsthesis}{Bachelor's Thesis}
  \renewcommand{\translateprojectwork}{Project Work}
  \renewcommand{\translateprimaryreviewer}{Primary Reviewer}
  \renewcommand{\translatesecondaryreviewer}{Secondary Reviewer}
  \renewcommand{\translatesupervisor}{Supervisor}
  \renewcommand{\translatesubmittedby}{submitted by}
  \renewcommand{\translatefrom}{from}
  \renewcommand{\translateuniversityname}{Heinrich Heine University Düsseldorf}
  \renewcommand{\translatedepartment}{Department Operating Systems}
  \renewcommand{\translatedeclarationtitle}{Statutory Declaration}
  \renewcommand{\translatedeclaration}{I hereby state that I have written this {\thesistypename} independently and that I have not used any sources or aids other than those declared. All passages taken from the literature have been marked as such. This thesis has not yet been submitted to any examination authority in the same or a similar form.}
}

\addto\captionsngerman{
  \SetAlgorithmName{Algorithmus}{Algorithmus}{Algorithmenverzeichniss}
  \renewcommand{\chaptername}{Kapitel}
  \renewcommand{\translatemastersthesis}{Masterarbeit}
  \renewcommand{\translatebachelorsthesis}{Bachelorarbeit}
  \renewcommand{\translateprojectwork}{Projektarbeit}
  \renewcommand{\translateprimaryreviewer}{Erstgutachter}
  \renewcommand{\translatesecondaryreviewer}{Zweitgutachter}
  \renewcommand{\translatesupervisor}{Betreuer}
  \renewcommand{\translatesubmittedby}{vorgelegt von}
  \renewcommand{\translatefrom}{aus}
  \renewcommand{\translateuniversityname}{Heinrich-Heine-Universität Düsseldorf}
  \renewcommand{\translatedepartment}{Abteilung Betriebssysteme}
  \renewcommand{\translatedeclarationtitle}{Ehrenwörtliche Erklärung}
  \renewcommand{\translatedeclaration}{Hiermit versichere ich, die vorliegende {\thesistypename} selbstständig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt zu haben. Alle Stellen, die aus den Quellen entnommen wurden, sind als solche kenntlich gemacht worden. Diese Arbeit hat in gleicher oder ähnlicher Form noch keiner Prüfungsbehörde vorgelegen.}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Variables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\thesistitle}[1]{\title{#1}}

\newcommand{\thesisauthor}[1]{\author{#1}}

\newcommand{\submissiondate}[1]{\date{#1}}

\def\@thesislanguage{}
\newcommand{\thesislanguage}[1]{\def\@thesislanguage{#1}}

\def\@thesiskeywords{}
\newcommand{\thesiskeywords}[1]{\def\@thesiskeywords{#1}}

\def\@authorbirthplace{}
\newcommand{\authorbirthplace}[1]{\def\@authorbirthplace{#1}}

\def\@authorbirthname{}
\newcommand{\authorbirthname}[1]{\def\@authorbirthname{#1}}

\def\@firstreviewer{}
\newcommand{\firstreviewer}[1]{\def\@firstreviewer{#1}}

\def\@secondreviewer{}
\newcommand{\secondreviewer}[1]{\def\@secondreviewer{#1}}

\def\@supervisor{}
\newcommand{\supervisor}[1]{\def\@supervisor{#1}}

\def\@thesistype{}
\newcommand{\thesistype}[1]{\def\@thesistype{#1}}

\def\@glossaryenabled{}
\newcommand{\glossaryenabled}[1]{\def\@glossaryenabled{#1}}

\def\@listoffiguresenabled{}
\newcommand{\listoffiguresenabled}[1]{\def\@listoffiguresenabled{#1}}

\def\@listoftablesenabled{}
\newcommand{\listoftablesenabled}[1]{\def\@listoftablesenabled{#1}}

\def\@listofalgorithmsenabled{}
\newcommand{\listofalgorithmsenabled}[1]{\def\@listofalgorithmsenabled{#1}}

\def\@hidefigures{}
\newcommand{\hidefigures}[1]{\def\@hidefigures{#1}}

\def\@hidecode{}
\newcommand{\hidecode}[1]{\def\@hidecode{#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Colors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Primary
\definecolor{hhuCorporateBlue}{HTML}{006AB3}
\definecolor{hhuCorporateGrey}{HTML}{D9DADB}

% Secondary
\definecolor{hhuCorporateGreen}{HTML}{97BF0D}
\definecolor{hhuCorporateOrange}{HTML}{F29400}
\definecolor{hhuCorporateRed}{HTML}{BE0A26}
\definecolor{hhuCorporateDarkBlue}{HTML}{003865}
\definecolor{hhuCorporateLightBlue}{HTML}{32B8C9}

% Code
\colorlet{titlebg}{hhuCorporateGrey!80!white}
\colorlet{titlecolor}{black}
\colorlet{termbg}{hhuCorporateGrey!10!white}
\colorlet{termfg}{hhuCorporateGrey!20!white}
\colorlet{codebg}{white}
\colorlet{numberbg}{hhuCorporateGrey!25!white}
\colorlet{languagebg}{hhuCorporateGrey!20!white}
\definecolor{mintedtext}{HTML}{F8F8F2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document settings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength{\marginparwidth}{2.1cm}

\AtBeginDocument{

  \hypersetup{
    pdfauthor={\@author},
    pdftitle={\@title},
    pdfkeywords={\@thesiskeywords},
    pdfproducer={LaTeX with hyperref},
    pdfcreator={PDFLaTeX}
  }

  \selectlanguage{\@thesislanguage}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Thesis environment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{thesis}
{

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Global options
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  \setlength{\parindent}{0pt}

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Disable fancy headers
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  \pagestyle{empty}
  \pagenumbering{gobble}

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Title page
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  \thesiscover

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Table of contents
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  \tableofcontents
  \cleardoublepage

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Re-enable fancy headers
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  % \pagenumbering{arabic} % Only number chapters
  \pagestyle{thesis}

  \ifthenelse{\equal{\@glossaryenabled}{true}}
  {%
    \setacronymstyle{short-long}

    \printglossary[type=\acronymtype]
    \cleardoublepage

    \printglossary
    \cleardoublepage
  }%
  {}

  \ifthenelse{\equal{\@hidefigures}{true}}
  {%
    \excludecomment{figure}
    \let\endfigure\relax
  }%
  {}

  \ifthenelse{\equal{\@hidecode}{true}}
  {%
    \excludecomment{codeblock}
    \let\endcodeblock\relax
  }%
  {}

  \pagenumbering{arabic}
}
{
  \pagenumbering{gobble}
  \printbibliography % [heading=bibintoc]
  %\cleardoublepage
  \clearpage

  \tcblistof[\chapter*]{listings}{List of Listings}
  % \addcontentsline{toc}{chapter}{List of Listings}
  %\cleardoublepage
  \clearpage

  % The lof/lot linespacing should match the lol linespacing
  \setlength{\cftparskip}{2pt}

  \ifthenelse{\equal{\@listoftablesenabled}{true}}
  {%
    \listoftables
    %\cleardoublepage
    \clearpage
  }%
  {}

  \ifthenelse{\equal{\@listoffiguresenabled}{true}}
  {%
    \listoffigures
    %\cleardoublepage
    \clearpage
  }%
  {}

  \ifthenelse{\equal{\@listofalgorithmsenabled}{true}}
  {%
    \listofalgorithms
    %\cleardoublepage
    \clearpage
  }%
  {}

  \declaration
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\thesiscover}
{
  \begin{titlepage}

    \newgeometry{left=2.5cm,right=2.5cm,top=3cm}

    \begin{center}

      \includesvg[width=5cm]{img/hhu_color.svg}

      \vspace{0.75cm}

      {\Large \thesistypename}

      \vspace{0.75cm}

      % Thesis title
      \rule{\textwidth}{0.25mm}\\
      \vspace{-5pt}
      \rule{\textwidth}{0.8mm}\\

      {\Huge \textsc{\@title\\}}

      \rule{\textwidth}{0.8mm}\\
      \vspace{-5pt}
      \rule{\textwidth}{0.25mm}

      \vspace{7.5em}

      {\translatesubmittedby} \\[.5em]
      {\huge \@author} \\[.5em]
      {{\translatefrom} \@authorbirthplace}\\

      \vfill


      % Department


      {\translatedepartment}\\
      Prof. Dr. Michael Schöttner\\
      {\translateuniversityname}\\

      \vspace{1cm}


      % Date
      \vspace{0.5cm}
      \@date
      \vspace{0.5cm}


      % People
      \begin{tabular}{r  l}
        {\translateprimaryreviewer}: & \@firstreviewer \\
        \ifthenelse{\equal{\@thesistype}{project}}{}{{\translatesecondaryreviewer}: & \@secondreviewer \\}
        {\translatesupervisor}: & \@supervisor \\
      \end{tabular}


    \end{center}

  \end{titlepage}
  \clearpage{\pagestyle{empty}\cleardoublepage}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Literature
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\literature}
{
  % Why is this here twice?
  % \bibliography{\literaturebibtexdatei}
  % \bibliographystyle{plain}

  % \addcontentsline{toc}{chapter}{Literaturverzeichnis}
  % \cleardoublepage
  \bibliography{\literaturebibtexdatei}
  \bibliographystyle{plain}

  \clearpage{\pagestyle{empty}\cleardoublepage}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Statutory Declaration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\declaration}
{
  \cleardoublepage
  \pagestyle{empty}
  \huge
  \noindent\textbf{\translatedeclarationtitle}

  \large
  \vspace{3cm}
  {\noindent\translatedeclaration}

  \vspace{4cm}
  \begin{center}
    \begin{tabular}{lc}
      Düsseldorf, \@date \hspace{1.5cm} & \hspace{7cm} \\[-10pt]
                                        & \hrulefill \\
                                        & \@author
\\
    \end{tabular}
  \end{center}

  \clearpage{\pagestyle{empty}\cleardoublepage}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Miscellaneous
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\thesistypename}{%
  \ifthenelse{\equal{\@thesistype}{bachelor}}
    {\translatebachelorsthesis}
    {%
      \ifthenelse{\equal{\@thesistype}{master}}
      {\translatemastersthesis}
      {\translateprojectwork}
    }%
}

\newtcolorbox[auto counter,list inside=listings,number within=chapter]{codeblock}[3][]
{%
  enhanced,
  colbacktitle=titlebg,
  coltitle=titlecolor,
  colframe=titlebg,
  interior style={%
    top color=codebg,
    bottom color=codebg
  },
  boxrule=.5pt,
  arc=0.6mm,
  width= (\linewidth),
  fonttitle=\footnotesize,
  adjusted title=\thetcbcounter\quad\texttt{#2},
  list entry=\thetcbcounter\quad\texttt{#2},
  after title={%
    \hfill\setlength{\fboxsep}{2pt}
    \codelang{#3}
  },
  overlay={%
    \begin{tcbclipinterior}\fill[numberbg] (frame.south west)
      rectangle ([xshift=5mm]frame.north west);
    \end{tcbclipinterior}
  },
  top=0mm,
  bottom=0mm,
  right=0mm,
  left=5mm,
  #1
}

\newtcolorbox{terminalblock}
{%
  enhanced,
  colbacktitle=titlebg,
  coltitle=titlecolor,
  colframe=titlebg,
  interior style={%
    top color=codebg,
    bottom color=codebg
  },
  boxrule=.5pt,
  arc=0.6mm,
  width= (\linewidth),
  fonttitle=\footnotesize,
  adjusted title={%
    \tikz\draw[hhuCorporateGrey!50!black,fill=hhuCorporateGrey!50!black] (0,0) circle (.5ex);
    \tikz\draw[hhuCorporateGrey!60!black,fill=hhuCorporateGrey!60!black] (0,0) circle (.5ex);
    \tikz\draw[hhuCorporateGrey!70!black,fill=hhuCorporateGrey!70!black] (0,0) circle (.5ex);
  },
  top=1mm,
  bottom=0mm,
  left=1mm,
  right=1mm
}

\newtcbox{\codehighlight}{nobeforeafter,boxrule=.5pt,colback=black!5,colframe=black!35,
  arc=2pt,boxsep=0pt,left=2pt,right=2pt,top=2pt,bottom=1pt, tcbox raise base}

\newcommand{\code}[1]{\codehighlight{\texttt{#1}}}

\newtcbox{\languagehighlight}{nobeforeafter,boxrule=0pt,colback=black!5,arc=1pt,
  boxsep=0pt,left=2pt,right=2pt,top=2pt,bottom=2pt, tcbox raise base}

\newcommand{\codelang}[1]{\languagehighlight{\texttt{#1}}}

\newenvironment{noteblock}%
{
  \setlength\topsep{4pt}
  \setlength\parskip{0pt}
  \begin{center}
    \begin{tabular}{|p{.95\linewidth}}
    }
    %
    {
    \end{tabular}
  \end{center}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newminted{java}{
  linenos,
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=0.8,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}

\newminted{kotlin}{
  linenos,
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=0.8,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}

\newminted{scala}{
  linenos,
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=0.8,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}

\newminted{c}{
  linenos,
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=0.8,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}

\newmintedfile[cppfile]{cpp}{
  linenos,
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=0.8,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}

\newmintedfile[nasmfile]{nasm}{
  linenos,
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=0.8,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}

\newminted{rust}{
  linenos,
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=1.0,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}

\newminted{go}{
  linenos,
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=1.0,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}

\newminted{text}{
  autogobble,
  breaklines=true,
  breaksymbol=,
  breakindent=4mm,
  breakbefore=.,
  breakbeforesymbolpre=,
  breakbeforesymbolpost=,
  baselinestretch=1.0,
  escapeinside=||,
  framesep=5mm,
  numbersep=7pt,
  % fontfamily=tt,
  fontsize=\footnotesize,
  % style=bw,
  escapeinside=||
}