% \iffalse meta-comment
%
% Copyright (C) 2026 Seppe Ongena <seppe.ongena@ugent.be>
% Portions Copyright (C) 2013-2026 Walter Daems (uantwerpendocs v4.12)
% Portions Copyright (C) 2017-2026 Joris Meys, adapted with permission
%
% This work is derived from uantwerpendocs v4.12 by Walter Daems
% (https://ctan.org/pkg/uantwerpendocs), substantially rewritten and
% expanded for the Ghent University house style. Code for the styling and
% GAI disclaimer from Joris Meys' LaTeX at UGent was adapted with permission
% and used for the bama and report classes. The full development history
% can be found in the CHANGELOG.md and at:
%
%   https://github.com/SeppeOngena/ugentdocs/
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 of this license
% or (at your option) any later version.  The latest version of this
% license is in:
%
%   https://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Seppe Ongena.
%
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{ugentdocs.dtx}
%</driver>
%<@@=ugentdocs>
%<crs|bama|phd|rp|le|ex|bmr|bkc>\NeedsTeXFormat{LaTeX2e}
%<clo>\ProvidesFile{ugentcommon.clo}
%<col>\ProvidesPackage{ugentcolor}
%<crs>\ProvidesClass{ugentcourse}
%<bama>\ProvidesClass{ugentbama}
%<phd>\ProvidesClass{ugentphd}
%<rp>\ProvidesClass{ugentreport}
%<le>\ProvidesClass{ugentletter}
%<ex>\ProvidesClass{ugentexam}
%<bmr>\ProvidesPackage{beamerthemeugent}
%<bkc>\ProvidesClass{ugentbookcover}
%<art>\ProvidesClass{ugentarticle}
%<col|crs|bama|phd|rp|le|ex|bmr|bkc|art>    [2026/07/03 v1.0.0 .dtx skeleton file]
%<*driver>
\documentclass[a4paper,10pt]{ltxdoc}
%
\providecommand{\ugentdocsdate}{\the\year-\the\month-\the\day}
\providecommand{\ugentdocsversion}{v1.0.0}
%
\usepackage{geometry}
\usepackage[dutch,main=english]{babel}
\usepackage{makeidx}
\makeindex
\usepackage{alltt}
\usepackage{adjustbox}
\usepackage{fontspec}
\usepackage[mathrm = sym,mathup = sym,mathbf = sym,mathit = sym, mathsf = sym]{unicode-math}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{metalogo}
\usepackage{ulem}
\renewcommand{\ULthickness}{1pt}
\usepackage{wasysym}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,fit,backgrounds}
\usepackage{tikzpagenodes}
\usepackage{hyphenat}
\usepackage{fancyvrb}
\usepackage{fvextra}
\fvset{fontsize=\tiny}
%
\makeatletter
\input{ugentcommon.clo}
\ExplSyntaxOn
\keys_set:nn { ugentdocs } { faculty = bw }
\ExplSyntaxOff
\makeatother
\usepackage{ugentcolor}
%
\IfFileExists{idxlayout.sty}{\usepackage[totoc]{idxlayout}}{}
\IfFileExists{hyperref.sty}{\usepackage[bookmarksopen,hyperindex=false]{hyperref}}{}
\IfFileExists{hypdoc.sty}{\usepackage{hypdoc}}{}
\usepackage{dtxdescribe}
%
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%
% Fix for copying code line numbers
\usepackage{accsupp}
\renewcommand\theCodelineNo{%
  \BeginAccSupp{method=plain,ActualText={}}%
  \scriptsize\arabic{CodelineNo}%
  \EndAccSupp{}%
}
%
% Patch dtxdescribe category not printing
\makeatletter
\ExplSyntaxOn
\keys_define:nn {doc}
{
  unknown .code:n = {
    \tl_set:Nx \DTXD@category { \l_keys_key_str }
  },
}
\ExplSyntaxOff
\makeatother
%
% Patch dtxdescribe multi-category
\makeatletter
\renewcommand*{\DTXD@maybecategorylevel}[1]{%
  \ifdefvoid{\DTXD@categorylevelname}%
  {}%
  {%
    \begingroup
    \edef\DTXD@categorylist{\DTXD@categorylevelname}%
    \StrSubstitute{\DTXD@categorylist}{-}{,}[\DTXD@categorylist]%
    \@for\DTXD@onecategory:=\DTXD@categorylist\do{%
      \index{%
        \DTXD@onecategory
        \noexpand\actualchar%
        \string\verb% %
        \noexpand\quotechar%
        *%
        \noexpand\verbatimchar%
        [\DTXD@onecategory]:%
        \noexpand\verbatimchar%
        \noexpand\levelchar%
        \noexpand\DTXD@printobjectname{\DTXD@gtempa@nobackslash}{\@gtempa}%
        \ifblank{#1}{}{\string\DTXDbreak (#1)}%
        \noexpand\doc@handleencap{usage}%
      }%
    }%
    \endgroup
  }%
}
\makeatother
%
\begin{document}
  \DocInput{ugentdocs.dtx}
\end{document}
%</driver>
% \fi
%
% \DoNotIndex{\newcommand,\newenvironment,\begin,\bfseries,\draw,\clip,\else,\fi,\if,\fill,\filldraw,\ifx,\textwidth,\node,\\,\@empty,\@tempdima,\@tempdimb,\@tempswatrue,\{,\},\ ,\bf,\BODY,\break,\Alph,\and,\define@key,\color,\dx,\dy,\g,\gdef,\hbox,\tiny,\scriptsize,\footnotesize,\small,\normalsize,\large,\Large,\LARGE,\huge,\Huge,\l,\LaTeX,\let,\p@,\relax,\renewcommand,\Requirepackage,\textbf,\textsf,\texttt,\textbackslash,\vspace,\hspace,\hfill,\hskip,\vskip,\hline,\vrule,\typeout,\usebox,\end,\paperheight,\paperwidth,\par,\NewDocumentCommand,\seq,\&,\@@,\@afterheading,\@ifnextchar,\@ifpackageloaded,\@makechapterhead,\@makeschapterhead,\@schapter,\@place,\@pdfauthor,\@pdfsubtitle,\@pdftitle,\_,\@thanks,\addthumb,\AddToHook,\AddToHookNext,\AddToShipoutPicture,\adjustbox,\advance,\appendix,\appendixname,\apptocmd,\AtBeginDocument,\AtEndDocument,\AtEndEnvironment,\backgroundsetup,\baselineskip,\baselinestretch,\BeforeBeginEnvironment,\begingroup,\bookcovercomponent,\bool,\c,\ccname,\centering,\chapter,\chaptermark,\chaptername,\chaptertitlename,\clearpage,\cleardoublepage,\colorlet,\continuethumb,\coordinate,\cr,\cs,\csname,\DeclareRobustCommand,\def,\defbeamertemplate,\dim,\dimexpr,\documentclass,\EANBarcode,\edef,\endcsname,\endgroup,\exp,\expandafter,\ExplSyntaxOff,\ExplSyntaxOn,\fancyfoot,\fancyhead,\fancyhf,\fancypagestyle,\file,\fontsize,\footrulewidth,\footskip,\foreach,\fp,\frontmatter,\,,\getlength,\global,\halign,\headheight,\heading,\headrulewidth,\height,\hfil,\hoffset,\href,\hypersetup,\hyphenpenalty,\if@twoside,\ifblank,\ifdefempty,\ifdefvoid,\ifdim,\ifnum,\IfPackageLoadedTF,\includegraphics,\insertauthor,\insertdate,\insertframenumber,\insertframesubtitle,\insertframetitle,\insertsection,\insertsectionnumber,\insertsubsection,\insertsubtitle,\inserttitle,\inserttotalframenumber,\interlinepenalty,\iow,\it,\itshape,\jobname,\leavevmode,\leftmark,\linewidth,\mainmatter,\makeatletter,\makeatother,\makebox,\MakeUppercase,\markboth,\mode,\msg,\newbookcovercomponenttype,\newdimen,\NewEnviron,\newif,\newlength,\newline,\nn,\nobreak,\noexpand,\nohyphens,\noindent,\null,\PackageError,\pagenumbering,\pagestyle,\parbox,\parindent,\parskip,\PassOptionsToPackage,\path,\pgfgetlastxy,\pgfmathsetlength,\pgfmathsetmacro,\phantom,\place,\pretocmd,\protected@xdef,\put,\raggedleft,\raggedright,\raisebox,\RequirePackage,\rfoot,\rightmark,\rmfamily,\rotatebox,\rule,\section,\selectfont,\selectlanguage,\setbeamercolor,\setbeamerfont,\setbeamersize,\setbeamertemplate,\setbox,\setcounter,\setlength,\settowidth,\ShellEscape,\smallskip,\space,\stopthumb,\str,\stretch,\strip@pt,\strut,\subheading,\tableofcontents,\tabularnewline,\textcolor,\textcopyright,\textheight,\textit,\textrm,\thanks,\the,\thechapter,\thepage,\thesection,\theta,\thispagestyle,\titleformat,\titlespacing,\tl,\uline,\useasboundingbox,\usebeamercolor,\usebeamerfont,\usecolortheme,\usefont,\usefonttheme,\useinnertheme,\useoutertheme,\usepackage,\usetikzlibrary,\value,\vbox,\vfill,\voffset,\vphantom,\xdef,\ztotpages,\clist,\hrule,\pdfstringdefDisableCommands,\pgfmathsetlengthmacro,\z@,\xspace,\xmpcomma,\topsep,\skip,\spinewidth,\partopsep,\newpage,\medskip,\markright,\group,\copyright,\c@chapter}
%
% \setlength{\parindent}{0em}
% \addtolength{\parskip}{0.5\baselineskip}
% \newcommand{\githubmain}{https://github.com/SeppeOngena/ugentdocs}
%
% \title{
%   The |ugentdocs| classes
%   \thanks{Thanks to Walter Daems for the original \texttt{uantwerpendocs}
%     package and Joris Meys for the \texttt{bama} and \texttt{report}
%     titles style, cover text, header/footer, and GAI disclaimer code}
% }
% \author{Seppe Ongena (|seppe.ongena@ugent.be|)}
% \date{release \ugentdocsdate{} --- \ugentdocsversion{}}
%
% \newgeometry{left=3cm,right=2cm,top=2cm,bottom=2.5cm}
%
% \maketitle
% \vfill
% \section*{Introduction}
%
% This package implements the house style of Ghent University (version 2025)
% for MSc/BSc/PhD dissertations, research articles, reports (meeting notes or
% course assignments), exams, letters, course notes, and slides (beamer).
% These class files allow you to make and keep most of your document needs
% compliant to this version and future versions of the UGent house style.
%
% If you think (1) there's an error in compliance with regards to the house
% style, (2) there's a feature missing in the classes or beamer theme, or
% (3) there's a bug in this package, please,
% \href{\githubmain/issues}{open an issue on GitHub} or contact me via
% email (\href{mailto:seppe.ongena@ugent.be}{seppe.ongena@ugent.be}).%
%
% \vfill
% \newpage
% \section*{Synopsis}
% The |course| and |phd| classes\footnote{For readability the class names
% have been abbreviated by omitting the |ugent| prefix} are an extension
% of the standard \LaTeX{} |book| class. They are intended to be used for
% writing course texts and PhD dissertations and provide a cover page compliant
% to the UGent house style. They also typeset the data pages automatically
% (e.g., examination committee, title page, colophon)
% and style the rest of the document appropriately.
% These two classes additionally enable the generation of
% a full book cover (back/spine/front) with auto-generated ISBN barcode.
%
% The |bama| and |report| classes are also derived from the standard \LaTeX{}
% |book| class. These are intended for writing BSc/MSc dissertations and
% generic reports (e.g. research reports, course assignments, meeting notes).
% The |bama| class additionally populates a copyright page with signature fields
% based on the authors, supervisors, and tutors added.
%
% The |letter| class is derived from the standard \LaTeX{} |letter| class.
% It is intended to be used for writing business letters compliant to the house
% style and allows for using left-aligned windowed envelopes of the DL format.
%
% The |exam| and |article| classes are derived from the standard \LaTeX{}
% |article| class.
% THey allows typesetting bilingual exams and research articles for submission
% to journals or UGent Biblio.
%
% The slides come under the form of a beamer theme. The beamer theme is based
% on the modern 2025 UGent Panno Text one (with support for Arial), \emph{not}
% the 2016 Arial theme as that does not adhere to, e.g., grid spacing and feels
% less refined / more ``loud'' in general (large font size of slide titles,
% in both caps and underline).
%
% \begin{center}
%   \framebox[0.95\textwidth]{
%     \begin{minipage}{0.92\textwidth}
%       The documentation of the class files for PhD dissertations,
%       MSc/BSc dissertations,articles, letters, course texts, reports,
%       and exams can be found in this document (Part~\ref{P:I}).
%       \\[\baselineskip]
%
%       Template files for all of the classes can be found below in
%       Part~I Section~\ref{S:examples}.
%       \\[\baselineskip]
%
%       The documentation for the beamer theme is embedded in the
%       demo/user-guide presentation |beamerthemeugentuserguide.pdf|.
%       (Part~\ref{P:II})
%
%     \end{minipage}
%   }
% \end{center}
%
% A number of packages are required by |ugentdocs|. \watchout See Part~I
% Section~\ref{S:usage:packages} for an overview. Make sure these packages are
% available to your \LaTeX{} compiler. Most of these should be installed by
% default in TeXLive distributions or can be made to auto-install for MikTeX.
%
% \newpage
% \section*{How to read this documentation}
% \begin{itemize}
%   \item The classes are shown without the |ugent| prefix. In some cases,
%     even shorter forms are used: |crs=course|, |rp=report|, |le=letter|,
%     |ex=exam|, |bkc=bookcover|, |art=article| and |bmr=beamer|.
%     |bama| remains |bama| and |phd| remains |phd|.
%   \item Common macros or options are defined in |ugentcommon.clo| and are
%     denoted in the descriptions below using |common| or the shorthand |clo|.
%   \item When an option or macro (command) is being described, its name
%      is shown in the left margin.
%   \item If an option is being described instead of a macro,
%     this is shown in the margin by the \textit{(Opt)} note.
%   \item If a macro is mandatory, 'mandatory' is shown in the left margin.
%     A placeholder is set for that macro, which you should override.
%     A warning is also printed in the log for mandatory macros.
%   \item If a macro sets a tag -- e.g., the |\date| macro sets the |\@date|
%     tag -- it is noted by a 'tag' text in the left margin. See the tag
%     note further in this list on how to retrieve tags for use.
%   \item If a macro sets a sequence -- e.g., the |\degree| macro sets the
%     |degrees| and |degreecalls| sequences -- it is noted by a
%     '|degrees_seq|' and '|degreecalls_seq|' text in the left margin.
%     These are all global sequences, so their full \LaTeX{}3 name is
%     e.g., |\g_@@_degrees_seq|.
%     See Section~\ref{S:usage:nameseqparse} for more information.
%   \item The classes for which an option or macro is available are given
%     between square brackets in the margin, e.g. [phd-crs].
%   \item Most options can be set as |option=value| in your
%     |\documentclass[<options>]{<class>}| command, but also plain
%     |value| works.
%   \item This: |<name>| is a placeholder. Replace it with your own text.
%   \item For macros, mandatory arguments are shown between curly braces \{\},
%     and optional arguments are shown between square braces [], just as they
%     are when you use them.
%   \item In general, |\macros| are commands you can use in your main.tex
%     document file.
%     \\[\baselineskip]
%     Some |\@macros| or |\@tags| are for internal usage, but
%     they can be retrieved or executed by wrapping them in
%     |\makeatletter| and |\makeatother| (required due to the |@|
%     sign). Some of these are also meant to be sections of code you can
%     customize (see ``A note on customization'' below). If so, their
%     implementation code is shown in this docs for copy-pasting to your
%     customization file.
%     \\[\baselineskip]
%     \LaTeX{3} variables are formatted as |\scope_@@_varname_vartype|,
%     e.g., the local boolean variable |\l_@@_embargo_bool| (|g| is used for global
%     variables instead of |l|).
%     \\[\baselineskip]
%     Control sequences are formatted as |\@@_csname| or
%     |\_@@_csname| (for private control sequences). If you want to use
%     L3 control sequences or variables in customized code, you need to
%     replace '|@@|' with '|_ugentdocs|'!
% \end{itemize}
%
% \section*{A note on fonts}
%
% The house style of Ghent University recommends two fonts:
% \vspace{-\parskip}
% \begin{itemize}
%   \item Primary font: UGent Panno Text. ``This font does justice to
%     the historical values of Ghent University and is simultaneously
%     modern, distinctive and charismatic.''
%     \watchout The Medium and SemiLight variants are needed for the logos,
%     so they are an absolute requirement. If the Normal variant is installed,
%     it is used by default for all class files. You can download it
%     \href{https://ugentbe.sharepoint.com/sites/intranet-communicatie/SitePages/en/corporate-design.aspx}
%     {from the intranet}. The font files can also be put in the document's
%     working directory or in a |fonts/| subdirectory (for Inscrive or Overleaf).
%   \item Secondary font: Arial. This is normally used for office templates
%     distributed outside of Ghent University. Since \LaTeX{} usually outputs
%     PDFs with fonts embedded, this is not a concern.
%     Still, you can override the font to Arial should
%     you wish (see Part~I Section~\ref{S:usage:cffcl:fonts}).
% \end{itemize}
% \vspace{-\parskip}
% As both official fonts are sans-serif styled, a similar
% math font is preferred. For this, we load the Noto Sans Math font (if it is
% installed), with a DejaVu Math TeX Gyre fallback.
%
%
% \section*{A note on compilers}
% These \watchout class files should be ready to use with modern
% \LaTeX{} compilers \XeLaTeX{} or \LuaLaTeX{}, and \LaTeX{}2e kernel
% versions newer than October 2020 from the major \TeX{}-distributions
% (TeTeX, TexLive, MikTeX).
% Using an old \LaTeX{} + dvips setup or PDF\LaTeX{} is
% not supported due to the logo implementation. So ditch the route via DVI
% and abandon the old PDF\LaTeX{} compiler.
% If you experience other problems, please inform the author.
%
% \section*{A note on customization}
% \label{S:customization}
% We do not recommend altering the UGent house style too much, and we
% certainly do not recommend altering any of the class files directly.
% You can customize the classes by overwriting any of the commands in
% Part~\ref{P:I} in a .sty file. A recommended naming scheme is
% |<classname>-customization.sty|, e.g. |ugentphd-customization.sty|.\\
% You can then load this customization using
% |\usepackage{ugentphd-customization}|.
% The customization file can also be used to adjust fonts, add
% your own packages, or your own commands or macros in one file separate
% from your main document.
% Be sure to renew commands instead of redefining commands --
% e.g., use |\renewcommand| and |\RenewDocumentCommand|
% -- and replace any '|@@|' with '|_ugentdocs|'
% (do not replace single |@|'s!).
%
% Colours can be adjusted using, e.g.:
% {\setlength{\topsep}{0pt}\setlength{\partopsep}{0pt}
% \begin{verbatim}
% \ExplSyntaxOn
% \str_if_eq:VnTF \l__ugentdocs_colormodel_tl {cmyk} {
%   \definecolor{<customcolor>}{cmyk}{<C,M,Y,K>} % From 0 to 1
% }{
%   \definecolor{<customcolor>}{RGB}{<R,G,B>} % From 0 to 255
% }
% \ExplSyntaxOff
% \colorlet{titlecolor}{<customcolor>}
% \end{verbatim}
% }
%
% \section*{A note on references}
% \label{S:references}
% We recommend the use of the more modern |biblatex| package with the |biber| backend
% as opposed to |bibtex| and the |natbib| package.
% It can be loaded using, e.g.,
% |\usepackage[backend=biber,| |style=authoryear]{biblatex}|.
% Add a bibliography file using |\addbibresource{<filename>.bib}|,
% obtained from a reference manager such as
% Zotero (with Better BibTeX) or JabRef.
% For the most simple use, cite using |\autocite{key}| for
% parentheses or numbered citations,
% and |\textcite{key}| for in-text citations.
% Display your bibliography section using |\printbibliography|.
% Biblatex has a lot more advanced features, such as a per-chapter reference list,
% but for this we refer to the
% \href{https://ctan.org/pkg/biblatex}{biblatex package documentation}.
%
%
% \section*{\LaTeX3}
% The |ugentdocs| package relies for a large part of its codebase on
% \LaTeX3{}, for which the |expl3| package is required. The \LaTeX3{}
% constructs are never exposed directly so this has no effect on the
% user of the classes, unless you wish to customize parts (see above).
% \iffalse
%<*crs|bama|phd|rp|le|ex|bkc|bmr|art>
\RequirePackage{expl3}
%\RequirePackage[check-declarations]{expl3} % I use this during debug phase
%</crs|bama|phd|rp|le|ex|bkc|bmr|art>
% \fi
%
%
% \section*{Thanks}
% This package is derived from the excellent |uantwerpendocs| package by
% Walter Daems, Paul Levrie, and Lukas Leitner
% (\href{https://ctan.org/pkg/uantwerpendocs}{available on CTAN}).
% Version 4.12 was used as the starting point, and as such, many similarities
% can be found between the two packages, although most of the code has been
% reworked. For a complete changelog, please see the CHANGELOG.md file, or
% for even more in-depth analysis, you can browse the
% \href{\githubmain}{GitHub repository}.
% Special thanks to Joris Meys for his previous work on the LaTeX at UGent
% faculty of Bioscience Engineering templates, of which the cover text,
% chapter title, header/footer, and GAI disclaimer code has been adapted
% and integrated.
%
%
% \newpage
% \tableofcontents
% \clearpage
%
% \newgeometry{left=4.75cm,right=2cm,top=2cm,bottom=2.5cm}
%
% \renewcommand{\partname}{Part}
% \part{The paper classes}
% \label{P:I}
%
% In the following sections, we will describe the usage of the classes
% (Section~\ref{S:usage}), show the style implementation (Section~\ref{S:style})
% and show some example documents (Section~\ref{S:examples}).
% You can skip straight to the examples if you prefer and just copy-paste
% a specific class example and start using and adjusting them to your needs,
% as most functionality is explained within.
% The full package source code will \emph{not} be given here in the documentation.
% For that, you can inspect the .dtx file where this documentation
% is interwoven with the source code. The exception is any code for which
% customization is ``allowed'', i.e., it does not touch fundamental class logic.
% See the customization note on page \pageref{S:customization} for more
% information.
%
% \section{Usage}
% \label{S:usage}
%
%
% \subsection{Colours, fonts, faculties, campuses, and logos}
% \label{S:usage:cffcl}
%
% \subsubsection{Colours}
% \label{S:usage:cffcl:colours}
%
% The colours are defined in the |ugentcolors.sty| package, and are shown below:
%
% \bigskip
% \makeatletter
% \def\ugentswsize{3cm}
% \def\ugentswcols{5}
%
% \newcommand*{\ugentdrawswatch}[3]{%
%   \pgfmathtruncatemacro{\swcol}{mod(#1,\ugentswcols)}%
%   \pgfmathtruncatemacro{\swrow}{floor(#1/\ugentswcols)}%
%   \node[fill=#2, anchor=north west,
%         minimum width=\ugentswsize, minimum height=\ugentswsize]
%     (sw-#1) at
%     (\swcol*\ugentswsize+\swcol*3mm, -\swrow*\ugentswsize-\swrow*3mm) {};
%   \node[swatchtext, font=\logotextface\normalsize\selectfont,
%         text width=\ugentswsize-4mm, anchor=north west]
%     at ([xshift=2mm,yshift=-2mm]sw-#1.north west) {\nohyphens{#3}};
%   \node[swatchtext, font=\ttfamily\small, anchor=south west]
%     at ([xshift=2mm,yshift=2mm]sw-#1.south west) {#2};
% }
%
% \noindent\hspace*{-1in-\hoffset-\oddsidemargin}%
% \makebox[\paperwidth][c]{%
% \begin{tikzpicture}[
%   swatchtext/.style={text=white, align=left, inner sep=2pt}
% ]
% \foreach \key/\name [count=\i from 0] in {
%   ugent@main/{UGent Blue},
%   ugent@accent/{UGent Yellow}
% }{
%   \ugentdrawswatch{\i}{\key}{\name}
% }
% \foreach \fac [count=\i from 2] in {lw,re,we,ge,ea,eb,di,pp,bw,fw,ps}{
%   \renewcommand*{\@fselector}{\fac}%
%   \ugentdrawswatch{\i}{ugent@\fac}{\@faculty}
% }
%
% \foreach \key/\name [count=\i from 13] in {
%   lightgray/{Light gray},
%   darkgray/{Dark gray}
% }{
%   \ugentdrawswatch{\i}{\key}{\name}
% }
% \end{tikzpicture}%
% }
% \makeatother
%
% \iffalse
%<*col>
\RequirePackage{xcolor}
\ExplSyntaxOn
\str_if_eq:VnTF \l_@@_colormodel_tl {cmyk} {
  %% UGent
  \definecolor{ugent@main}    {cmyk}{1.00,0.40,0.00,0.00} % UGent Blue
  \definecolor{ugent@accent}  {cmyk}{0.00,0.10,1.00,0.00} % UGent Yellow
  %% Faculties
  \definecolor{ugent@lw}      {cmyk}{0.00,0.32,1.00,0.00} % Arts and Philosophy
  \definecolor{ugent@re}      {cmyk}{0.00,0.87,0.85,0.00} % Law and Criminology
  \definecolor{ugent@we}      {cmyk}{0.75,0.00,0.10,0.03} % Sciences
  \definecolor{ugent@ge}      {cmyk}{0.00,0.69,0.29,0.00} % Medicine and Health Sciences
  \definecolor{ugent@ea}      {cmyk}{0.49,0.13,0.00,0.00} % Engineering and Architecture
  \definecolor{ugent@eb}      {cmyk}{0.31,0.05,1.00,0.00} % Economics and Business Administration
  \definecolor{ugent@di}      {cmyk}{0.44,0.70,0.00,0.00} % Veterinary Medicine
  \definecolor{ugent@pp}      {cmyk}{0.00,0.61,0.97,0.00} % Psychology and Educational Sciences
  \definecolor{ugent@bw}      {cmyk}{0.74,0.00,0.29,0.00} % Bioscience Engineering
  \definecolor{ugent@fw}      {cmyk}{0.16,0.83,0.00,0.00} % Pharmaceutical Sciences
  \definecolor{ugent@ps}      {cmyk}{0.71,0.00,1.00,0.00} % Political and Social Sciences

  \definecolor{orcidcolor}    {cmyk}{0.40,0.00,1.00,0.00}
}{
  %% UGent
  \definecolor{ugent@main}    {RGB}{30,100,200}   % UGent Blue
  \definecolor{ugent@accent}  {RGB}{255,210,0}    % UGent Yellow
  %% Faculties
  \definecolor{ugent@lw}      {RGB}{241,164,43}   % Arts and Philosophy
  \definecolor{ugent@re}      {RGB}{220,78,40}    % Law and Criminology
  \definecolor{ugent@we}      {RGB}{45,140,168}   % Sciences
  \definecolor{ugent@ge}      {RGB}{232,94,113}   % Medicine and Health Sciences
  \definecolor{ugent@ea}      {RGB}{139,190,232}  % Engineering and Architecture
  \definecolor{ugent@eb}      {RGB}{174,176,80}   % Economics and Business Administration
  \definecolor{ugent@di}      {RGB}{130,84,145}   % Veterinary Medicine
  \definecolor{ugent@pp}      {RGB}{251,126,58}   % Psychology and Educational Sciences
  \definecolor{ugent@bw}      {RGB}{39,171,173}   % Bioscience Engineering
  \definecolor{ugent@fw}      {RGB}{190,81,144}   % Pharmaceutical Sciences
  \definecolor{ugent@ps}      {RGB}{113,168,96}   % Political and Social Sciences

  \definecolor{orcidcolor}    {RGB}{166,206,57}
}
\definecolor{lightgray}{cmyk}   {0.00,0.00,0.00,0.10}
\definecolor{darkgray}{cmyk}    {0.00,0.00,0.00,0.80}
\ExplSyntaxOff
%</col>
% \fi
%
% \newpage
% Some class options change colour handling:
%
% \DescribeOption[common]{neutralcolors}
%   \DescribeDefault{false}
%   Options: |true|, |false|\\
%   When enabled (|neutralcolors=true| or plain |neutralcolors|),
%   UGent colours override the faculty colour.
%   If the faculty option is empty (see later),
%   UGent colours will always be used.
%
% \DescribeOption[common]{colormodel}
%   \DescribeDefault{rgb}
%   Options: |rgb|, |cmyk|\\
%   These set the colour model of the faculty and UGent colours used.
%   For digital display, |rgb| is preferable.
%   Switching to |cmyk| is reserved for printing,
%   although your printing service may prefer |rgb|
%   to convert it themselves before printing.
%   Best to ask with them.
%
% \iffalse
%<*clo>
\ExplSyntaxOn
% Colours
\bool_new:N \l_@@_neutralcolors_bool
\tl_new:N \l_@@_colormodel_tl
\tl_set:Nn \l_@@_colormodel_tl {rgb}

\keys_define:nn { ugentdocs } {
  neutralcolors .bool_set:N = \l_@@_neutralcolors_bool ,
  neutralcolors .default:n = true ,
  colormodel .tl_set:N = \l_@@_colormodel_tl ,
  cmyk .code:n = { \tl_set:Nn \l_@@_colormodel_tl {cmyk} } ,
  rgb .code:n = { \tl_set:Nn \l_@@_colormodel_tl {rgb} } ,
}
\ExplSyntaxOff
%</clo>
%<*col>
\ExplSyntaxOn
\tl_if_empty:NT \l_@@_fselector_tl {
  \bool_set_true:N \l_@@_neutralcolors_bool
}

\bool_if:NTF \l_@@_neutralcolors_bool {
  \colorlet{ugent@faculty}{ugent@main}
}{
  \colorlet{ugent@faculty}{ugent@\@fselector}
}
\ExplSyntaxOff
%</col>
% \fi
%
% The documents use specific derived colours for typesetting contents:
% \begin{itemize}
%   \item \textcolor{titlecolor}{|titlecolor|} (ugent@main): chapter and section titles
%   \item \textcolor{toccolor}{|toccolor|} (black): table of contents
%   \item \textcolor{hypercolor}{|hypercolor|} (ugent@main!50!black): hyperlinks, in-text citations
%   \item \textcolor{watermarkcolor}{|watermarkcolor|} (lightgray): course, exam, and report watermarks
%   \item \textcolor{insetboxcolor}{|insetboxcolor|} (ugent@faculty): insettext and insetquote box colours
% \end{itemize}
%
% \iffalse
%<*col>
\ExplSyntaxOn
\colorlet{titlecolor}{ugent@main}
\colorlet{toccolor}{black}
\colorlet{hypercolor}{ugent@main!50!black}
\colorlet{watermarkcolor}{lightgray}
\colorlet{insetboxcolor}{ugent@faculty}
\ExplSyntaxOff
%</col>
% \fi
%
% Likewise, the cover pages set some colours, although these differ per class:
% \begin{itemize}
%   \item |covertitlecolor|: Cover title and subtitle
%   \item |coverdatacolor|: Cover data text (e.g., author, supervisors, academic year)
%   \item |coverbgcolor|: Main cover background (full page except UGent and faculty logos)
%   \item |coverareacolor|: Cover data area (in bottom left for PhDs and courses)
%   \item |spinecolor|: Spine (for PhDs and courses)
%   \item |spinetextcolor|: Spine text - title (for PhDs and courses)
%   \item |spinetextcoloralt|: Spine text - author \& year (for PhDs and courses)
% \end{itemize}
%
% \iffalse
%<*col>
\ExplSyntaxOn
\exp_args:NnV \clist_if_in:nnT { bama, report, exam } \l_@@_covertype_tl {
  \bool_if:NTF \l_@@_coverbg_bool {
    \colorlet{covertitlecolor}  {white}
    \colorlet{coverdatacolor}   {white}
    \colorlet{coverbgcolor}     {ugent@faculty}
  }{
    \colorlet{covertitlecolor}  {ugent@main}
    \colorlet{coverdatacolor}   {black}
    \colorlet{coverbgcolor}     {white}
  }
}
\str_if_eq:VnT \l_@@_covertype_tl {phd} {
  \bool_if:NTF \l_@@_bwphdcover_bool { % BW cover
    \colorlet{covertitlecolor}    {white}
    \colorlet{coverdatacolor}     {white}
    \colorlet{coverbgcolor}       {lightgray}
    \colorlet{coverareacolor}     {ugent@faculty}
    \colorlet{spinecolor}         {ugent@main}
    \colorlet{spinetextcolor}     {white}
    \colorlet{spinetextcoloralt}  {white}
  }{ % UGent cover
    \colorlet{covertitlecolor}    {ugent@faculty}
    \colorlet{coverdatacolor}     {white}
    \colorlet{coverbgcolor}       {ugent@faculty!10}
    \colorlet{coverareacolor}     {ugent@faculty}
    \colorlet{spinecolor}         {white}
    \colorlet{spinetextcolor}     {ugent@main}
    \colorlet{spinetextcoloralt}  {ugent@faculty}
  }
}
\str_if_eq:VnT \l_@@_covertype_tl {course} {
  \colorlet{covertitlecolor}    {white}
  \colorlet{coverdatacolor}     {white}
  \tl_if_empty:NTF \l_@@_fselector_tl {
    \colorlet{coverbgcolor}     {ugent@accent}
  }{
  \bool_if:NTF \l_@@_neutralcolors_bool {
    \colorlet{coverbgcolor}     {ugent@accent}
  }{
    \colorlet{coverbgcolor}     {ugent@faculty}
  }
  }
  \colorlet{coverareacolor}     {ugent@main}
  \colorlet{spinecolor}         {white}
  \colorlet{spinetextcolor}     {ugent@main}
  \colorlet{spinetextcoloralt}  {ugent@faculty}
}
\str_if_eq:VnTF \l_@@_covertype_tl {article} {
  \colorlet{covertitlecolor}  {ugent@main}
  \colorlet{coverdatacolor}   {black}
  \colorlet{firstnamecolor}   {black!50}
}{
  \colorlet{firstnamecolor}   {black!50}
}
\ExplSyntaxOff
%</col>
% \fi
%
%
% \subsubsection{Fonts}
% \label{S:usage:cffcl:fonts}
% UGent Panno Text and its Medium and SemiLight variants should always be
% installed\watchout -- and the document compiled using \LuaLaTeX{} or \XeLaTeX{}
% -- as they are used in the logo's.
% For the document itself, it is recommended to use UGent Panno Text as well,
% which is why it is set by default through
% the |\trysetsansfont[UGentPannoText-Normal]{UGent Panno Text}[...]{}| block
% below. However, Arial is also a valid official alternative and can override
% UGent Panno Text by adding the |\trysetsansfont[Arial]{Arial}[...]{}| block below to the
% beginning of your document or your customization file.
% UGent uses Arial as default for Word and PowerPoint templates
% as these are distributed outside Ghent University.
% This is not applicable for \LaTeX{} however, as PDFs are always generated,
% usually with fonts embedded.
% Thus, UGent Panno Text is the default everywhere.
%
% \begin{verbatim}
% \trysetsansfont[UGentPannoText-Normal]{UGent Panno Text}[
%   BoldFont            = *,
%   BoldFeatures        = {FakeBold=2.5},
%   ItalicFont          = *,
%   ItalicFeatures      = {FakeSlant=0.15},
%   BoldItalicFont      = *,
%   BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
% ]{}
% \tryoverridemathfont[UGentPannoText-Normal]{UGent Panno Text}{>}
% \end{verbatim}
%
% \begin{verbatim}
% \trysetsansfont[Arial]{Arial}[
%   BoldFont            = *,
%   BoldFeatures        = {FakeBold=2.5},
%   ItalicFont          = *,
%   ItalicFeatures      = {FakeSlant=0.15},
%   BoldItalicFont      = *,
%   BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
% ]{}
% \tryoverridemathfont[Arial]{Arial}{}
% \end{verbatim}
%
% To support automatically loading fonts from file or by name (whichever is found first),
% the fontspec functions are extended here with a |try| prefix.
%
% For example:\\
% |\trysetsansfont[<Font File>]{<Font Name>}[<Font Features>]{<False Code>}|\\
% first tries to find the font by a |<Font File>|, which can be, e.g.,
% |Arial| (searches for |.ttf| or |.otf|) or |Arial.ttf|.
% It searches in the main document root directory or working directory first,
% then a |fonts/| subdirectory,
% then it searches the system installed fonts by |<Font Name>|.
% If it doesn't find the font in either of those places, the |<False Code>| is run.
% The |<Font Features>| are the same you would normally use in
% |\setsansfont{<Font>}[<Font Features>]|.
% These set of functions enable the use of online editors such as Inscrive or Overleaf
% with uploaded font files.
%
% Since both the official fonts are sans-serif, we use the |unicode-math| package
% with the Noto Sans Math font if available, and the DejaVu Math TeX Gyre
% font otherwise. You can override these fonts by using:\\
% |\trysetmathfont[<Font File>]{<Font Name>}[<Font Features>]{<False Code>}|.
%
% If you want to set the letters and numbers of the math font to a different font,
% use the\\
% |\tryoverridemathfont[<Font File>]{<Font Name>}[<Font Features>]{<False Code>}|\\
% macro. This is executed by default when loading the fonts at class load.\\
% Use |\tryoverridemathfont{}{}| to use the math font's own glyphs.
%
% \iffalse
%<*clo>
% Fonts
\RequirePackage{iftex}
\iftutex
\ExplSyntaxOn
\tl_new:N \g_@@_mathletter_font_tl
\tl_new:N \g_@@_mathletter_opts_tl
\tl_new:N \l_@@_try_name_tl
\tl_new:N \l_@@_try_opts_tl
\bool_new:N \l_@@_try_found_bool

% Override letters and numbers from math font with font #1
\cs_new_protected:Npn \@@_math_letters:nn #1#2 {
  \tl_if_empty:nF {#1} {
    \setmathfont {#1} [ #2
    range = { up/{latin,Latin,num}, sfup/{latin,Latin,num} } ]
    \setmathfont {#1} [ #2 FakeSlant = 0.15 ,
    range = { it/{latin,Latin}, sfit/{latin,Latin} } ]
    \setmathfont {#1} [ #2 FakeBold = 2.5 ,
    range = { bfup/{latin,Latin,num}, bfsfup/{latin,Latin,num} } ]
    \setmathfont {#1} [ #2 FakeBold = 2.5 , FakeSlant = 0.15 ,
    range = { bfit/{latin,Latin}, bfsfit/{latin,Latin} } ]
  }
}
\cs_generate_variant:Nn \@@_math_letters:nn { VV }


% Probe directory #1 for file #2, as given or with a font extension
\cs_new_protected:Npn \@@_try_file:nn #1#2 {
  \tl_map_inline:nn { {} {.otf} {.ttf} {.OTF} {.TTF} } {
    \bool_if:NF \l_@@_try_found_bool {
      \file_if_exist:nT { #1 #2 ##1 } {
        \tl_set:Nn \l_@@_try_name_tl { #2 ##1 }
        \tl_if_empty:nF {#1} { \tl_set:Nn \l_@@_try_opts_tl { Path = #1 , } }
        \bool_set_true:N \l_@@_try_found_bool
      }
    }
  }
}
\cs_generate_variant:Nn \@@_try_file:nn { ne }

% Find a font: file #1 in the doc dir or fonts/, else system font #2
\cs_new_protected:Npn \@@_try_font:nn #1#2 {
  \bool_set_false:N \l_@@_try_found_bool
  \tl_clear:N \l_@@_try_opts_tl
  \tl_if_blank:nF {#1} {
    \tl_map_inline:nn { {} {fonts/} } {
      \@@_try_file:nn {##1} {#1}
      \@@_try_file:ne {##1} { \str_lowercase:n {#1} }
      \@@_try_file:ne {##1} { \str_uppercase:n {#1} }
    }
  }
  \bool_if:NF \l_@@_try_found_bool {
    \IfFontExistsTF {#2} {
      \tl_set:Nn \l_@@_try_name_tl {#2}
      \bool_set_true:N \l_@@_try_found_bool
    } { }
  }
}

% #1 load command, #2 file, #3 name, #4 fontspec options, #5 false code
\cs_new_protected:Npn \@@_load:nnnn #1#2#3#4 { #1 {#2} [ #3 #4 ] }
\cs_generate_variant:Nn \@@_load:nnnn { nVVn }
\cs_new_protected:Npn \@@_try_load:nnnnn #1#2#3#4#5 {
  \@@_try_font:nn {#2} {#3}
  \bool_if:NTF \l_@@_try_found_bool {
    \@@_load:nVVn {#1} \l_@@_try_name_tl \l_@@_try_opts_tl {#4}
  }{
    #5
  }
}

% \trysetsansfont[<file>]{<name>}[<fontspec options>]{<false code>}
\NewDocumentCommand \trysetsansfont { O{} m O{} m }
{ \@@_try_load:nnnnn { \setsansfont } {#1} {#2} {#3} {#4} }
% \trynewfontfamily<cs>[<file>]{<name>}[<fontspec options>]{<false code>}
\NewDocumentCommand \trynewfontfamily { m O{} m O{} m }
{ \@@_try_load:nnnnn { \newfontfamily #1 } {#2} {#3} {#4} {#5} }
% \trynewfontface<cs>[<file>]{<name>}[<fontspec options>]{<false code>}
\NewDocumentCommand \trynewfontface { m O{} m O{} m }
{ \@@_try_load:nnnnn { \newfontface #1 } {#2} {#3} {#4} {#5} }
% \trysetmathfont[<file>]{<name>}[<fontspec options>]{<false code>}
\NewDocumentCommand \trysetmathfont { O{} m O{} m }
{ \@@_try_load:nnnnn { \setmathfont } {#1} {#2} {#3} {#4} }

% Override numbers/letters from math font with specified font
\NewDocumentCommand \overridemathfont { m } {
  \tl_gset:Nn \g_@@_mathletter_font_tl {#1}
  \tl_gclear:N \g_@@_mathletter_opts_tl
}
% \tryoverridemathfont[<file>]{<name>}{<false code>}
\NewDocumentCommand \tryoverridemathfont { O{} m m } {
  \@@_try_font:nn {#1} {#2}
  \bool_if:NTF \l_@@_try_found_bool {
    \tl_gset_eq:NN \g_@@_mathletter_font_tl \l_@@_try_name_tl
    \tl_gset_eq:NN \g_@@_mathletter_opts_tl \l_@@_try_opts_tl
  } {#3}
}
\@onlypreamble \overridemathfont
\@onlypreamble \tryoverridemathfont

\AddToHook { begindocument / before } {
  \@@_math_letters:VV \g_@@_mathletter_font_tl \g_@@_mathletter_opts_tl
}
\ExplSyntaxOff

\newcommand{\@loadfonts}{
  \RequirePackage{fontspec}
  \trysetsansfont[UGentPannoText-Normal]{UGent Panno Text}[
    BoldFont            = *,
    BoldFeatures        = {FakeBold=2.5},
    ItalicFont          = *,
    ItalicFeatures      = {FakeSlant=0.15},
    BoldItalicFont      = *,
    BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
  ]{%
    \trysetsansfont[Arial]{Arial}[
      BoldFont            = *,
      BoldFeatures        = {FakeBold=2.5},
      ItalicFont          = *,
      ItalicFeatures      = {FakeSlant=0.15},
      BoldItalicFont      = *,
     BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
    ]{%
      \PackageWarning{ugentdocs}
      {Neither UGent Panno Text nor Arial are installed, no font set!}%
    }%
  }
  \tryoverridemathfont[UGentPannoText-Normal]{UGent Panno Text}{%
    \tryoverridemathfont[Arial]{Arial}{}%
  }

  \RequirePackage
  [mathrm = sym,mathup = sym,mathbf = sym,mathit = sym, mathsf = sym]
  {unicode-math}
  \trysetmathfont[NotoSansMath-Regular]{Noto Sans Math}[Scale = 0.9]{%
    \trysetmathfont{DejaVuMathTeXGyre}[DejaVu Math TeX Gyre]{}%
  }

  \renewcommand{\familydefault}{\sfdefault}
}

\AtBeginDocument{
  \trynewfontface\logotextface
  [UGentPannoText-Medium]{UGent Panno Text Medium}[LetterSpace=-0.75]{%
    \PackageError{ugentdocs}
    {UGent Panno Text Medium is required for logo typesetting}
    {See the ugentdocs manual}
  }
  \trynewfontface\logosubtextface
  [UGentPannoText-SemiLight]{UGent Panno Text SemiLight}[LetterSpace=0.1]{%
    \PackageError{ugentdocs}
    {UGent Panno Text SemiLight is required for logo typesetting}
    {See the ugentdocs manual}
  }
}
\else
\PackageError{ugentdocs}{Only LuaLaTeX or XeLaTeX is supported for compilation}
{See the ugentdocs manual}
\fi

% Small caps for fontspec fonts
\newcommand\fakesc[1]{\textschelper#1 \relax\relax}
\def\textschelper#1 #2\relax{%
  \textschelphelp#1\relax\relax%
  \if\relax#2\relax\else\ \textschelper#2\relax\fi%
}
\def\Hscale{.83}\def\Vscale{.72}\def\Cscale{1.00}
\def\textschelphelp#1#2\relax{%
  \ifnum`#1=\lccode`#1\relax\scalebox{\Hscale}[\Vscale]{\char\uccode`#1}\else%
  \scalebox{\Cscale}[1]{#1}\fi%
  \ifx\relax#2\relax\else\textschelphelp#2\relax\fi}

% Sample math
\newcommand{\samplemath}{%
  \[
  \int_0^\infty e^{-x^2}\,\mathrm{d}x = \frac{\sqrt{\pi}}{2}
  \qquad
  \sum_{k=1}^{n} k = \frac{n(n+1)}{2}
  \qquad
  \alpha + \beta \le \gamma \;\Rightarrow\; \Omega \in \mathbb{R}
  \]
  \[
  \mathcal{F}(\omega) = \int_{-\infty}^{\infty} f(t)\, e^{-i \omega t}\, \mathrm{d}t
  \qquad
  \mathbf{v} \cdot \mathbf{w} = \lVert \mathbf{v} \rVert\, \lVert \mathbf{w} \rVert \cos\theta
  \]
}
%</clo>
% \fi
%
% Font examples:
% \begingroup\renewcommand{\familydefault}{\sfdefault}
% \begin{itemize}
%   \item {
%     \trysetsansfont[UGentPannoText-Normal]{UGent Panno Text}[
%       BoldFont            = {UGent Panno Text},
%       BoldFeatures        = {FakeBold=2.5},
%       ItalicFont          = {UGent Panno Text},
%       ItalicFeatures      = {FakeSlant=0.15},
%       BoldItalicFont      = {UGent Panno Text},
%       BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
%     ]{}
%     UGent Panno Text: \textbf{bold}, \textit{italic}, \textbf{\textit{bolditalic}}, and \fakesc{Fake Small Caps}
%   }
%   \item {
%     \trysetsansfont[UGentPannoText-Medium]{UGent Panno Text Medium}[
%       BoldFont            = *,
%       BoldFeatures        = {FakeBold=2.5},
%       ItalicFont          = *,
%       ItalicFeatures      = {FakeSlant=0.15},
%       BoldItalicFont      = *,
%       BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
%     ]{}
%     UGent Panno Text Medium: \textbf{bold}, \textit{italic}, \textbf{\textit{bolditalic}}, and \fakesc{Fake Small Caps}
%   }
%   \item {
%     \trysetsansfont[UGentPannoText-SemiLight]{UGent Panno Text SemiLight}[
%       BoldFont            = *,
%       BoldFeatures        = {FakeBold=2.5},
%       ItalicFont          = *,
%       ItalicFeatures      = {FakeSlant=0.15},
%       BoldItalicFont      = *,
%       BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
%     ]{}
%     UGent Panno Text SemiLight: \textbf{bold}, \textit{italic}, \textbf{\textit{bolditalic}}, and \fakesc{Fake Small Caps}
%   }
%   \item {
%     \trysetsansfont[Arial]{Arial}[
%       BoldFont            = *,
%       BoldFeatures        = {FakeBold=2.5},
%       ItalicFont          = *,
%       ItalicFeatures      = {FakeSlant=0.15},
%       BoldItalicFont      = *,
%       BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
%     ]{}
%     Arial: \textbf{bold}, \textit{italic}, \textbf{\textit{bolditalic}}, and \textsc{Small Caps}
%   }
%   \item {
%     \trysetmathfont[NotoSansMath-Regular]{Noto Sans Math}[Scale=0.9]{}
%     Noto Sans Math:\\ \samplemath
%   }
%   \item {
%     \trysetmathfont[DejaVuMathTeXGyre]{DejaVu Math TeX Gyre}{}
%     DejaVu Math TeX Gyre:\\ \samplemath
%   }
% \end{itemize}
% \endgroup
%
% \subsubsection{Faculty}
% \label{S:usage:cffcl:faculty}
%
% Faculties determine colour, logos, in some cases specific cover types (such as
% BW for PhDs), and the faculty name used throughout the documents. The UGent
% faculties are:
%
% \makeatletter
% \ExplSyntaxOn
% \tl_clear_new:N \l__ugentdocs_facultyrows_tl
% \clist_map_inline:nn { lw,re,we,ge,ea,eb,di,pp,bw,fw,ps } {
%   \tl_put_right:Nn \l__ugentdocs_facultyrows_tl {
%     \texttt{#1} & \translatekey{org-#1} &  \foreignlanguage{dutch}{\translatekey{org-#1}}\\
%   }
% }
% \begin{center}\small
%   \begin{tabular}{cp{6cm}p{6.5cm}}
%     \toprule
%     Option & Faculty~(EN) & Faculty~(NL) \\
%     \midrule
%     \l__ugentdocs_facultyrows_tl
%     \bottomrule
%   \end{tabular}
% \end{center}
% \ExplSyntaxOff
% \makeatother
%
% \iffalse
%<*clo>
% Faculty: initializing variables
\ExplSyntaxOn
\tl_new:N \l_@@_fselector_tl
\newcommand*\@fselector{}
\newcommand*\@ficonpath{}

\NewDocumentCommand{\@flogotext}{}{
  \tl_set:Nx \l_@@_lookup_key_tl { \languagename {} : facultyof }
  \translatekey[uppercase]{faculty}{}%
  \tl_if_empty:eF { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl }
  {~\translatekey[uppercase]{facultyof}}%
  {~\translatekey[uppercase,expand]{org-\@fselector}}%
}
\newcommand*\@flogosubtext{~}

\newlength\@logounit          \setlength\@logounit          {0.75cm}
\newlength\@ficonw            \setlength\@ficonw            {\@logounit}
\newlength\@flogospace        \setlength\@flogospace        {0.116cm}
\newlength\@ftextmarginextra  \setlength\@ftextmarginextra  {0mm}
\newlength\@ftextwen
\newlength\@ftextwnl
%</clo>
% \fi
%
% \DescribeOption[common]{faculty}
%   \DescribeDefault{empty}
%   Options: |lw|, |re|, |we|, |ge|, |ea|, |eb|, |di|, |pp|, |bw|, |fw|, |ps|\\
%   Used as, e.g., |faculty=bw|, but also plain |bw| works. Sets the faculty selector
%   (|\@fselector|) to this value, which is used to determine the faculty
%   text (for both EN and NL) and colour.
%   Also loads the faculty icon and its width, the faculty logo text format (newline behaviour),
%   the faculty logo text width (for both EN and NL), and any additional text spacing
%   needed.\\
%   An empty faculty will not print the logo, faculty name, or acronym, and will
%   extend the cover or beamer slide background to the top.
%
% \iffalse
%<*clo>
% Faculty: class options
\keys_define:nn { ugentdocs } {
  faculty .choice:,
  bw .meta:n = { faculty = bw },
  faculty / bw .code:n = {
    \renewcommand*\@fselector{bw}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (10.63, 13.2).. controls (9.21, 13.2) and (8.06, 12.05) .. (8.06, 10.63).. controls (8.06, 9.21) and (9.21, 8.06) .. (10.63, 8.06).. controls (12.05, 8.06) and (13.2, 9.21) .. (13.2, 10.63).. controls (13.2, 12.05) and (12.05, 13.2) .. (10.63, 13.2) -- cycle(11.95, 10.63).. controls (11.95, 9.9) and (11.36, 9.31) .. (10.63, 9.31).. controls (9.9, 9.31) and (9.3, 9.9) .. (9.3, 10.63).. controls (9.3, 11.36) and (9.9, 11.96) .. (10.63, 11.96).. controls (11.36, 11.96) and (11.95, 11.36) .. (11.95, 10.63);
      \path[nonzero~rule,line~width=0.1pt] (16.01, 20.1).. controls (14.59, 20.1) and (13.44, 18.95) .. (13.44, 17.53).. controls (13.44, 16.11) and (14.59, 14.96) .. (16.01, 14.96).. controls (17.43, 14.96) and (18.58, 16.11) .. (18.58, 17.53).. controls (18.58, 18.95) and (17.43, 20.1) .. (16.01, 20.1) -- cycle(17.34, 17.53).. controls (17.34, 16.8) and (16.74, 16.2) .. (16.01, 16.2).. controls (15.28, 16.2) and (14.69, 16.8) .. (14.69, 17.53).. controls (14.69, 18.26) and (15.28, 18.85) .. (16.01, 18.85).. controls (16.74, 18.85) and (17.34, 18.26) .. (17.34, 17.53);
      \path[nonzero~rule,line~width=0.1pt] (10.63, 20.01).. controls (10.92, 20.01) and (11.2, 19.99) .. (11.49, 19.97) -- (11.6, 21.21).. controls (11.28, 21.24) and (10.96, 21.26) .. (10.63, 21.26).. controls (4.76, 21.26) and (-0.0, 16.5) .. (-0.0, 10.63).. controls (-0.0, 4.76) and (4.76, 0.0) .. (10.63, 0.0).. controls (16.5, 0.0) and (21.26, 4.76) .. (21.26, 10.63).. controls (21.26, 11.86) and (21.04, 13.04) .. (20.66, 14.14) -- (19.48, 13.72).. controls (19.82, 12.75) and (20.01, 11.72) .. (20.01, 10.63).. controls (20.01, 5.45) and (15.81, 1.25) .. (10.63, 1.25).. controls (5.45, 1.25) and (1.25, 5.45) .. (1.25, 10.63).. controls (1.25, 15.81) and (5.45, 20.01) .. (10.63, 20.01);
      \path[nonzero~rule,line~width=0.1pt] (10.63, 17.52).. controls (10.84, 17.52) and (11.05, 17.51) .. (11.26, 17.49) -- (11.37, 18.73).. controls (11.13, 18.75) and (10.88, 18.77) .. (10.63, 18.77).. controls (6.14, 18.77) and (2.49, 15.12) .. (2.49, 10.63).. controls (2.49, 6.14) and (6.14, 2.49) .. (10.63, 2.49).. controls (15.12, 2.49) and (18.77, 6.14) .. (18.77, 10.63).. controls (18.77, 11.57) and (18.6, 12.47) .. (18.3, 13.31) -- (17.13, 12.9).. controls (17.38, 12.19) and (17.52, 11.43) .. (17.52, 10.63).. controls (17.52, 6.83) and (14.43, 3.74) .. (10.63, 3.74).. controls (6.83, 3.74) and (3.74, 6.83) .. (3.74, 10.63).. controls (3.74, 14.43) and (6.83, 17.52) .. (10.63, 17.52);
    }
    \RenewDocumentCommand{\@flogotext}{}{
      \translatekey[uppercase]{faculty}%
      \tl_set:Nx \l_@@_lookup_key_tl { \languagename {} : facultyof }
      \tl_if_empty:eF { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl }
      {~\translatekey[uppercase]{facultyof}}\newline%
      {~\translatekey[uppercase,expand]{org-\@fselector}}%
    }
    \setlength\@ftextwen{6\@logounit}
    \setlength\@ftextwnl{8\@logounit}
  },
  di .meta:n = { faculty = di },
  faculty / di .code:n = {
    \renewcommand*\@fselector{di}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (9.23, 8.22).. controls (6.84, 6.21) and (5.24, 3.3) .. (4.99, -0.0) -- (6.24, -0.0).. controls (6.49, 2.92) and (7.92, 5.5) .. (10.04, 7.28) -- (9.23, 8.22);
      \path[nonzero~rule,line~width=0.1pt] (11.14, 12.31).. controls (6.3, 10.2) and (2.84, 5.53) .. (2.49, -0.0) -- (3.74, -0.0).. controls (4.09, 5.02) and (7.25, 9.27) .. (11.66, 11.18) -- (11.14, 12.31);
      \path[nonzero~rule,line~width=0.1pt] (16.57, 20.06) -- (12.45, 15.4).. controls (5.54, 13.53) and (0.4, 7.4) .. (-0.0, -0.0) -- (1.25, -0.0).. controls (1.65, 6.96) and (6.58, 12.7) .. (13.14, 14.31) -- (15.93, 17.46) -- (19.66, 2.47) -- (16.55, 2.47) -- (13.6, 6.0) -- (12.64, 5.21) -- (15.97, 1.22) -- (21.26, 1.22) -- (16.57, 20.06);
    }
    \renewcommand*\@flogosubtext{accredited~by~EAEVE}
    \setlength\@ftextwen{5\@logounit}
    \setlength\@ftextwnl{5\@logounit}
  },
  ea .meta:n = { faculty = ea },
  faculty / ea .code:n = {
    \renewcommand*\@fselector{ea}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (0.0, 0.0) -- (1.25, 0.0) -- (1.25, 3.68) -- (0.0, 3.68) -- (0.0, 0.0);
      \path[nonzero~rule,line~width=0.1pt] (2.49, 0.0) -- (3.74, 0.0) -- (3.74, 8.22) -- (2.49, 8.22) -- (2.49, 0.0);
      \path[nonzero~rule,line~width=0.1pt] (4.99, 0.0) -- (6.24, 0.0) -- (6.24, 12.76) -- (4.99, 12.76) -- (4.99, -0.0);
      \path[nonzero~rule,line~width=0.1pt] (8.33, 21.26) -- (7.48, 21.26) -- (7.48, 0.0) -- (8.73, 0.0) -- (8.73, 19.09) -- (15.76, 12.06) -- (15.76, -0.0) -- (17.01, -0.0) -- (17.01, 12.58) -- (8.33, 21.26);
    }
    \setlength\@ficonw{0.6cm}
    \setlength\@ftextwen{6\@logounit}
    \setlength\@ftextwnl{9\@logounit}
    \setlength\@ftextmarginextra{0.1cm}
  },
  re .meta:n = { faculty = re },
  faculty / re .code:n = {
    \renewcommand*\@fselector{re}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (8.66, 4.99) -- (4.92, 13.18) -- (3.73, 13.18) -- (-0.0, 4.99) -- (1.37, 4.99) -- (4.33, 11.48) -- (7.29, 4.99) -- (8.66, 4.99);
      \path[nonzero~rule,line~width=0.1pt] (21.26, 4.99) -- (17.53, 13.18) -- (16.34, 13.18) -- (12.6, 4.99) -- (13.97, 4.99) -- (16.93, 11.48) -- (19.89, 4.99) -- (21.26, 4.99);
      \path[nonzero~rule,line~width=0.1pt] (8.66, 1.25) -- (-0.0, 1.25) -- (1.25, 0.0) -- (7.41, 0.0) -- (8.66, 1.25);
      \path[nonzero~rule,line~width=0.1pt] (21.26, 1.25) -- (12.6, 1.25) -- (13.85, -0.0) -- (20.01, -0.0) -- (21.26, 1.25);
      \path[nonzero~rule,line~width=0.1pt] (8.66, 3.74) -- (-0.0, 3.74) -- (-0.0, 2.49) -- (8.66, 2.49) -- (8.66, 3.74);
      \path[nonzero~rule,line~width=0.1pt] (4.3, 14.42) -- (16.96, 14.42) -- (16.39, 15.67) -- (4.87, 15.67) -- (4.3, 14.42);
      \path[nonzero~rule,line~width=0.1pt] (21.26, 3.74) -- (12.6, 3.74) -- (12.6, 2.49) -- (21.26, 2.49) -- (21.26, 3.74);
      \path[nonzero~rule,line~width=0.1pt] (12.6, 21.26) -- (8.66, 21.26) -- (8.66, 20.01) -- (10.01, 20.01) -- (10.01, 16.92) -- (11.25, 16.92) -- (11.25, 20.01) -- (12.6, 20.01) -- (12.6, 21.26);
    }
    \RenewDocumentCommand{\@flogotext}{}{
      \translatekey[uppercase]{faculty}{}%
      \tl_set:Nx \l_@@_lookup_key_tl { \languagename {} : facultyof }
      \tl_if_empty:eF { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl }
      {~\translatekey[uppercase]{facultyof}}\newline%
      {~\translatekey[uppercase,expand]{org-\@fselector}}%
    }
    \setlength\@ftextwen{5\@logounit}
    \setlength\@ftextwnl{6\@logounit}
    \setlength\@ftextmarginextra{0.1cm}
  },
  we .meta:n = { faculty = we },
  faculty / we .code:n = {
    \renewcommand*\@fselector{we}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (9.96, 6.85).. controls (9.33, 6.47) and (8.61, 6.24) .. (7.82, 6.24).. controls (5.57, 6.24) and (3.74, 8.06) .. (3.74, 10.32).. controls (3.74, 11.78) and (4.53, 13.05) .. (5.69, 13.77) -- (4.79, 14.67).. controls (3.41, 13.71) and (2.49, 12.13) .. (2.49, 10.32).. controls (2.49, 7.37) and (4.88, 4.99) .. (7.82, 4.99).. controls (9.44, 4.99) and (10.86, 5.72) .. (11.84, 6.85) -- (9.96, 6.85);
      \path[nonzero~rule,line~width=0.1pt] (13.4, 6.85).. controls (12.24, 4.99) and (10.18, 3.74) .. (7.82, 3.74).. controls (4.19, 3.74) and (1.25, 6.69) .. (1.25, 10.32).. controls (1.25, 12.47) and (2.29, 14.37) .. (3.89, 15.57) -- (3.0, 16.46).. controls (1.18, 15.02) and (-0.0, 12.81) .. (-0.0, 10.32).. controls (-0.0, 6.0) and (3.5, 2.49) .. (7.82, 2.49).. controls (10.9, 2.49) and (13.55, 4.27) .. (14.83, 6.85) -- (13.4, 6.85);
      \path[nonzero~rule,line~width=0.1pt] (2.6, 18.62) -- (7.21, 14.01) -- (8.09, 14.89) -- (3.48, 19.5) -- (2.6, 18.62);
      \path[nonzero~rule,line~width=0.1pt] (4.36, 20.38) -- (8.97, 15.77) -- (9.86, 16.65) -- (5.25, 21.26) -- (4.36, 20.38);
      \path[nonzero~rule,line~width=0.1pt] (8.09, 13.12) -- (8.98, 12.24) -- (11.62, 14.89) -- (10.74, 15.77) -- (8.09, 13.12);
      \path[nonzero~rule,line~width=0.1pt] (9.63, 8.1) -- (15.87, 8.1) -- (15.87, 9.34) -- (9.63, 9.34) -- (9.63, 8.1);
      \path[nonzero~rule,line~width=0.1pt] (2.53, 0.0) -- (13.12, 0.0) -- (11.87, 1.25) -- (3.78, 1.25) -- (2.53, 0.0);
    }
    \setlength\@ficonw{0.56cm}
    \RenewDocumentCommand{\@flogotext}{}{
      \translatekey[uppercase]{faculty}\newline%
      \tl_set:Nx \l_@@_lookup_key_tl { \languagename {} : facultyof }
      \tl_if_empty:eF { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl }
      {~\translatekey[uppercase]{facultyof}}%
      {~\translatekey[uppercase,expand]{org-\@fselector}}%
    }
    \setlength\@ftextwen{3\@logounit}
    \setlength\@ftextwnl{4\@logounit}
  },
  pp .meta:n = { faculty = pp },
  faculty / pp .code:n = {
    \renewcommand*\@fselector{pp}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (15.86, 14.19).. controls (15.86, 14.27) and (15.88, 14.35) .. (15.88, 14.43).. controls (15.88, 18.2) and (12.82, 21.26) .. (9.05, 21.26).. controls (5.28, 21.26) and (2.22, 18.2) .. (2.22, 14.43).. controls (2.22, 12.92) and (2.72, 11.54) .. (3.55, 10.41) -- (4.56, 8.96) -- (0.0, 0.0) -- (1.4, 0.0) -- (6.01, 9.07) -- (4.56, 11.14).. controls (3.88, 12.07) and (3.47, 13.2) .. (3.47, 14.43).. controls (3.48, 17.51) and (5.97, 20.01) .. (9.05, 20.01).. controls (12.13, 20.01) and (14.62, 17.51) .. (14.63, 14.43).. controls (14.63, 14.28) and (14.6, 14.13) .. (14.59, 13.99) -- (14.59, 13.99) -- (14.59, 13.98) -- (15.89, 11.05) -- (14.34, 11.05) -- (13.72, 6.96) -- (11.59, 6.96) -- (10.96, 5.72) -- (14.79, 5.72) -- (15.42, 9.8) -- (17.2, 9.8) -- (17.57, 10.32) -- (15.86, 14.19);
      \path[nonzero~rule,line~width=0.1pt] (7.46, 9.18) -- (2.79, 0.0) -- (4.19, 0.0) -- (8.91, 9.29) -- (6.57, 12.62).. controls (6.19, 13.13) and (5.97, 13.75) .. (5.96, 14.43).. controls (5.97, 16.13) and (7.35, 17.51) .. (9.05, 17.52).. controls (9.08, 17.52) and (9.1, 17.51) .. (9.13, 17.51) -- (9.13, 18.76).. controls (9.1, 18.76) and (9.08, 18.77) .. (9.05, 18.77).. controls (6.66, 18.76) and (4.72, 16.83) .. (4.72, 14.43).. controls (4.72, 13.48) and (5.04, 12.6) .. (5.56, 11.88) -- (7.46, 9.18);
    }
    \setlength\@ficonw{0.62cm}
    \setlength\@ftextwen{6\@logounit}
    \setlength\@ftextwnl{7\@logounit}
    \setlength\@ftextmarginextra{0.35cm}
  },
  lw .meta:n = { faculty = lw },
  faculty / lw .code:n = {
    \renewcommand*\@fselector{lw}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (11.25, 7.21).. controls (11.62, 7.42) and (12.05, 7.54) .. (12.5, 7.54) -- (20.01, 7.54) -- (20.01, 20.01) -- (12.5, 20.01).. controls (11.81, 20.01) and (11.25, 19.45) .. (11.25, 18.77) -- cycle(10.01, 18.77).. controls (10.01, 19.45) and (9.45, 20.01) .. (8.76, 20.01) -- (1.25, 20.01) -- (1.25, 7.54) -- (8.76, 7.54).. controls (9.21, 7.54) and (9.64, 7.42) .. (10.01, 7.21) -- cycle(8.76, 6.29) -- (-0.0, 6.29) -- (-0.0, 21.26) -- (8.76, 21.26).. controls (9.51, 21.26) and (10.17, 20.92) .. (10.63, 20.4).. controls (11.09, 20.92) and (11.75, 21.26) .. (12.5, 21.26) -- (21.26, 21.26) -- (21.26, 6.29) -- (12.5, 6.29).. controls (11.75, 6.29) and (11.09, 5.97) .. (10.63, 5.45).. controls (10.17, 5.97) and (9.51, 6.29) .. (8.76, 6.29);
      \path[nonzero~rule,line~width=0.1pt] (8.76, 5.05).. controls (9.51, 5.05) and (10.17, 4.72) .. (10.63, 4.2).. controls (11.09, 4.72) and (11.75, 5.05) .. (12.5, 5.05) -- (21.26, 5.05) -- (20.01, 3.8) -- (12.5, 3.8).. controls (11.75, 3.8) and (11.09, 3.47) .. (10.63, 2.96).. controls (10.17, 3.47) and (9.51, 3.8) .. (8.76, 3.8) -- (1.25, 3.8) -- (-0.0, 5.05) -- (8.76, 5.05);
      \path[nonzero~rule,line~width=0.1pt] (8.76, 17.52) -- (2.49, 17.52) -- (2.49, 16.27) -- (8.76, 16.27) -- (8.76, 17.52);
      \path[nonzero~rule,line~width=0.1pt] (8.76, 15.02) -- (2.49, 15.02) -- (2.49, 13.78) -- (8.76, 13.78) -- (8.76, 15.02);
      \path[nonzero~rule,line~width=0.1pt] (8.76, 12.53) -- (2.49, 12.53) -- (2.49, 11.28) -- (8.76, 11.28) -- (8.76, 12.53);
    }
    \setlength\@ftextwen{4\@logounit}
    \setlength\@ftextwnl{5\@logounit}
  },
  eb .meta:n = { faculty = eb },
  faculty / eb .code:n = {
    \renewcommand*\@fselector{eb}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (12.47, 7.95) -- (12.47, 2.49) -- (13.72, 2.49) -- (13.72, 7.95) -- (12.47, 7.95);
      \path[nonzero~rule,line~width=0.1pt] (9.98, 15.91) -- (9.98, 2.49) -- (11.23, 2.49) -- (11.23, 15.91) -- (9.98, 15.91);
      \path[nonzero~rule,line~width=0.1pt] (7.48, 13.26) -- (7.48, 2.49) -- (8.73, 2.49) -- (8.73, 13.26) -- (7.48, 13.26);
      \path[nonzero~rule,line~width=0.1pt] (4.99, 9.28) -- (4.99, 2.49) -- (6.24, 2.49) -- (6.24, 9.28) -- (4.99, 9.28);
      \path[nonzero~rule,line~width=0.1pt] (2.49, 13.26) -- (2.49, 2.49) -- (3.74, 2.49) -- (3.74, 13.26) -- (2.49, 13.26);
      \path[nonzero~rule,line~width=0.1pt] (17.52, 1.25) -- (1.25, 1.25) -- (1.25, 21.26) -- (0.0, 21.26) -- (0.0, -0.0) -- (18.77, -0.0) -- (17.52, 1.25);
    }
    \setlength\@ficonw{0.662cm}
    \setlength\@ftextwen{6\@logounit}
    \setlength\@ftextwnl{5\@logounit}
    \setlength\@ftextmarginextra{0.25cm}
  },
  ps .meta:n = { faculty = ps },
  faculty / ps .code:n = {
    \renewcommand*\@fselector{ps}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (10.0, 2.5) -- (10.0, 3.75).. controls (8.04, 3.93) and (6.19, 4.94) .. (4.99, 6.64) -- (3.91, 6.02).. controls (5.35, 3.92) and (7.61, 2.68) .. (10.0, 2.5);
      \path[nonzero~rule,line~width=0.1pt] (10.0, 1.25).. controls (7.18, 1.44) and (4.5, 2.9) .. (2.84, 5.39) -- (1.76, 4.77).. controls (3.66, 1.88) and (6.75, 0.19) .. (10.0, -0.0) -- (10.0, 1.25);
      \path[nonzero~rule,line~width=0.1pt] (10.0, 5.01) -- (10.0, 6.28).. controls (8.91, 6.44) and (7.9, 6.99) .. (7.18, 7.9) -- (6.08, 7.27).. controls (7.04, 5.96) and (8.47, 5.18) .. (10.0, 5.01);
      \path[nonzero~rule,line~width=0.1pt] (3.29, 7.09) -- (4.38, 7.72).. controls (3.55, 9.5) and (3.5, 11.62) .. (4.37, 13.5) -- (3.29, 14.12).. controls (2.2, 11.84) and (2.25, 9.25) .. (3.29, 7.09);
      \path[nonzero~rule,line~width=0.1pt] (2.2, 6.47).. controls (0.96, 9.0) and (0.89, 12.06) .. (2.21, 14.75) -- (1.13, 15.37).. controls (-0.42, 12.28) and (-0.33, 8.76) .. (1.12, 5.85) -- (2.2, 6.47);
      \path[nonzero~rule,line~width=0.1pt] (5.46, 8.35) -- (6.56, 8.98).. controls (6.16, 10.01) and (6.13, 11.16) .. (6.56, 12.24) -- (5.46, 12.87).. controls (4.81, 11.39) and (4.85, 9.75) .. (5.46, 8.35);
      \path[nonzero~rule,line~width=0.1pt] (17.96, 14.12) -- (16.87, 13.5).. controls (17.7, 11.71) and (17.75, 9.6) .. (16.87, 7.72) -- (17.95, 7.09).. controls (19.05, 9.38) and (18.99, 11.96) .. (17.96, 14.12);
      \path[nonzero~rule,line~width=0.1pt] (19.04, 14.75).. controls (20.29, 12.21) and (20.36, 9.16) .. (19.03, 6.47) -- (20.11, 5.85).. controls (21.67, 8.94) and (21.58, 12.46) .. (20.12, 15.37) -- (19.04, 14.75);
      \path[nonzero~rule,line~width=0.1pt] (15.79, 12.87) -- (14.69, 12.23).. controls (15.09, 11.21) and (15.12, 10.05) .. (14.69, 8.98) -- (15.79, 8.34).. controls (16.44, 9.82) and (16.4, 11.46) .. (15.79, 12.87);
      \path[nonzero~rule,line~width=0.1pt] (17.34, 6.01) -- (16.25, 6.64).. controls (15.11, 5.03) and (13.31, 3.94) .. (11.25, 3.75) -- (11.25, 2.5).. controls (13.77, 2.7) and (15.98, 4.04) .. (17.34, 6.01);
      \path[nonzero~rule,line~width=0.1pt] (18.42, 5.39).. controls (16.84, 3.04) and (14.24, 1.45) .. (11.25, 1.26) -- (11.25, 0.01).. controls (14.7, 0.21) and (17.7, 2.04) .. (19.5, 4.76) -- (18.42, 5.39);
      \path[nonzero~rule,line~width=0.1pt] (15.16, 7.27) -- (14.06, 7.9).. controls (13.38, 7.04) and (12.39, 6.44) .. (11.25, 6.28) -- (11.25, 5.0).. controls (12.85, 5.18) and (14.25, 6.03) .. (15.16, 7.27);
    }
    \setlength\@ftextwen{5\@logounit}
    \setlength\@ftextwnl{6\@logounit}
  },
  ge .meta:n = { faculty = ge },
  faculty / ge .code:n = {
    \renewcommand*\@fselector{ge}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (17.44, 9.99) -- (17.68, 8.74) -- (21.26, 8.74) -- (21.26, 9.99) -- (17.44, 9.99);
      \path[nonzero~rule,line~width=0.1pt] (3.08, 6.25) -- (-0.0, 6.25) -- (-0.0, 5.0) -- (3.32, 5.0) -- (3.08, 6.25);
      \path[nonzero~rule,line~width=0.1pt] (9.68, 21.26) -- (6.2, 3.28) -- (5.14, 8.75) -- (-0.0, 8.75) -- (-0.0, 7.5) -- (4.11, 7.5) -- (5.56, -0.0) -- (6.83, -0.0) -- (10.95, 21.26) -- (9.68, 21.26);
      \path[nonzero~rule,line~width=0.1pt] (16.65, 7.5) -- (13.98, 21.26) -- (12.22, 21.26) -- (8.1, -0.0) -- (9.37, -0.0) -- (13.1, 19.25) -- (15.62, 6.25) -- (21.26, 6.25) -- (21.26, 7.5) -- (16.65, 7.5);
    }
    \setlength\@ftextwen{5\@logounit}
    \setlength\@ftextwnl{7\@logounit}
  },
  fw .meta:n = { faculty = fw },
  faculty / fw .code:n = {
    \renewcommand*\@fselector{fw}
    \tl_set:Nx \l_@@_fselector_tl { \@fselector }
    \renewcommand*\@ficonpath{
      \path[nonzero~rule,line~width=0.1pt] (11.22, 5.61) -- (11.22, 10.01) -- (9.98, 10.01) -- (9.98, 5.61).. controls (9.98, 3.2) and (8.02, 1.25) .. (5.61, 1.25).. controls (3.2, 1.25) and (1.25, 3.2) .. (1.25, 5.61) -- (1.25, 10.01) -- (0.0, 10.01) -- (0.0, 5.61).. controls (0.0, 2.51) and (2.51, -0.0) .. (5.61, -0.0).. controls (8.71, -0.0) and (11.22, 2.51) .. (11.22, 5.61);
      \path[nonzero~rule,line~width=0.1pt] (11.22, 15.65) -- (11.22, 11.25) -- (9.98, 11.25) -- (9.98, 15.65).. controls (9.98, 18.06) and (8.02, 20.01) .. (5.61, 20.01).. controls (3.2, 20.01) and (1.25, 18.06) .. (1.25, 15.65) -- (1.25, 11.25) -- (0.0, 11.25) -- (0.0, 15.65).. controls (0.0, 18.75) and (2.51, 21.26) .. (5.61, 21.26).. controls (8.71, 21.26) and (11.22, 18.75) .. (11.22, 15.65);
      \path[nonzero~rule,line~width=0.1pt] (6.24, 15.65) -- (6.24, 11.25) -- (4.99, 11.25) -- (4.99, 15.65).. controls (4.99, 15.99) and (5.27, 16.27) .. (5.61, 16.27).. controls (5.96, 16.27) and (6.24, 15.99) .. (6.24, 15.65);
      \path[nonzero~rule,line~width=0.1pt] (8.73, 15.65) -- (8.73, 11.25) -- (7.48, 11.25) -- (7.48, 15.65).. controls (7.48, 16.68) and (6.65, 17.52) .. (5.61, 17.52).. controls (4.58, 17.52) and (3.74, 16.68) .. (3.74, 15.65) -- (3.74, 11.25) -- (2.49, 11.25) -- (2.49, 15.65).. controls (2.49, 17.37) and (3.89, 18.77) .. (5.61, 18.77).. controls (7.33, 18.77) and (8.73, 17.37) .. (8.73, 15.65);
    }
    \setlength\@ficonw{0.396cm}
    \setlength\@ftextwen{6\@logounit}
    \setlength\@ftextwnl{6\@logounit}
    \setlength\@ftextmarginextra{0.25cm}
  },
}
\ExplSyntaxOff
%</clo>
% \fi
%
% When the faculty is specified, the |\@faculty| and |\@facultyacronym|
% tags are set. You can retrieve these similar to the \LaTeX{}-native |\@title| tag by
% wrapping it in |\makeatletter| and |\makeatother| (required due to the |@| sign).
% For example:
% \begin{itemize}
%   \item |\makeatletter\@faculty\makeatother|:
%     \makeatletter\@faculty\makeatother
%   \item |\makeatletter\@facultyacronym\makeatother|:
%     \makeatletter\@facultyacronym\makeatother
% \end{itemize}
% \DescribeMacro[common]{\faculty}
%   \marg{name}
%   \margintag{tag}\\
%   Overrides the faculty tag |\@faculty| with the |name| entered.
%   Overrides the name only, no logos or colours!
%   To use for, e.g., faculty services like ``Directie ICT'' for letters or beamer slides.
%
% \iffalse
%<*clo>
\ExplSyntaxOn
\NewDocumentCommand{\@faculty}{O{}}{%
  \ifx\@fselector\@empty\else
  \translatekey[#1]{faculty}{}%
  \tl_set:Nx \l_@@_lookup_key_tl { \languagename {} : facultyof }
  \tl_if_empty:eF { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl }
  {~\translatekey[#1]{facultyof}}%
  {~\translatekey[#1,expand]{org-\@fselector}}%
  \fi
}

\newcommand*{\faculty}[1]{%
  \RenewDocumentCommand{\@faculty}{O{}}{
    \str_case:nnF {##1}{
      {uppercase}{\text_uppercase:n{#1}}
      {lowercase}{\text_lowercase:n{#1}}
    }{
      #1
    }
  }%
}
\ExplSyntaxOff

\newcommand*\@facultyacronym{
  \MakeUppercase{F\@fselector}
}
%</clo>
% \fi
%
% \DescribeMacro[common]{\department}
%   \marg{name}
%   \margintag{tag}\\
%   Sets the department.
%   Currently only used in the beamer title slide.
%
% \DescribeMacro[common]{\team}
%   \marg{name}
%   \margintag{tag}\\
%   Sets the unit.
%   Can be used to set ``Team ...'' or your research lab to the second line of the
%   letter header or beamer title page.
%
% \iffalse
%<*clo>
\ExplSyntaxOn
\NewDocumentCommand{\@department}{O{}}{}
\newcommand*{\department}[1]{
  \RenewDocumentCommand{\@department}{O{}}{
    \str_case:nnF {##1}{
      {uppercase}{\text_uppercase:n{#1}}
      {lowercase}{\text_lowercase:n{#1}}
    }{
      #1
    }
  }%
}
\NewDocumentCommand{\@team}{O{}}{}
\newcommand*{\team}[1]{
    \RenewDocumentCommand{\@team}{O{}}{
    \str_case:nnF {##1}{
      {uppercase}{\text_uppercase:n{#1}}
      {lowercase}{\text_lowercase:n{#1}}
    }{
      #1
    }
  }%
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \DescribeMacro[common]{\ficon}
%   \marg{height}
%   \marg{color}
%   \marg{alignment}\\
%   When used within a tikzpicture, this prints the faculty icon. The height is a
%   length, the alignment ranges from 0 (left edge) to 1 (right edge).
%   The colour can be set to, e.g., white to print on a dark background.\\
%   Usage:
%
%   |\begin{tikzpicture}\ficon{1cm}{ugent@faculty}{0}\end{tikzpicture}|\\
%   \begin{tikzpicture}
%     \ficon{1cm}{ugent@faculty}{0}
%   \end{tikzpicture}
%
% \iffalse
%<*clo>
\newcommand{\ficon}[3]{
  \ifx\@fselector\@empty\else
  \pgfmathsetmacro{\@ficonscale}{#1/\@logounit}
  \pgfmathsetmacro{\@ficonxshift}{-#3*\@logounit*\@ficonscale}
  \begin{scope}[  y=1pt, x=1pt, inner sep=0pt, outer sep=0pt,
    shift={(\@ficonxshift, 0.0cm)},yscale=\@ficonscale,xscale=\@ficonscale,
    every node/.append style={scale=\@ficonscale, color=#2},every path/.append style={fill=#2} ]
    \@ficonpath
  \end{scope}
  \fi
}
%</clo>
% \fi
%
% \DescribeMacro[common]{\faclogo}
%   \marg{height}
%   \marg{color}
%   \marg{alignment}\\
%   When used within a tikzpicture, this prints the faculty logo. The height is a
%   length, the alignment ranges from 0 (left edge) to 1 (right edge).
%   The colour can be set to, e.g., white to print on a dark background.\\
%   The logo text uses the current language.\\
%   Usage (the rectangle is just to visualize the boundaries here):
%
% {\setlength{\topsep}{0pt}\setlength{\partopsep}{0pt}
% \begin{verbatim}
% \begin{tikzpicture}
%   \faclogo{3cm}{ugent@faculty}{0}
% \end{tikzpicture}
% \end{verbatim}
% \vspace{-\parskip}\nointerlineskip
% \begin{tikzpicture}[show background rectangle]
%   \faclogo{3cm}{ugent@faculty}{0}
% \end{tikzpicture}
%
% \begin{verbatim}
% \foreignlanguage{dutch}{
%   \begin{tikzpicture}
%     \faclogo{3cm}{ugent@faculty}{0}
%   \end{tikzpicture}
% }
% \end{verbatim}
% \vspace{-\parskip}\nointerlineskip
% \foreignlanguage{dutch}{
%   \begin{tikzpicture}[show background rectangle]
%     \faclogo{3cm}{ugent@faculty}{0}
%   \end{tikzpicture}
% }
%
% \begin{verbatim}
% \makeatletter
% \ExplSyntaxOn
%   \keys_set:nn { ugentdocs } { faculty = di }
%   \colorlet{ugent@faculty}{ugent@\@fselector}
%   \begin{tikzpicture}
%     \faclogo{3cm}{ugent@faculty}{0}
%   \end{tikzpicture}
% \ExplSyntaxOff
% \makeatother
% \end{verbatim}
% \vspace{-\parskip}\nointerlineskip
% \makeatletter
% \ExplSyntaxOn
%   \keys_set:nn { ugentdocs } { faculty = di }
%   \colorlet{ugent@faculty}{ugent@\@fselector}
%   \begin{tikzpicture}[show~background~rectangle]
%     \faclogo{3cm}{ugent@faculty}{0}
%   \end{tikzpicture}
%   \keys_set:nn { ugentdocs } { faculty = bw }
%   \colorlet{ugent@faculty}{ugent@\@fselector}
% \ExplSyntaxOff
% \makeatother
% }
%
% \iffalse
%<*clo>
% Faculty: set text width
\newlength{\@ftextw}
\ExplSyntaxOn
\newcommand{\@setfaclogotext}{
  \exp_args:Nx \str_case:nnF { \languagename } {
    { dutch }{ \setlength{\@ftextw}{\@ftextwnl} }
  }{
    \setlength{\@ftextw}{\@ftextwen}
  }
}
% Faculty: logo
\newcommand*{\faclogo}[3]{% height, colour, align (0=left,1=right,0.5=center)
  \ifx\@fselector\@empty\else
  \@setfaclogotext
  \pgfmathsetmacro{\@flogoscale}{#1/3/\@logounit}
  \pgfmathsetmacro{\@flogoxshift}{-#3*(3*\@logounit+\@ftextw)*\@flogoscale}

  \begin{scope}[  y=1pt, x=1pt, inner~sep=0pt, outer~sep=0pt,
    shift={(\@flogoxshift, 0.0cm)},yscale=\@flogoscale,xscale=\@flogoscale,
    every~node/.append~style={scale=\@flogoscale, color=#2} ]
    %\draw[step=\@logounit,black,thin] (0,0) grid (3*\@logounit+\@ftextw,3*\@logounit); % logo grid
    \begin{scope}[shift={(\@logounit,\@logounit)},every~path/.append~style={fill=#2}]
      \@ficonpath
    \end{scope}

    \path (0,0) rectangle (3*\@logounit+\@ftextw,3*\@logounit);

    \node[  anchor=south~west, align=flush~left,
    text~width=\@ftextw+\@ftextmarginextra,
    font = \logotextface\fontsize{13.6pt}{12.4pt}\selectfont]
    at (\@logounit+\@ficonw+\@flogospace,\@logounit)
    {\spaceskip=0.0825cm%
      \nohyphens{\@flogotext}};

    \node[  anchor=south~west, align=flush~left,
    text~width=\@ftextw,
    font=\logosubtextface\fontsize{7.45pt}{8pt}\selectfont]
    at (\@logounit+\@ficonw+\@flogospace+0.019cm,\@logounit-0.34cm)
    {\spaceskip=0.054cm%
      \@flogosubtext};
  \end{scope}
  \fi
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \subsubsection{Campus}
% \label{S:usage:cffcl:campus}
%
% \DescribeOption[common]{campus}
%   \DescribeDefault{ugent}
%   Options: |ugent|, |kortrijk|, |gugc|\\
%   Used as, e.g., |campus=kortrijk|, but also plain |kortrijk| works.
%   Only affects the UGent logo.
%
% \iffalse
%<*clo>
% UGent: campus
\ExplSyntaxOn
\tl_new:N \l_@@_campus_tl
\tl_set:Nn \l_@@_campus_tl {ugent}

\keys_define:nn { ugentdocs } {
  campus .tl_set:N = \l_@@_campus_tl ,
  ugent    .code:n   = { \tl_set:Nn \l_@@_campus_tl {ugent} } ,
  gugc     .code:n   = { \tl_set:Nn \l_@@_campus_tl {gugc} } ,
  kortrijk .code:n   = { \tl_set:Nn \l_@@_campus_tl {kortrijk} } ,
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \DescribeMacro[common]{\ugenticon}
%   \marg{height}
%   \marg{color}
%   \marg{alignment}\\
%   When used within a tikzpicture, this prints the UGent icon.
%   The height is a length, the alignment ranges from 0 (left edge) to 1 (right edge).
%   The colour can be set to, e.g., white to print on a dark background.\\
%   Usage:
%
% |\begin{tikzpicture}\ugenticon{1cm}{ugent@main}{0}\end{tikzpicture}|\\
% \begin{tikzpicture}
%   \ugenticon{1cm}{ugent@main}{0}
% \end{tikzpicture}
%
% \iffalse
%<*clo>
% UGent: icon
\newcommand{\@ugenticonpath}{
  \path[nonzero rule,line width=0.1pt] (11.25, 18.07) -- (10.01, 18.07) -- (10.01, 9.98) -- (11.25, 9.98) -- (11.25, 18.07);
  \path[nonzero rule,line width=0.1pt] (8.76, 18.07) -- (7.51, 18.07) -- (7.51, 9.98) -- (8.76, 9.98) -- (8.76, 18.07);
  \path[nonzero rule,line width=0.1pt] (6.27, 18.07) -- (5.02, 18.07) -- (5.02, 9.98) -- (6.27, 9.98) -- (6.27, 18.07);
  \path[nonzero rule,line width=0.1pt] (3.77, 18.07) -- (2.52, 18.07) -- (2.52, 9.98) -- (3.77, 9.98) -- (3.77, 18.07);
  \path[nonzero rule,line width=0.1pt] (13.75, 18.07) -- (12.5, 18.07) -- (12.5, 9.98) -- (13.75, 9.98) -- (13.75, 18.07);
  \path[nonzero rule,line width=0.1pt] (16.24, 18.07) -- (14.99, 18.07) -- (14.99, 9.98) -- (16.24, 9.98) -- (16.24, 18.07);
  \path[nonzero rule,line width=0.1pt] (18.74, 18.07) -- (17.49, 18.07) -- (17.49, 9.98) -- (18.74, 9.98) -- (18.74, 18.07);
  \path[nonzero rule,line width=0.1pt] (20.01, 7.48) -- (1.25, 7.48) -- (1.25, 8.73) -- (20.01, 8.73) -- (20.01, 7.48);
  \path[nonzero rule,line width=0.1pt] (18.74, 19.32) -- (2.52, 19.32) -- (1.28, 20.57) -- (19.98, 20.57) -- (18.74, 19.32);
  \path[nonzero rule,line width=0.1pt] (21.26, 4.99) -- (0.0, 4.99) -- (0.0, 6.24) -- (21.26, 6.24) -- (21.26, 4.99);
  \path[nonzero rule,line width=0.1pt] (21.26, 22.58) -- (10.63, 26.35) -- (0.0, 22.58) -- (0.0, 21.26) -- (10.63, 25.02) -- (21.26, 21.26) -- (21.26, 22.58);
}

\newcommand{\ugenticon}[3]{
  \pgfmathsetmacro{\@ugenticonscale}{#1/\@logounit}
  \pgfmathsetmacro{\@ugenticonxshift}{-#3*\@logounit*\@ugenticonscale}
  \begin{scope}[  y=1pt, x=1pt, inner sep=0pt, outer sep=0pt,
    shift={(\@ugenticonxshift, 0.0cm)},yscale=\@ugenticonscale,xscale=\@ugenticonscale,
    every node/.append style={scale=\@ugenticonscale, color=#2},every path/.append style={fill=#2} ]
    \@ugenticonpath
  \end{scope}
}
%</clo>
% \fi
%
% \DescribeMacro[common]{\ugentlogo}
%   \marg{height}
%   \marg{color}
%   \marg{alignment}\\
%   When used within a tikzpicture, this prints the UGent logo, dependent on
%   the campus. The height is a length, the alignment ranges from 0 (left edge)
%   to 1 (right edge).
%   The colour can be set to, e.g., white to print on a dark background.
%   The logo text uses the current language.\\
%   Usage (the rectangle is just to visualize the boundaries here):
%
% {\setlength{\topsep}{0pt}\setlength{\partopsep}{0pt}
% \begin{verbatim}
% \begin{tikzpicture}
%   \ugentlogo{4cm}{ugent@main}{0}
% \end{tikzpicture}
%
% \hspace{0.5cm}
%
% \foreignlanguage{dutch}{
%   \begin{tikzpicture}
%     \ugentlogo{4cm}{ugent@main}{0}
%   \end{tikzpicture}
% }
% \end{verbatim}
%
% \begin{tikzpicture}[show background rectangle]
%   \ugentlogo{4cm}{ugent@main}{0}
% \end{tikzpicture}
% \hspace{0.5cm}
% \foreignlanguage{dutch}{
%   \begin{tikzpicture}[show background rectangle]
%     \ugentlogo{4cm}{ugent@main}{0}
%   \end{tikzpicture}
% }
%
% \begin{verbatim}
% \makeatletter
% \ExplSyntaxOn
%
% \keys_set:nn { ugentdocs } { campus = kortrijk }
% \begin{tikzpicture}
%   \ugentlogo{4cm}{ugent@main}{0}
% \end{tikzpicture}
%
% \hspace{0.5cm}
%
% \keys_set:nn { ugentdocs } { campus = gugc }
% \begin{tikzpicture}
%   \ugentlogo{4cm}{ugent@main}{0}
% \end{tikzpicture}
%
% \ExplSyntaxOff
% \makeatother
% \end{verbatim}
% \vspace{-\parskip}\nointerlineskip
% \makeatletter
% \ExplSyntaxOn
% \keys_set:nn { ugentdocs } { campus = kortrijk }
% \begin{tikzpicture}[show~background~rectangle]
%   \ugentlogo{4cm}{ugent@main}{0}
% \end{tikzpicture}
% \hspace{0.5cm}
% \keys_set:nn { ugentdocs } { campus = gugc }
% \begin{tikzpicture}[show~background~rectangle]
%   \ugentlogo{4cm}{ugent@main}{0}
% \end{tikzpicture}
% \keys_set:nn { ugentdocs } { campus = ugent }
% \ExplSyntaxOff
% \makeatother
% }
%
% \iffalse
%<*clo>
% UGent: set logo text and textwidth
\newcommand*\@ugentlogotext{}
\newlength{\@ugenttextw}
\newlength{\@ugenttextmarginextra}
\ExplSyntaxOn
\tl_new:N \l_@@_logotext_tmpa_tl
\tl_new:N \l_@@_logotext_tmpb_tl

\newcommand*\@setugentlogotext{
  \exp_args:Nx \str_case:nnF { \l_@@_campus_tl } {
    { ugent }    {
      \renewcommand{\@ugentlogotext}{
        \tl_set:Nx \l_@@_logotext_tmpa_tl { \translatekey[uppercase]{org-ugent} }
        \nohyphens{\l_@@_logotext_tmpa_tl}
      }
      \setlength\@ugenttextw{3\@logounit}
      \setlength\@ugenttextmarginextra{0cm}
    }
    { gugc }     {
      \renewcommand{\@ugentlogotext}{
        \tl_set:Nx \l_@@_logotext_tmpa_tl { GHENT~UNIVERSITY }
        \nohyphens{\l_@@_logotext_tmpa_tl}\\
        \logosubtextface\fontsize{13.6pt}{12.5pt}\selectfont
        \tl_set:Nx \l_@@_logotext_tmpb_tl { GLOBAL~CAMPUS }
        \nohyphens{\l_@@_logotext_tmpb_tl}
      }
      \setlength\@ugenttextw{4\@logounit}
      \setlength\@ugenttextmarginextra{0.3\@logounit}
    }
    { kortrijk } {
      \renewcommand{\@ugentlogotext}{
        \tl_set:Nx \l_@@_logotext_tmpa_tl { \translatekey[uppercase]{org-ugent} }
        \nohyphens{\l_@@_logotext_tmpa_tl}\\
        \logosubtextface\fontsize{13.6pt}{12.5pt}\selectfont
        \tl_set:Nx \l_@@_logotext_tmpb_tl { CAMPUS~KORTRĲK }
        \nohyphens{\l_@@_logotext_tmpb_tl}
      }
      \setlength\@ugenttextw{4\@logounit}
      \setlength\@ugenttextmarginextra{0.3\@logounit}
    }
  }{
    \msg_error:nnn { ugentdocs } { unknown~campus } { \l_@@_campus_tl  }
  }
}
\ExplSyntaxOff

% UGent: logo
\newcommand*{\ugentlogo}[3]{% height, colour, align (0=left,1=right,0.5=center)
  \@setugentlogotext
  \pgfmathsetmacro{\@logoscale}{#1/4/\@logounit}%
  \pgfmathsetmacro{\@logoxshift}{-#3*(\@ugenttextw+2*\@logounit)*\@logoscale}
  \begin{scope}[y=1pt, x=1pt,
    shift={(\@logoxshift, 0.0cm)},
    yscale=\@logoscale,xscale=\@logoscale, every node/.append style={scale=\@logoscale, color=#2}, inner sep=0pt, outer sep=0pt]
    %\draw[step=\@logounit,black,thin] (0,0) grid (5*\@logounit,4*\@logounit); % logo grid
    \path (0,0) rectangle (2*\@logounit+\@ugenttextw,4*\@logounit);
    \begin{scope}[shift={(\@logounit,2*\@logounit)},every path/.append style={fill=#2}]
      \@ugenticonpath
    \end{scope}
    \node[anchor=south west, text width=\@ugenttextw+\@ugenttextmarginextra, align=flush left, font=\logotextface\fontsize{13.6pt}{12.5pt}\selectfont] at (\@logounit-0.03cm,\@logounit-0.005cm) {\spaceskip=0.0825cm%
      \@ugentlogotext};
  \end{scope}
}
%</clo>
% \fi
%
% \iffalse
%<*clo>
\newlength\@orcidiconunit
\setlength\@orcidiconunit{32pt}


\newcommand{\@orcidiconpath}{
  \path[even odd rule]
  % Circle
  (32, 16) .. controls (32, 7.163) and (24.837, 0) .. (16, 0)
  .. controls (7.162, 0) and (0, 7.163) .. (0, 16)
  .. controls (0, 24.838) and (7.162, 32) .. (16, 32)
  .. controls (24.837, 32) and (32, 24.838) .. (32, 16) -- cycle
  % D
  (18.813, 22.363) -- (13.363, 22.363) -- (13.363, 8.463) -- (18.837, 8.463)
  .. controls (23.392, 8.463) and (26.187, 11.841) .. (26.187, 15.413)
  .. controls (26.187, 17.048) and (25.625, 18.785) .. (24.417, 20.117)
  .. controls (23.202, 21.453) and (21.352, 22.363) .. (18.813, 22.363) -- cycle
  (18.600, 10.700) -- (15.787, 10.700) -- (15.787, 20.125) -- (18.500, 20.125)
  .. controls (20.323, 20.125) and (21.620, 19.573) .. (22.460, 18.725)
  .. controls (23.302, 17.876) and (23.712, 16.704) .. (23.712, 15.413)
  .. controls (23.712, 14.629) and (23.473, 13.446) .. (22.719, 12.465)
  .. controls (21.974, 11.496) and (20.709, 10.700) .. (18.600, 10.700) -- cycle
  % i
  (8.363, 22.325) -- (8.363, 8.438) -- (10.788, 8.438) -- (10.788, 22.325) -- cycle
  (9.575, 23.350) .. controls (10.415, 23.350) and (11.088, 24.039) .. (11.088, 24.863)
  .. controls (11.088, 25.686) and (10.415, 26.375) .. (9.575, 26.375)
  .. controls (8.737, 26.375) and (8.063, 25.701) .. (8.063, 24.862)
  .. controls (8.063, 24.039) and (8.735, 23.350) .. (9.575, 23.350) -- cycle;
}

\newcommand{\orcidicon}[3]{
  \pgfmathsetmacro{\@orcidiconscale}{#1/\@orcidiconunit}
  \pgfmathsetmacro{\@orcidiconxshift}{-#3*\@orcidiconunit*\@orcidiconscale}
  \begin{scope}[ y=1pt, x=1pt, inner sep=0pt, outer sep=0pt,
    shift={(\@orcidiconxshift, 0.0cm)}, yscale=\@orcidiconscale, xscale=\@orcidiconscale,
    every path/.append style={fill=#2} ]
    \@orcidiconpath
  \end{scope}
}
%</clo>
% \fi
%
%
% \newpage
% \subsection{Language, time, and location}
% \label{S:usage:langdateloc}
% \subsubsection{Language}
% \label{S:usage:langdateloc:dict}
% The |ugentdocs| documents are officially supported in either English or Dutch:
%
% \DescribeOption[common]{language}
%   \DescribeDefault{english}
%   Options: |dutch|, |english|\\
%   Sets the main document language and all automatic text.
%
% \iffalse
%<*clo>
\ExplSyntaxOn
% Dictionaries: language class options
\tl_new:N \l_@@_language_tl
\tl_set:Nn \l_@@_language_tl {english}

\keys_define:nn { ugentdocs } {
  language .tl_set:N = \l_@@_language_tl ,
  dutch    .code:n   = { \tl_set:Nn \l_@@_language_tl {dutch} } ,
  english  .code:n   = { \tl_set:Nn \l_@@_language_tl {english} } ,
}
\ExplSyntaxOff
%</clo>
% \fi
%
% To support multi-language documents and automatically setting all template
% text -- e.g., copyright page, faculty name, or other specific terms set by
% the class -- a dictionary system was implemented.
% \iffalse
%<*clo>
\ExplSyntaxOn
% Dictionaries: translation machinery
\prop_new:N \g_@@_dict_keyvals_prop
\seq_new:N  \l_@@_value_paragraphs_seq
\tl_new:N \l_@@_lookup_key_tl
\tl_new:N \l_@@_value_cased_tl

\cs_new:Npn \_@@_translate:nn #1#2 {
  \tl_set:Nx \l_@@_lookup_key_tl { \languagename {} :#2 }
  \prop_if_in:NVTF \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl {
    \protected@edef \l_@@_value_cased_tl { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl }
  }{
    \tl_set:Nx \l_@@_lookup_key_tl { english:#2 }
    \protected@edef \l_@@_value_cased_tl { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl }
  }
  \tl_if_empty:nF {#1} {
    \str_case:nnF {#1}{
      {uppercase}{\protected@edef \l_@@_value_cased_tl{\text_uppercase:n{\l_@@_value_cased_tl}}}
      {lowercase}{\protected@edef \l_@@_value_cased_tl{\text_lowercase:n{\l_@@_value_cased_tl}}}
    }{
    }
  }
  \regex_split:nVN { __NEWLINE__ } \l_@@_value_cased_tl \l_@@_value_paragraphs_seq
  \seq_use:Nn \l_@@_value_paragraphs_seq { \newline\mbox{}\newline }
}

% Dictionaries: key-value parsing
\tl_new:N \l_@@_key_tl
\tl_new:N \l_@@_value_tl
\bool_new:N \l_@@_keyval_flushpending_bool
\tl_new:N \l_@@_dictlang_tl
\tl_new:N \l_@@_dictkey_tl

\cs_new_nopar:Nn \@@_flush_value: {
  \bool_if:NT \l_@@_keyval_flushpending_bool {
    \tl_trim_spaces:N \l_@@_value_tl
    \regex_replace_all:nnN {\x7E} {\c{nobreakspace}} \l_@@_value_tl
    \tl_set:Nx \l_@@_dictkey_tl { \l_@@_dictlang_tl {} :\l_@@_key_tl }
    \prop_gput:NVV \g_@@_dict_keyvals_prop \l_@@_dictkey_tl \l_@@_value_tl
    \bool_set_false:N \l_@@_keyval_flushpending_bool
  }
}

\cs_new_nopar:Npn \@@_dictparser:w #1 = #2 \q_stop {
  \tl_set:Nn \l_@@_key_tl{#1}
  \tl_set:Nn \l_@@_value_tl{#2}
  \tl_trim_spaces:N \l_@@_key_tl
  \tl_trim_spaces:N \l_@@_value_tl
}

% Dictionaries: dictionary file reader
\ior_new:N \l_@@_dict_ior
\cs_new_nopar:Nn \@@_dictreader:n {
  \tl_set:Nn \l_@@_dictlang_tl {#1}
  \bool_set_false:N \l_@@_keyval_flushpending_bool
  \ior_open:Nn \l_@@_dict_ior { ugentdocs-#1.dict }
  \ior_str_map_inline:Nn \l_@@_dict_ior {
    \tl_if_blank:nTF {##1}{
      \@@_flush_value:
    }{
      \regex_match:nnTF {=} {##1}{
        \@@_flush_value:
        \@@_dictparser:w ##1 \q_stop
        \bool_set_true:N \l_@@_keyval_flushpending_bool
      }{
        \tl_put_right:Nx \l_@@_value_tl { ~ ##1 }
      }
    }
  }
  \@@_flush_value:
  \ior_close:N \l_@@_dict_ior
}

% Dictionaries: manual entries
\cs_new_protected:Npn \@@_dict_add:nnn #1#2#3 {
  \tl_set:Nx \l_@@_dictkey_tl
  { \tl_trim_spaces:n {#1} {} : \tl_trim_spaces:n {#2} }
  \tl_set:Nn \l_@@_value_tl {#3}
  \tl_trim_spaces:N \l_@@_value_tl
  \prop_gput:NVV \g_@@_dict_keyvals_prop \l_@@_dictkey_tl \l_@@_value_tl
}

\msg_new:nnn { ugentdocs } { dict-missing-value }
{ Dictionary~key~'#1'~has~no~value~and~was~ignored. }

\cs_new_protected:Npn \@@_dict_add_keyvals:nn #1#2 {
  \keyval_parse:nnn
  { \msg_warning:nnn { ugentdocs } { dict-missing-value } }
  { \@@_dict_add:nnn {#1} }
  {#2}
}

% one entry
\NewDocumentCommand \ugentdocsdictadd { m m +m } {
  \@@_dict_add:nnn {#1} {#2} {#3}
}

% several entries for one language
\NewDocumentCommand \ugentdocsdictset { m +m } {
  \@@_dict_add_keyvals:nn {#1} {#2}
}
\ExplSyntaxOff
%</clo>
% \fi
% A key can be translated to the currently active babel language using:
%
% \DescribeMacro[common]{\translatekey}
%   \oarg{expand}
%   \oarg{casing}
%   \marg{key}\\
%   Translates the |<key>| using the currently active language
%   (|babel| package, see Section \ref{S:usage:packages:options}).
%   This can be the main language,
%   an override using |\selectlanguage{<languagename>}|, or
%   a temporary language using the\\ |\foreignlanguage{<languagename>}{...}| wrapper.
%   A list of keys can be found in the dictionaries below.\\
%   Optional arguments:\\
%   |expand| - expands the |key|, for use with a key such as |org-\@fselector|\\
%   |uppercase| or |lowercase| - changes key result casing.
%
% \iffalse
%<*clo>
% Dictionaries: translate keys
\ExplSyntaxOn
\cs_generate_variant:Nn \_@@_translate:nn { xn, xx }
\bool_new:N \l_@@_expand_bool
\tl_new:N \l_@@_case_tl

\NewDocumentCommand{\translatekey}{O{} m}{
  \bool_set_false:N \l_@@_expand_bool
  \tl_clear:N \l_@@_case_tl
  \clist_map_inline:nn {#1} {
    \str_case:nnF {##1}{
      {expand}    { \bool_set_true:N \l_@@_expand_bool    }
      {uppercase} { \tl_set:Nn \l_@@_case_tl {uppercase}  }
      {lowercase} { \tl_set:Nn \l_@@_case_tl {lowercase}  }
    }{
      \msg_error:nnn {ugentdocs}{Unknown~translatekey~option}{##1}
    }
  }
  \bool_if:NTF \l_@@_expand_bool {
    \_@@_translate:xx {\l_@@_case_tl} {#2}
  }{
    \_@@_translate:xn {\l_@@_case_tl} {#2}
  }
}
\ExplSyntaxOff
%</clo>
% \fi
%
% By default, only English and Dutch dictionaries are supported, but a different
% language can be loaded using:
%
% \DescribeMacro[common]{\useugentdocsdictionary}
%   \marg{languagename}\\
%   When used, the dictionary reader will load a file named
%   |ugentdocs-<languagename>.dict| into the dictionary library.
%   If you want to use this language as main document language, be sure to load
%   the |babel| package again immediately after class load using\\
%   |\usepackage[main=<languagename>]{babel}|.
%
% \iffalse
%<*clo>
\ExplSyntaxOn
% Dictionaries: translation macro
\seq_new:N  \g_@@_loaded_dicts_seq
\NewDocumentCommand{\useugentdocsdictionary}{m}{
  \seq_if_in:NnTF \g_@@_loaded_dicts_seq {#1}{
  }{
    \@@_dictreader:n {#1}
    \seq_gput_right:Nn \g_@@_loaded_dicts_seq {#1}
  }
}

\useugentdocsdictionary{english}
\useugentdocsdictionary{dutch}
\ExplSyntaxOff
%</clo>
% \fi
%
% Dictionaries support paragraphs using a \_\_NEWLINE\_\_ placeholder
% and empty lines for readability.
%
% The English dictionary:
% \begin{Verbatim}[
%   fontsize=\scriptsize,
%   breaklines=true,
%   breakautoindent=true,
%   breakanywhere=true,
%   breaksymbolleft={},
% ]
%<*english>
org-ugent   = Ghent University
org-deugent = Ghent University
ghent       = Ghent
domain      = ugent.be
faculty     = Faculty
facultyof   = of
org-bw      = Bioscience Engineering
org-lw      = Arts and Philosophy
org-re      = Law and Criminology
org-we      = Sciences
org-ge      = Medicine and Health Sciences
org-ea      = Engineering and Architecture
org-eb      = Economics and Business Administration
org-di      = Veterinary Medicine
org-pp      = Psychology and Educational Sciences
org-fw      = Pharmaceutical Sciences
org-ps      = Political and Social Sciences

date        = Date
acyear      = Academic year
subject     = Subject
of          = Of
the-de      = The
the-het     = The
in          = In
and         = And
andlist     = , and
version     = Version

baprog           = Bachelor's programme
sprog            = Linking Course
vprog            = Preparatory Course
maprog           = Master's programme
phdprog          = PhD

dissertation     = Dissertation
dissertation-ma  = Master's dissertation
dissertation-ba  = Bachelor's dissertation
dissertation-phd = Doctoral dissertation
projreport       = Project report

submittedto      = Submitted to
bmfulfil         = in partial Fulfilment of the Requirements for the Degree of
phdfulfil        = in Fulfilment of the Requirements for the Degree of
badegree         = Bachelor
madegree         = Master
phddegree        = Doctor

author         = Author
authors        = Authors
lecturer       = Lecturer
lecturers      = Lecturers
examiner       = Examiner
examiners      = Examiners
supervisor     = Supervisor
supervisors    = Supervisors
cosupervisor   = Cosupervisor
cosupervisors  = Cosupervisors
extsupervisor  = External supervisor
extsupervisors = External supervisors
allsupervisor  = Supervisor
allsupervisors = Supervisors
tutor          = Tutor
tutors         = Tutors
jury           = Examination committee
jurymembers    = Jury members
jurychair      = Chair
dean           = Dean
rector         = Rector
coverdesigner  = Cover illustration designer

exam         = Exam
series       = Series
lastname     = Last name
firstname    = First name
name         = Name
studentnr    = Student ID
room         = Room
rooms        = Rooms
examstart    = Start
examend      = End
examduration = Exam duration
question     = Question
weight       = Weight
total        = Total
wordcount    = Word count
page         = Page
appendix     = Appendix
package      = Package

abstract          = Abstract
graphicalabstract = Graphical abstract
articleinfo       = Article info
highlights        = Highlights
keywords          = Keywords
corrauthor        = Corresponding author
submitted         = Submitted
accepted          = Accepted
published         = Published
preprint          = Preprint
emails            = Emails

confidential    = Confidential
confidentiality = Confidentiality
arr             = All rights reserved
crdisclaimer    = Copyright
supportedby     = This work was supported by
typeset         = This document has been typeset using
pleaserefer     = Please refer to this work as
ourref          = Our reference

arrphd          = The author allows to consult and copy parts of this work for personal use. Further reproduction or transmission in any form or by any means, without the prior permission of the author is strictly forbidden.

integrityclause = The PhD researcher and supervisor(s) declare that the PhD research was conducted according to the principles of scientific integrity, as mentioned in the general PhD regulations and charter for PhD researchers of Ghent University and the integrity charter for PhD researchers and supervisors affiliated with Ghent University.

embargofullphd  = The author of this dissertation declares that this document is marked confidential. The content of this doctoral dissertation is confidential and is reserved solely for use by the supervisors and the doctoral jury to evaluate the doctoral quality of the dissertation. Any distribution, copying or dissemination of this document in whole or in part shall comply with all applicable legal stipulations governing the use of confidential information. The use of the information contained herein by any other person or entity is prohibited.

embargotempphd  = The author of this dissertation declares that this document is confidential from __START__ until __END__ (embargo period), and becomes freely accessible after this embargo period. During the embargo period the content of this doctoral dissertation is confidential and is reserved solely for use by the supervisors and the doctoral jury to evaluate the doctoral quality of the dissertation. Any distribution, copying or dissemination of this document in whole or in part shall comply with all applicable legal stipulations governing the use of confidential information. The use of the information contained herein by any other person or entity is prohibited.

arrbama         =  give the permission to use this dissertation for consultation and to copy parts of it for personal use. Every other use is subject to the copyright laws, more specifically the source must be extensively specified when using results from this dissertation.

embargofullbama = of this dissertation declare that this document is confidential. The content of this dissertation is confidential and is reserved solely for use by the supervisors and the jury to evaluate the quality of the dissertation. Any distribution, copying or dissemination of this document in whole or in part shall comply with all applicable legal stipulations governing the use of confidential information. The use of the information contained herein by any other person or entity is prohibited.

embargotempbama = of this dissertation declare that this document is confidential from __START__ until __END__ (embargo period), and becomes freely accessible after this embargo period. During the embargo period the content of this dissertation is confidential and is reserved solely for use by the supervisors and the jury to evaluate the quality of the dissertation. Any distribution, copying or dissemination of this document in whole or in part shall comply with all applicable legal stipulations governing the use of confidential information. The use of the information contained herein by any other person or entity is prohibited.
%</english>
% \end{Verbatim}
%
% The Dutch dictionary:
% \begin{Verbatim}[
%   fontsize=\scriptsize,
%   breaklines=true,
%   breakautoindent=true,
%   breakanywhere=true,
%   breaksymbolleft={},
% ]
%<*dutch>
org-ugent   = Universiteit Gent
org-deugent = de Universiteit Gent
ghent       = Gent
domain      = ugent.be
faculty     = Faculteit
facultyof   =
org-bw      = Bio-ingenieurswetenschappen
org-lw      = Letteren en Wĳsbegeerte
org-re      = Recht en Criminologie
org-we      = Wetenschappen
org-ge      = Geneeskunde en Gezondheidswetenschappen
org-ea      = Ingenieurswetenschappen en Architectuur
org-eb      = Economie en Bedrĳfskunde
org-di      = Diergeneeskunde
org-pp      = Psychologie en Pedagogische Wetenschappen
org-fw      = Farmaceutische Wetenschappen
org-ps      = Politieke en Sociale Wetenschappen

date        = Datum
acyear      = Academiejaar
subject     = Onderwerp
of          = Van
the-de      = De
the-het     = Het
in          = In
and         = En
andlist     = ~en
version     = Versie

baprog           = Bacheloropleiding
sprog            = Schakelprogramma
vprog            = Voorbereidingsprogramma
maprog           = Masteropleiding
phdprog          = Doctoraat

dissertation     = Proefschrift
dissertation-ma  = Masterproef
dissertation-ba  = Bachelorproef
dissertation-phd = Doctoraatsproefschrift
projreport       = Projectverslag

submittedto      = Voorgelegd aan
bmfulfil         = ter gedeeltelijke voldoening aan de vereisten voor de graad van
phdfulfil        = ter voldoening aan de vereisten voor de graad van
badegree         = Bachelor
madegree         = Master
phddegree        = Doctor

author         = Auteur
authors        = Auteurs
lecturer       = Lesgever
lecturers      = Lesgevers
examiner       = Examinator
examiners      = Examinators
supervisor     = Promotor
supervisors    = Promotoren
cosupervisor   = Copromotor
cosupervisors  = Copromotoren
extsupervisor  = Externe Promotor
extsupervisors = Externe Promotoren
allsupervisor  = Promotor
allsupervisors = Promotoren
tutor          = Mentor
tutors         = Mentors
jury           = Examencommissie
jurymembers    = Juryleden
jurychair      = Voorzitter
dean           = Decaan
rector         = Rector
coverdesigner  = Ontwerper kaftillustratie

exam         = Examen
series       = Reeks
lastname     = Achternaam
firstname    = Voornaam
name         = Naam
studentnr    = Student nr.
room         = Lokaal
rooms        = Lokalen
examstart    = Begin
examend      = Einde
examduration = Duur van het examen
question     = Vraag
weight       = Gewicht
total        = Totaal
wordcount    = Aantal woorden
page         = Pagina
appendix     = Bijlage
package      = Pakket

abstract          = Abstract
graphicalabstract = Grafisch abstract
articleinfo       = Artikelinfo
highlights        = Kernpunten
keywords          = Trefwoorden
corrauthor        = Corresponderende auteur
submitted         = Ingediend
accepted          = Aanvaard
published         = Gepubliceerd
preprint          = Preprint
emails            = Emails

confidential    = Confidentieel
confidentiality = Confidentialiteit
arr             = Alle rechten voorbehouden
crdisclaimer    = Copyright
supportedby     = Dit werk werd ondersteund door
typeset         = Dit document is opgemaakt met
pleaserefer     = Gelieve naar dit werk te verwijzen als
ourref          = Ons kenmerk

arrphd          = De auteur staat toe dat delen van dit werk geraadpleegd en gekopieerd worden voor persoonlijk gebruik. Verdere reproductie of transmissie zonder voorafgaande toestemming van de auteur in eender welke vorm of op eender welke manier is strikt verboden.

integrityclause = De doctoraatsonderzoeker en promotor(en) verklaren dat het doctoraatsonderzoek werd uitgevoerd volgens de principes van de wetenschappelijke integriteit, zoals vermeld in het algemeen doctoraatsreglement en algemeen charter van de doctorandus van de UGent en het integriteitscharter voor doctorandi en promotoren verbonden aan de Universiteit Gent.

embargofullphd  = De auteur van dit proefschrift verklaart dat dit document confidentieel is. De inhoud van dit doctoraatsproefschrift is confidentieel en uitsluitend voorbehouden voor gebruik door de promotoren en de doctoraatsjury om de doctoraatskwaliteit van het proefschrift te evalueren. Het verdelen, kopiëren of verspreiden van dit document, zij het volledig of gedeeltelijk, zal voldoen aan alle wettelijke bepalingen die van toepassing zijn met betrekking tot het gebruik van confidentiële informatie. Het gebruik van de informatie die hierin vervat zit door elke andere persoon of entiteit is verboden.

embargotempphd  = De auteur van dit proefschrift verklaart dat dit document confidentieel is van __START__ tot en met __END__ (embargoperiode), en vrij beschikbaar wordt na deze embargoperiode. Tijdens de embargoperiode is de inhoud van dit doctoraatsproefschrift confidentieel en uitsluitend voorbehouden voor gebruik door de promotoren en de doctoraatsjury om de doctoraatskwaliteit van het proefschrift te evalueren. Het verdelen, kopiëren of verspreiden van dit document, zij het volledig of gedeeltelijk, zal voldoen aan alle wettelijke bepalingen die van toepassing zijn met betrekking tot het gebruik van confidentiële informatie. Het gebruik van de informatie die hierin vervat zit door elke andere persoon of entiteit is verboden.

arrbama         =  geven de toelating deze scriptie voor consultatie beschikbaar te stellen en delen ervan te kopiëren voor persoonlijk gebruik. Elk ander gebruik valt onder de beperkingen van het auteursrecht, in het bijzonder met betrekking tot de verplichting uitdrukkelijk de bron te vermelden bij het aanhalen van resultaten uit deze scriptie.

embargofullbama = van dit proefschrift verklaren dat dit document confidentieel is. De inhoud van dit proefschrift is confidentieel en uitsluitend voorbehouden voor gebruik door de promotoren en de jury om de kwaliteit van het proefschrift te evalueren. Het verdelen, kopiëren of verspreiden van dit document, zij het volledig of gedeeltelijk, zal voldoen aan alle wettelijke bepalingen die van toepassing zijn met betrekking tot het gebruik van confidentiële informatie. Het gebruik van de informatie die hierin vervat zit door elke andere persoon of entiteit is verboden.

embargotempbama = van dit proefschrift verklaren dat dit document confidentieel is van __START__ tot en met __END__ (embargoperiode), en vrij beschikbaar wordt na deze embargoperiode. Tijdens de embargoperiode is de inhoud van dit proefschrift confidentieel en uitsluitend voorbehouden voor gebruik door de promotoren en de jury om de kwaliteit van het proefschrift te evalueren. Het verdelen, kopiëren of verspreiden van dit document, zij het volledig of gedeeltelijk, zal voldoen aan alle wettelijke bepalingen die van toepassing zijn met betrekking tot het gebruik van confidentiële informatie. Het gebruik van de informatie die hierin vervat zit door elke andere persoon of entiteit is verboden.
%</dutch>
% \end{Verbatim}
%
% \newpage
% \subsubsection{Time and location}
% \label{S:usage:langdateloc:dateloc}
%
% \DescribeOption[common]{localizedates}
%   \DescribeDefault{true}
%   Options: |true|, |false|\\
%   Localizes the date format based on the active language to, e.g., May 26, 2026
%   if it is entered in the ISO format (YYYY-MM-DD). If no ISO format is input or
%   the option is set to |false|, the date is printed verbatim.
%   Also applies to the embargo period format (see later).
% \iffalse
%<*clo>
\ExplSyntaxOn
\bool_new:N \l_@@_localizedates_bool
\bool_set_true:N \l_@@_localizedates_bool

\keys_define:nn { ugentdocs } {
  localizedates .bool_set:N = \l_@@_localizedates_bool ,
  localizedates .default:n = true ,
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \DescribeMacro[common]{\date}
%   \oarg{type}
%   \marg{new date}
%   \DescribeDefault{\textbackslash today}
%   \margintag{tag}\\
%   Sets the document date. Interacts with the |localizedates| option.
%   Used in the |bama| copyright / autograph page, the |phd| title page, and
%   the |letter| header.
%   The article class uses the |type| option, which can be
%   |submitted|, |accepted|, or |published| for the article info section.
% \iffalse
%<*clo>
\ExplSyntaxOn
\msg_new:nnn { ugentdocs } { unknown-date-type }
{ Unknown~date~type~'#1'.~Use~submitted,~accepted~or~published. }

\providecommand*{\@submitteddate}{}
\providecommand*{\@accepteddate}{}
\providecommand*{\@publisheddate}{}
\cs_new_protected:Nn \@@_setdate:nn {
  \regex_match:nnTF { \A \d{4} - \d{2} - \d{2} \Z } {#2}
  { \cs_gset:cpn {#1} { \DTMdate{#2} } }
  { \cs_gset:cpn {#1} {#2} }
}
\RenewDocumentCommand \date { o m } {
  \IfNoValueTF {#1}{
    \@@_setdate:nn { @date } {#2}
  }{
    \clist_if_in:nnTF { submitted, accepted, published } {#1} {
      \@@_setdate:nn { @#1date } {#2}
    }{
      \msg_error:nnn { ugentdocs } { unknown-date-type } {#1}
    }
  }
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \DescribeMacro[native]{\year}
%   \marg{YYYY}
%   \DescribeDefault{current year}\\
%   Sets the document year using native \LaTeX{}, e.g., through |\year=2026|.
%   This is independent from the |\date|.
%   Used in the copyright sections (e.g., Copyright 2026), the PhD ``cite as'',
%   and the PhD spine year.
%   If not set, the current year is used.
%
% \DescribeMacro[common]{\academicyear}
%   \marg{YYYY--YYYY}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Specifies the academic year.
%   Not mandatory for report class.
%   Used in title page of the |report|, |bama|, |course|, and |phd| classes,
%   and the footer of the |exam| class.
% \iffalse
%<*clo>
\ExplSyntaxOn
\msg_new:nnnn { ugentdocs } { mandatory-macro }
{ The~macro~'#1'~is~mandatory~and~is~currently~unset. }
{ A~placeholder~was~inserted~temporarily. }

\newcommand*{\@academicyear}{%
  YYYY--YYYY%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\academicyear}%
}
\newcommand*{\academicyear}[1]{\renewcommand*{\@academicyear}{#1}}
\ExplSyntaxOff
%</clo>
%<rp>\AtEndOfClass{\renewcommand*{\@academicyear}{}}
% \fi
%
% \DescribeMacro[common]{\location}
%   \marg{new location}
%   \DescribeDefault{Ghent}
%   \margintag{tag}\\
%   Sets the location.
%   The default is Ghent, translated to NL or EN using the dictionaries.
%   Used in the default signing page of the bama class and the PhD colophon.
% \iffalse
%<*clo>
\newcommand*\@location{\translatekey{ghent}}
\AtEndOfClass{ % after letter class loads
  \providecommand*{\location}{} % if not letter class
  \renewcommand*{\location}[1]{
    \renewcommand*\@location{#1}
    \def\fromlocation{#1} % letter class compat
  }
}
%</clo>
% \fi
%
%
% \newpage
% \subsection{Name, affiliation, and sequence parsing}
% \label{S:usage:nameseqparse}
% Names are always input as "Surname, Firstname"
% (BibTeX format) in, e.g, |\author| commands (see the
% ``people'' macros in Section~\ref{S:usage:macros:people}).
% The |ugentdocs| classes have specialized mechanisms
% to convert these to regular "Firstname Surname" or "Surname Firstname",
% and extracting initials, first names, and surnames.
%
% \iffalse
%<*clo>
\ExplSyntaxOn
\seq_new:N \l_@@_name_seq
\tl_new:N  \l_@@_nameinput_tl
\tl_new:N  \l_@@_surname_tl
\tl_new:N  \l_@@_firstname_tl
\tl_new:N  \l_@@_formattedname_tl

\msg_new:nnnn { ugentdocs } { name-not-bibtex-format }
{ The~name~'#1'~is~not~formatted~as~'Surname,~Firstname'. }
{ Names~must~be~given~as~'Surname,~Firstname'~(BibTeX~style,~separated~by~a~comma). }

\cs_new_protected:Npn \@@_parsename:n #1 {
  \tl_set:Nx \l_@@_nameinput_tl { #1 }
  \seq_set_split:NnV \l_@@_name_seq { , } \l_@@_nameinput_tl
  \int_compare:nNnTF { \seq_count:N \l_@@_name_seq } = { 2 } {
    \seq_pop_left:NN \l_@@_name_seq \l_@@_surname_tl
    \tl_trim_spaces:N \l_@@_surname_tl
    \seq_pop_left:NN \l_@@_name_seq \l_@@_firstname_tl
    \tl_trim_spaces:N \l_@@_firstname_tl
  }{
    \msg_error:nnx { ugentdocs } { name-not-bibtex-format } { \l_@@_nameinput_tl }
    \tl_set_eq:NN \l_@@_surname_tl \l_@@_nameinput_tl
    \tl_clear:N \l_@@_firstname_tl
  }
}

\cs_new_protected:Npn \@@_buildformattedname: {
  \str_if_eq:VnTF \l_@@_nameformat_tl {surnamefirst} {
    \tl_set_eq:NN \l_@@_formattedname_tl \l_@@_surname_tl
    \tl_if_empty:NF \l_@@_firstname_tl {
      \tl_put_right:Nn \l_@@_formattedname_tl { \space }
      \tl_put_right:NV \l_@@_formattedname_tl \l_@@_firstname_tl
    }
  }{
    \tl_set_eq:NN \l_@@_formattedname_tl \l_@@_firstname_tl
    \tl_if_empty:NF \l_@@_firstname_tl
    { \tl_put_right:Nn \l_@@_formattedname_tl { \space } }
    \tl_put_right:NV \l_@@_formattedname_tl \l_@@_surname_tl
  }
}

\NewDocumentCommand \@surname { m }
{ \@@_parsename:n {#1} \l_@@_surname_tl }

\NewDocumentCommand \@firstname { m }
{ \@@_parsename:n {#1} \l_@@_firstname_tl }

\NewDocumentCommand \@firstnameinitial { m }
{
  \@@_parsename:n {#1}
  \tl_if_empty:NF \l_@@_firstname_tl { \tl_head:N \l_@@_firstname_tl . }
}

\NewDocumentCommand \@formatname { m }
{
  \@@_parsename:n {#1}
  \@@_buildformattedname:
  \l_@@_formattedname_tl
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \DescribeOption[common]{nameformat}
%   \DescribeDefault{surnamelast}
%   Options:\\
%   |surnamefirst|: outputs all names as ``Surname Firstname''\\
%   |surnamelast|: outputs all names as ``Firstname Surname''
%
% \iffalse
%<*clo>
\ExplSyntaxOn
\tl_new:N \l_@@_nameformat_tl
\tl_set:Nn \l_@@_nameformat_tl {surnamelast}

\keys_define:nn { ugentdocs } {
  nameformat .tl_set:N = \l_@@_nameformat_tl ,
  surnamefirst .code:n   = { \tl_set:Nn \l_@@_nameformat_tl {surnamefirst} } ,
  surnamelast  .code:n   = { \tl_set:Nn \l_@@_nameformat_tl {surnamelast} } ,
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \DescribeOption[common]{affiliationformat}
%   \DescribeDefault{alph}
%   Options: |arabic|, |alph|\\
%   Sets affiliation indexes to |arabic| (``1,2,3'') or |alph| (``a,b,c'').
% \iffalse
%<*clo>
\ExplSyntaxOn
\tl_new:N \l_@@_affformat_tl

\keys_define:nn { ugentdocs } {
  affiliationformat .choices:nn =
  { arabic, alph }
  { \tl_set_eq:NN \l_@@_affformat_tl \l_keys_choice_tl } ,
  affiliationformat .initial:n = alph ,
}
\ExplSyntaxOff
%</clo>
% \fi
%
% Among other things such as email addresses or mobile numbers, names are stored
% in \LaTeX{}3 sequences. Several macros are introduced here to work with those
% sequences.
%
% \DescribeMacro[common]{\printseq}
%   \marg{sequence name}
%   \marg{two-item-separator}
%   \marg{separator}
%   \marg{last-separator}\\
%   When used, returns the items in |<sequence name>| in order with the separators.
%   These separators can be anything, even newlines.\\
%   For example, |\printseq{authors}{~&~}{,~}{\translatekey{andlist},~}| returns:\\
%   Single item: |Name1|\\
%   Two-item list:  |Name1| \& |Name2|\\
%   Multi-item list: |Name1|, |Name2|, and |Name3|
%
% \iffalse
%<*clo>
\ExplSyntaxOn
\cs_new:Npn \@@_printseq:nnnn #1#2#3#4 {
  \exp_args:Nc \seq_use:Nnnn { g_@@_#1_seq } { #2 } { #3 } { #4 }
}
\NewDocumentCommand{\printseq}{mmmm}{
  \@@_printseq:nnnn {#1}{#2}{#3}{#4}
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \DescribeMacro[common]{\ifseqempty}
%   \marg{sequence name}
%   \marg{true code}
%   \marg{false code}\\
%   If the sequence |<sequence name>| is empty, the |<true code>| is executed,
%   otherwise the |<false code>| is executed.
%
% \iffalse
%<*clo>
\ExplSyntaxOn
\prg_new_conditional:Nnn \@@_seq_empty:n { p, T, F, TF } {
  \exp_args:Nc \seq_if_empty:NTF { g_@@_#1_seq }
  { \prg_return_true: }
  { \prg_return_false: }
}
\NewDocumentCommand{\ifseqempty}{mmm}{
  \@@_seq_empty:nTF { #1 } { #2 } { #3 }
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \DescribeMacro[common]{\getseqcaption}
%   \oarg{casing option}
%   \marg{sequence name}
%   \marg{post-caption content}\\
%   Fetches the caption of a sequence depending on its length. For example, using
%   this macro on the |authors| sequence returns the dictionary key |author|
%   (i.e., 'Author') if only one entry is present and |authors| (i.e., 'Authors')
%   if multiple are present. Does not support non-'s' terminated sequences.
%   For empty sequences, the |<post-caption content>| is not executed.
%
% \iffalse
%<*clo>
\ExplSyntaxOn
\NewDocumentCommand{\getseqcaption}{O{} mm}{
  \int_compare:nNnTF { \exp_args:Nc \seq_count:N { g_@@_#2_seq } } > {1} {
    \translatekey[#1]{#2} #3
  }{
    \int_compare:nNnTF { \exp_args:Nc \seq_count:N { g_@@_#2_seq } } = {1} {
      \translatekey[#1]{ \tl_range:nnn {#2} {1} {-2} } #3
    }{
      % empty
    }
  }
}
\ExplSyntaxOff
%</clo>
% \fi
%
% \newpage
% \subsection{Class options}
% \label{S:usage:classopt}
%
% Some common options such as |neutralcolors|, |colormodel|, |faculty|, |campus|,
% |language|, |localizedates|, |nameformat|, and |affiliationformat|
% were previously defined in the section above,
% found in the file |ugentcommon.clo| which is loaded for each class.%
% \iffalse
%<*crs|bama|phd|rp|bkc|le|ex|bmr|art>
\input{ugentcommon.clo}
%</crs|bama|phd|rp|bkc|le|ex|bmr|art>
% \fi
% A few of the document classes have specialized options, which will be
% described in this section.
% \iffalse
%<*clo>
\ExplSyntaxOn
% Class options: declare some variables used commonly
\bool_new:N \l_@@_bwphdcover_bool
\bool_new:N \l_@@_coverbg_bool
\tl_new:N \l_@@_covertype_tl
\msg_new:nnn { ugentdocs } { cover~type~not~implemented }
{ Cover~type~'#1'~is~not~implemented. }
\ExplSyntaxOff
%</clo>
%<*phd|bkc|crs|rp|le|ex|bama|bmr|art>
\ExplSyntaxOn
%</phd|bkc|crs|rp|le|ex|bama|bmr|art>
% \fi
%
% \DescribeOption[phd-bkc]{cameraready}
%   \DescribeDefault{false}
%   Options: |true|, |false|\\
%   Forces the smaller PhD format to be printed on A4 with bleed space,
%   for if your print shop requires as a camera-ready copy.
%   For the bookcover class, this sets a bleed space and fold or cut
%   markers. See Section~\ref{S:usage:packages:options} for customization.
% \iffalse
%<*phd|bkc>
\bool_new:N \l_@@_cameraready_bool

\keys_define:nn { ugentdocs } {
  cameraready .bool_set:N = \l_@@_cameraready_bool ,
  cameraready .default:n = true ,
}
%</phd|bkc>
% \fi
%
% \DescribeOption[phd-crs]{bare}
%   \DescribeDefault{false}
%   Options: |true|, |false|\\
%   Removes the front and back cover, such that you can give
%   a 'bare' version containing only the document contents to your print shop.
% \iffalse
%<*phd|crs>
\bool_new:N \l_@@_bare_bool

\keys_define:nn { ugentdocs } {
  bare .bool_set:N = \l_@@_bare_bool ,
  bare .default:n = true ,
}
%</phd|crs>
% \fi
%
% \DescribeOption[phd-crs]{thumbs}
%   \DescribeDefault{true}
%   Options: |true|, |false|\\
%   Adds chapter thumb indexes to your document.
%   See Section~\ref{S:usage:packages:options} for customization.
% \iffalse
%<*phd|crs|rp|bama>
\bool_new:N \l_@@_thumbs_bool
%</phd|crs|rp|bama>
%<*phd|crs>
\bool_set_true:N \l_@@_thumbs_bool

\keys_define:nn { ugentdocs } {
  thumbs .bool_set:N = \l_@@_thumbs_bool ,
  thumbs .default:n = true ,
}
%</phd|crs>
% \fi
%
% \DescribeOption[crs-rp]{copyright}
%   \DescribeDefault{false}
%   Options: |true|, |false|\\
%   Forces printing a watermark on every page. For the
%   paper version of your document, this is inappropriate, but for any
%   e-copy you make available, this may be appropriate.
%   See Section~\ref{S:usage:packages:options} for customization.
% \iffalse
%<*crs|rp>
\bool_new:N \l_@@_copyright_bool

\keys_define:nn { ugentdocs } {
  copyright .bool_set:N = \l_@@_copyright_bool ,
  copyright .default:n = true ,
}
%</crs|rp>
% \fi
%
% \DescribeOption[ex]{examiner}
%   \DescribeDefault{false}
%   Options: |true|, |false|\\
%   Allows setting the exam class in examiner mode,
%   mentioning the examiner mode on every page (as regular text in the
%   header and also in a watermark) to make sure you never hand out
%   that copy to students.
% \iffalse
%<*ex>
\bool_new:N \l_@@_examiner_bool

\keys_define:nn { ugentdocs } {
  examiner .bool_set:N = \l_@@_examiner_bool ,
  examiner .default:n = true ,
}
%</ex>
% \fi
%
% \DescribeOption[bama-rp-ex]{coverbg}
%   \DescribeDefault{false}
%   Options: |true|, |false|\\
%   Sets a cover background with the relevant UGent or faculty colour,
%   depending on |faculty| and |neutralcolors| options.
% \iffalse
%<*bama|rp|ex>
\keys_define:nn { ugentdocs } {
  coverbg .bool_set:N = \l_@@_coverbg_bool ,
  coverbg .default:n = true ,
}
%</bama|rp|ex>
% \fi
%
% \DescribeOption[le]{foldline}
%   \DescribeDefault{true}
%   Options: |true|, |false|\\
%   Adds a little fold line to the letter margin, 1/3 of the page height from the top.
% \iffalse
%<*le>
\bool_new:N \l_@@_foldline_bool
\bool_set_true:N \l_@@_foldline_bool

\keys_define:nn { ugentdocs } {
  foldline .bool_set:N = \l_@@_foldline_bool ,
  foldline .default:n = true ,
}
%</le>
% \fi
%
% \DescribeOption[bkc]{covertype}
%   Options: |phd|, |course|\\
%   Passes the cover type to construct to the |bookcover| class.
% \iffalse
%<*bkc>
\keys_define:nn { ugentdocs } {
  covertype .tl_set:N = \l_@@_covertype_tl ,
  phd .code:n   = { \tl_set:Nn \l_@@_covertype_tl {phd} } ,
  course       .code:n   = { \tl_set:Nn \l_@@_covertype_tl {course} } ,
}
%</bkc>
%<phd>\tl_set:Nn \l_@@_covertype_tl {phd}
%<crs>\tl_set:Nn \l_@@_covertype_tl {course}
%<bama>\tl_set:Nn \l_@@_covertype_tl {bama}
%<rp>\tl_set:Nn \l_@@_covertype_tl {report}
%<ex>\tl_set:Nn \l_@@_covertype_tl {exam}
%<art>\tl_set:Nn \l_@@_covertype_tl {article}
% \fi
%
%
% \DescribeOption[bmr]{secnums}
%   \DescribeDefault{false}
%   Options: |true|, |false|\\
%   Enables section numbering in beamer presentations.
% \iffalse
%<*bmr>
\bool_new:N \l_@@_secnums_bool
\keys_define:nn { ugentdocs } {
  secnums .bool_set:N = \l_@@_secnums_bool ,
  secnums .default:n = true ,
}
%</bmr>
% \fi
%
% \iffalse
%<*phd|bkc|crs|rp|le|ex|bama|bmr|art>
\ExplSyntaxOff
%</phd|bkc|crs|rp|le|ex|bama|bmr|art>
% \fi
%
% Class loading operates as follows. The standard options such as |11pt|,
% |oneside|, or |openright| are passed to the relevant base classes. For courses,
% BSc/MSc and PhD dissertations, and reports, this is the |book| class.
% The |ugentletter| class expands |letter|, while exams and articles are based on |article|.
% \iffalse
%<*crs|bama|phd|rp|bkc|le|ex|art>
\ExplSyntaxOn
\clist_new:N \l_@@_optgroups_clist
\clist_new:N \l_@@_tmp_clist
\tl_new:N    \g_@@_baseclass_tl

\cs_new_protected:Npn \@@_declare_option_group:nnn #1#2#3 {
% Args: group name, options in the group, default
  \tl_new:c { l_@@_opt_#1_tl }
  \tl_set:cn { l_@@_opt_#1_tl } {#3}
  \clist_put_right:Nn \l_@@_optgroups_clist {#1}
  \clist_map_inline:nn {#2} {
    \keys_define:nn { ugentdocs } {
      ##1 .code:n = \tl_set:cn { l_@@_opt_#1_tl } {##1}
    }
  }
}

\cs_new_protected:Npn \@@_pass_option_groups: {
  \clist_clear:N \l_@@_tmp_clist
  \clist_map_inline:Nn \l_@@_optgroups_clist
  { \clist_put_right:Nv \l_@@_tmp_clist { l_@@_opt_##1_tl } }
  \exp_args:Nee \PassOptionsToClass
  { \clist_use:Nn \l_@@_tmp_clist { , } }
  { \g_@@_baseclass_tl }
}

\keys_define:nn { ugentdocs } {
  unknown .code:n = {
    \tl_if_blank:nTF {#1} {
      \exp_args:Nee \PassOptionsToClass
      { \l_keys_key_str } { \g_@@_baseclass_tl }
    }{
      \exp_args:Nee \PassOptionsToClass
      { \l_keys_key_str = { \exp_not:n {#1} } }
      { \g_@@_baseclass_tl }
    }
  }
}
\ExplSyntaxOff
%</crs|bama|phd|rp|bkc|le|ex|art>
%<*crs|bama|phd|rp>
\ExplSyntaxOn
\tl_gset:Nn \g_@@_baseclass_tl { book }
\@@_declare_option_group:nnn { paper }
  { a4paper, a5paper, b5paper, letterpaper, legalpaper, executivepaper } { a4paper }
\@@_declare_option_group:nnn { size }  { 10pt, 11pt, 12pt }     { 11pt }
\@@_declare_option_group:nnn { sides } { oneside, twoside }     { oneside }
\@@_declare_option_group:nnn { open }  { openright, openany }   { openright }
\ExplSyntaxOff
%</crs|bama|phd|rp>
%<*bkc>
\ExplSyntaxOn
\tl_gset:Nn \g_@@_baseclass_tl { bookcover }
\ExplSyntaxOff
%</bkc>
%<*le>
\ExplSyntaxOn
\tl_gset:Nn \g_@@_baseclass_tl { letter }
\@@_declare_option_group:nnn { paper }
  { a4paper, a5paper, b5paper, letterpaper, legalpaper, executivepaper } { a4paper }
\@@_declare_option_group:nnn { size }  { 10pt, 11pt, 12pt }     { 10pt }
\@@_declare_option_group:nnn { sides } { oneside, twoside }     { oneside }
\ExplSyntaxOff
%</le>
%<*ex|art>
\ExplSyntaxOn
\tl_gset:Nn \g_@@_baseclass_tl { article }
\@@_declare_option_group:nnn { paper }
  { a4paper, a5paper, b5paper, letterpaper, legalpaper, executivepaper } { a4paper }
\@@_declare_option_group:nnn { size }  { 10pt, 11pt, 12pt }     { 10pt }
\@@_declare_option_group:nnn { sides } { oneside, twoside }     { oneside }
\ExplSyntaxOff
%</ex|art>
%\fi
% Then, our custom options are processed,
% \iffalse
%<*crs|bama|phd|rp|bkc|le|ex|bmr|art>
\ProcessKeyOptions[ ugentdocs ]
%</crs|bama|phd|rp|bkc|le|ex|bmr|art>
%<*crs|bama|phd|rp|bkc|le|ex|art>
\ExplSyntaxOn
\@@_pass_option_groups:
\ExplSyntaxOff
%</crs|bama|phd|rp|bkc|le|ex|art>
% \fi
% and the base classes are loaded in.
% \iffalse
%<*crs|bama|phd|rp>
\LoadClass{book}
%</crs|bama|phd|rp>
%<*bkc>
% Apply bleed space and marker length for cameraready
\newlength{\@bleedspace}
\newlength{\@markerlength}
\ExplSyntaxOn
\bool_if:NTF \l_@@_cameraready_bool {
  \setlength\@bleedspace{3mm}
  \setlength\@markerlength{10mm}
}{
  \setlength\@bleedspace{0mm}
  \setlength\@markerlength{0mm}
}

% Set cover dimensions based on cover type
\exp_args:Nx \str_case:nnF { \l_@@_covertype_tl } {
  { phd } {
    \PassOptionsToClass{
      coverheight=24cm,
      coverwidth=16cm,
      bleedwidth=\the\@bleedspace,
      marklength=\the\@markerlength
    }{bookcover}
  }
  { course }{
    \PassOptionsToClass{
      coverheight=29.7cm,
      coverwidth=21cm,
      bleedwidth=\the\@bleedspace,
      marklength=\the\@markerlength
    }{bookcover}
  }
}{
  \msg_error:nnx { ugentdocs } { cover~type~not~implemented } { \l_@@_covertype_tl }
}
\ExplSyntaxOff
\LoadClass{bookcover}
%</bkc>
%<*le>
\LoadClass{letter}
%</le>
%<*ex|art>
\LoadClass{article}
%</ex|art>
%<*phd|bkc>
% Check if BW bookcover should be set
\ExplSyntaxOn
\exp_args:Nx \str_if_eq:eeT { \l_@@_fselector_tl } { bw } {
  \exp_args:Nx \str_if_eq:eeT { \l_@@_covertype_tl } { phd } {
    \bool_set_true:N \l_@@_bwphdcover_bool
  }
}
\ExplSyntaxOff
%</phd|bkc>
% \fi
% Finally, the fonts are loaded and modern typesetting is applied: no
% paragraph indentation and decent paragraph spacing.
% \iffalse
%<*crs|bama|phd|rp|bkc|le|ex|bmr|art>
\@loadfonts
%</crs|bama|phd|rp|bkc|le|ex|bmr|art>
%<*crs|bama|phd|rp|le|ex|art>
% Modern typesetting
\setlength{\parindent}{0pt}
\addtolength{\parskip}{0.75\baselineskip}
\setcounter{secnumdepth}{3}
%</crs|bama|phd|rp|le|ex|art>
% \fi
%
%
% \newpage
% \subsection{Packages}
% \label{S:usage:packages}
% The following packages are required by |ugentdocs|:
%
% \begin{center}\small
%   \begin{tabular}{lp{8cm}}
%     \toprule
%     |adjustbox|       & Trimming and clipping of images                   \\
%     |babel|           & Translations of keywords and logos                \\
%     |background|      & Copyright watermarks for courses and reports      \\
%     |beamerposter|    & Custom slide dimensions for beamer                \\
%     |color|           & Colour management                                 \\
%     |crop|            & Camera-ready version of PhD dissertations         \\
%     |csquotes|        & Context sensitive quotation facilities            \\
%     |datetime2|       & Enhanced date parsing with language support       \\
%     |environ|         & Custom environments for beamer template           \\
%     |etoolbox|        & Toolbox for class definitions internally          \\
%     |expl3|           & Use of \LaTeX{}3 code internally                  \\
%     |fancyhdr|        & Headers and footers                               \\
%     |fontawesome|     & Beamer default closing page                       \\
%     |fontspec|        & Fonts                                             \\
%     |geometry|        & Page geometry and margins                         \\
%     |graphbox|        & Improved placement of graphics                    \\
%     |graphicx|        & Enhanced support for graphics                     \\
%     |GS1|             & ISBN barcode for PhDs and courses                 \\
%     |hyphenat|        & Hyphenation control                               \\
%     |iftex|           & Checking compiler type                            \\
%     |setspace|        & Set line spacing                                  \\
%     |shellesc|        & Shell command execution, used in |\runwordcount|  \\
%     |soul|            & Underline spanning multiple lines                 \\
%     |tabularx|        & Auto-expandable paragraph columns                 \\
%     |thumbs|          & Thumb indexes for PhDs and courses                \\
%     |tikz|            & logos, cover pages, etc.                          \\
%     |tikzpagenodes|   & Positioning relative to page                      \\
%     |titlesec|        & Chapter title formatting                          \\
%     |ulem|            & Line-breaking underline                           \\
%     |unicode-math|    & Sans-serif math                                   \\
%     |wasysym|         & Symbols                                           \\
%     |zref-abspage|    & Absolute page positions                           \\
%     |zref-savepos|    & Save page positions                               \\
%     |zref-totpages|   & Page count                                        \\
%     \bottomrule
%   \end{tabular}
% \end{center}
%
% Make sure \watchout these packages are available to your \LaTeX{} compiler.
% Most of these should be installed by default in TeXLive distributions
% or can be made to auto-install for MikTeX.
%
% \iffalse
%<*crs|bama|phd|rp|le|ex|bkc|bmr|art>
\RequirePackage{etoolbox}
\IfFileExists{shellesc.sty}{
  \RequirePackage{shellesc}}{}
\RequirePackage{hyphenat}
\RequirePackage{graphicx}
\RequirePackage{tabularx}
\RequirePackage{graphbox}
\RequirePackage{soul}
\RequirePackage[export]{adjustbox}
\RequirePackage{color}
\RequirePackage{tikz}
\RequirePackage{tikzpagenodes}
\usetikzlibrary{positioning,calc,fit,backgrounds}
\RequirePackage{zref-totpages}
\RequirePackage{zref-savepos}
\RequirePackage{zref-abspage}
\RequirePackage[normalem]{ulem}
\renewcommand{\ULthickness}{1pt}
\RequirePackage{setspace}
\RequirePackage{wasysym}
\RequirePackage{ugentcolor}
%</crs|bama|phd|rp|le|ex|bkc|bmr|art>
%<*crs|bama|phd|rp|le|ex|art>
\RequirePackage{fancyhdr}
%</crs|bama|phd|rp|le|ex|art>
%<*bkc|phd|crs>
\RequirePackage{GS1}
%</bkc|phd|crs>
%
%<*crs|bama|phd|rp|le|ex|bkc|bmr|art>
% Fix wasy font scaling
\DeclareFontFamily{U}{wasy}{}
\DeclareFontShape{U}{wasy}{m}{n}{
  <-5.5> wasy5 <5.5-6.5> wasy6 <6.5-7.5> wasy7
  <7.5-8.5> wasy8 <8.5-9.5> wasy9 <9.5-> wasy10}{}
\DeclareFontShape{U}{wasy}{b}{n}{<-> wasyb10}{}
%</crs|bama|phd|rp|le|ex|bkc|bmr|art>
% \fi
%
% \newpage
% \subsubsection{Options-specific packages}
% \label{S:usage:packages:options}
%
% Some of the packages listed above are loaded depending on the class options set:
%
% \begin{itemize}
%   \item |babel|: sets the main document language from the |language| option.
%     You can add more languages by calling |\usepackage[<languages>]{babel}|
%     again in your customization file, but make sure a dictionary is available for
%     the |main| language (see Section \ref{S:usage:langdateloc:dict}).
%    \begin{macrocode}
%<*crs|bama|phd|rp|le|ex|bkc|bmr|art>
\ExplSyntaxOn
\str_if_eq:VnTF \l_@@_language_tl {dutch} {
  \PassOptionsToPackage{main=dutch}{babel}
}{
  \PassOptionsToPackage{main=english}{babel}
}
\RequirePackage[dutch,english]{babel}
\RequirePackage{csquotes}
\ExplSyntaxOff
%</crs|bama|phd|rp|le|ex|bkc|bmr|art>
%    \end{macrocode}
%   \item |datetime2|: sets the date format based on the |localizedates| option.
%    \begin{macrocode}
%<*crs|bama|phd|rp|le|ex|bkc|bmr|art>
\ExplSyntaxOn
\bool_if:NTF \l_@@_localizedates_bool {
  \RequirePackage[useregional]{datetime2}
}{
  \RequirePackage{datetime2}
}
\ExplSyntaxOff
%</crs|bama|phd|rp|le|ex|bkc|bmr|art>
%    \end{macrocode}
%   \item |background|: adds background watermark support for the courses and
%     reports if the |copyright| option is |true|.
%     Currently, only the course class uses this through\\
%     |\backgroundsetup{contents={Copyright Ghent~University, All Rights Reserved}}|,
%     but you can set your own watermark if you want by calling\\
%     |\backgroundsetup{contents={<yourwatermark>}}|
%    \begin{macrocode}
%<*crs|rp>
\ExplSyntaxOn
\bool_if:NT \l_@@_copyright_bool {
  \RequirePackage[contents={},color=watermarkcolor,scale=3]{background}
}
\ExplSyntaxOff
%</crs|rp>
%    \end{macrocode}
%   \item |crop|: handles the |cameraready| option for the PhD class,
%     embedding the smaller page into an A4 page with cut marks.
%    \begin{macrocode}
%<*phd>
\ExplSyntaxOn
\bool_if:NT \l_@@_cameraready_bool {
  \RequirePackage[cam,center,width=21truecm,height=29.7truecm]{crop}
  \RequirePackage[nopagecolor=white]{pagecolor}
}
\ExplSyntaxOff
%</phd>
%    \end{macrocode}
%   \item |thumbs|: handles thumb indexes for courses and reports.
%     You can customize them by calling |\usepackage[<options>]{thumbs}|
%     in your customization file. Be sure to apply the correct |ignorehoffset| and
%     |ingnorevoffset| values if you use |cameraready=true| as class option.
%     You can customize the thumb content (e.g., number) and colour by overwriting the
%     |\@addthumb| command in your customization file.
%    \begin{macrocode}
%<bama|rp|phd|crs>\newcommand{\@addthumb}{}
%<*phd|crs>
\ExplSyntaxOn
\bool_if:NT \l_@@_thumbs_bool {
  \IfPackageLoadedTF{crop}{% Thumbs should be loaded after crop!
    \PassOptionsToPackage{ignorehoffset=false,ignorevoffset=false}{thumbs}% crop
  }{
    \PassOptionsToPackage{ignorehoffset=true,ignorevoffset=true}{thumbs}% no crop
  }
  \RequirePackage[
    height=25.4mm,
    width=auto,
    distance=2mm,
    bottomthumbmargin=auto,
    txtcentered=true,
    topthumbmargin=3in
  ]{thumbs}

  \renewcommand*{\@addthumb}{%
    \addthumb{\chaptername~\thechapter}% Full chapter name
      {\Large\bfseries\thechapter}% Chapter name in thumb (\thechapter = 1, 2, ...)
      {white}% Chapter name colour
      {gray!50}% Thumb colour
  }
}
\ExplSyntaxOff
%</phd|crs>
%    \end{macrocode}
% \iffalse
%<*phd|crs>
\ExplSyntaxOn
\bool_if:NT \l_@@_thumbs_bool {
  % Thumb fix not moving down when calling from titlesec
  % At begin document to allow customization to alter addthumb
  \AtBeginDocument{
    \apptocmd{\@addthumb}{
    \xdef\@thumbposysave{\the\th@mbposy}%
    \xdef\@thumbposyAsave{\the\th@mbposyA}%
    \aftergroup\@fixthumbposy
    }{}{}
  }
  % Helper
  \newcommand*{\@fixthumbposy}{%
    \global\th@mbposy=\@thumbposysave\relax
    \global\th@mbposyA=\@thumbposyAsave\relax
  }
}
\ExplSyntaxOff
%</phd|crs>
% \fi
% \end{itemize}
%
%
% \newpage
% \subsubsection{Geometry}
% \label{S:usage:packages:geometry}
% The |geometry| package is used to set the paper size for the documents.
% Based on the paper width and height, we define the |\gridunit| length
% from the official grid layout. It is calculated by dividing the long paper edge
% by 7, and then again by 4. You can use this length in your own graphics, and
% you \emph{can} technically override it in your customization file using
% |\setlength\gridunit{<length>}|,
% although this is not recommended.
%
% \iffalse
%<*crs|bama|phd|rp|le|ex|bkc|bmr|art>
\newlength{\@PW}      % Paper width
\newlength{\@PH}      % Paper height
\newlength{\gridunit} % Grid unit layout
\newcommand*{\@setgridunit}{\pgfmathsetlength{\gridunit}{max(\@PW,\@PH)/7/4}}
%</crs|bama|phd|rp|le|ex|bkc|bmr|art>
% \fi
% \newlength{\gridunit}
% \pgfmathsetlength{\gridunit}{297mm/7/4}
%
% The paper size and margins are then set based on the official Office templates:
%    \begin{macrocode}
%<*crs|rp|ex>
\setlength\@PW{210mm}
\setlength\@PH{297mm}
\@setgridunit
\RequirePackage[heightrounded,paperwidth=\@PW,paperheight=\@PH,
                top=2.54cm, bottom=2.54cm, left=2\gridunit, right=2.97cm]{geometry}
%</crs|rp|ex>
%<*phd>
\setlength\@PW{160mm}
\setlength\@PH{240mm}
\@setgridunit
\RequirePackage[heightrounded,paperwidth=\@PW,paperheight=\@PH,
                top=2.54cm,bottom=2.54cm,inner=2cm,outer=2cm,twoside]
                {geometry}
%</phd>
%<*bama>
\setlength\@PW{210mm}
\setlength\@PH{297mm}
\@setgridunit
\RequirePackage[heightrounded,paperwidth=\@PW,paperheight=\@PH,
                top=2.54cm, bottom=2.54cm, left=2\gridunit, right=2\gridunit]{geometry}
%</bama>
%<*le>
\setlength\@PW{210mm}
\setlength\@PH{297mm}
\@setgridunit
\RequirePackage[heightrounded,a4paper, footskip=4\gridunit,
                top=5\gridunit, bottom=4\gridunit, left=2\gridunit, right=4.07cm]{geometry}
%</le>
%<*art>
\setlength\@PW{210mm}
\setlength\@PH{297mm}
\@setgridunit
\RequirePackage[heightrounded,paperwidth=\@PW,paperheight=\@PH,
top=2\gridunit, bottom=2\gridunit, left=2\gridunit, right=2\gridunit]{geometry}
%</art>
%    \end{macrocode}
%
% For the |bookcover| class, the dimensions are dependent on the cover type (phd or course):
%    \begin{macrocode}
%<*bkc>
\ExplSyntaxOn
\exp_args:Nx \str_case:nnF { \l_@@_covertype_tl } {
  { phd } {
    \setlength\@PW{160mm}
    \setlength\@PH{240mm}
  }
  { course } {
    \setlength\@PW{210mm}
    \setlength\@PH{297mm}
  }
}{
  \msg_error:nnx { ugentdocs } { cover~type~not~implemented } { \l_@@_covertype_tl }
}
\@setgridunit
\ExplSyntaxOff
%</bkc>
%    \end{macrocode}
%
%
% \subsubsection{Recommended packages}
% \label{S:usage:packages:recommended}
% Besides the packages listed above required for the classes to work,
% some other commonly used packages are recommended for use:
%
% \begin{center}\small
%   \begin{tabular}{lp{8cm}}
%     \toprule
%     \href{https://ctan.org/pkg/algorithm2e}{|algorithm2e|}        & Algorithms and pseudocode                         \\
%     \href{https://ctan.org/pkg/biblatex}{|biblatex|}              & References                                        \\
%     \href{https://ctan.org/pkg/booktabs}{|booktabs|}              & Prettier tables                                   \\
%     \href{https://ctan.org/pkg/caption}{|caption|}                & Styling of figure and table captions              \\
%     \href{https://ctan.org/pkg/listings}{|listings|}              & Code display                                      \\
%     \href{https://ctan.org/pkg/longtable}{|longtable|}            & Multi-page tables                                 \\
%     \href{https://ctan.org/pkg/lscape}{|lscape|}                  & Landscape pages                                   \\
%     \href{https://ctan.org/pkg/mhchem}{|mhchem|}                  & Chemical equations made easy                      \\
%     \href{https://ctan.org/pkg/multirow}{|multirow|}              & Table cells spanning multiple rows                \\
%     \href{https://ctan.org/pkg/pdfpages}{|pdfpages|}              & Inclusion of PDF pages into the document          \\
%     \href{https://ctan.org/pkg/siunitx}{|siunitx|}                & SI units and quantities                           \\
%     \href{https://ctan.org/pkg/subcaption}{|subcaption|}          & Subfigure captions                                \\
%     \href{https://ctan.org/pkg/threeparttable}{|threeparttable|}  & Tables with footnotes                             \\
%     \href{https://ctan.org/pkg/totalcount}{|totalcount|}          & Total counts of figures and tablescounts          \\
%     \href{https://ctan.org/pkg/xspace}{|xspace|}                  & Correct space after a command that outputs text   \\
%     \bottomrule
%   \end{tabular}
% \end{center}
%
%
% \newpage
% \subsection{Macros}
% \label{S:usage:macros}
% In the following sections, the macros used in the documents are explained.
% If a macro is mandatory, it is noted in the margin, and a placeholder text is
% set by default or an warning message is printed.
%
%
% \subsubsection{Inset text and quotes}
% \label{S:usage:macros:inset}
%
% \DescribeMacro[bama-phd-crs-rp]{\insettext}
%   \marg{title}
%   \marg{content}\\
%   Formats the |title| and |content| into a text box. By default, the colours are\\
%   faculty-based (|insetboxcolor|).\\
%   Examples:\\
%
% \newcommand{\insettext}[2]{
% \begin{adjustbox}{center}
%   \begin{tikzpicture}
%   \node[align=flush left, text width=\linewidth-6mm, inner sep=3mm] (body) {#2};
%   \ifblank{#1}{}{%
%     \node[align=flush left, text width=\linewidth-6mm, inner sep=3mm,
%     fill=insetboxcolor, text=white, font=\bfseries,
%     above=0pt of body, anchor=south] (title) {#1};
%   }%
%   \begin{scope}[on background layer]
%   \ifblank{#1}{%
%     \node[fill=insetboxcolor!10, fit=(body), inner sep=0mm] {};
%   }{%
%     \node[fill=insetboxcolor!10, fit=(body)(title), inner sep=0mm] {};
%   }%
%   \end{scope}
%   \end{tikzpicture}
% \end{adjustbox}
%}
% |\insettext{An example title}{This is the content.}|\\
% \insettext{An example title}{This is the content.}
% |\insettext{}{This is the content without a title.}|\\
% \insettext{}{This is the content without a title.}
% |\colorlet{insetboxcolor}{ugent@accent}|\\
% |\insettext{An example title}{This is the content.}|\\
% \begingroup\colorlet{insetboxcolor}{ugent@accent}
% \insettext{An example title}{This is the content.}
% \endgroup
%
% Implementation:
%    \begin{macrocode}
%<*bama|phd|crs|rp>
\newcommand{\insettext}[2]{
  \par\noindent
  \begin{adjustbox}{center}%
    \begin{tikzpicture}%
      \node[align=flush left, text width=\linewidth-6mm, inner sep=3mm] (body) {#2};
      \ifblank{#1}{}{%
        \node[align=flush left, text width=\linewidth-6mm, inner sep=3mm,
        fill=insetboxcolor, text=white, font=\bfseries,
        above=0pt of body, anchor=south] (title) {#1};
      }%
      \begin{scope}[on background layer]
      \ifblank{#1}{%
        \node[fill=insetboxcolor!10, fit=(body), inner sep=0mm] {};
      }{%
        \node[fill=insetboxcolor!10, fit=(body)(title), inner sep=0mm] {};
      }%
      \end{scope}
    \end{tikzpicture}%
  \end{adjustbox}%
  \par
}
%</bama|phd|crs|rp>
%    \end{macrocode}
%
% \DescribeMacro[bama-phd-crs-rp]{\insetquote}
%   \marg{quote}
%   \marg{citation}\\
%   Formats the |quote| and |citation| into a text box using |insettext|.
%   By default, the colours are faculty-based (|insetboxcolor|).\\
%   Example:\\
%   |\insetquote{I feel quite hungry!}{Some dude from Bohemia named Henry}|\\
%
% \makeatletter
% \newlength{\@quotetextwidth}
% \newlength{\@quoteinnerxsep}
% \setlength{\@quoteinnerxsep}{10mm}
%
% \newcommand{\@insetquotepicture}[2]{
% \begin{tikzpicture}[baseline]
% \node[align=#1, text width=\@quotetextwidth,
% inner xsep=\@quoteinnerxsep, inner ysep=6mm] (qtext) {#2};
% \node[font=\Huge, anchor=north west] at (qtext.north west) {``};
% \node[font=\Huge, anchor=south east] at (qtext.south east) {''};
% \end{tikzpicture}
% }
%
% \newcommand{\insetquote}[2]{
% \insettext{}{%
%   \settowidth{\@quotetextwidth}{#1}%
%   \ifdim\@quotetextwidth>\dimexpr\linewidth-6mm-2\@quoteinnerxsep\relax
%   \setlength{\@quotetextwidth}{\dimexpr\linewidth-6mm-2\@quoteinnerxsep\relax}%
%   \@insetquotepicture{justify}{#1}\par
%   \else
%   \begin{center}
%     \@insetquotepicture{center}{#1}\par
%   \end{center}
%   \fi
%   \ifblank{#2}{}{\raggedleft #2\par}%
% }%
% }
% \makeatother
%
% \insetquote{I feel quite hungry!}{Some dude from Bohemia named Henry}
%
% Implementation:
%    \begin{macrocode}
%<*bama|phd|crs|rp>
\newlength{\@quotetextwidth}
\newlength{\@quoteinnerxsep}
\setlength{\@quoteinnerxsep}{10mm}

\newcommand{\@insetquotepicture}[2]{
  \begin{tikzpicture}[baseline]
    \node[align=#1, text width=\@quotetextwidth,
    inner xsep=\@quoteinnerxsep, inner ysep=6mm] (qtext) {#2};
    \node[font=\Huge, anchor=north west] at (qtext.north west) {``};
    \node[font=\Huge, anchor=south east] at (qtext.south east) {''};
  \end{tikzpicture}
}

\newcommand{\insetquote}[2]{
  \insettext{}{%
    \settowidth{\@quotetextwidth}{#1}%
    \ifdim\@quotetextwidth>\dimexpr\linewidth-6mm-2\@quoteinnerxsep\relax
    \setlength{\@quotetextwidth}{\dimexpr\linewidth-6mm-2\@quoteinnerxsep\relax}%
    \@insetquotepicture{justify}{#1}\par
    \else
    \begin{center}
      \@insetquotepicture{center}{#1}\par
    \end{center}
    \fi
    \ifblank{#2}{}{\raggedleft #2\par}%
  }%
}
%</bama|phd|crs|rp>
%    \end{macrocode}
%
%
% \newpage
% \subsubsection{Document data}
% \label{S:usage:macros:data}
% \DescribeMacro[crs-bama-phd-rp-bkc-bmr-ex-art]{\title}
%   \oarg{short title}
%   \marg{title}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   This macro sets the title of the document.
%   It is \LaTeX{}-native, but is extended here with an optional short title
%   argument that additionally sets the |\@shorttitle| tag.
%   It also sets the |pdftitle| tag of the hyperref package (if it is
%   loaded), so that the PDF-document meta-information is correct.
% \iffalse
%<*crs|rp|bkc|phd|bmr|ex|art>
\ExplSyntaxOn
\renewcommand{\@title}{%
  <This~is~your~document~title>%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\title}
}
\newcommand{\@shorttitle}{\@title}
\RenewDocumentCommand{\title}{o m}{
  \gdef\@title{#2}
  \@ifundefined{inserttitle}{}{\gdef\inserttitle{#2}}
  \IfNoValueTF{#1}
  {\gdef\@shorttitle{#2}
   \@ifundefined{shorttitle}{}{\gdef\shorttitle{#2}}}
  {\gdef\@shorttitle{#1}
   \@ifundefined{shorttitle}{}{\gdef\shorttitle{#1}}}
}
\ExplSyntaxOff
%</crs|rp|bkc|phd|bmr|ex|art>
% \fi
%
% \DescribeMacro[phd]{\titel}
%   \marg{dutch title}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   This macro sets the Dutch title that will later be used in the PhD
%   dissertation colophon page -- if the main document language is not Dutch.
% \iffalse
%<*phd>
\ExplSyntaxOn
\newcommand*{\@titel}{%
  <Dit~is~de~nederlandse~titel~van~het~document>%
  \str_if_eq:VnF \l_@@_language_tl {dutch} {%
    \msg_warning:nnn { ugentdocs }{ mandatory-macro }%
      {\titel~for~non-dutch~PhDs}%
  }%
}
\newcommand*{\titel}[1]{%
  \renewcommand*\@titel{#1}
}
\ExplSyntaxOff
%</phd>
% \fi
%
% \DescribeMacro[crs-bama-phd-rp-bkc]{\subtitle}
%   \oarg{short subtitle}
%   \marg{subtitle}
%   \margintag{tag}\\
%   This macro sets the subtitle of the document through the |\@subtitle| and
%   |\@shortsubtitle| tags.
%   You may use this to further clarify the title or to indicate the nature of
%   this document. The latter is to be considered when you want to provide
%   multiple documents as parts of the full course text (e.g., Course Notes,
%   Theoretical Exercises, Practical Exercises).
%   This macro also sets the |subject| tag of the hyperref package  (if
%   it is loaded),
%   so that the PDF-document meta-information is correct.
% \iffalse
%<art>\newcommand{\@subtitle}{}
%<*crs|phd|rp|bama|bkc>
\ExplSyntaxOn
\newcommand{\@subtitle}{}
\newcommand{\@shortsubtitle}{\@subtitle}
\NewDocumentCommand{\subtitle}{o m}{
  \gdef\@subtitle{#2}
  \IfNoValueTF{#1}
  {\gdef\@shortsubtitle{#2}}
  {\gdef\@shortsubtitle{#1}}
}
\ExplSyntaxOff
%</crs|phd|rp|bama|bkc>
% \fi
%
% \DescribeMacro[phd-bkc]{\subtitel}
%   \marg{dutch subtitle}
%   \margintag{tag}\\
%   This macro sets the Dutch subtitle that will later be used in the PhD
%   dissertation colophon page if the main document language is not Dutch.
% \iffalse
%<*phd>
\newcommand*{\@subtitel}{}
\newcommand*{\subtitel}[1]{%
  \renewcommand*\@subtitel{#1}
}
%</phd>
% \fi
%
% \DescribeMacro[rp]{\extra}
%   \marg{extra title}
%   \margintag{tag}\\
%   Specifies some extra comment
%   (e.g., the nature of the document)
%   below the title or subtitle of the report class.
% \iffalse
%<*rp>
\newcommand\@extra{}
\newcommand\extra[1]{\renewcommand\@extra{#1}}
%</rp>
% \fi
%
% \DescribeMacro[phd-crs-bkc]{\coverimage}
%   \marg{image path}
%   \margintag{tag}\\
%   Sets the filename of the front cover image
%   for courses and PhD dissertations.
%   The cover image is automatically fitted and cropped to the cover,
%   but it is best to set an approximately correctly sized image.
%   If the image is not defined for a course text,
%   the faculty icon will be used instead.
% \iffalse
%<*crs|phd|bkc>
\newcommand*\@coverimage{}
\newcommand*\coverimage[1]{\renewcommand*\@coverimage{#1}}
%</crs|phd|bkc>
% \fi
%
% \DescribeMacro[bama-rp-phd-crs-bkc]{\frontcoverlogos}
%   \marg{graphics}
%   \margintag{tag}\\
%   Sets the logos in the bottom right corner of the cover page of most classes,
%   Used for, e.g., publisher logos (course) or company logos (bama or phd).
%   The FBW PhD cover does not support this (there is no space).\\
%   Example use -- see also |example-ugentbama-1.pdf|:
% \begin{verbatim}
% \frontcoverlogos{
%   \includegraphics[height=2\gridunit]{example-image-a}
%   \hspace{\gridunit}
%   \includegraphics[height=2\gridunit]{example-image-b}
% }
% \end{verbatim}
% \iffalse
%<*bama|rp|crs|phd|bkc|ex>
\newcommand*{\@frontcoverlogos}{}
\newcommand*{\frontcoverlogos}[1]{\renewcommand*{\@frontcoverlogos}{#1}}
%</bama|rp|crs|phd|bkc|ex>
% \fi
%
% \DescribeMacro[phd-crs-bkc]{\backcoverlogos}
%   \marg{graphics}
%   \margintag{tag}\\
%   Sets the logos in the bottom right corner of the back cover page
%   of the PhD and course classes,
%   used for, e.g., a publisher logo.
% \iffalse
%<*bkc|phd|crs>
\newcommand*{\@backcoverlogos}{}
\newcommand*{\backcoverlogos}[1]{\renewcommand*{\@backcoverlogos}{#1}}
%</bkc|phd|crs>
% \fi
%
% \DescribeMacro[crs-ex-bkc-phd-bama]{\degree}
%   \marg{full degree}
%   \margintag{mandatory}
%   \margintag{degrees\_seq}
%   \margintag{degreecalls\_seq}\\
%   Sets the official degree name in full. You have to type it in the appropriate
%   language yourself -- possibly mixed ``Dutch (English)''.
%   This must be the official title of your diploma.
%   For bachelor and master programmes in Dutch, it must
%   be the Dutch title. For programmes in English it may be the English
%   title. For PhD degrees, language constraints are less strict.\\
%   Consult the Flemish Higher Education Register
%   (\href{https://www.highereducation.be}{in English} or
%   \href{https://www.hogeronderwijsregister.be}{in Dutch})
%   for correct bachelor and master degree titles.
%   Consult the Doctoral bylaws of the university for PhD degree titles.\\
%   The degree(s) are used on the cover pages of the |bama|, |phd|, |course|,
%   and |exam| classes, and on the title page of the |phd| class.
% \iffalse
%<*crs|ex|bkc|phd|bama>
\ExplSyntaxOn
\seq_new:N \g_@@_degrees_seq
\seq_new:N \g_@@_degreecalls_seq

\cs_new:Nn \@@_adddegree:n {
  \seq_gput_right:Nn \g_@@_degrees_seq { #1 }
  \seq_gput_right:Nx \g_@@_degreecalls_seq
  { \exp_not:N\degree { \exp_not:n{#1} } }
}
\NewDocumentCommand{\degree}{m}{
  \@@_adddegree:n { #1\strut }
}
\AtBeginDocument{
  \let\degree\relax
  \ifseqempty{degrees}{
    \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\degree}%
  }{}

}
\ExplSyntaxOff
%</crs|ex|bkc|phd|bama>
% \fi
%
% \DescribeMacro[bkc-phd-bama-rp]{\doctype}
%   \marg{document type}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Sets the document type for use in the |phd| and |bama| cover pages.
%   Should be one of the doctype dictionary keys, being
%   |dissertation-ba|, |dissertation-ma|, or |dissertation-phd|.
%   The |report| class currently doesn't use this macro or tag,
%   although you could set |\extra{\@doctype}| and |\doctype{projreport}|,
%   probably.
% \iffalse
%<*bama|phd|bkc|rp>
\ExplSyntaxOn
\newcommand*\@doctype{
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\doctype}%
}
\newcommand*\doctype[1]{
  \renewcommand*\@doctype{\translatekey{#1}}
}
\ExplSyntaxOff
%</bama|phd|bkc|rp>
%<phd>\doctype{dissertation-phd}
% \fi
%
% \DescribeMacro[bama-phd-rp]{\wordcount}
%   \marg{word count}
%   \margintag{tag}\\
%   Sets the word count of your document for printing on the cover page of the
%   |bama| and |report| classes. The |phd| class doesn't use it currently.
%   If not called or set empty, the word count is not printed out.
%   The |<word count>| can also be set to |\runwordcount|,
%   which counts the words automatically (see below).
% \iffalse
%<*bama|phd|rp>
\newcommand*\@wordcount{}
\newcommand*\wordcount[1]{
  \renewcommand*\@wordcount{#1}
}
%</bama|phd|rp>
% \fi
%
% \DescribeMacro[bama-phd-rp]{\runwordcount}
%   Runs |texcount| using |shell-escape| (see code below), which
%   automatically counts the words and sets the |\@wordcount| tag.
%   Command arguments that expand to more text (e.g., a |\translatekey| call)
%   only count the arguments, so results may be inaccurate,
%   but it's the best we have.\\
%   You should also run your compiler with the flag '|--shell-escape|'.
%   For notes on how to do this for your editor or compiler, visit
%   \href
%   {https://tex.stackexchange.com/questions/598818/how-can-i-enable-shell-escape}
%   {the TeX StackExchange wiki}.\\
%   \watchout Enabling |shell-escape| potentially risks the execution of
%   malicious code from dubious packages.
%   Be sure to only use reputable packages and
%   disable |shell-escape| when not used.
%   The packages required by the |ugentdocs| classes \emph{should} be safe,
%   but better safe than sorry\ldots
%    \begin{macrocode}
%<*bama|phd|rp>
\ExplSyntaxOn
\cs_new:Nn \@@_runwordcount: {
  \ShellEscape{texcount~-1~-sum~-merge~-q~\jobname.tex~>~\jobname.wc}
  \file_if_exist:nTF { \jobname.wc } {
    \file_get:nnN { \jobname.wc } { } \l_tmpa_tl
    \tl_to_str:N \l_tmpa_tl
    \xdef\@wordcount{\l_tmpa_tl}
  }{
    \gdef\@wordcount{?}
  }
}
\NewDocumentCommand{\runwordcount}{}{
  \@@_runwordcount:
}
\ExplSyntaxOff
%</bama|phd|rp>
%    \end{macrocode}
%
% \DescribeMacro[phd-art]{\grants}
%   \marg{grant text}
%   \margintag{tag}\\
%   Specifies any grants that supported the research.
%   Used to print a message in the PhD colophon page
%   and the article title page:
%   ``This research was supported by |<grant text>|''
% \iffalse
%<*phd|art>
\newcommand*{\@grants}{}
\newcommand*{\grants}[1]{
  \renewcommand*{\@grants}{#1}
}
%</phd|art>
% \fi
%
% \DescribeMacro[phd-art]{\doi}
%   \marg{DOI}
%   \margintag{tag}\\
%   Specify the correct Digital Object Identifier (without the https://doi.org/)
%   of your PhD for display on the colophon page of the |phd| class
%   or your article for display in the article info and footer
%   of the |article| class.
%   If the |hyperref| package is loaded, the full URL will be linked.
% \iffalse
%<*phd|art>
\ExplSyntaxOn
\str_new:N \l_@@_doiurl_str
\newcommand*{\@doi}{}
\newcommand*{\doi}[1]{
  \renewcommand*{\@doi}{#1}
  \str_set:Ne \l_@@_doiurl_str { https://doi.org/ \@doi }
}
\ExplSyntaxOff
%</phd|art>
% \fi
%
% \DescribeMacro[crs-phd-bkc]{\isbn}
%   \marg{ISBN}
%   \margintag{tag}\\
%   Specify your International Standard Book Number
%   (if you requested one in time).
%   The ISBN will be used to generate the barcode on the back cover
%   automatically.
%   If no ISBN is given, no barcode or placeholder is produced.
% \iffalse
%<*phd|bkc|crs>
\newcommand*{\@isbn}{}
\newcommand*{\isbn}[1]{\renewcommand*{\@isbn}{#1}}
%</phd|bkc|crs>
% \fi
%
% \DescribeMacro[bama-phd-bkc]{\embargo}
%   \oarg{start = YYYY-MM-DD, end = YYYY-MM-DD}\\
%   Generates the correct embargo message in your PhD colophon or
%   Ba/Ma dissertation copyright signing page.
%   Adds the word 'CONFIDENTIAL' (translated) to your cover and title pages.\\
%   If no optional dates are given,
%   the document is considered under full embargo.
%   If the dates are given as ISO format,
%   they interact with the |localizedates| option
%   (see Section~\ref{S:usage:langdateloc:dateloc}).
%   The document is then considered to be under temporary embargo, and
%   the dates replace the |__START__| and |__END__| placeholders of the
%   |embargotempbama| or |embargotempphd| dictionary keys
%   (see Section~\ref{S:usage:langdateloc:dict}).
%   This message is then printed using the |\@embargotempwithdates| macro,
%   which interacts with the current document language.
%
% \iffalse
%<*crs|rp>
\ExplSyntaxOn
\bool_new:N \l_@@_embargo_bool
\bool_new:N \l_@@_embargotemp_bool
\ExplSyntaxOff
%</crs|rp>
%<*phd|bkc|bama>
\ExplSyntaxOn
\bool_new:N \l_@@_embargo_bool
\bool_new:N \l_@@_embargotemp_bool
\tl_new:N \@embargotempstart
\tl_new:N \@embargotempend
\tl_new:N \l_@@_embargostartdate_tl
\tl_new:N \l_@@_embargoenddate_tl

\msg_new:nnn { ugentdocs }
{ embargo-start-without-end }
{ An~embargo~start~date~was~given,~but~no~end~date}
\msg_new:nnn { ugentdocs }
{ embargo-end-without-start }
{ An~embargo~end~date~was~given,~but~no~start~date}

\keys_define:nn { ugentdocs/embargo } {
  start .tl_set:N = \l_@@_embargostartdate_tl ,
  end   .tl_set:N = \l_@@_embargoenddate_tl ,
}

\NewDocumentCommand{\embargo}{O{}}{
  \bool_set_true:N \l_@@_embargo_bool
  \tl_clear:N \l_@@_embargostartdate_tl
  \tl_clear:N \l_@@_embargoenddate_tl
  \keys_set:nn { ugentdocs/embargo } { #1 }
  \tl_if_empty:NTF \l_@@_embargostartdate_tl {
    \tl_if_empty:NF \l_@@_embargoenddate_tl {
      \msg_error:nn { ugentdocs } { embargo-end-without-start }
    }
  }{
    \tl_if_empty:NTF \l_@@_embargoenddate_tl {
      \msg_error:nn { ugentdocs } { embargo-start-without-end }
    }{
      \bool_set_true:N \l_@@_embargotemp_bool
      \regex_replace_all:nnN {\s} {\c{space}} \l_@@_embargostartdate_tl
      \regex_replace_all:nnN {\s} {\c{space}} \l_@@_embargoenddate_tl
      \@@_embargostoredate:NN \@embargotempstart \l_@@_embargostartdate_tl
      \@@_embargostoredate:NN \@embargotempend \l_@@_embargoenddate_tl
    }
  }
}

\tl_new:N \l_@@_embargodatetmp_tl
\cs_new_protected:Nn \@@_embargostoredate:NN {
  \tl_set:Nx \l_@@_embargodatetmp_tl {#2}
  \exp_args:Nnx \regex_match:nnTF {^\d{4}-\d{2}-\d{2}$} {\l_@@_embargodatetmp_tl} %$
  {
    \tl_gset:Nx #1 {
      \exp_not:N \DTMdisplaydate
      { \exp_args:NV \tl_range:nnn \l_@@_embargodatetmp_tl {1} {4} }
      { \exp_args:NV \tl_range:nnn \l_@@_embargodatetmp_tl {6} {7} }
      { \exp_args:NV \tl_range:nnn \l_@@_embargodatetmp_tl {9} {10} }
      {-1}
    }
  }{
    \tl_gset_eq:NN #1 #2
  }
}

\tl_new:N \l_@@_embargotemp_tl
\seq_new:N \l_@@_embargosplit_seq
\cs_new:Nn \_@@_embargosubstitute:nN {
  \regex_split:nVN {#1} \l_@@_embargotemp_tl \l_@@_embargosplit_seq
  \tl_clear:N \l_@@_embargotemp_tl
  \tl_put_right:Nx \l_@@_embargotemp_tl { \seq_item:Nn \l_@@_embargosplit_seq {1} }
  \tl_put_right:Nx \l_@@_embargotemp_tl { \exp_not:V #2 }
  \tl_put_right:Nx \l_@@_embargotemp_tl { \seq_item:Nn \l_@@_embargosplit_seq {2} }
}
\NewDocumentCommand{\@embargotempwithdates}{}{
%<*phd|bkc>
  \tl_set:Nx \l_@@_lookup_key_tl { \languagename {} : embargotempphd }
%</phd|bkc>
%<*bama>
  \tl_set:Nx \l_@@_lookup_key_tl { \languagename {} : embargotempbama }
%</bama>
  \tl_set:Nx \l_@@_embargotemp_tl { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl }
  \_@@_embargosubstitute:nN {__START__} \@embargotempstart
  \_@@_embargosubstitute:nN {__END__} \@embargotempend
  \l_@@_embargotemp_tl
}
\ExplSyntaxOff
%</phd|bkc|bama>
% \fi
%
% \DescribeMacro[crs-rp-bama-phd-art]{\copyrightnotices}
%   \marg{notice content}
%   \margintag{tag}\\
%   Used to override the default |\@copyrightnotices| content
%   (see Section~\ref{S:style:copyright}).
%   Can be used to load a signed copyright page for the |bama| class
%   using the |pdfpages| package and:
%   |\copyrightnotices{\includepdf[pages={1}]{copyright_signed.pdf}}|
% \iffalse
%<*crs|rp|bama|phd|art>
\newcommand{\@copyrightnotices}{}
\newcommand{\copyrightnotices}[1]{\renewcommand{\@copyrightnotices}{#1}}
%</crs|rp|bama|phd|art>
% \fi
%
% \DescribeMacro[crs-rp]{\extranotices}
%   \marg{extra copyright notices}
%   \margintag{tag}\\
%   Adds additional copyright notices to the default course and report
%   copyright notices (see Section~\ref{S:style:copyright}).
%   For example:
% \begin{verbatim}
% \extranotices{
%   The graphics in this document have been typeset using \textrm{TikZ}.\\
%   This document has been \textrm{\TeX}-ed on a GNU/Linux workstation.
% }
% \end{verbatim}
% \iffalse
%<*crs|rp>
\newcommand{\@extranotices}{}
\newcommand{\extranotices}[1]{\renewcommand{\@extranotices}{#1}}
%</crs|rp>
% \fi
%
% \DescribeMacro[art]{\abstract}
%   \marg{abstract text}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Specifies the abstract of the article.
% \iffalse
%<*art>
\ExplSyntaxOn
\newcommand{\@abstract}{%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\abstract}%
}
\renewcommand{\abstract}[1]{\renewcommand{\@abstract}{#1}}
\ExplSyntaxOff
%</art>
% \fi
%
% \DescribeMacro[art]{\graphicalabstract}
%   \marg{graphical abstract content}
%   \margintag{tag}\\
%   Specifies the graphical abstract of the article.\\
%   Can be |\includegraphics[width=\textwidth]{GraphicalAbstractFile}|.
% \iffalse
%<*art>
\newcommand{\@graphicalabstract}{}
\newcommand{\graphicalabstract}[1]{\renewcommand{\@graphicalabstract}{#1}}
%</art>
% \fi
%
% \DescribeMacro[art]{\highlights}
%   \marg{highlight items}\\
%   Specifies the highlights of the article.\\
%   Should be input as ``|\item highlight1 \item highlight2 ...|''
% \iffalse
%<*art>
\ExplSyntaxOn
\tl_new:N \g_@@_highlights_tl

\NewDocumentCommand \highlights { +m } {
  \tl_gset:Nn \g_@@_highlights_tl {#1}
}

\cs_new_protected:Nn \@@_printhighlights: {
  \tl_if_empty:NF \g_@@_highlights_tl {
    \begin{itemize} \g_@@_highlights_tl \end{itemize}
  }
}
\ExplSyntaxOff
%</art>
% \fi
%
% \DescribeMacro[art]{\keywords}
%   \marg{comma separated keywords}\\
%   Specifies the keywords of the article.
%   Should be input as ``|keyword1, keyword2, ...|''
% \iffalse
%<*art>
\ExplSyntaxOn
\clist_new:N \g_@@_keywords_clist

\NewDocumentCommand \keywords { m }{
  \clist_gput_right:Nn \g_@@_keywords_clist {#1}
}

\cs_new_protected:Nn \@@_printkeywords: {
  \clist_if_empty:NF \g_@@_keywords_clist {
    \noindent \textbf{ \translatekey{keywords}: }~
    \clist_use:Nn \g_@@_keywords_clist { ;~ } \par
  }
}
\ExplSyntaxOff
%</art>
% \fi
%
% \DescribeMacro[art]{\journal}
%   \marg{journal title}
%   \margintag{tag}\\
%   Specifies the journal in which the article was published
%   or to which it was submitted.
% \iffalse
%<*art>
\newcommand{\@journal}{}
\newcommand{\journal}[1]{\renewcommand{\@journal}{#1}}
%</art>
% \fi
%
%
% \newpage
% \subsubsection{People}
% \label{S:usage:macros:people}
%
% \DescribeMacro[crs-bama-phd-rp-bkc-le-ex-art]{\affiliation}
%   \marg{affiliation}
%   \margintag{affiliations\_seq}
%   \margintag{affidx\_seq}
%   \margintag{affiliationscalls\_seq}\\
%   Adds an affiliation to the sequence.
%   It can then be used as, e.g., ``a'' or ``1''
%   (depending on the affiliationformat option) in the |\author| macro.
%   Specifying an affiliation in the |\author| macro
%   not currently present in the sequence
%   also adds that affiliation to the sequence.
%   Any affiliation added is added as plain
%   ``|\affiliation{<affiliation>}|'' to the |affiliationscalls| sequence.
% \iffalse
%<*phd|crs|bama|bkc|ex|le|rp|art>
\ExplSyntaxOn
\seq_new:N \g_@@_affiliations_seq
\seq_new:N \l_@@_affidx_seq
\seq_new:N \g_@@_affiliationscalls_seq

\tl_new:N \l_@@_affiltext_tl
\tl_new:N \l_@@_affsep_tl
\tl_set:Nn \l_@@_affsep_tl { ,~ }
\tl_new:N  \l_@@_nameaffsep_tl
\tl_set:Nn \l_@@_nameaffsep_tl { \\ }
\int_new:N \l_@@_affindex_int

% Affiliation keys regex constant
\regex_const:Nn \c_@@_affkeys_regex
{ \A \s* (?: [a-zA-Z] | \d+ ) (?: \s* , \s* (?: [a-zA-Z] | \d+ ) )* \s* \Z }
\regex_const:Nn \c_@@_affnum_regex { \A \d+ \Z }

% Msg: Affiliation not found in sequence
\msg_new:nnn { ugentdocs } { unknown-affiliation }
{ Affiliation~key~'#1'~does~not~refer~to~a~declared~affiliation~
  (#2~declared~so~far). }

% Helper CS for adding affiliations and affiliation calls
\cs_new_protected:Nn \@@_addaffiliation:n {
  \int_zero:N \l_@@_affindex_int
  \seq_map_indexed_inline:Nn \g_@@_affiliations_seq {
    \tl_if_eq:nnT {##2} {#1} {
      \seq_map_break:n { \int_set:Nn \l_@@_affindex_int {##1} }
    }
  }
  \int_compare:nNnT \l_@@_affindex_int = 0 {
    \seq_gput_right:Nn \g_@@_affiliations_seq {#1}
    \seq_gput_right:Nn \g_@@_affiliationscalls_seq { \affiliation {#1} }
    \int_set:Nn \l_@@_affindex_int { \seq_count:N \g_@@_affiliations_seq }
  }
}

% Helper CS for I) adding affiliation indexes II) setting affiltext
\cs_new_protected:Nn \@@_addaffindex: {
  \seq_put_right:Nx \l_@@_affidx_seq {
    \use:c { int_to_ \l_@@_affformat_tl :n } { \l_@@_affindex_int }
  }
  \tl_if_empty:NF \l_@@_affiltext_tl {
    \tl_put_right:NV \l_@@_affiltext_tl \l_@@_affsep_tl
  }
  \tl_put_right:Nx \l_@@_affiltext_tl {
    \seq_item:Nn \g_@@_affiliations_seq { \l_@@_affindex_int }
  }
}

% General add to affiliations helper
\cs_new_protected:Nn \@@_addto_affseq:n {
  \seq_clear:N \l_@@_affidx_seq
  \tl_clear:N \l_@@_affiltext_tl
  \regex_match:NnTF \c_@@_affkeys_regex {#1} {
    \clist_map_inline:nn {#1} {
      \regex_match:NnTF \c_@@_affnum_regex {##1}{
        \int_set:Nn \l_@@_affindex_int {##1}
      }{
        \int_set:Nn \l_@@_affindex_int { \int_from_alph:n {##1} }
      }
      \bool_lazy_or:nnTF
      { \int_compare_p:nNn \l_@@_affindex_int < 1 }
      { \int_compare_p:nNn \l_@@_affindex_int > { \seq_count:N \g_@@_affiliations_seq } }{
        \msg_error:nnee { ugentdocs } { unknown-affiliation }
        {##1} { \seq_count:N \g_@@_affiliations_seq }
      }{
        \@@_addaffindex:
      }
    }
    \tl_if_empty:NF \l_@@_affiltext_tl{
      \tl_put_left:Nn \l_@@_affiltext_tl { \l_@@_nameaffsep_tl }
    }
  }{
    \tl_if_blank:nF {#1}{
      \@@_addaffiliation:n {#1}
      \@@_addaffindex:
    }
  }
  \seq_gput_right:Nx \g_@@_authoraffs_seq { \seq_use:Nn \l_@@_affidx_seq {,} }
}

% Print affiliation list for articles
\cs_new_protected:Nn \@@_printaffiliationlist: {
  \seq_map_indexed_inline:Nn \g_@@_affiliations_seq {
    \hbox_set:Nn \l_tmpa_box {
      \textsuperscript { \use:c { int_to_ \l_@@_affformat_tl :n } {##1} } ~
    }
    \noindent
    \hangindent = \box_wd:N \l_tmpa_box
    \box_use:N \l_tmpa_box ##2 \par
  }
}

\NewDocumentCommand{\affiliation}{m}{
  \@@_addaffiliation:n {#1}
}
\ExplSyntaxOff
%</phd|crs|bama|bkc|ex|le|rp|art>
% \fi
%
% \DescribeMacro[crs-bama-phd-rp-bkc-le-ex-art]{\author}
%   \oarg{corresponding}
%   \oarg{email}
%   \oarg{orcid}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \marg{affiliation}
%   \margintag{mandatory}
%   \margintag{authors\_seq}
%   \margintag{authorswaff\_seq}
%   \margintag{authoraffs\_seq}
%   \margintag{authorlist\_seq}
%   \margintag{authorscalls\_seq}
%   \margintag{authorcorr\_seq}
%   \margintag{authoremails\_seq}
%   \margintag{authororcids\_seq}
%   \margintag{authorsurnames\_seq}
%   \margintag{authorfirstnames\_seq}\\
%   This macro adds an author to the document.
%   The author name should be in BibTeX format (i.e., ``Surname, Firstname'').
%   Use multiple calls for multiple authors.\\
%   The affiliation can have multiple formats, e.g.,
%   start with a newline: '|\\|',
%   start with '|, |' for regular inline,
%   or even '|&|' for horizontal alignment in the |bama| \& |report| cover pages.
%   Optional argument |corresponding| sets the author as corresponding,
%   |email| specifies the author email, and |orcid| the ORCID.
%   These are stored in the |authorcorr|, |authoremails|,
%   and |authororcids| sequences.
%
%   The authors are used in
%   the |bama|, |report| (optional), and |phd| cover pages,
%   the |bama| autograph / copyright page,
%   the |article| graphical abstract and title page,
%   the |course| (optional) and |phd| colophon,
%   the |phd| title page, and the |bookcover| spine.
%   The |pdfauthor| tag of the hyperref package (if it is loaded),
%   is set using the |authorlist|
%   so that the PDF-document meta-information is correct.
%
%   The formatted author name (see Section~\ref{S:usage:nameseqparse}) is
%   stored with the title in the |authors| sequence
%   (e.g., ``prof. Firstname Surname'') and
%   the full name and title with affiliation
%   (e.g., ``prof. Firstname Surname, Ghent University'')
%   is stored in the |authorswaff| sequence.
%   The |authorlist| sequence stores ``Surname, F.'' formatted names
%   for printing of a citation-style list,
%   and the plain call --
%   e.g., |\author{prof.}{Surname, Firstname}{, Ghent University}|
%   -- is stored in the |authorscalls| sequence for usage later in the
%   |\generatebookcover| macro.\\%
%   These sequences can be used following the instructions
%   in Section~\ref{S:usage:nameseqparse}.
%
% \iffalse
%<*phd|crs|bama|bkc|ex|le|rp|art>
\ExplSyntaxOn
% General add name helper
\cs_new_protected:Nn \@@_addto_nameseq:nnn {
  % args: seq, title, name
  \exp_args:Nc \seq_gput_right:Nn { g_@@_#1_seq } { #2~\@formatname{#3}\strut }
}

% General add name with affiliation helper
\cs_new_protected:Nn \@@_addto_nameaffiliationseq:nnnn {
  % args: seq, title, name, affiliation
  \exp_args:Nc \seq_gput_right:Nn { g_@@_#1waff_seq } {%
    \tl_if_blank:nF {#2} { #2~ }
    \@formatname{#3}\strut
    \tl_if_blank:nF {#4} { #4\strut }
  }
}
\cs_generate_variant:Nn \@@_addto_nameaffiliationseq:nnnn { nnnV }

% General add call helper
\cs_new_protected:Nn \@@_addto_callseq:nnnnn {
  % args: seq, options, title, name, affiliation
  \exp_args:Ncx \seq_gput_right:Nn { g_@@_#1calls_seq } {
    \exp_not:c { \tl_range:nnn {#1} {1} {-2} }
    \tl_if_blank:nF {#5} { [ \exp_not:n {#5} ] }
    { \exp_not:n{#2} } { \exp_not:n{#3} } { \exp_not:n{#4} }
  }
}
\cs_new_protected:Nn \@@_addto_callseq:nnnn {
  \@@_addto_callseq:nnnnn {#1} {#2} {#3} {#4} {}
}

% Author printing for articles
\seq_new:N \l_@@_authorentries_seq
\tl_new:N  \l_@@_authorentry_tl
\tl_new:N  \l_@@_authorfirst_tl
\tl_new:N  \l_@@_authorsup_tl
\tl_new:N \l_@@_authororcid_tl

\cs_new_protected:Nn \@@_orcidlink:n {
  \cs_if_exist:NTF \href {
    \exp_args:Ne \href { \tl_to_str:n { https://orcid.org/#1 } }
    { \XeTeXLinkBox { \tikz[baseline=0pt]{\orcidicon {1.6ex} {orcidcolor} {0}} } }
  }{
    \tikz[baseline=0pt]{\orcidicon {1.6ex} {orcidcolor} {0}}
  }
}
\cs_new_protected:Nn \@@_printauthorlist: {
  \seq_clear:N \l_@@_authorentries_seq
  \seq_map_indexed_inline:Nn \g_@@_authorsurnames_seq {
    % Name
    \tl_set:Nn \l_@@_surname_tl {##2}
    \tl_set:Nx \l_@@_firstname_tl { \seq_item:Nn \g_@@_authorfirstnames_seq {##1} }
    \tl_if_empty:NF \l_@@_firstname_tl {
      \tl_set:Nx \l_@@_firstname_tl
      { \exp_not:N \textcolor { firstnamecolor } { \exp_not:V \l_@@_firstname_tl } }
    }
    \@@_buildformattedname:
    \tl_set_eq:NN \l_@@_authorentry_tl \l_@@_formattedname_tl

     % Superscript
    \tl_set:Nx \l_@@_authorsup_tl { \seq_item:Nn \g_@@_authoraffs_seq {##1} }
    \seq_if_in:NnT \g_@@_authorcorr_seq {##1} {
      \tl_if_empty:NF \l_@@_authorsup_tl { \tl_put_right:Nn \l_@@_authorsup_tl {,} }
      \tl_put_right:Nn \l_@@_authorsup_tl { * }
    }
    \tl_if_empty:NF \l_@@_authorsup_tl {
      \tl_put_right:Nx \l_@@_authorentry_tl
      { \exp_not:N \textsuperscript { \exp_not:V \l_@@_authorsup_tl } }
    }
    % ORCID
    \tl_set:Nx \l_@@_authororcid_tl { \seq_item:Nn \g_@@_authororcids_seq {##1} }
    \tl_if_blank:VF \l_@@_authororcid_tl {
      \tl_put_right:Nx \l_@@_authorentry_tl {
        \exp_not:N \,
        \exp_not:N \@@_orcidlink:n { \exp_not:V \l_@@_authororcid_tl }
      }
    }
    \seq_put_right:NV \l_@@_authorentries_seq \l_@@_authorentry_tl
  }
  \seq_use:Nnnn \l_@@_authorentries_seq{~\&~}{,~}{\translatekey{andlist}~}
}

% Print author footnote
\seq_new:N \l_@@_fnemails_seq
\seq_new:N \l_@@_fnorcids_seq
\tl_new:N  \l_@@_fnname_tl
\str_new:N \l_@@_orcidurl_str

\cs_new_protected:Nn \@@_printauthorfootnote: {
  \seq_clear:N \l_@@_fnemails_seq
  \seq_clear:N \l_@@_fnorcids_seq
  \seq_map_indexed_inline:Nn \g_@@_authoremails_seq {
    % name
    \tl_set:Nx \l_@@_fnname_tl { \seq_item:Nn \g_@@_authorfirstnames_seq {##1} }
    \tl_if_empty:NF \l_@@_fnname_tl {
      \tl_set:Nx \l_@@_fnname_tl { \tl_head:N \l_@@_fnname_tl . ~ }
    }
    \tl_put_right:Nx \l_@@_fnname_tl { \seq_item:Nn \g_@@_authorsurnames_seq {##1} }
    % email
    \tl_if_blank:nF {##2} {
      \seq_put_right:Nx \l_@@_fnemails_seq
      { \exp_not:n {##2} ~ ( \exp_not:V \l_@@_fnname_tl ) }
    }
    % ORCID
    \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g_@@_authororcids_seq {##1} }
    \tl_if_blank:VF \l_tmpa_tl {
      \str_set:Nx \l_@@_orcidurl_str { https://orcid.org/ \l_tmpa_tl }
      \seq_put_right:Nx \l_@@_fnorcids_seq {
        \cs_if_exist:NTF \href{
          \exp_not:N \href { \l_@@_orcidurl_str } { \exp_not:V \l_tmpa_tl }
        }{
          \exp_not:V \l_tmpa_tl
        }
        {}~ ( \exp_not:V \l_@@_fnname_tl )
      }
    }
  }
  \bool_lazy_all:nF {
    { \seq_if_empty_p:N \g_@@_authorcorr_seq }
    { \seq_if_empty_p:N \l_@@_fnemails_seq }
    { \seq_if_empty_p:N \l_@@_fnorcids_seq }
  }{
    \group_begin:
    \cs_set_eq:NN \thefootnote \relax % unnumbered
    \cs_set:Npn \@makefntext ##1
    { \dim_zero:N \parindent \noindent ##1 }
    \footnotetext {
      \seq_if_empty:NF \g_@@_authorcorr_seq {
        \textsuperscript{*} ~ \translatekey{corrauthor}. \par
      }
      \seq_if_empty:NF \l_@@_fnemails_seq {
        \translatekey{emails}: ~
        \seq_use:Nn \l_@@_fnemails_seq { , ~ } . \par
      }
      \seq_if_empty:NF \l_@@_fnorcids_seq {
        ORCID: ~ \seq_use:Nn \l_@@_fnorcids_seq { , ~ } . \par
      }
    }
    \group_end:
  }
}

% Declare author sequences
\seq_new:N \g_@@_authors_seq
\seq_new:N \g_@@_authorswaff_seq
\seq_new:N \g_@@_authoraffs_seq
\seq_new:N \g_@@_authorlist_seq
\seq_new:N \g_@@_authorscalls_seq
\seq_new:N \g_@@_authoremails_seq
\seq_new:N \g_@@_authororcids_seq
\seq_new:N \g_@@_authorcorr_seq
\seq_new:N \g_@@_authorsurnames_seq
\seq_new:N \g_@@_authorfirstnames_seq

\bool_new:N \l_@@_author_iscorresponding_bool
\tl_new:N   \l_@@_author_email_tl
\tl_new:N   \l_@@_author_orcid_tl

% Add author to sequences
\cs_new:Nn \@@_addauthor:nnnn {
  \tl_clear:N \l_@@_author_email_tl
  \tl_clear:N \l_@@_author_orcid_tl
  \bool_set_false:N \l_@@_author_iscorresponding_bool
  \keys_set:nn { ugentdocs / author } {#4}

  \@@_addto_affseq:n {#3} % must be before nameaffiliationseq

  \@@_addto_nameseq:nnn             {authors} {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {authors} {#1}{#2}{\l_@@_affiltext_tl}
  \@@_addto_callseq:nnnnn           {authors} {#1}{#2}{#3}{#4}

  \tl_if_blank:VTF \l_@@_author_email_tl {
    \seq_gput_right:Nn \g_@@_authoremails_seq {}
  }{
    \@@_formatemail:V \l_@@_author_email_tl
    \seq_gput_right:NV \g_@@_authoremails_seq \l_@@_email_tl
  }
  \seq_gput_right:NV \g_@@_authororcids_seq \l_@@_author_orcid_tl
  \bool_if:NT \l_@@_author_iscorresponding_bool{
    \seq_gput_right:Nx \g_@@_authorcorr_seq
    { \seq_count:N \g_@@_authors_seq }
  }

  \@@_parsename:n {#2}
  \seq_gput_right:NV \g_@@_authorsurnames_seq   \l_@@_surname_tl
  \seq_gput_right:NV \g_@@_authorfirstnames_seq \l_@@_firstname_tl
  \seq_gput_right:Nx \g_@@_authorlist_seq {
    \exp_not:V \l_@@_surname_tl ,~\tl_head:N \l_@@_firstname_tl .
  }
}

\keys_define:nn { ugentdocs / author }{
  corresponding .bool_set:N = \l_@@_author_iscorresponding_bool,
  corresponding .default:n  = true,
  email         .tl_set:N   = \l_@@_author_email_tl,
  orcid         .tl_set:N   = \l_@@_author_orcid_tl,
}

\RenewDocumentCommand{\author}{O{} mmm}{
  \@@_addauthor:nnnn { #2 } { #3 } { #4 } { #1 }
}
\ExplSyntaxOff
%</phd|crs|bama|bkc|ex|le|rp|art>
%<*phd|bama|art>
\ExplSyntaxOn
\AtBeginDocument{
  \ifseqempty{authors}{
    \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\author}%
  }{}
}
\ExplSyntaxOff
%</phd|bama|art>
% \fi
%
% \DescribeMacro[crs-rp-bkc-ex]{\lecturer}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \marg{affiliation}
%   \margintag{lecturers\_seq}
%   \margintag{lecturerswaff\_seq}
%   \margintag{lecturerscalls\_seq}\\
%   Usage similar to |\author|.
%   The lecturers can be the same or independent
%   from the authors of, e.g., a course text.
%   The lecturers are used in
%   the |report| cover page (optional),
%   the |course| and |exam| cover pages, and
%   the |bookcover| spine (precedence over authors).
% \iffalse
%<*crs|ex|rp|bkc>
\ExplSyntaxOn
\seq_new:N \g_@@_lecturers_seq
\seq_new:N \g_@@_lecturerscalls_seq
\seq_new:N \g_@@_lecturerswaff_seq
\cs_new:Nn \@@_addlecturer:nnn {
  \@@_addto_affseq:n {#3}

  \@@_addto_nameseq:nnn             {lecturers} {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {lecturers} {#1}{#2}{\l_@@_affiltext_tl}
  \@@_addto_callseq:nnnn            {lecturers} {#1}{#2}{#3}
}
\NewDocumentCommand{\lecturer}{mmm}{
  \@@_addlecturer:nnn { #1 } { #2 } { #3 }
}
\ExplSyntaxOff
%</crs|ex|rp|bkc>
%<*crs|bkc>
\ExplSyntaxOn
\AtBeginDocument{
  \exp_args:Nx \str_case:nn { \l_@@_covertype_tl } {
    { course }  {
      \ifseqempty{lecturers}{

      \ifseqempty{authors}{
        \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\lecturer~or~\author}%
      }{}
      }{}
    }
  }
}
\ExplSyntaxOff
%</crs|bkc>
% \fi
%
% \DescribeMacro[bama-phd-bkc]{\supervisor}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \marg{affiliation}
%   \margintag{mandatory}
%   \margintag{supervisors\_seq}
%   \margintag{supervisorswaff\_seq}
%   \margintag{supervisorscalls\_seq}
%   \margintag{allsupervisors\_seq}
%   \margintag{allsupervisorswaff\_seq}
%   \margintag{allsupervisorstutors\_seq}\\
%   Adds a person supervising the dissertation.
%   Usage similar to |\author|.
%   The supervisors are used in
%   the |bama|, |report| (optional), and |phd| cover pages,
%   and the |phd| examination committee page.
%   The |allsupervisors| sequence additionally stores the
%   co-supervisors and external supervisors (see below), and the
%   |allsupervisorstutors| additionally includes |tutors| (see below).
%   Both are used in the |bama| autograph / copyright page.
% \iffalse
%<*bama|phd|bkc>
\ExplSyntaxOn
\seq_new:N \g_@@_supervisors_seq
\seq_new:N \g_@@_supervisorscalls_seq
\seq_new:N \g_@@_supervisorswaff_seq
\seq_new:N \g_@@_allsupervisors_seq
\seq_new:N \g_@@_allsupervisorstutors_seq
\seq_new:N \g_@@_allsupervisorswaff_seq
\cs_new:Nn \@@_addsupervisor:nnn {
  \@@_addto_affseq:n {#3}

  \@@_addto_nameseq:nnn             {supervisors} {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {supervisors} {#1}{#2}{\l_@@_affiltext_tl}
  \@@_addto_callseq:nnnn            {supervisors} {#1}{#2}{#3}

  \@@_addto_nameseq:nnn             {allsupervisors}        {#1}{#2}
  \@@_addto_nameseq:nnn             {allsupervisorstutors}  {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {allsupervisors}        {#1}{#2}{\l_@@_affiltext_tl}
}
\NewDocumentCommand{\supervisor}{mmm}{
  \@@_addsupervisor:nnn { #1 } { #2 } { #3 }
}

\AtBeginDocument{
  \exp_args:Nx \str_case:nn { \l_@@_covertype_tl } {
    { phd }    {
      \ifseqempty{supervisors}{
        \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\supervisor}%
      }{}
    }
  }
}
\ExplSyntaxOff
%</bama|phd|bkc>
% \fi
%
% \vspace{1.5cm}
% \DescribeMacro[bama]{\cosupervisor}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \marg{affiliation}
%   \margintag{cosupervisors\_seq}
%   \margintag{cosupervisorswaff\_seq}\\
%   Adds a person co-supervising the Ba/Ma dissertation (optional).
%   Used in the |bama| cover page and autograph / copyright page.
%   See also |\supervisor|.
%
% \DescribeMacro[bama]{\extsupervisor}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \marg{affiliation}
%   \margintag{extsupervisors\_seq}
%   \margintag{extsupervisorswaff\_seq}\\
%   Adds an external supervisor of the Ba/Ma dissertation (optional).
%   Used in the |bama| cover page and autograph / copyright page.
%   See also |\supervisor|.
%
% \DescribeMacro[bama]{\tutor}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \marg{affiliation}
%   \margintag{tutors\_seq}
%   \margintag{tutorswaff\_seq}\\
%   Adds a tutor or mentor of the Ba/Ma dissertation (optional).
%   Used in the |bama| cover page and autograph / copyright page.
%   See also |\supervisor|.
% \iffalse
%<*bama>
\ExplSyntaxOn
\seq_new:N \g_@@_cosupervisors_seq
\seq_new:N \g_@@_cosupervisorswaff_seq
\cs_new:Nn \@@_addcosupervisor:nnn {
  \@@_addto_affseq:n {#3}

  \@@_addto_nameseq:nnn             {cosupervisors} {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {cosupervisors} {#1}{#2}{\l_@@_affiltext_tl}

  \@@_addto_nameseq:nnn             {allsupervisors}        {#1}{#2}
  \@@_addto_nameseq:nnn             {allsupervisorstutors}  {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {allsupervisors}        {#1}{#2}{\l_@@_affiltext_tl}
}
\NewDocumentCommand{\cosupervisor}{mmm}{
  \@@_addcosupervisor:nnn { #1 } { #2 } { #3 }
}

\seq_new:N \g_@@_extsupervisors_seq
\seq_new:N \g_@@_extsupervisorswaff_seq
\cs_new:Nn \@@_addextsupervisor:nnn {
  \@@_addto_affseq:n {#3}

  \@@_addto_nameseq:nnn             {extsupervisors} {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {extsupervisors} {#1}{#2}{\l_@@_affiltext_tl}

  \@@_addto_nameseq:nnn             {allsupervisors}        {#1}{#2}
  \@@_addto_nameseq:nnn             {allsupervisorstutors}  {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {allsupervisors}        {#1}{#2}{\l_@@_affiltext_tl}
}
\NewDocumentCommand{\extsupervisor}{mmm}{
  \@@_addextsupervisor:nnn { #1 } { #2 } { #3 }
}

\seq_new:N \g_@@_tutors_seq
\seq_new:N \g_@@_tutorswaff_seq
\cs_new:Nn \@@_addtutor:nnn {
  \@@_addto_affseq:n {#3}

  \@@_addto_nameseq:nnn             {tutors} {#1}{#2}
  \@@_addto_nameaffiliationseq:nnnV {tutors} {#1}{#2}{\l_@@_affiltext_tl}

  \@@_addto_nameseq:nnn             {allsupervisorstutors} {#1}{#2}
}
\NewDocumentCommand{\tutor}{mmm}{
  \@@_addtutor:nnn { #1 } { #2 } { #3 }
}
\ExplSyntaxOff
%</bama>
% \fi
%
% \DescribeMacro[phd]{\jurymember}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \marg{affiliation}
%   \margintag{mandatory}
%   \margintag{jurymemberswaff\_seq}\\
%   Adds a jury member to your PhD dissertation.
%   This excludes the jury chair (see below).
%   Usage similar to |\author|.
%   Used in the PhD examination committee page.
% \iffalse
%<*phd>
\ExplSyntaxOn
\seq_new:N \g_@@_jurymemberswaff_seq
\cs_new:Nn \@@_addjurymember:nnn {
  \@@_addto_affseq:n {#3}

  \@@_addto_nameaffiliationseq:nnnV {jurymembers} {#1}{#2}{\l_@@_affiltext_tl}
}
\NewDocumentCommand{\jurymember}{mmm}{
  \@@_addjurymember:nnn { #1 } { #2 } { #3 }
}
\AtBeginDocument{
  \ifseqempty{jurymemberswaff}{
    \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\jurymember}%
  }{}
}
\ExplSyntaxOff
%</phd>
% \fi
%
% \DescribeMacro[phd]{\jurychair}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \marg{affiliation}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Specifies the jury chair of your PhD dissertation.
%   Used in the PhD examination committee page.
%   Sets the |\@jurychairaff| tag in addition to the |\@jurychair| tag.
% \iffalse
%<*phd>
\ExplSyntaxOn
\newcommand*{\@jurychair}{
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\jurychair}%
}
\newcommand*{\@jurychairaff}{}
\newcommand*{\jurychair}[3]{
  \renewcommand*{\@jurychair}{#1~\@formatname{#2}}\renewcommand*{\@jurychairaff}{#3}}
\ExplSyntaxOff
%</phd>
% \fi
%
% \DescribeMacro[phd]{\dean}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Specifies the current dean of your faculty.
%   Used in the PhD examination committee page.
% \iffalse
%<*phd>
\ExplSyntaxOn
\newcommand*{\@dean}[2]{
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\dean}%
}
\newcommand*{\dean}[2]{
  \renewcommand*{\@dean}{#1~\@formatname{#2}}
}
\ExplSyntaxOff
%</phd>
% \fi
%
% \DescribeMacro[phd]{\rector}
%   \marg{title}
%   \marg{Surname, Firstname}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Specifies the current rector of the university.
%   Used in the PhD examination committee page.
% \iffalse
%<*phd>
\ExplSyntaxOn
\newcommand*{\@rector}[2]{%
  prof.~dr.~\@formatname{De~Sutter, Petra}%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\rector}%
}
\newcommand*{\rector}[2]{
  \renewcommand*{\@rector}{#1~\@formatname{#2}}
}
\ExplSyntaxOff
%</phd>
% \fi
%
% \DescribeMacro[phd-crs]{\coverdesigner}
%   \marg{Surname, Firstname}
%   \margintag{tag}\\
%   Credits the cover designer of your cover page image.
%   Used in the PhD colophon page.
% \iffalse
%<*phd|crs>
\newcommand*{\@coverdesigner}{}
\newcommand*{\coverdesigner}[1]{
  \renewcommand*{\@coverdesigner}{\@formatname{#1}}
}
%</phd|crs>
% \fi
%
% \DescribeMacro[bama-ex-rp]{\studentnr}
%   \marg{student number}
%   \margintag{tag}\\
%   Specifies the student number.
%   For reports and Ba/Ma dissertations, this is used in the cover page if set.
%   For multiple students for reports or bachelor's dissertations,
%   it is best to specify the student numbers
%   in the affiliation section of the |\author| macro,
%   with '|&|' to align them (see also examples).
% \iffalse
%<*ex|bama|rp>
\newcommand*{\@studentnr}{}
\newcommand*{\studentnr}[1]{\renewcommand*{\@studentnr}{#1}}
%</ex|bama|rp>
% \fi
%
%
% \subsubsection{Contact}
% \label{S:usage:macros:contact}
%
% \DescribeMacro[phd-le-rp]{\address}
%   \marg{address lines}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Address of the author(s) of the |letter|, |report|, or |phd|.
%   Newlines are allowed and encouraged.
%   Used in the letter's header, the report cover page (optional),
%   and the PhD colophon page.
% \iffalse
%<*phd|le>
\ExplSyntaxOn
\newcommand*{\@address}{
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\address}%
}
\ExplSyntaxOff
%</phd|le>
%<rp>\newcommand*{\@address}{}
%<phd|rp>\newcommand*{\address}[1]{\renewcommand*{\@address}{#1}}
%<le>\renewcommand*{\address}[1]{\renewcommand*{\@address}{#1}}
% \fi
%
% \DescribeMacro[phd-crs-bama-bkc-ex-le-rp-bmr-art]{\email}
%   \oarg{domain}
%   \marg{local-part}
%   \margintag{emails\_seq}\\
%   E-mail address of the sending person, or the administrative person
%   tracking the letter or report.
%   Used in the |letter| header and |report| cover page (optional).
%   You can specify multiple email addresses by using the command
%   multiple times.
% \iffalse
%<*phd|crs|bama|bkc|ex|le|rp|bmr|art>
\ExplSyntaxOn
\seq_new:N \g_@@_emails_seq
\tl_new:N \l_@@_domain_tl
\tl_new:N  \l_@@_email_tl
\seq_new:N \l_@@_emailparts_seq

% Helper CS for email when both name and domain are given
\cs_new_protected:Nn \@@_formatemail:nn {
  \tl_set:Nn \l_@@_domain_tl {#1}
  \tl_if_empty:NT \l_@@_domain_tl {
    \tl_set:Nx \l_@@_lookup_key_tl { \languagename {}: domain }
    \prop_if_in:NVTF \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl
      { \tl_set:Nx \l_@@_domain_tl { \prop_item:NV \g_@@_dict_keyvals_prop \l_@@_lookup_key_tl } }
      { \tl_set:Nx \l_@@_domain_tl { \prop_item:Nn \g_@@_dict_keyvals_prop {english:domain} } }
  }
  \@ifpackageloaded{hyperref}{
    \tl_set:Nx \l_@@_email_tl
    { \exp_not:N \href{mailto:#2@\l_@@_domain_tl}{#2@\l_@@_domain_tl} }
  }{
    \tl_set:Nx \l_@@_email_tl { #2@\l_@@_domain_tl }
  }
}
\cs_generate_variant:Nn \@@_formatemail:nn { ee }

% Helper CS for email when either full email or only local part is given
\cs_new_protected:Nn \@@_formatemail:n {
  \regex_extract_once:nnNTF { \A (.*) @ (.*) \Z } {#1} \l_@@_emailparts_seq {
    \@@_formatemail:ee
      { \seq_item:Nn \l_@@_emailparts_seq {3} }
      { \seq_item:Nn \l_@@_emailparts_seq {2} }
  }{
    \@@_formatemail:nn {} {#1}
  }
}
\cs_generate_variant:Nn \@@_formatemail:n { V }

\cs_new_protected:Nn \@@_addemail:nn {
  \@@_formatemail:nn {#1} {#2}
  \seq_gput_right:Nx \g_@@_emails_seq { \exp_not:V \l_@@_email_tl \exp_not:N \strut }
}
\NewDocumentCommand{\email}{O{} m}{
  \@@_addemail:nn { #1 } { #2 }
}
\ExplSyntaxOff
%</phd|crs|bama|bkc|ex|le|rp|bmr|art>
% \fi
%
%
% \DescribeMacro[le-rp]{\phone}
%   \marg{phone number}
%   \margintag{phones\_seq}\\
%   \def\Phone {{\wasyfamily\char7}}
%   Add phone numbers.
%   Used in the |letter| header and |report| cover page (optional).
%   The |wasysym| package's |\phone| macro is redefined to |\Phone|: \Phone
% \iffalse
%<*bkc|le|rp|ex|crs|phd|bama>
% wasysym fix
\IfPackageLoadedTF{wasysym}{
  \def\Phone {{\wasyfamily\char7}}
}{}
%</bkc|le|rp|ex|crs|phd|bama>
%<*le|rp|bmr>
\ExplSyntaxOn
\seq_new:N \g_@@_phones_seq
\cs_new:Nn \@@_addphone:n {
  \seq_gput_right:Nn \g_@@_phones_seq {#1\strut}
}
\RenewDocumentCommand{\phone}{m}{ % Already def'ed in wasysym
  \@@_addphone:n { #1 }
}
\ExplSyntaxOff
%</le|rp|bmr>
% \fi
%
%
% \DescribeMacro[le]{\fax}
%   \marg{fax number}
%   \margintag{faxes\_seq}\\
%   Add fax numbers.
%   Used in the |letter| header.
% \iffalse
%<*le>
\ExplSyntaxOn
\seq_new:N \g_@@_faxes_seq
\cs_new:Nn \@@_addfax:n {
  \seq_gput_right:Nn \g_@@_faxes_seq {#1\strut}
}
\NewDocumentCommand{\fax}{m}{
  \@@_addfax:n { #1 }
}
\ExplSyntaxOff
%</le>
% \fi
%
%
% \DescribeMacro[le-rp]{\mobile}
%   \marg{mobile number}
%   \margintag{mobiles\_seq}\\
%   Add mobile numbers.
%   Used in the |letter| header and |report| cover page (optional).
% \iffalse
%<*le|rp|bmr>
\ExplSyntaxOn
\seq_new:N \g_@@_mobiles_seq
\cs_new:Nn \@@_addmobile:n {
  \seq_gput_right:Nn \g_@@_mobiles_seq {#1\strut}
}
\NewDocumentCommand{\mobile}{m}{
  \@@_addmobile:n { #1 }
}
\ExplSyntaxOff
%</le|rp|bmr>
% \fi
%
%
% \subsubsection{Course macros}
% \label{S:usage:macros:course}
%
% \DescribeMacro[ex-crs]{\course}
%   \marg{course code}
%   \marg{course name}
%   \margintag{mandatory}
%   \margintag{courses\_seq}
%   \margintag{courseswcodes\_seq}
%   \margintag{courscodes\_seq}\\
%   Code  and name of the curriculum course this course material
%   or exam belongs to. Not sure if there's a clear structure for course codes,
%   but you can find them on the ``studiefiche'' of the course.
% \iffalse
%<*crs|ex>
\ExplSyntaxOn
\seq_new:N \g_@@_courseswcodes_seq
\seq_new:N \g_@@_courses_seq
\seq_new:N \g_@@_coursecodes_seq
\cs_new:Nn \@@_addcourse:nn {
  \seq_gput_right:Nn \g_@@_courseswcodes_seq { \texttt{#1}~#2\strut }
  \seq_gput_right:Nn \g_@@_courses_seq       { #2\strut             }
  \seq_gput_right:Nn \g_@@_coursecodes_seq   { \texttt{#1}\strut    }
}
\NewDocumentCommand{\course}{mm}{
  \@@_addcourse:nn { #1 } { #2 }
}

\AtBeginDocument{
  \ifseqempty{courses}{
    \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\course}%
  }{}
}
\ExplSyntaxOff
%</crs|ex>
% \fi
%
% \DescribeMacro[crs]{\courseversion}
%   \marg{version number}
%   \margintag{tag}\\
%   Sets the current course version, to keep track of changes over time.
%   Used on the colophon / copyright page and in the header/footer.
% \iffalse
%<*crs>
\newcommand*{\@courseversion}{}
\newcommand*{\courseversion}[1]{\renewcommand*{\@courseversion}{#1}}
%</crs>
% \fi
%
% \DescribeMacro[crs]{\publisher}
%   \marg{publisher information}
%   \margintag{tag}\\
%   Sets the publisher information. Can be multiline to include an address.
% \iffalse
%<*crs>
\newcommand{\@publisher}{}
\newcommand*{\publisher}[1]{\renewcommand*{\@publisher}{#1}}
%</crs>
% \fi
%
% \DescribeMacro[crs]{\publishercode}
%   \marg{publisher code}
%   \margintag{tag}\\
%   This macro sets the publisher code of the document.
%   It is printed on the course colophon / copyright page.
%   This is code that the publisher uses for its internal administration.
%   It may be a proprietary code, or an ISBN number.
% \iffalse
%<*crs>
\newcommand*{\@publishercode}{}
\newcommand*{\publishercode}[1]{\renewcommand*{\@publishercode}{#1}}
%</crs>
% \fi
%
%
% \subsubsection{Exam macros}
% \label{S:usage:macros:exam}
%
% \DescribeMacro[ex]{\exampart}
%   \marg{exam part}
%   \margintag{tag}\\
%   Describes which part of the course the exam covers.
%   The evaluation of a course often consists of multiple elements
%   (e.g. a written and oral exam).
%   Used in the exam cover page.
% \iffalse
%<*ex>
\newcommand*{\@exampart}{}
\newcommand*{\exampart}[1]{\renewcommand*{\@exampart}{#1}}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\examseries}
%   \marg{number or name of the exam series}
%   \margintag{tag}\\
%   Set the exam series number or name,
%   e.g., ``1 (eerste examenkans-inhaal)''.
%   Used in the exam cover page and footers.
% \iffalse
%<*ex>
\newcommand*{\@examseries}{}
\newcommand*{\examseries}[1]{\renewcommand*{\@examseries}{#1}}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\examduration}
%   \marg{HHh}
%   \margintag{tag}\\
%   Specifies the total length of the exam in a unit of time, e.g., '4h'.
%   Used on the exam cover page.
% \iffalse
%<*ex>
\newcommand*{\@examduration}{TBD}
\newcommand*{\examduration}[1]{\renewcommand*{\@examduration}{#1}}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\examstart}
%   \marg{HHhMM}
%   \margintag{tag}\\
%   Specifies the start time of the exam,
%   preferably in the format 'HHhMM', e.g., '08h30'.
%   Used on the exam cover page.
% \iffalse
%<*ex>
\newcommand*{\@examstart}{TBD}
\newcommand*{\examstart}[1]{\renewcommand*{\@examstart}{#1}}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\examend}
%   \marg{HHhMM}
%   \margintag{tag}\\
%   Specifies the end time of the exam,
%   preferably in the format 'HHhMM', e.g., '12h30'.
%   Used on the exam cover page.
% \iffalse
%<*ex>
\newcommand*{\@examend}{TBD}
\newcommand*{\examend}[1]{\renewcommand*{\@examend}{#1}}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\room}
%   \marg{room number}
%   \margintag{rooms\_seq}\\
%   Specifies the rooms in which the exam will take place.
%   This is useless info for the student when reading the exam,
%   but may be of convenience for you as author or supervisor of the exam.
%   Used in the cover page of the exam.
% \iffalse
%<*ex>
\ExplSyntaxOn
\seq_new:N \g_@@_rooms_seq
\cs_new:Nn \@@_addroom:n {
  \seq_gput_right:Nn \g_@@_rooms_seq { #1\strut }
}
\NewDocumentCommand{\room}{m}{
  \@@_addroom:n { #1 }
}
\ExplSyntaxOff
%</ex>
% \fi
%
% \DescribeMacro[ex]{\extrainfo}
%   \marg{extra information text}
%   \margintag{tag}\\
%   Specifies the extra information to describe
%   the materials that can be used during the examination
%   and cautioning the students not to commit fraud.
% \iffalse
%<*ex>
\newcommand{\@extrainfo}{}
\NewDocumentCommand{\extrainfo}{+m} {
  \renewcommand{\@extrainfo}{#1}
}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\question}
%   \oarg{weight}\marg{question}\\
%   Adds a question to the exam, with automatic number counting.
%   The |<question>| can be any content.
%   Using the optional argument (e.g., |weight=3|)
%   adds the weight of the question in the left margin.
%
% \DescribeMacro[ex]{\subquestion}
%   \oarg{weight}\marg{question}\\
%   Works entirely similar to the |\question|, but
%   uses letters (e.g., ``a)'') and is indented slightly.
% \iffalse
%<*ex>
\ExplSyntaxOn
% Question counters
\newcounter{question}
\newcounter{subquestion}[question]
\setcounter{question}{0}

\renewcommand*\thequestion{\@arabic\c@question}
\renewcommand*\thesubquestion{\alph{subquestion}}

% Vars
\int_new:N \l_@@_qweight_int
\bool_new:N \l_@@_qhasweight_bool
\tl_new:N  \l_@@_pointlabel_tl
\tl_new:N  \g_@@_pointlabel_default_tl
\tl_gset:Nn \g_@@_pointlabel_default_tl { p }
\int_new:N \l_@@_qoverviewtot_int
\tl_new:N \l_@@_qoverviewrows_tl

% Question arg keys
\keys_define:nn { ugentdocs/question } {
  weight     .code:n = {
    \int_set:Nn \l_@@_qweight_int {#1}
    \bool_set_true:N \l_@@_qhasweight_bool
  } ,
  pointlabel .tl_set:N = \l_@@_pointlabel_tl ,
}

% Helper CS for margin label
\cs_new_protected:Npn \@@_qmarginlabel:n #1 {
  \leavevmode
  \kern -1cm
  \llap{ #1 }
  \kern 1cm
}

% Question label box
\box_new:N \l_@@_qlabel_box

\cs_new_protected:Npn \@@_hanginglabel:n #1 {
  \hbox_set:Nn \l_@@_qlabel_box { #1 }
  \hangindent = \wd\l_@@_qlabel_box
  \hangafter  = 1
  \box_use:N \l_@@_qlabel_box
}

% Question and subqestion
\NewDocumentCommand{\question}{O{} +m} {
  \par
  \bool_set_false:N \l_@@_qhasweight_bool
  \int_zero:N \l_@@_qweight_int
  \tl_set_eq:NN \l_@@_pointlabel_tl \g_@@_pointlabel_default_tl
  \keys_set:nn { ugentdocs/question } { #1 }
  \stepcounter{question}
  \begingroup
    \noindent
    \bool_if:NT \l_@@_qhasweight_bool {
      \textbf{\@@_qmarginlabel:n { \int_use:N \l_@@_qweight_int \l_@@_pointlabel_tl }}
    }
    \textbf{\translatekey{question}~\thequestion{}:}~#2%
    \bool_if:NT \l_@@_qhasweight_bool {
      \@@_qoverview_write:nnn { 0 }
        { \thequestion } { \int_use:N \l_@@_qweight_int }
    }
    \par
  \endgroup
}

\NewDocumentCommand{\subquestion}{O{} +m} {
  \par
  \bool_set_false:N \l_@@_qhasweight_bool
  \int_zero:N \l_@@_qweight_int
  \tl_set_eq:NN \l_@@_pointlabel_tl \g_@@_pointlabel_default_tl
  \keys_set:nn { ugentdocs/question } { #1 }
  \stepcounter{subquestion}
  \begingroup
    \noindent
    \advance\leftskip by 0.25cm\relax
    \parindent=0pt
    \noindent
    \bool_if:NT \l_@@_qhasweight_bool {
      \@@_qmarginlabel:n { \int_use:N \l_@@_qweight_int \l_@@_pointlabel_tl }
    }
    \@@_hanginglabel:n { \thesubquestion)~ }
    ~#2%
    \bool_if:NT \l_@@_qhasweight_bool {
      \@@_qoverview_write:nnn { 1 }
        { \thequestion\thesubquestion } { \int_use:N \l_@@_qweight_int }
    }
    \par
  \endgroup
}
\ExplSyntaxOff
%</ex>
% \fi
%
% \DescribeMacro[ex]{\pointoverview}
%   Prints the point overview table, including a total row.
% \iffalse
%<*ex>
\ExplSyntaxOn
% Question overview aux file
\seq_new:N \g_@@_qoverview_seq
\iow_new:N \g_@@_qoverview_iow

\cs_new_protected:Npn \@@_qoverview_addq:nnn #1#2#3 {
  \seq_gput_right:Nn \g_@@_qoverview_seq { {#1}{#2}{#3} }
}

\cs_new_protected:Npn \@@_qoverview_write:nnn #1#2#3 {
  \iow_now:Nx \g_@@_qoverview_iow {
    \exp_not:N \@@_qoverview_addq:nnn {#1}{#2}{#3}
  }
}

\cs_new_protected:Npn \@@_qoverview_procq:nnn #1#2#3 {
  \int_compare:nNnT {#1} = {0} { \int_add:Nn \l_@@_qoverviewtot_int {#3} }
  \tl_put_right:Nn \l_@@_qoverviewrows_tl {
    \int_compare:nNnTF {#1} = {0}
    { \textbf{~#2}   ~&~ #3 \\}
    { \phantom{~0}#2 ~&~ \phantom{~0}#3 \\}

  }
}

\ExplSyntaxOff

% Open and close aux .exq file
\ExplSyntaxOn
\AddToHook{begindocument}{
  \seq_gclear:N \g_@@_qoverview_seq
  \ExplSyntaxOn
  \InputIfFileExists{\jobname.exq}{}{}
  \ExplSyntaxOff
  \iow_open:Nn \g_@@_qoverview_iow { \jobname.exq }
}
\AddToHook{enddocument/afterlastpage}{
  \iow_close:N \g_@@_qoverview_iow
}
\ExplSyntaxOff

% Print point overview
\ExplSyntaxOn
\NewDocumentCommand{\pointoverview}{}{
  \par
  \group_begin:
  \tl_clear:N \l_@@_qoverviewrows_tl
  \int_zero:N \l_@@_qoverviewtot_int
  \seq_map_inline:Nn \g_@@_qoverview_seq { \@@_qoverview_procq:nnn ##1 }
  \begin{tabular}{@{}l@{\hspace{2em}}l@{}}
    \textbf{\translatekey{question}} & \textbf{\translatekey{weight}}\\
    \hline
    \l_@@_qoverviewrows_tl
    \hline
    \textbf{\translatekey{total}} & \int_use:N \l_@@_qoverviewtot_int \\
  \end{tabular}
  \group_end:
  \par
}
\ExplSyntaxOff
%</ex>
% \fi
%
% \DescribeMacro[ex]{\bilingual}
%   \oarg{language 1}
%   \oarg{language 2}
%   \marg{text 1}
%   \marg{text 2}\\
%   Typesets content (|<text 1>| and |<text 2>|) in two languages side-by-side.
%   By default, |<language 1>| is |english| and |<language 2>| is |dutch|.
%   Specifying only one optional argument overrides English.
%   Fully supported by the |babel| package, so logos, translatekeys, etc.
%   are automatically translated if the dictionary is present for that language
%   (see Section~\ref{S:usage:langdateloc:dict}).
% \iffalse
%<*ex>
\NewDocumentCommand{\bilingual}{O{english} O{dutch} +m +m}{%
  \par\noindent
  \begin{minipage}[t]{\dimexpr0.5\linewidth-1em\relax}%
    \foreignlanguage{#1}{#3}%
  \end{minipage}%
  \hfill
  \begin{minipage}[t]{\dimexpr0.5\linewidth-1em\relax}%
    \foreignlanguage{#2}{#4}%
  \end{minipage}%
  \par
}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\mcsymb}
%   \marg{new symbol}
%   \DescribeDefault{\textbackslash Square: \Square}\\
%   Sets the symbol to be used as multiple choice mark.
% \iffalse
%<*ex>
\newcommand*\@mcsymb{\Square}
\newcommand*\mcsymb[1]{\renewcommand\@mcsymb{#1}}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\mc}
%   \marg{choice option}\\
%   Typesets a multiple choice answer option.\\
%   For bilingual, use |\mc{\bilingual{english option}{dutch option}}|.
% \iffalse
%<*ex>
\newcommand\mc[1]{%
  \hfill\break\qquad\begin{tabular}{cc}
    $\@mcsymb$
    &
    \begin{minipage}[t]{0.9\textwidth}%
      #1
    \end{minipage}%
  \end{tabular}
}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\gridpage}
%   \marg{watermark}\\
%   Creates a full page containing the |<watermark>| (can be empty),
%   with a dotted grid wiith half a |\gridunit| spacing.
%   Can be used for, e.g., scrap paper.
% \iffalse
%<*ex>
\newlength\@PD % Page diagonal
\pgfmathsetlength\@PD{veclen(\@PW,\@PH)}
\pgfmathsetmacro\@WMA{atan(\@PH/\@PW)}% Watermark angle

\newcommand\gridpage[1]{
  \clearpage
  \AddToHookNext{shipout/foreground}{
    \put(0,-\paperheight){%
      \begin{tikzpicture}
      \path (0,0) (\paperwidth,\paperheight);
      \draw[densely dotted, step=0.5\gridunit,black!20] % Left of footer
        (\gridunit,\gridunit) grid (2\gridunit,2\gridunit);
      \draw[densely dotted, step=0.5\gridunit,black!20] % Right of footer
        (\paperwidth-2\gridunit,\gridunit) grid (\paperwidth-\gridunit,2\gridunit);

      \draw[densely dotted, step=0.5\gridunit,black!20] % Main grid
        (\gridunit,2\gridunit) grid (\paperwidth-\gridunit,\paperheight-2\gridunit);
      \draw[densely dotted, step=0.5\gridunit,black!20] % Left of header
        (\gridunit,\paperheight-2\gridunit) grid (10\gridunit,\paperheight-\gridunit);
      \end{tikzpicture}
    }
    \put(0.5\@PW,-0.5\@PH){\makebox(0,0){\rotatebox{\@WMA}{%
          \parbox{\@PD}{\centering\color{watermarkcolor}%
            \fontsize{105}{130}\selectfont\sffamily #1}}}}%
  }%
  ~\relax
}
%</ex>
% \fi
%
% \DescribeMacro[ex]{\answerspace}
%   \oarg{style=grid/lines/none}
%   \oarg{lines=number of lines}\\
%   Creates an answer space with an outline box.
%   If |lines| is not specified,
%   it will fill the remainder of the page (or create a full page).
%   If the number of |lines| exceeds the remaining page capacity,
%   it continues on the next page.
%   The line or grid spacing dimension can be set using
%   |\answerspacing{<length>}|.
%   Specifying no |style| optional argument just prints the outline box,
%   whilst |style=grid| produces a |darkgray| dotted grid,
%   and |style=lines| produces a |darkgray| lined box.
% \iffalse
%<*ex>
\ExplSyntaxOn
\NewDocumentCommand{\answerspacing}{m}{
  \dim_set:Nn \l_@@_anslinestep_dim {#1}
}

\zref@addprops{savepos}{abspage}
\dim_new:N \l_@@_anslinestep_dim
\dim_new:N \l_@@_ansytop_dim
\dim_new:N \l_@@_ansybottom_dim

\dim_new:N \l_@@_anstolerancesnap_dim
\dim_set:Nn \l_@@_anstolerancesnap_dim {1cm}
\dim_new:N \l_@@_ansgapstop_dim
\dim_set:Nn \l_@@_ansgapstop_dim {0.2cm}
\dim_new:N \l_@@_textleft_dim

\int_new:N \g_@@_anscounter_int
\int_new:N \l_@@_anstargetpage_int
\dim_new:N \l_@@_cury_dim
\dim_new:N \l_@@_needed_dim
\dim_new:N \l_@@_available_dim
\bool_new:N \l_@@_ansattop_bool
\tl_new:N \l_@@_ansstyle_tl
\int_new:N \l_@@_nlines_int


% Set dimensions of linestep and where top starts and bottom ends
\AtBeginDocument{
  \dim_set:Nn \l_@@_anslinestep_dim {\baselineskip}
  \dim_set:Nn \l_@@_ansytop_dim
    { \paperheight - 1in - \voffset - \topmargin - \headheight - \headsep }
  \group_begin:
    \small
    \dim_gset:Nn \g_tmpa_dim { \box_ht:N \strutbox }
  \group_end:
  \dim_set:Nn \l_@@_ansybottom_dim
    { \l_@@_ansytop_dim - \textheight - \footskip + \g_tmpa_dim + \footruleskip }
}

% Set style of grid and lines
\tikzset{
  answer-grid/.style  =
    { densely~dotted, darkgray, step = \l_@@_anslinestep_dim },
  answer-lines/.style =
    { densely~dotted, darkgray, xstep = \paperwidth, ystep = \l_@@_anslinestep_dim },
  answer-/.style      =
    { draw = none },
}

% Helper CS: #1 rounded down to a whole number of line steps
\cs_new:Nn \_@@_trim_span:n {
  \l_@@_anslinestep_dim *
  \int_div_truncate:nn { \dim_to_decimal_in_sp:n {#1} }
    { \dim_to_decimal_in_sp:n { \l_@@_anslinestep_dim } }
}

% Answer boxes 1: contained/inline box.
% #1 = height, #2 = style
\cs_new_protected:Nn \_@@_draw_inline_ansgrid:nn {
  \par\noindent
  \begin{tikzpicture}
    \useasboundingbox (0,0) rectangle (\textwidth,#1);
    \draw [answer-#2] (0,0) grid (\textwidth,#1);
    \draw [thick] (0,0) rectangle (\textwidth,#1);
  \end{tikzpicture}
  \par
}
\cs_generate_variant:Nn \_@@_draw_inline_ansgrid:nn { nV }

% Answer boxes 2: extending down to footer rule.
% #1 = target abspage, #2 = y top, #3 = y pattern anchor, #4 = style
\cs_new_protected:Nn \_@@_shipout_ansgrid:nnnn {
  \int_compare:nNnT { \value{abspage} } = {#1} {
    \dim_set:Nn \l_@@_textleft_dim
    { 1in + \hoffset + \int_if_odd:nTF { \value{page} } { \oddsidemargin } { \evensidemargin } }
    \put (0,-\paperheight) {
      \begin{tikzpicture}
        \path (0,0) (\paperwidth,\paperheight);
        \begin{scope}
          \clip (\l_@@_textleft_dim,\l_@@_ansybottom_dim)
            rectangle (\l_@@_textleft_dim+\textwidth,#2);
          \draw [answer-#4, shift={(\l_@@_textleft_dim,#3)}]
            (0,-\textheight) grid (\textwidth,\textheight);
        \end{scope}
        \draw [thick] (\l_@@_textleft_dim,\l_@@_ansybottom_dim)
        |- (\l_@@_textleft_dim+\textwidth,#2) -- ++(0,\l_@@_ansybottom_dim-#2);
      \end{tikzpicture}
    }
  }
}

\keys_define:nn { ugentdocs/answerspace } {
  style .tl_set:N  = \l_@@_ansstyle_tl ,
  lines .int_set:N = \l_@@_nlines_int ,
}

\NewDocumentCommand{\answerspace}{O{}}{%
  \keys_set:nn { ugentdocs/answerspace } { style = , lines = 0, #1 }
  \par
  \int_gincr:N \g_@@_anscounter_int
  \zsavepos{answerspace-\int_use:N\g_@@_anscounter_int}%
  \dim_set:Nn \l_@@_cury_dim { \zposy{answerspace-\int_use:N\g_@@_anscounter_int} sp }
  \int_set:Nn \l_@@_anstargetpage_int {
    \zref@extract{answerspace-\int_use:N\g_@@_anscounter_int}{abspage}
  }
  \bool_set:Nn \l_@@_ansattop_bool{
    \dim_compare_p:nNn { \l_@@_ansytop_dim - \l_@@_cury_dim } < { 0.05cm }
  }
  \dim_sub:Nn \l_@@_cury_dim { \l_@@_ansgapstop_dim }
  \dim_set:Nn \l_@@_needed_dim {
    \int_if_zero:nTF { \l_@@_nlines_int }{
      \_@@_trim_span:n { \l_@@_cury_dim - \l_@@_ansybottom_dim }
    }{
      \l_@@_anslinestep_dim * \l_@@_nlines_int
    }
  }

  \bool_while_do:nn { \dim_compare_p:nNn { \l_@@_needed_dim } > { 0pt } } {
    \dim_set:Nn \l_@@_available_dim
      { \_@@_trim_span:n { \l_@@_cury_dim - \l_@@_ansybottom_dim } }
    \dim_compare:nNnTF { \l_@@_available_dim - \l_@@_needed_dim } < { \l_@@_anstolerancesnap_dim }{
      % Ansbox doesn't fit
      \exp_args:Nnx \AddToHook {shipout/background} {
        \_@@_shipout_ansgrid:nnnn
        { \int_use:N \l_@@_anstargetpage_int } % target page
        { \dim_eval:n { % y top
            \bool_if:NTF \l_@@_ansattop_bool{
              \l_@@_ansytop_dim
            }{
              \l_@@_ansybottom_dim + \l_@@_available_dim
            }
          }
        }
        { \dim_eval:n { % y pattern anchor
            \bool_if:NTF \l_@@_ansattop_bool {
              \l_@@_ansytop_dim
            }{
              \l_@@_ansybottom_dim
            }
          }
        }
        { \l_@@_ansstyle_tl } % pattern style (grid/lines)
      }
      \nointerlineskip\null
      \clearpage
      \int_incr:N \l_@@_anstargetpage_int
      \dim_sub:Nn \l_@@_needed_dim { \l_@@_available_dim }
      \dim_set_eq:NN \l_@@_cury_dim \l_@@_ansytop_dim
      \bool_set_true:N \l_@@_ansattop_bool
    }{
      % Ansbox fits, just inline
      \_@@_draw_inline_ansgrid:nV { \dim_use:N \l_@@_needed_dim } \l_@@_ansstyle_tl
      \dim_zero:N \l_@@_needed_dim
    }
  }
}
\ExplSyntaxOff
%</ex>
% \fi
%
%
% \subsubsection{Letter macros}
% \label{S:usage:macros:letter}
%
% \DescribeMacro[le]{\sender}
%   \marg{title and name}
%   \marg{role}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Sets the person writing the letter.
%   Does not use the |nameformat| option.
%   Additionally sets the |\@senderrole| tag to |<role>| (can be left empty).
%   Used in the letter's header and closing.
% \iffalse
%<*le>
\ExplSyntaxOn
\newcommand*{\@sender}{%
  <Sender>%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\sender}%
}
\newcommand*{\@senderrole}{~}
\newcommand*{\sender}[2]{\renewcommand*{\@sender}{#1}\renewcommand*{\@senderrole}{#2}}
\ExplSyntaxOff
%</le>
% \fi
%
% \DescribeMacro[le]{\returnaddress}
%   \marg{return address information}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   This is a short return address,
%   listed in small font on top of the  destination address,
%   visible in a windowed envelope (European format)
%   It should fit on a single line.
% The goal is to get the undelivered letter back to
% the person that can take action accordingly.
% \iffalse
%<*le>
\ExplSyntaxOn
\newcommand*{\@returnaddress}{%
  <Return~address>%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\returnaddress}%
}
\renewcommand*{\returnaddress}[1]
{\renewcommand*{\@returnaddress}{#1}}
\ExplSyntaxOff
%</le>
% \fi
%
% \DescribeMacro[le]{\to}
%   \marg{addressee name}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Specifies the name of the addressee.
%   Used in the envelope window
%   (5 lines estate, including |\returnaddress| and the other 'to' macros).
% \iffalse
%<*le>
\ExplSyntaxOn
\newcommand*{\@to}{%
  <Addressee name>%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\to}%
}
\renewcommand*{\to}[1]{\renewcommand*{\@to}{#1}}
\ExplSyntaxOff
%</le>
% \fi
%
% \DescribeMacro[le]{\toorganization}
%   \marg{organization name}
%   \margintag{tag}\\
%   Sets the name of the organization that employs the addressee.
%   Used in the envelope window
%   (5 lines estate, including |\returnaddress| and the other 'to' macros).
% \iffalse
%<*le>
\newcommand*{\@toorganization}{}
\newcommand*{\toorganization}[1]{\renewcommand*{\@toorganization}{#1}}
%</le>
% \fi
%
% \DescribeMacro[le]{\toaddress}
%   \marg{multiline address}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Address of the addressee. Newlines are allowed.
%   Used in the envelope window
%   (5 lines estate, including |\returnaddress| and the other 'to' macros).
% \iffalse
%<*le>
\newcommand*{\@toaddress}{%
  <Receiver~address>%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\toaddress}%
}
\newcommand*{\toaddress}[1]{\renewcommand*{\@toaddress}{#1}}
%</le>
% \fi
%
% \DescribeMacro[le]{\subject}
%   \marg{subject title}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Short descriptive title that describes the contents of the letter.
% \iffalse
%<*le>
\ExplSyntaxOn
\newcommand*{\@subject}{%
  -%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\subject}%
}
\newcommand*{\subject}[1]{\renewcommand*{\@subject}{#1}}
\ExplSyntaxOff
%</le>
% \fi
%
% \DescribeMacro[le]{\reference}
%   \marg{reference number}
%   \margintag{tag}\\
%   Sets the reference number to be used in the letter's heading text.
% \iffalse
%<*le>
\newcommand*{\@reference}{-}
\newcommand*{\reference}[1]{\renewcommand*{\@reference}{#1}}
%</le>
% \fi
%
% \DescribeMacro[le]{\opening}
%   \marg{Dear prof. X,}\\
%   Opening address of the letter.
% \iffalse
%<*le>
\renewcommand*{\opening}[1]{#1}
%</le>
% \fi
%
% \DescribeMacro[le]{\closing}
%   \marg{Kind regards,}
%   \margintag{mandatory}
%   \margintag{tag}\\
%   Closing clause of the letter.
% \iffalse
%<*le>
\ExplSyntaxOn
\newcommand*{\@closing}{%
  <Closing~formula>%
  \msg_warning:nnn { ugentdocs }{ mandatory-macro }{\opening~and~\closing}%
}
\renewcommand*{\closing}[1]{\renewcommand*{\@closing}{#1}}
\ExplSyntaxOff
%</le>
% \fi
%
% \DescribeMacro[le]{\signature}
%   \marg{signature content}
%   \margintag{tag}\\
%   Add a signature between the closing statement of the
%   letter and the sender's name.
%   This can be a text message, an image using |\includegraphics|,
%   or overridden to empty (|\signature{}|).
%   By default, it leaves some vertical space for manual signing.
% \iffalse
%<*le>
\newcommand*{\@signature}{\vspace*{8ex}}
\renewcommand*{\signature}[1]{\renewcommand*{\@signature}{#1}}
%</le>
% \fi
%
% \DescribeMacro[le]{\carboncopy}
%   \marg{CC content}
%   \margintag{tag}\\
%   List of persons receiving a copy of this letter. Format at will.
%   Used in the trailer of the letter.
% \iffalse
%<*le>
\newcommand*{\@carboncopy}{}
\newcommand*{\carboncopy}[1]{\renewcommand*{\@carboncopy}{#1}}
%</le>
% \fi
%
% \DescribeMacro[le]{\enclosed}
%   \marg{enclosed items description}
%   \margintag{tag}\\
%   List of enclosed documents. Format at will.
%   Used in the trailer of the letter.
% \iffalse
%<*le>
\newcommand*{\@enclosed}{}
\newcommand*{\enclosed}[1]{\renewcommand*{\@enclosed}{#1}}
%</le>
% \fi
%
% \DescribeMacro[le]{\closeletter}
%   Close the letter (with the closing greetings and underwriting)
%   such that the letter can be continued if desired with attachments.
%   This macro generates a |\clearpage|.
%   If not used, it is automatically invoked at the end of the letter.
% \iffalse
%<*le>
\ExplSyntaxOn
\bool_new:N \l_@@_letterclosed_bool
\newcommand\closeletter{
  \bool_if:NF \l_@@_letterclosed_bool {
    \@closing\\
    \@signature~\\
    \@sender
    \ifx\@senderrole\@empty\\[8ex]\else\\*\@senderrole\\[8ex]\fi
    \setlength{\parskip}{0em}
    \ifx\@carboncopy\@empty\else\MakeUppercase{\ccname}:~\@carboncopy\\[4ex]\fi
    \ifx\@enclosed\@empty\else\translatekey{appendix}:~\@enclosed\fi
    \bool_set_true:N \l_@@_letterclosed_bool
    \clearpage
  }
}
\AtEndDocument{
  \closeletter
}
\ExplSyntaxOff
%</le>
% \fi
%
%
% \newpage
% \subsection{Making titles and covers}
% \label{S:usage:macros:make}
% This section contains the macros needed to display your front
% cover and your title, colophon, copyright,\ldots{} pages.
% It also contains their implementation. If you do not wish to customize that,
% you do not need to pay attention to the code.
%
% \DescribeMacro[bama-phd-rp-crs-ex-le-art]{\maketitle}
%   A native \LaTeX{} macro, overridden to support the generation of
%   cover pages, title pages, colophon pages, etc.
%
% For the |bama|, |phd|, |course|, |report|, and |exam| classes,
% this generates the cover page using |\@frontcover|
% (see Section \ref{S:style:covers}):
%    \begin{macrocode}
%<*bama|phd|rp|crs|ex>
\ExplSyntaxOn
\renewcommand\maketitle{%
\pagestyle{empty}
%
% Cover page
%</bama|phd|rp|crs|ex>
%<*phd|crs>
% Do not print thumbs on the first pages
\bool_if:NT \l_@@_thumbs_bool {
  \stopthumb
}
% Do not count page number of the cover page
\bool_if:NF \l_@@_bare_bool {
  \begingroup
  \pagenumbering{gobble}
%</phd|crs>
%<*bama|phd|rp|crs|ex>
% Insert front cover
\begin{titlepage}
  \setlength\parskip{0pt}%
  \setlength\parindent{0pt}%
  %
  \AddToHookNext{shipout/foreground}{%
    \begin{tikzpicture}[remember~picture,overlay]
    \node[anchor=south~west, inner~sep=0pt]
    at (current~page.south~west) {%
      \@frontcover
    };
    \end{tikzpicture}%
  }%
  \null
\end{titlepage}%
%</bama|phd|rp|crs|ex>
%<*phd|crs>
  \endgroup
\setcounter{page}{0}%
}
%</phd|crs>
%<bama>\null\par
%    \end{macrocode}
%
% Then, the remaining front pages are added.
% For the |bama|, |report|, and |course| classes,
% this is just a copyright page using
% |\@copyrightnotices| (See Section \ref{S:style:copyright}):
%    \begin{macrocode}
%<*bama|rp>
\ifx\@copyrightnotices\@empty\else
\noindent\@copyrightnotices
\fi
%</bama|rp>
%
%<*crs>
~\par\relax
\clearpage
\bool_if:NT \l_@@_copyright_bool {
  \backgroundsetup{contents={Copyright~Ghent~University,~All~Rights~Reserved}}
}
\null\vfill
\ifx\@copyrightnotices\@empty\else
\@copyrightnotices
\clearpage
\fi
%</crs>
%    \end{macrocode}
% For the |exam| class, this is simply the extra info.
%    \begin{macrocode}
%<*ex>
~\par\relax
\clearpage
\@extrainfo{}
%</ex>
%    \end{macrocode}
%
% For the |phd| class, this is a blank page,
% the committee page, the title page, and the colophon page:
%    \begin{macrocode}
%<*phd>
% Page 1: blank
\clearpage\thispagestyle{empty}\null

% Page 2: committee
\clearpage\thispagestyle{empty}
\null\vfill % flush to bottom
\noindent\begin{minipage}[b]{\textwidth}
%
\textbf{\getseqcaption{supervisors}{}}\hfill\break
%
\printseq{supervisorswaff}{\\}{\\}{\\}
\vskip 2em
%
%
\textbf{\translatekey{jury}}\hfill\\[1ex]
%
\textit{\translatekey{jurychair}}\hfill\break
\@jurychair{}\ifdefvoid{\@jurychairaff}{}{\@jurychairaff}
\vskip 1em
%
\textit{\translatekey{jurymembers}}\hfill\break
{\printseq{jurymemberswaff}{\\}{\\}{\\}}%
\vskip 2em%
%
%
\textbf{\translatekey{dean}\tl_if_empty:NF \l_@@_fselector_tl {%
    {}~\translatekey[lowercase]{of}~\translatekey[lowercase]{the-de}~\@faculty%
  }}\hfill\break
\@dean\phantom{.}%
\vskip 2em
%
\textbf{\translatekey{rector}~\translatekey[lowercase]{of}
  {}~\translatekey{org-deugent}}\hfill\break
\@rector\phantom{.}
\end{minipage}%

% Page 3: title
\clearpage\thispagestyle{empty}
\null\vfill % Bottom-align
\noindent\begin{minipage}[b]{\textwidth}
  \begingroup
  \raggedright
  {\Huge\bfseries\nohyphens\@title\par}%

  \ifx\@subtitle\@empty\else
  \vspace{.5\baselineskip}
  {\Large\@subtitle\par}%
  \fi
  \endgroup

  \vspace{5\baselineskip}%
  {\Large\printseq{authors}{\\}{\\}{\\}\par}%

  \bool_if:NTF \l_@@_embargo_bool {
    \vspace{5\baselineskip}
    {\large\translatekey[uppercase]{confidential}\par}
    \vspace{5\baselineskip}
  }{
    \vspace{10\baselineskip}%
  }

  {\small \@doctype{}~\translatekey[lowercase]{submittedto}%
    \tl_if_empty:NF \l_@@_fselector_tl {%
      {}~\translatekey[lowercase]{the-de}~\@faculty{}~\translatekey[lowercase]{of}}%
      {}~\translatekey{org-deugent},~\translatekey{phdfulfil}%
      {}~\printseq{degrees}{~\&~}{,~}{\translatekey{andlist}~}\par}%

  \vspace{.3\baselineskip}%
  {\small\translatekey{org-ugent},~\@location,~\@date}%
\end{minipage}%

% Page 4: copyright page (verso, bottom-left)
\clearpage\thispagestyle{empty}\null\vfill
\@copyrightnotices\par
%</phd>
%
%<*bama|phd|rp|crs|ex>
% Relax a bit
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
  \pagestyle{fancy}
  \thispagestyle{empty}
}
\ExplSyntaxOff
%</bama|phd|rp|crs|ex>
%    \end{macrocode}
%
% The |letter| class also uses |\maketitle| to typeset the header,
% including the logos, the faculty and team header,
% and the info ribbon (|\@letterheader|, see Section \ref{S:usage:macros:letter}).
% It also typesets the first page, with the foldline, the from and to address,
% and the sender information:
%    \begin{macrocode}
%<*le>
\ExplSyntaxOn
\newcommand\maketitle{%
  \pagestyle{empty}
  \thispagestyle{empty}
  \AddToHook{shipout/foreground}{%
    \begin{tikzpicture}[inner~sep=0pt,outer~sep=0pt,overlay]
    \clip (0,0) rectangle(\paperwidth,-\paperheight);
    \begin{scope}[shift={(\gridunit,-\@PH)}]
      \ugentlogo{4\gridunit}{ugent@main}{0.0}
    \end{scope}
    \begin{scope}[shift={(\gridunit,-3\gridunit)}]
      \faclogo{3\gridunit}{ugent@\@fselector}{0}
    \end{scope}
    \path (\@PW-\gridunit,-\gridunit)
    node[anchor=north~east,text~width=61.5mm,align=flush~left] {
      \small{\nohyphens{\bfseries\textcolor{ugent@main}{\@faculty[uppercase]}}}\\*
      \textcolor{ugent@main}{\MakeUppercase{\@team}}
    };

    \ifnum\value{page}>1
    \path (2\gridunit,-3\gridunit)
    node[anchor=north~west] { \@letterheader };
    \fi
    \end{tikzpicture}
  }

  \AddToHookNext{shipout/foreground}{%
    % Adapted from uantwerpendocs v4.12, (C) Walter Daems, LPPL 1.3c
    \begin{tikzpicture}[inner~sep=0pt,outer~sep=0pt,overlay]
    \clip (0,0) rectangle(\paperwidth,-\paperheight);
    %

    \bool_if:NT \l_@@_foldline_bool {
      \draw (1cm,-98mm) -- (1.5cm,-98mm);
    }
    %
    \path (2\gridunit,-44mm)
    node[anchor=north~west,text~width=80mm,align=flush~left] {
      \scriptsize\textcolor{gray}{\uline{\@returnaddress}}\\*
      \normalsize\@to\\*
      \ifx\@toorganization\@empty\else\@toorganization\\*\fi%
      \@toaddress
    };

    \path (\@PW-\gridunit,-3\gridunit)
    node[anchor=north~east,text~width=61.5mm,align=flush~left] {
      \textcolor{ugent@main}{\textbf{\@sender}}
      \ifx\@senderrole\@empty\\[1.75ex]\else \\*\@senderrole\\[1.75ex]\fi
      \ifseqempty{emails} {}{E~\printseq{emails}
        {\\\phantom{E~}}{\\\phantom{E~}}{\\\phantom{E~}}\\}
      \ifseqempty{phones} {}{T~\printseq{phones}
        {\\\phantom{T~}}{\\\phantom{T~}}{\\\phantom{T~}}\\}
      \ifseqempty{faxes}  {}{F~\printseq{faxes}
        {\\\phantom{F~}}{\\\phantom{F~}}{\\\phantom{F~}}\\}
      \ifseqempty{mobiles}{}{M~\printseq{mobiles}
        {\\\phantom{M~}}{\\\phantom{M~}}{\\\phantom{M~}}\\}
      \vskip 1.75ex
      \@address\\[1.75ex]
      \@ifpackageloaded{hyperref}{
        \href{https://www.ugent.be}{www.ugent.be}
      }{
        www.ugent.be
      }
    };
    \end{tikzpicture}
  }
  \null
  \vspace{4\gridunit}
  \@letterheader\\[\gridunit]
  {\bfseries\@subject}
}
\ExplSyntaxOff
%</le>
%    \end{macrocode}
%
% The |article| class uses a simple title, no cover page is included.
% It includes a ``cover'' page containing the graphical abstract, highlights,
% and copyright notice (if those are given).
% The title page contains the title,
% author names with affiliations and ORCID badges,
% the affiliation list,
% optional grant message, and
% the article info and abstract table.
% A footnote is included with the author emails and ORCIDs.
%    \begin{macrocode}
%<*art>
\ExplSyntaxOn
\renewcommand\maketitle{%
  % First page (if applicable)
  \bool_lazy_or:nnT
    { ! \tl_if_empty_p:o { \@graphicalabstract } }
    { ! \tl_if_empty_p:N \g_@@_highlights_tl }
  { \thispagestyle{empty}
    \color{covertitlecolor}{
      \fontsize{20}{28}\selectfont\@title\par
    }
    \vskip 0.5\gridunit
    \color{coverdatacolor}{
      \fontsize{14}{17}\selectfont
      \printseq{authorlist}{~\&~}{,~}{\translatekey{andlist}~}
      \par
    }

    \tl_if_empty:oF { \@graphicalabstract }{
      \color{covertitlecolor}{
        \fontsize{20}{28}\selectfont
        \vskip\gridunit
        \translatekey{graphicalabstract}\par
      }
      \@graphicalabstract
    }
    \tl_if_empty:NF \g_@@_highlights_tl {
      \vskip\gridunit
      \color{covertitlecolor}{
        \fontsize{20}{28}\selectfont
        \translatekey{highlights}\par
      }
      \color{coverdatacolor}{
        \fontsize{14}{17}\selectfont
        \@@_printhighlights:
      }
    }
    \ifx\@copyrightnotices\@empty\else
    \null\vfill
    \@copyrightnotices
    \fi
  }
  \newpage
  \thispagestyle{titlepage}
  % Title
  \color{covertitlecolor}{\fontsize{20}{28}\selectfont\@title\par}
  % Author and affiliation list
  \vskip 0.5\gridunit
  \color{coverdatacolor}{
    \fontsize{14}{17}\selectfont
    \@@_printauthorlist:
    \par
    \vskip 0.5\gridunit
    \fontsize{10}{12}\selectfont
    \@@_printaffiliationlist:
    \ifx\@grants\@empty\else
      \vskip 0.25\gridunit
      {\translatekey{supportedby}~\@grants.}
    \fi
    \vskip 0.5\gridunit
    \hrule \medskip
    \noindent
     % Article info
    \begin{minipage}[t]{0.3\linewidth}
      \raggedright
      \fontsize{14}{17}\selectfont
      \translatekey[uppercase]{articleinfo} \par
      \smallskip \hrule \medskip
      \normalsize
      % keywords
      \clist_if_empty:NF \g_@@_keywords_clist {
        \textit{ \translatekey{keywords} } \par
        \clist_map_inline:Nn \g_@@_keywords_clist { ##1 \par }
        \medskip
      }
      % dates
      \tl_if_empty:oF {\@submitteddate} {
        \translatekey{submitted}~\@submitteddate \par
      }
      \tl_if_empty:oF {\@accepteddate} {
        \translatekey{accepted}~\@accepteddate \par
      }
      \tl_if_empty:oF {\@publisheddate} {
        \translatekey{published}~\@publisheddate \par
      }
      % journal
      \tl_if_empty:oF { \@journal } {
        \medskip
        \translatekey{published}~\translatekey[lowercase]{in}:
        {}~\textit{ \@journal } \par
      }
      % doi
      \tl_if_empty:oF { \@doi }{
        \medskip{DOI~
          \@ifpackageloaded{hyperref}{
            \exp_args:NV \href \l_@@_doiurl_str {\@doi}
          }{
            \@doi
          }
        }
      }
    \end{minipage}
    \hfill
    % Abstract
    \begin{minipage}[t]{0.65\linewidth}
      \fontsize{14}{17}\selectfont
      \translatekey[uppercase]{abstract} \par
      \smallskip \hrule \medskip
      \normalsize
      \@abstract
    \end{minipage}
    \par \medskip \hrule
  }
  \@@_printauthorfootnote:
}
\ExplSyntaxOff
%</art>
%    \end{macrocode}
%
%
% \DescribeMacro[phd-crs]{\makefinalpage}
%   Inserts the final pages and cover
%   using |\@backcover| (see Section \ref{S:style:covers}).
%   An extra blank page is included (the back of the cover).
% \iffalse
%<*phd|crs>
\ExplSyntaxOn
\newcommand\makefinalpage{
\bool_if:NF \l_@@_bare_bool {
  \cleardoublepage
  \bool_if:NT \l_@@_thumbs_bool {
    \stopthumb
  }
  \thispagestyle{empty}
  \null% intentionally blank page
  \clearpage
  \thispagestyle{empty}
  \AddToHookNext{shipout/foreground}{%
    \begin{tikzpicture}[remember~picture,overlay]
    \node[anchor=south~west, inner~sep=0pt]
    at (current~page.south~west) {%
      \@backcover
    };
    \end{tikzpicture}%
  }%
  \null
}
}
\ExplSyntaxOff
%</phd|crs>
% \fi
%
% \DescribeMacro[bkc]{\makebookcover}
%   This macro creates a book cover for the bookcover class. This is already
%   defined in the |bookcover| package, so we need to renew it.
%   If the spine width is too small, the spine text will not be printed.
%   Uses the |\@frontcover| and |\@backcover| (see Section \ref{S:style:covers}).
%   For courses, the lecturers are preferred on the spine over the authors.
% \iffalse
%<*bkc>
\ExplSyntaxOn
\msg_new:nnnn { bookcover } { spine-too-small }
{ The~spine~width~(#1mm)~is~too~small. }
{ It~must~be~at~least~10mm~to~typeset~any~spine~text. }
\msg_new:nnnn { bookcover } { spine-big-enough }
{ The~spine~width~(#1mm)~is~big~enough. }
{ It~must-be~at~least~10mm~to~typeset~the~spine~text. }
\ExplSyntaxOff
%</bkc>
% \fi
%    \begin{macrocode}
%<*bkc>
\ExplSyntaxOn
\bool_new:N \l_@@_printonspine_bool
\AtBeginDocument{
  \fp_compare:nNnTF { \spinewidth } < { 10.0mm } {
    \msg_warning:nnx { bookcover } { spine-too-small } { \fp_to_decimal:n{\spinewidth/1mm} }
    \bool_set_false:N \l_@@_printonspine_bool
  }{
    \msg_info:nnx { bookcover } { spine-big-enough } { \fp_to_decimal:n{\spinewidth/1mm} }
    \bool_set_true:N \l_@@_printonspine_bool
  }
}

\renewcommand\makebookcover{
  \begin{bookcover}
    \bookcovercomponent{normal}{front}{\@frontcover}
    \makeatletter
    \bookcovercomponent{color}{bg~spine}{spinecolor}
    \bool_if:NT \l_@@_printonspine_bool {
      \bookcovercomponent{logo}{spine}{spinetextcolor}
      \bookcovercomponent{title}{spine}{{\renewcommand{\\}[1][]{~}\@title{}}}
      \bookcovercomponent{authoryear}{spine}{
        \exp_args:Nx \str_case:nn { \l_@@_covertype_tl } {
          { phd }    {
            \printseq{authors}{~\&~}{,~}{\translatekey{andlist}~}
          }
          { course }  {
            \ifseqempty{lecturers}{
              \printseq{authors}{~\&~}{,~}{\translatekey{andlist}~}
            }{
              \printseq{lecturers}{~\&~}{,~}{\translatekey{andlist}~}
            }
          }
        }
      }
    }
    \makeatother
    \bookcovercomponent {normal}{back}{\@backcover}
  \end{bookcover}
}
\ExplSyntaxOff
%</bkc>
%    \end{macrocode}
%
% \DescribeMacro[phd-crs]{\generatebookcover}
% This macro generates a |<filename>-cover.tex| file
% from your current document for the creation of a
% full book cover (back/spine/front).
% It copies over all relevant information.
% \iffalse
%<*phd|crs>
\ExplSyntaxOn
\fp_new:N \l_@@_paperweight_fp
\fp_new:N \l_@@_paperbulk_fp
\fp_new:N \l_@@_pagecount_fp

\tl_new:N \l_@@_title_tl
\tl_new:N \l_@@_subtitle_tl
\tl_new:N \l_@@_isbn_tl
\tl_new:N \l_@@_coverimage_tl
\tl_new:N \l_@@_backcoverlogos_tl
\tl_new:N \l_@@_frontcoverlogos_tl
\tl_new:N \l_@@_academicyear_tl

\tl_new:N \l_@@_year_tl
\tl_new:N \l_@@_camerareadykeyval_tl
\tl_new:N \l_@@_covertypekeyval_tl
\tl_new:N \l_@@_covertemplate_tl

\newcommand\generatebookcover{
  \fp_set:Nn \l_@@_paperweight_fp { 80 } % g/m2
  \fp_set:Nn \l_@@_paperbulk_fp   { 1.25 } % cm3/g
  \bool_if:NTF \l_@@_bare_bool {
    \fp_set:Nn \l_@@_pagecount_fp  { \ztotpages }
  }{
    \fp_set:Nn \l_@@_pagecount_fp  { \ztotpages - 2}
  }

  \dim_new:N \l_@@_spinewidth_dim
  \dim_set:Nn \l_@@_spinewidth_dim {\fp_to_decimal:n {\l_@@_pagecount_fp/2*\l_@@_paperweight_fp/1e6*\l_@@_paperbulk_fp*1e3} mm}

  \tl_set:Nx \l_@@_title_tl           { \exp_not:o{\@title} }
  \tl_set:Nx \l_@@_subtitle_tl        { \exp_not:o{\@subtitle} }
  \tl_set:Nx \l_@@_isbn_tl            { \exp_not:o{\@isbn} }
  \tl_set:Nx \l_@@_coverimage_tl      { \exp_not:o{\@coverimage} }
  \tl_set:Nx \l_@@_backcoverlogos_tl  { \exp_not:o{\@backcoverlogos} }
  \tl_set:Nx \l_@@_frontcoverlogos_tl { \exp_not:o{\@frontcoverlogos} }

  \tl_set:Nx \l_@@_year_tl            { \exp_not:n{\the\year} }
  \tl_set:Nx \l_@@_academicyear_tl    { \exp_not:n{\@academicyear} }

  \tl_clear_new:N \l_@@_affiliationscalls_tl
  \seq_map_inline:Nn \g_@@_affiliationscalls_seq
  { \tl_put_right:Nn \l_@@_affiliationscalls_tl { ##1 \iow_newline: } }

  \tl_clear_new:N \l_@@_authorscalls_tl
  \seq_map_inline:Nn \g_@@_authorscalls_seq
  { \tl_put_right:Nn \l_@@_authorscalls_tl { ##1 \iow_newline: } }

  \tl_clear_new:N \l_@@_degreecalls_tl
  \seq_map_inline:Nn \g_@@_degreecalls_seq
  { \tl_put_right:Nn \l_@@_degreecalls_tl { ##1 \iow_newline: } }

  \exp_args:Nx \str_case:nnF { \l_@@_covertype_tl } {
    { phd }    {
      \tl_clear_new:N \l_@@_supervisorscalls_tl
      \seq_map_inline:Nn \g_@@_supervisorscalls_seq
      { \tl_put_right:Nn \l_@@_supervisorscalls_tl { ##1 \iow_newline: } }
      \bool_if:NTF \l_@@_cameraready_bool {
        \tl_set:Nn \l_@@_camerareadykeyval_tl { ,cameraready=true }
      }{
        \tl_set:Nn \l_@@_camerareadykeyval_tl { ,cameraready=false }
      }
      \tl_set:Nn \l_@@_covertypekeyval_tl { ,phd }
    }
    { course }     {
      \tl_clear_new:N \l_@@_lecturerscalls_tl
      \seq_map_inline:Nn \g_@@_lecturerscalls_seq
      { \tl_put_right:Nn \l_@@_lecturerscalls_tl { ##1 \iow_newline: } }
      \tl_set:Nx \l_@@_camerareadykeyval_tl { }
      \tl_set:Nn \l_@@_covertypekeyval_tl { ,course }
    }
  }{
    \msg_error:nnx { ugentdocs } { cover~type~not~implemented } { \l_@@_covertype_tl }
  }

  \tl_set:Nn \l_@@_covertemplate_tl {
    \exp_not:N\documentclass[\l_@@_fselector_tl, spinewidth=\fp_to_decimal:n{round(\dim_ratio:nn{\l_@@_spinewidth_dim}{1mm},1)}mm
    \l_@@_camerareadykeyval_tl
    ,\l_@@_colormodel_tl
    ,\l_@@_language_tl
    ,\l_@@_nameformat_tl
    \l_@@_covertypekeyval_tl]{ugentbookcover} \iow_newline:
    \c_percent_str~Currently,~a~for~80~g/m2~paper~with~a~bulk~of~1.25~cm3/g~is~assumed~(0.1~mm~caliper~or~thickness).       \iow_newline:
    \c_percent_str~Page~count~is~\fp_to_decimal:n{round(\l_@@_pagecount_fp,0)}~pages.~Adjust~spinewidth~if~necessary~using: \iow_newline:
    \c_percent_str~spinewidth~=~page~count~/~2~*~grammage~*~bulk~=~page~count~/~2~*~caliper                                 \iow_newline:
    \iow_newline:
    \exp_not:N\title            {\exp_not:V\l_@@_title_tl}            \iow_newline:
    \exp_not:N\subtitle         {\exp_not:V\l_@@_subtitle_tl}         \iow_newline:
    \l_@@_affiliationscalls_tl                                        \iow_newline:
    \l_@@_authorscalls_tl                                             \iow_newline:
    \exp_not:N\isbn             {\exp_not:V\l_@@_isbn_tl}             \iow_newline:
    \exp_not:N\coverimage       {\exp_not:V\l_@@_coverimage_tl}       \iow_newline:
    \exp_not:N\backcoverlogos   {\exp_not:V\l_@@_backcoverlogos_tl}   \iow_newline:
    \exp_not:N\frontcoverlogos  {\exp_not:V\l_@@_frontcoverlogos_tl}  \iow_newline:
  }

  \bool_if:NTF \l_@@_bwphdcover_bool {
    \tl_put_right:Nn \l_@@_covertemplate_tl {
      \iow_newline:
      \exp_not:N\year=\l_@@_year_tl \iow_newline:
    }
  }{
    \tl_put_right:Nn \l_@@_covertemplate_tl {
      \iow_newline:
      \l_@@_degreecalls_tl \iow_newline:
      \exp_not:N\academicyear {\l_@@_academicyear_tl} \iow_newline:
    }
  }

  \exp_args:Nx \str_case:nnF { \l_@@_covertype_tl } {
    { phd }    {
      \tl_put_right:Nn \l_@@_covertemplate_tl {
        \exp_not:N\doctype {dissertation-phd} \iow_newline:
        \l_@@_supervisorscalls_tl             \iow_newline:
        \bool_if:NT \l_@@_embargo_bool {
          \bool_if:NTF \l_@@_embargotemp_bool {
            \exp_not:N\embargo[start=\l_@@_embargostartdate_tl, end=\l_@@_embargoenddate_tl] \iow_newline:
          }{
            \exp_not:N\embargo \iow_newline:
          }
        }
      }
    }
    { course }     {
      \tl_put_right:Nn \l_@@_covertemplate_tl {
        \l_@@_lecturerscalls_tl             \iow_newline:
      }
    }
  }{
    \msg_error:nnx { ugentdocs } { cover~type~not~implemented } { \l_@@_covertype_tl }
  }

  \tl_put_right:Nn \l_@@_covertemplate_tl {
    \iow_newline:
    \exp_not:N\begin{document}          \iow_newline:
      \exp_not:N\makebookcover          \iow_newline:
      \exp_not:N\end{document}
  }

  \iow_new:N    \g_@@_coverfile_iow
  \iow_open:Nn  \g_@@_coverfile_iow { \jobname-cover.tex }
  \iow_now:Nx   \g_@@_coverfile_iow { \l_@@_covertemplate_tl }
  \iow_close:N  \g_@@_coverfile_iow
}
\ExplSyntaxOff
%</phd|crs>
% \fi
%
%
% \newpage
% \section{Style}
% \label{S:style}
%
% This section contains the actual style of the |ugentdocs| classes.
% If you don't need to customize the style (which we do not recommend anyway),
% you can best skip this whole section as it's very code-heavy.
% While the same from \LaTeX{}'s point of view,
% we refer to the commands in this section not as macros but
% as ``customization points'' or |custom| in short,
% as they are not intended to be used within the document
% but serve as a starting place for customization
% in a |<ugentclass>-customization.sty| file
% -- see also the note on customization on page \pageref{S:customization}.
%
% So a word of caution: \watchout do not use customization points
% within your document directly! Override them in a customization file
% that you load with |\usepackage|.
%
% \subsection{Cross-references}
% \label{S:style:crossref}
%
% The |hyperref| package is used for creating links within documents, such as
% table of contents (TOC), citations, URLs,\ldots{}
% If this package is loaded for
% the |crs|, |bama|, |phd|, |article|, or |report| classes,
% the style sets the TOC colour to |toccolor|
% and any other link colour to |hypercolor|
% (see Section~\ref{S:usage:cffcl:colours}).
% It additionally sets the |pdftitle|, |pdfsubject|, and |pdfauthor| metadata,
% in addition to the |pdfkeywords| for the |article class|:
%    \begin{macrocode}
%<*crs|bama|phd|rp|art>
\ExplSyntaxOn
\tl_new:N \g_@@_pdfauthor_tl
\seq_new:N \l_@@_pdfauthor_seq
\tl_new:N  \l_@@_pdfauthor_item_tl
\cs_new_protected:Npn \@@_pdfauthor_add:n #1{
  \tl_set:Nn \l_@@_pdfauthor_item_tl {#1}
  \tl_replace_all:Nnn \l_@@_pdfauthor_item_tl { , } { \xmpcomma }
  \seq_put_right:NV \l_@@_pdfauthor_seq \l_@@_pdfauthor_item_tl
}

\AtBeginDocument{
  \@ifpackageloaded{hyperref}{
    \pretocmd{\tableofcontents}{\begingroup\hypersetup{linkcolor=toccolor}}{}{}
    \apptocmd{\tableofcontents}{\endgroup}{}{}

    \begingroup
    \def\\{~}
    \seq_clear:N \l_@@_pdfauthor_seq
    \cs_if_exist:NTF \xmpcomma {
      \seq_map_function:NN \g_@@_authorlist_seq \@@_pdfauthor_add:n
    }{
      \seq_set_eq:NN \l_@@_pdfauthor_seq \g_@@_authorlist_seq
    }
    \tl_gset:Ne \g_@@_pdfauthor_tl { \seq_use:Nn \l_@@_pdfauthor_seq { ,~ } }
    \endgroup

    \pdfstringdefDisableCommands{
      \let\leavevmode\@empty
      \def\\{~}
      \def\xspace{}
    }
    \hypersetup{
      breaklinks=true,
      colorlinks=true,
      citecolor=hypercolor,
      filecolor=hypercolor,
      linkcolor=hypercolor,
      pageanchor=true,
      pdfpagemode=UseOutlines,
      urlcolor=hypercolor,
      pdftitle=\@title,
      pdfsubject=\@subtitle,
      pdfauthor=\g_@@_pdfauthor_tl
    }
%</crs|bama|phd|rp|art>
%<*art>
    \hypersetup{
      pdfkeywords = { \clist_use:Nn \g_@@_keywords_clist { ,~ } }
    }
%</art>
%<*crs|bama|phd|rp|art>
  }{}
}
\ExplSyntaxOff
%</crs|bama|phd|rp|art>
%<*crs|bama|phd|rp|art>
\AddToHook{package/hyperxmp/after}{\hypersetup{keeppdfinfo}}
%</crs|bama|phd|rp|art>
%    \end{macrocode}
%
%
% \subsection{Headers and Footers}
% \label{S:style:headerfooter}
% The |fancyhdr| package is used to make the headers and footers.
% Using this, we can set left/centre/right (L/C/R) areas of the headers and footers.
%
% For the |course| class, we define separate headers and footers
% for two-sided and one-sided documents.
% For two-sided even pages, we put the page number in the left header,
% the chapter title in the right header, and ``Ghent University'' (translated)
% with the faculty acronym (e.g., FBW) in the left footer.
% For two-sided odd pages, we put the page number in the right header,
% the section title in the left header, the course version in the left footer,
% and the title of the course and short subtitle in the right footer.
% For one-sided courses, we put the chapter title in the left header,
% the page number in the right header, the course version in the left footer,
% ``Ghent University'' (translated) and the faculty abbreviation in the centre footer,
% and the course title in the right footer.
% For both document types, we set the header height to 13.7pt,
% and the footer and header rule or line thickness to 1 pt.
% Page numbering is in arabic for all pages.
% For a plain page style, i.e., the title page of a chapter or section,
% we only print the page number in the centre of the footer.
%
% The choices above results in the following code:
%
%    \begin{macrocode}
%<*crs>
\fancyhf{}
\if@twoside
  \fancyhead[LE]{\small\thepage}
  \fancyhead[RE]{\small\leftmark}
  \fancyfoot[LE]{
    \small\translatekey{org-ugent}
    \ifx\@fselector\@empty\else -- \@facultyacronym\fi
  }

  \fancyhead[LO]{\small\rightmark}
  \fancyhead[RO]{\small\thepage}
  \fancyfoot[LO]{
    \ifx\@courseversion\@empty\else
      \small\translatekey{version}~\@courseversion
    \fi
  }
  \fancyfoot[RO]{
    \small{\renewcommand{\\}[1][]{~}\@title{}}
    \ifdefvoid{\@shortsubtitle}{}{ --- \@shortsubtitle}
  }
\else
  \fancyhead[L]{\small\leftmark}
  \fancyhead[R]{\small\thepage}
  \fancyfoot[L]{
    \ifx\@courseversion\@empty\else
      \small\translatekey{version}~\@courseversion
    \fi
  }
  \fancyfoot[C]{
    \small\translatekey{org-ugent}
    \ifx\@fselector\@empty\else -- \@facultyacronym\fi
  }
  \fancyfoot[R]{
    \small{\renewcommand{\\}[1][]{~}\@title{}}
  }
\fi
\fancypagestyle{plain}{%
  \fancyhf{}
  \renewcommand*{\headrulewidth}{0pt}
  \renewcommand*{\footrulewidth}{0pt}
  \fancyfoot[C]{\small\thepage}
}
\setlength{\headheight}{13.7pt}
\renewcommand*{\headrulewidth}{1pt}
\renewcommand*{\footrulewidth}{1pt}
\pagenumbering{arabic}
%</crs>
%    \end{macrocode}
%
%
% For the |bama| and |report| classes, the frontmatter -- e.g., copyright page,
% summary, abbreviations list, or AI use disclaimer -- uses a different style.
% For the frontmatter of a two-sided document,
% the even pages show the page number in the left header,
% and the odd pages show it in the left footer.
% The frontmatter of a one-sided document simply shows the page number
% in the right footer.
% No header line is drawn for the frontmatter.
% For the mainmatter, the chapter marks are formatted as, e.g.,
% ``1. Chapter title''.
% These are shown on the left header of odd pages for two-sided documents,
% and the left header of all pages for one-sided documents.
% Additionally, the page number is shown alternating on the outer corner of
% the footer (left for even, right for odd) of two-sided documents, and
% always in the right footer of one-sided documents.
% For one-sided documents, a small UGent logo is additionally shown
% in the left footer.
% For plain page styles such as chapter or section titles, the same
% style is kept as for the mainmatter, albeit without the header.
% Finally, the global header height is set to 21pt,
% and the footer skip to 1.5 cm.
%
% The choices above results in the following code
% (adapted from Joris Meys' LaTeX at UGent):
%
%    \begin{macrocode}
%<*bama|rp>
% Frontmatter
\apptocmd{\frontmatter}{\pagestyle{frontmatter}}{}{}
  % Auto set when calling frontmatter
\if@twoside
\fancypagestyle{frontmatter}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[RO]{\thepage}
  \fancyfoot[LE]{\thepage}
}
\else
\fancypagestyle{frontmatter}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[R]{\thepage}
}
\fi

% Mainmatter
\renewcommand{\chaptermark}[1]{\markboth{\thechapter. \ #1}{}}
  % Set chapter mark to e.g. 1. Chapter title
\renewcommand{\sectionmark}[1]{%
  \ifnum\c@chapter=\z@
  \markboth{\thesection. \ #1}{}%
  \else
  \markright{\thesection. \ #1}%
  \fi
}
\apptocmd{\mainmatter}{\pagestyle{mainmatter}}{}{}
  % Auto set when calling mainmatter

\if@twoside
\fancypagestyle{mainmatter}{
  \fancyhf{}
  \fancyhead[LO]{ \leftmark}
  % \fancyhead[RE]{ \rightmark}
  \fancyfoot[RO]{\thepage}
  \fancyfoot[LE]{\thepage}
  \renewcommand{\headrulewidth}{0.15pt}
}
\else
\fancypagestyle{mainmatter}{
  \fancyhf{}
  \fancyhead[L]{ \leftmark}
  \fancyfoot[R]{\thepage}
  \fancyfoot[L]{
      \begin{tikzpicture}[overlay,remember picture]
      \begin{scope}[shift={(current page.south west)}, xshift=2\gridunit-0.45cm]
        \ugentlogo{1.8cm}{ugent@main}{0.0}
      \end{scope}
      \end{tikzpicture}
  }
  \renewcommand{\headrulewidth}{0.15pt}
}
\fi

% for the title pages
\if@twoside
\fancypagestyle{plain}{
  \fancyhf{}
  \fancyfoot[RO]{\thepage}
  \fancyfoot[LE]{\thepage}
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
}
\else
\fancypagestyle{plain}{
  \fancyhf{}
  \fancyfoot[R]{\thepage}
  \fancyfoot[L]{
    \begin{tikzpicture}[overlay,remember picture]
      \begin{scope}[shift={(current page.south west)}, xshift=2\gridunit-0.45cm]
        \ugentlogo{1.8cm}{ugent@main}{0.0}
      \end{scope}
    \end{tikzpicture}
  }
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
}
\fi

\setlength{\headheight}{21pt}
\setlength{\footskip}{1.5cm}
%</bama|rp>
%    \end{macrocode}
%
% The |phd| class uses simpler headers and footers.
% For regular pages, only headers are used.
% For two-sided documents, the page numbers are shown on the outer header corners.
% The chapter is shown in the right header on even pages,
% and the section is shown in the left header on odd pages.
% For one-sided documents, this becomes the chapter mark in the left header
% and the page number in the right header.
% For plain pages, the page number is shown in the centre of the footer.
% The header height is set to 13.7pt, and the header and footer line widths to 0pt.
% The description above results in the following code:
%    \begin{macrocode}
%<*phd>
\if@twoside
  \fancyhf{}
  \fancyhead[LE]{\small\thepage}
  \fancyhead[RE]{\small\leftmark}
  \fancyhead[LO]{\small\rightmark}
  \fancyhead[RO]{\small\thepage}
\else
  \fancyhf{}
  \fancyhead[L]{\small\leftmark}
  \fancyhead[R]{\small\thepage}

\fi
\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[C]{\small\thepage}
}
\setlength{\headheight}{13.7pt}
\renewcommand*{\headrulewidth}{0pt}
\renewcommand*{\footrulewidth}{0pt}
%</phd>
%    \end{macrocode}
%
% The footer of the |exam| class is simply the page number and
% total page count in the centre.
% The right header displays ``EXAMINER VERSION'' for the |examiner=true| option,
% and the student number for |examiner=false| (default).
% Additionally, a watermark is drawn for the examiner version.
% This results in the following code:
%    \begin{macrocode}
%<*ex>
\fancyhf{}
\ExplSyntaxOn
\bool_if:NTF \l_@@_examiner_bool {
  \fancyhead[R]{\small EXAMINER~VERSION}
  \AddToHook{shipout/background}{
    \put(0.5\@PW,-0.5\@PH){\makebox(0,0){\rotatebox{\@WMA}{%
          \parbox{\@PD}{\centering\color{watermarkcolor}%
            \fontsize{105}{130}\selectfont Examiner~Version}}}}%
  }
}{
  \fancyhead[R]{\small \translatekey{studentnr}:
    {}~\phantom{\large 00000000}~\translatekey{name}:\hspace{3cm}}
}
\fancyfoot[L]{\small{\renewcommand{\\}[1][]{~}\@shorttitle{}}}
\fancyfoot[R]{\small
\ifx\@examseries\@empty~\else\translatekey{series}~\@examseries\fi{}
{}~---~\@academicyear}
\ExplSyntaxOff

\setlength{\headheight}{13.7pt}
\renewcommand*{\headrulewidth}{0pt}
\renewcommand*{\footrulewidth}{1pt}
%</ex>
%    \end{macrocode}
%
% For the |article| class, this is the short title in the centre header,
% a left footer ``Published'' or ``Published in: journal'' (if journal is given)
% when a publication % date is given,
% else ``Preprint'' or ``Preprint submitted to journal'',
% and the page count in the right footer
%
%    \begin{macrocode}
%<*art>
\fancyhf{}
\ExplSyntaxOn
\fancyhead[C]{\small {\renewcommand{\\}[1][]{~}\@shorttitle{}}}
\fancyfoot[L]{
  \tl_if_empty:oTF { \@publisheddate }{
    \translatekey{preprint}
    \bool_lazy_and:nnT
    { ! \tl_if_empty_p:o { \@submitteddate } }
    { ! \tl_if_empty_p:o { \@journal } }
    { {}~\translatekey[lowercase]{submittedto}~\@journal }
  }{
    \translatekey{published}
    \tl_if_empty:oF { \@journal }
    { ~\translatekey[lowercase]{in}:~\@journal }
    \tl_if_empty:oF { \@doi }{
      .~{\small DOI~
        \@ifpackageloaded{hyperref}{
          \exp_args:NV \href \l_@@_doiurl_str {\@doi}
        }{
          \@doi
        }
      }
    }
  }
}
\fancyfoot[R]{\small \thepage/\ztotpages}
\ExplSyntaxOff

\setlength{\headheight}{13.7pt}
\renewcommand*{\headrulewidth}{0pt}
\renewcommand*{\footrulewidth}{1pt}

\pagestyle{fancy}
\fancypagestyle{titlepage}[fancy]{
  \fancyhead{}
}
%</art>
%    \end{macrocode}
%
% For the |letter| class, we don't use the fancyhdr package.
% Instead, we define a custom header using TikZ:
%
% \DescribeObject[custom]{\@letterheader}
%   This consists of 3 parts, the date on the left,
%    the page number and total pages in the middle,
%   and the reference number on the right.
%   The labels above the date, page number, and reference are shown in
%   \textcolor{ugent@main}{UGent Blue}. Doing this in a TikZ picture allows us to
%   position the header differently between the first and later pages.
%   Implementation:
%    \begin{macrocode}
%<*le>
\fancyhf{}
\newcommand{\@letterheader}{
  \begin{tikzpicture}[anchor=north west,align=left,outer sep=0,inner sep=0]
    \path
    (0,0) node { \small\strut\textcolor{ugent@main}{\translatekey[uppercase]{date}} }
    (4cm,0) node { \small\strut\textcolor{ugent@main}{\translatekey[uppercase]{page}} }
    (8cm,0) node { \small\strut\textcolor{ugent@main}{\translatekey[uppercase]{ourref}} }
    (0,-2.5ex) node { \strut \@date }
    (4cm,-2.5ex) node { \strut \thepage/\ztotpages }
    (8cm,-2.5ex) node { \strut \@reference };
  \end{tikzpicture}
}
%</le>
%    \end{macrocode}
%
%
% \newpage
% \subsection{Chapter and section titles}
% \label{S:style:title}
% A total of 5 chapter styles are available:
% |plain|, |fancy|, |fancycompact|, |uantwerpen|, and |legacyplain|.
% The style is set through the |\l_@@_chaptitlestyle_tl| variable,
% which can be overridden in a customization file.
%
% \iffalse
%<*crs|bama|rp|phd>
\ExplSyntaxOn
\tl_new:N \l_@@_chaptitlestyle_tl
\ExplSyntaxOff
%</crs|bama|rp|phd>
% \fi
%
% \setsansfont{UGent Panno Text}[
%       BoldFont            = {UGent Panno Text},
%       BoldFeatures        = {FakeBold=2.5},
%       ItalicFont          = {UGent Panno Text},
%       ItalicFeatures      = {FakeSlant=0.15},
%       BoldItalicFont      = {UGent Panno Text},
%       BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
% ]
%
% The |plain| style (default for |report| and |bama|):
% \iffalse
%<*bama|rp>
\ExplSyntaxOn
\tl_set:Nn \l_@@_chaptitlestyle_tl {plain}
\ExplSyntaxOff
%</bama|rp>
% \fi
%
% {\fontsize{16}{19}\selectfont \color{titlecolor} \bfseries \textsf{\uline{1. AN EXAMPLE TITLE}}}
%
% The |fancy| style (default for |phd|):
% \iffalse
%<*phd>
\ExplSyntaxOn
\tl_set:Nn \l_@@_chaptitlestyle_tl {fancy}
\ExplSyntaxOff
%</phd>
% \fi
%
% \begin{tikzpicture}[remember picture, overlay]
% \node[fill=titlecolor, minimum height=3\gridunit, minimum width=4\gridunit+\the\hoffset,
% inner sep=0pt, anchor=north east] (numbox) at
% ([xshift=\the\hoffset,yshift=-5\gridunit]current page.north east) {};
%
% \node[white, font=\fontsize{70}{70}\selectfont\bfseries,
% anchor=center] at ([xshift=1.5\gridunit]numbox.west |- numbox.center) {\textsf{1}};
%
% \node[white, font=\bfseries\normalsize, rotate=90, anchor=center,
% inner sep=2pt] at ([xshift=3.5\gridunit]numbox.west |- numbox.center) {\textsf{Chapter}};
%
% \end{tikzpicture}%
% \vspace*{20pt}
% \begin{flushright}
%   \color{titlecolor}\huge\bfseries \textsf{An example title}%
% \end{flushright}%
% \vspace*{-10pt}%
% {\color{titlecolor}\rule{\textwidth}{1pt}}
%
% The |fancycompact| style (default for |course|):
% \iffalse
%<*crs>
\ExplSyntaxOn
\tl_set:Nn \l_@@_chaptitlestyle_tl {fancycompact}
\ExplSyntaxOff
%</crs>
% \fi
%
%\begin{tikzpicture}[remember picture, overlay]
% \node[fill=titlecolor, minimum height=3\gridunit, minimum width=4\gridunit+\the\hoffset,
% inner sep=0pt, anchor=north east] (numbox) at
% ([xshift=\the\hoffset,yshift=-12\gridunit]current page.north east) {};
%
% \node[white, font=\fontsize{70}{70}\selectfont\bfseries,
% anchor=center] at ([xshift=1.5\gridunit]numbox.west |- numbox.center) {\textsf{1}};
%
% \node[white, font=\bfseries\normalsize, rotate=90, anchor=center,
% inner sep=2pt] at ([xshift=3.5\gridunit]numbox.west |- numbox.center) {\textsf{Chapter}};
%
% \node[titlecolor, font=\huge\bfseries, anchor=south east, align=flush right,
% text width=0.85\textwidth] at ([xshift=-10pt,yshift=10pt]numbox.west |- numbox.south) {\textsf{An example title}};
%
% \draw[titlecolor, line width=1pt]
% ([xshift=-\the\hoffset]current page text area.west |- numbox.south) -- (numbox.south east);
% \end{tikzpicture}%
% \vspace*{80pt}
%
% The |uantwerpen| style (legacy from |uantwerpendocs|):
%
% \begin{flushright}
%   \makebox[0pt][l]{\color{titlecolor}\rule[-0.4em]{10cm}{1.8em}}\textcolor{white}
%   {\LARGE\textbf{~\textsf{Chapter}~}}
%   \raisebox{-24pt}{
%     \begin{tikzpicture}
%       \foreach \theta in {0,5,...,355} {
%       \node[color=white] at (\theta:0.025)
%         {\fontsize{72}{12}\selectfont\textbf{\textsf{1}}};
%         }
%       \node[color=titlecolor!50] at (0,0)
%         {\fontsize{72}{12}\selectfont\textbf{\textsf{1}}};
%     \end{tikzpicture}%
%   }\hspace*{-8pt}
%   \par\nobreak
%   \huge\textbf{\textcolor{titlecolor}{\rule[-0.5ex]{0em}{2.6ex}~\textsf{An example title}}}
%   \par\nobreak
% \end{flushright}
% \rule{\textwidth}{1pt}
%
% The |legacyplain| style (legacy from my old templates):
%
% \makebox[0pt][r]{
%    \begin{tikzpicture}[baseline=(o), overlay]
%    \node[draw, text width=5cm, align=flush right, anchor=base east,
%    white, fill=titlecolor] (n) at (-10pt, 0) {{\fontsize{16}{18}\selectfont\textbf{\textsf{1}}}};
%    \node[inner sep=0, outer sep=0] (o) at (0,0) {};
%    \end{tikzpicture}%
%  }
%  {\Large\bfseries\textsf{An example title}}%
%
% \newpage
% The styles set the |\@titlestylechapter| and |\@titlestyleappendix|
% customization points:
%
% \DescribeObject[custom]{\@titlestylechapter}
%   Style of the chapter titles.
%   Automatically set at the beginning of the document.
%
% \DescribeObject[custom]{\@titlestyleappendix}
%   Style of the appendix chapter titles.
%   Automatically set after calling |\appendix|.
%
% Implementation:
%
%    \begin{macrocode}
%<*phd|crs|bama|rp|art>
\RequirePackage[explicit]{titlesec}
%</phd|crs|bama|rp|art>
%<*phd|crs|bama|rp>
\ExplSyntaxOn
\newcommand{\@titlestyleappendix}{}

\newcommand{\@titlestylechapter}{
  \exp_args:Nx \str_case:nnF { \l_@@_chaptitlestyle_tl } {
    { plain } {
      \titleformat{\chapter}
      [block] % shape
      {\fontsize{16}{19} \selectfont \color{titlecolor} \bfseries } % format
      {\thechapter. \ } % the label
      { 0ex } %separator space
      {\MakeUppercase{\uline{##1}} } %before code
      [\@addthumb] %after code

      \titleformat{name=\chapter,numberless}
      [block] % shape
      {\fontsize{16}{19} \selectfont \color{titlecolor} \bfseries } % format
      {} % the label
      {0ex}%separator space
      {\uline{\MakeUppercase{##1}}} %before code

      % Change the spacing above the chapter. This is left - above - below
      \titlespacing*{\chapter}{0pt}{-3em}{12pt}

      \renewcommand{\@titlestyleappendix}{ % Adds "appendix" to title
        \titleformat{\chapter}
        [display] % shape
        {\fontsize{18}{22}\selectfont\color{titlecolor}} % format
        {\MakeUppercase{\chaptertitlename\ \thechapter}} % the label
        {-2ex} %separator space
        {\fontsize{24}{32}\selectfont\bfseries\raggedright\MakeUppercase{%
            \uline{####1}}} %before code
        [\@addthumb] %after code
      }
    }
    { fancy } {
      \titleformat{\chapter}
        [display] % shape
        {}{}{0pt} % format, label, sep (unused: box+number are drawn manually)
        {%
          \begin{tikzpicture}[remember~picture, overlay]
          % Number coloured box
          \node[fill=titlecolor, minimum~height=3\gridunit, minimum~width=
          4\gridunit+\the\hoffset, inner~sep=0pt, anchor=north~east]
          (numbox)
          at ([xshift=\the\hoffset,yshift=-3\gridunit]current~page.north~east) {};

          % Chapter number
          \node[white, font=\fontsize{70}{70}\selectfont\bfseries, anchor=center]
          at ([xshift=1.5\gridunit]numbox.west |- numbox.center) {\thechapter};

          % Chapter name
          \node[white, font=\bfseries\normalsize, rotate=90, anchor=center, inner~sep=2pt]
          at ([xshift=3.5\gridunit]numbox.west |- numbox.center) {\chaptername};

          \end{tikzpicture}%
          \group_begin:
          \skip_set:Nn \topsep    { \dim_eval:n { \topsep } }
          \skip_set:Nn \partopsep { \dim_eval:n { \partopsep } }
          \skip_set:Nn \parskip   { \dim_eval:n { \parskip } }
          \vspace*{20pt}
          \begin{flushright}
            \color{titlecolor}\huge\bfseries##1%
          \end{flushright}%
          \vspace*{-10pt}%
          {\color{titlecolor}\rule{\textwidth}{1pt}}
          \group_end:
        }
        [\@addthumb] %after code

      \titleformat{name=\chapter,numberless}
      [block]
      {}{}{0pt}
      {%
        \group_begin:
        \skip_set:Nn \topsep    { \dim_eval:n { \topsep } }
        \skip_set:Nn \partopsep { \dim_eval:n { \partopsep } }
        \skip_set:Nn \parskip   { \dim_eval:n { \parskip } }
        \begin{flushright}
          \color{titlecolor}\huge\bfseries##1%
        \end{flushright}%
        \vspace*{-10pt}%
        {\color{titlecolor}\rule{\textwidth}{1pt}}
        \group_end:
      }

      \titlespacing*{\chapter}{0pt}{0pt}{20pt}

      % No thumb on chapter page
      \bool_if:NT \l_@@_thumbs_bool {
        \apptocmd{\@addthumb}{\stopthumb}{}{}
        \AddToHook{shipout/foreground}{\continuethumb}
      }

    }
    { fancycompact} {
      \titleformat{\chapter}
      [display] % shape
      {}{}{0pt} % format, label, sep (unused: box+number are drawn manually)
      {%
        \begin{tikzpicture}[remember~picture, overlay]
        % Number coloured box
        \node[fill=titlecolor, minimum~height=3\gridunit, minimum~width=
        4\gridunit+\the\hoffset, inner~sep=0pt, anchor=north~east]
        (numbox)
        at ([xshift=\the\hoffset,yshift=-3\gridunit]current~page.north~east) {};

        % Chapter number
        \node[white, font=\fontsize{70}{70}\selectfont\bfseries, anchor=center]
         at ([xshift=1.5\gridunit]numbox.west |- numbox.center) {\thechapter};

        % Chapter name
        \node[white, font=\bfseries\normalsize, rotate=90,
        anchor=center,inner~sep=2pt]
        at ([xshift=3.5\gridunit]numbox.west |- numbox.center) {\chaptername};

        % Chapter title
        \node[titlecolor, font=\huge\bfseries,
        anchor=south~east, align=flush~right, text~width=0.85\textwidth]
        at ([xshift=-10pt,yshift=10pt]numbox.west |- numbox.south) {##1};

        % Rule
        \draw[titlecolor, line~width=1pt]
        ([xshift=-\the\hoffset]current~page~text~area.west |- numbox.south)
          -- (numbox.south~east);
        \end{tikzpicture}%
        \vspace*{40pt}
      }
      [\@addthumb] %after code

      \titleformat{name=\chapter,numberless}
      [block]
      {}{}{0pt}
      {%
        \group_begin:
        \skip_set:Nn \topsep    { \dim_eval:n { \topsep } }
        \skip_set:Nn \partopsep { \dim_eval:n { \partopsep } }
        \skip_set:Nn \parskip   { \dim_eval:n { \parskip } }
        \begin{flushright}
          \color{titlecolor}\huge\bfseries##1%
        \end{flushright}%
        \vspace*{-10pt}%
        {\color{titlecolor}\rule{\textwidth}{1pt}}
        \group_end:
      }

      \titlespacing*{\chapter}{0pt}{0pt}{20pt}

      % No thumb on chapter page
      \bool_if:NT \l_@@_thumbs_bool {
        \apptocmd{\@addthumb}{\stopthumb}{}{}
        \AddToHook{shipout/foreground}{\continuethumb}
      }
    }
    { uantwerpen } {
      % Adapted from uantwerpendocs v4.12, (C) Walter Daems, LPPL 1.3c
      \def\@makechapterhead##1{%
        \vspace*{1ex}%
        \begin{flushright}
          \makebox[0pt][l]{\color{titlecolor}\rule[-0.4em]{10cm}{1.8em}}\textcolor{white}
          {\LARGE\textbf{~\chaptername~}}
          \raisebox{-24pt}{
            \@UAChapNum
          }\hspace*{-8pt}
          \par\nobreak
          \interlinepenalty\@M
          \huge\textbf{\textcolor{titlecolor}{\rule[-0.5ex]{0em}{2.6ex}~##1}}
          \par\nobreak
        \end{flushright}
        \rule{\textwidth}{1pt}
        \vspace{5\p@}%
        \@addthumb % Add thumb for every numbered chapter
        \par\nobreak
      }
      \def\@schapter##1{%
        \@makeschapterhead{##1}%
        \@afterheading
      }
      \def\@makeschapterhead##1{%
        \vspace*{1ex}%
        \begin{flushright}
          \LARGE\textbf{\textcolor{titlecolor}{\rule[-0.5ex]{0em}{2.6ex}~##1}}
        \end{flushright}
        \rule{\textwidth}{1pt}
        \vspace{5\p@}\par
      }
    }
    { legacyplain }{
      \newcommand*{\@legacychapshape}[3]{%
        % args: label text, text col, font style
        \begin{tikzpicture}[baseline=(o), overlay]
        \node[draw, text~width=3cm, align=flush~right, anchor=base~east,
        ##2, fill=titlecolor] (n) at (-10pt, 0) {{##3\textbf{##1}}};
        \node[inner~sep=0, outer~sep=0] (o) at (0,0) {};
        \end{tikzpicture}%
      }

      \titleformat{\chapter}[block]
      {\Large\bfseries}{}{20pt}{%
        \makebox[0pt][r]{\@legacychapshape{\thechapter}{white}{\fontsize{16}{18}\selectfont}}%
        ##1%
      }[\@addthumb]

      \titleformat{name = \chapter, numberless}[block]
      {\Large\bfseries}{}{0pt}{%
        \makebox[0pt][r]{\@legacychapshape{0}{ugent@main}{\large}}%
        ##1%
      }
      \titlespacing*{\section}{0pt}{-20pt}{10pt}
    }
  }{
    \PackageError{ugentdocs}
    { The~chapter~styling~specified~is~not~implemented }
    { See~the~ugentdocs~manual. }
  }
}

\def\appendix{
  \cleardoublepage
  \setcounter{chapter}{0}
  \renewcommand*{\thechapter}{\Alph{chapter}}
  \renewcommand*\chaptername\appendixname
}

\ExplSyntaxOff
%% Adapted from uantwerpendocs v4.12, (C) Walter Daems, LPPL 1.3c
\newcommand*{\@UAChapNum}{%
  \begin{tikzpicture}
  \foreach \theta in {0,5,...,355} {
    \node[color=white] at (\theta:0.025)
    {\fontsize{72}{12}\selectfont\textbf{\thechapter}};
  }
  \node[color=titlecolor!50] at (0,0)
  {\fontsize{72}{12}\selectfont\textbf{\thechapter}};
  \end{tikzpicture}%
}
%</phd|crs|bama|rp>
%    \end{macrocode}
% \iffalse
%<*art>
\newcommand{\@titlestylechapter}{}
\newcommand{\@titlestyleappendix}{}
%</art>
% \fi
%
% The section style is the same for all documents:
% \DescribeObject[custom]{\@titlestylesection}
%   Plain bold and black section titles.
%   Automatically set at the beginning of the document.
%
%   Implementation:
%
%    \begin{macrocode}
%<*phd|crs|bama|rp|art>
\newcommand{\@titlestylesection}{
  \titleformat{\section}
  [block] % shape
  {\fontsize{14}{17} \selectfont \bfseries } % format
  {\thesection \ } % the label
  { 0ex } %separator space
  { ##1 } %before code
  { } %after code

  % Change the spacing above the chapter. This is left - above - below
  \titlespacing*{\section}{0pt}{6pt}{0pt}
}
%</phd|crs|bama|rp|art>
%    \end{macrocode}
%
% \iffalse
%<*phd|crs|bama|rp|art>
\AtBeginDocument{
  \@titlestylechapter
  \@titlestylesection
  \apptocmd{\appendix}{\@titlestyleappendix}{}{}
}
%</phd|crs|bama|rp|art>
% \fi
%
%
% \newpage
% \subsection{Covers}
% \label{S:style:covers}
% The covers consist of layout dimensions based on the official grid layout,
% the cover body content,
% and the cover layout for plain and fancy covers.
% We will go over those in the sections below.
%
%
% \subsubsection{Cover dimensions}
% A few common dimensions are defined:
%    \begin{macrocode}
%<*phd|bkc|crs|bama|rp|ex>
\ExplSyntaxOn
\newlength{\@B}     % Bleed outside crop / cameraready
\newlength{\@HBS}   % Height bottom strip
\newlength{\@HTS}   % Height top strip
\newlength{\@MS}    % Margin Spine (front/back cover)
\newlength{\@MTLR}  % Margin Text Left Right
\newlength{\@MTTB}  % Margin Text Top Bottom
\newlength{\@HT}    % Height Title
\newlength{\@WD}    % Width Data area
\newlength{\@HD}    % Height Data area
\newlength{\@BT}    % Bleed Top
\newlength{\@WI}    % Width Image
\newlength{\@HI}    % Height Image
\ExplSyntaxOff
%</phd|bkc|crs|bama|rp|ex>
%    \end{macrocode}
%
% A scheme is given here as to what these dimensions represent
% based on the |\gridunit|:\\
%   \adjustbox{width=0.5\textwidth}{
%   \begin{tikzpicture}
%     \draw[dotted, fill=lightgray] (0, 32) grid (24, 0);
%     \draw[<->] (1, 0) -- (2, 0); \node at (1.5, 0.5) {gridunit};
%     \draw[fill=white] (2, 30) rectangle (22, 2);
%     \draw[fill=ugent@main, fill opacity=0.1] (3, 6) rectangle (22.5, 27);
%
%     \draw[loosely dashed, fill=white, fill opacity=0.3] (4, 15) rectangle (21, 24);
%     \node[scale=3] at (11, 19.5) {Text area (title)};
%
%     \draw[fill=ugent@main] (3, 6) rectangle (13, 14);
%
%     \draw[loosely dashed, fill=white, fill opacity=0.3] (4, 7) rectangle (12, 13);
%     \node[scale=2] at (8, 12) {Text area (in data area)};
%
%     \draw[<->] (18, 2) -- (18, 19.5);       \node at (17.5,19.5) {HT};
%     \draw[<->] (20.5, 27) -- (20.5, 27.75); \node at (21, 27.37) {BT};
%     \draw[<->] (20.5, 27) -- (20.5, 27.75); \node at (21, 27.37) {BT};
%     \draw[<->] (4, 27) -- (4, 30);          \node at (4.5, 28) {HTS};
%     \draw[<->] (4, 2) -- (4, 6);            \node at (4.5, 4) {HBS};
%     \draw[<->] (2, 21) -- (3, 21);          \node at (2.5, 21.5) {MS};
%     \draw[<->] (22, 26) -- (22.5, 26);      \node at (22.25, 26.5) {B};
%     \draw[<->] (4, 19) -- (3, 19);          \node at (3.5, 19.5) {MTLR};
%     \draw[<->] (21, 19) -- (22, 19);        \node at (21.5, 19.5) {MTLR};
%     \draw[<->] (4, 12) -- (3, 12);          \node at (3.5, 12.5) {MTLR};
%     \draw[<->] (13, 12) -- (12, 12);        \node at (12.5, 12.5) {MTLR};
%     \draw[<->] (2, 30) -- (22, 30);         \node at (2.5, 15) {PW};
%     \draw[<->] (2, 2) -- (2, 30);           \node at (12, 29.5) {PH};
%     \draw[<->] (10, 14) -- (10, 6);         \node at (9.5, 8.5) {HD};
%     \draw[<->] (13, 10) -- (3, 10);         \node at (4.5, 10.5) {WD};
%     \draw[<->] (7, 7) -- (7, 6);            \node at (6.5, 6.5) {MTTB};
%     \draw[<->] (7, 14) -- (7, 13);          \node at (6.5, 13.5) {MTTB};
%     \node[scale=1.5] at (12, 31.5) {A4 width};
%     \node[scale=1.5, rotate=-90] at (0.5, 15) {A4 height};
%   \end{tikzpicture}
%   }
%
% Next, we set the lengths based on the Office templates:
%    \begin{macrocode}
%<*phd|bkc|crs|bama|rp|ex>
\ExplSyntaxOn
\setlength\@B{3mm}
\bool_if:NTF \l_@@_bwphdcover_bool {
  % BW phd cover
  \setlength\@HBS{4\gridunit}
  \setlength\@HTS{0mm}
  \setlength\@BT{\@B}
  \setlength\@MS{0mm}
  \setlength\@MTLR{2\gridunit}
  \setlength\@MTTB{\gridunit}
  \setlength\@WD{0mm}
  \setlength\@HD{0mm}
  \setlength\@HT{2\@HBS}
}{
  % UGent cover
  \setlength\@HBS{4\gridunit}
  \tl_if_empty:NTF \l_@@_fselector_tl {
    \setlength\@HTS{0mm}
    \setlength\@BT{\@B}
  }{
    \setlength\@HTS{3\gridunit}
    \setlength\@BT{0mm}
  }
  \setlength\@MS{\gridunit}
  \setlength\@MTLR{\gridunit}
  \setlength\@MTTB{\gridunit}
  \setlength\@WD{12\gridunit}
  \setlength\@HD{10\gridunit}
  \pgfmathsetlength{\@HT}{0.5*\@PH+0.5*\@HBS-0.5*\@HTS+0.5*\@HD}
}
\ExplSyntaxOff
%</phd|bkc|crs|bama|rp|ex>
%    \end{macrocode}
%
% For the |bama|, |report|, and |exam|,
% the title position and text margin differ slightly:
%    \begin{macrocode}
%<*bama|rp|ex>
\ExplSyntaxOn
\setlength\@HT{0.9\@PH}

\bool_if:NTF \l_@@_coverbg_bool {
  \setlength\@MTLR{2\gridunit}
}{
  \setlength\@MTLR{\gridunit}
}
\ExplSyntaxOff
%</bama|rp|ex>
%    \end{macrocode}
%
% And the |course| data area width is slightly narrower:
%    \begin{macrocode}
%<*phd|bkc|crs>
\ExplSyntaxOn
\exp_args:Nx \str_case:nnF { \l_@@_covertype_tl } {
  { phd } { }
  { course } {
    \setlength\@WD{10\gridunit}
  }
}{
  \msg_error:nnx { ugentdocs } { cover~type~not~implemented } { \l_@@_covertype_tl }
}
\ExplSyntaxOff
%</phd|bkc|crs>
%    \end{macrocode}
%
%
% \subsubsection{Cover bodies}
% The cover body text itself differs between all classes,
% so we set it here. For the |bama| and |report| classes,
% the code was adapted from Joris Meys' LaTeX at UGent.
%
% \DescribeObject[custom]{\@coverbodybama}
%   The |bama| cover body consists of
%   the title, subtitle (if present),
%   word count (if given), confidentiality (if applicable),
%   author name(s), student nr. (one, if given),
%   (co/external) supervisors and tutor (if given),
%   the ``Submitted to\ldots'' text, and
%   the academic year:
%    \begin{macrocode}
%<*bama|rp>
\ExplSyntaxOn
\tl_new:N \l_@@_authortable_tl
\ExplSyntaxOff
%</bama|rp>
%<*bama>
\ExplSyntaxOn
\newcommand{\@coverbodybama}{
  \node[anchor=north~west, inner~sep=0pt, text~width=\@PW-\@MTLR-\gridunit,
  minimum~height=22.05cm, align=flush~left] at (\@MTLR,\@HT)
  {%
    \raggedright
    \begin{spacing}{2.5}
      {\fontsize{25}{30}\selectfont\color{covertitlecolor}\bfseries
        \MakeUppercase{\uline{\@title}}}
    \end{spacing}

    \vskip 1em

    {\fontsize{15}{18}\selectfont\color{covertitlecolor}
      \MakeUppercase{\@subtitle}}

    \vskip 1em

    \begingroup\color{coverdatacolor}
    \ifx\@wordcount\@empty\else
    \translatekey{wordcount}:~\@wordcount
    \fi

    \bool_if:NTF \l_@@_embargo_bool {
      \vskip 5em
      {\fontsize{15}{18}\selectfont\translatekey[uppercase]{confidential}}
      \vskip 5em
    }{
      \vskip 10em
    }

    \tl_set:Nx \l_@@_authortable_tl { \printseq{authorswaff}{\cr}{\cr}{\cr} }
    {\fontsize{15}{18}\selectfont
      \leavevmode\vbox{\halign{##\hfil&\hskip1em##\hfil\cr
          \l_@@_authortable_tl
          \cr}}
    }

    \ifx\@studentnr\@empty\else
    \par\translatekey{studentnr}:~\@studentnr
    \fi

    \vskip 1em

    {\fontsize{12}{15}\selectfont
      \getseqcaption{supervisors}{
        :~\printseq{supervisors}{~\&~}{,~}{\translatekey{andlist}~}\\}
    }

    {\fontsize{12}{15}\selectfont
      \getseqcaption{cosupervisors}{
        :~\printseq{cosupervisors}{~\&~}{,~}{\translatekey{andlist}~}\\}
    }

    {\fontsize{12}{15}\selectfont
      \getseqcaption{extsupervisors}{
        :~\printseq{extsupervisors}{~\&~}{,~}{\translatekey{andlist}~}\\}
    }

    \ifseqempty{tutors}{}{
      \vskip 1em
      {\fontsize{12}{15}\selectfont
        \getseqcaption{tutors}{}
        :~\printseq{tutors}{~\&~}{,~}{\translatekey{andlist}~}
      }
    }

    \vskip 1em
    {\@doctype{}~\translatekey[lowercase]{submittedto}%
      \ifx\@fselector\@empty\else{}%
        {}~\translatekey[lowercase]{the-de}~\@faculty{}~\translatekey[lowercase]{of}%
      \fi{}%
      {}~\translatekey{org-deugent},~\translatekey{bmfulfil}%
      {}~\printseq{degrees}{~\&~}{,~}{\translatekey{andlist}~}}

    \vskip 1em
    \translatekey{acyear}:~\@academicyear
    \endgroup
  };
}
\ExplSyntaxOff
%</bama>
%<rp|ex>\newcommand{\@coverbodybama}{}
%    \end{macrocode}
%
% \DescribeObject[custom]{\@coverbodyreport}
%   The |report| cover body consists of
%   the title, subtitle, and extra title (if present),
%   word count (if given),
%   author name(s), student nr. (one, if given),
%   lecturers (if given),
%   address (if given),
%   and the academic year (if given):
%    \begin{macrocode}
%<*rp>
\ExplSyntaxOn
\newcommand{\@coverbodyreport}{
  \node[anchor=north~west, inner~sep=0pt, text~width=\paperwidth-\@MTLR-\gridunit,
  minimum~height=22.05cm, align=flush~left] at (\@MTLR,\@HT)
  {%
    \raggedright
    \begin{spacing}{2.5}
      {\fontsize{25}{30}\selectfont\color{covertitlecolor}\bfseries
        \MakeUppercase{\uline{\@title}}}
    \end{spacing}

    \vskip 1em

    {\fontsize{15}{18}\selectfont\color{covertitlecolor}
      \MakeUppercase{\@subtitle}}

    \vskip 2em

    \begingroup\color{coverdatacolor}
    \ifx\@extra\@empty\else
    {\fontsize{12}{15}\selectfont\@extra}
    \fi

    \ifx\@wordcount\@empty\else
    \translatekey{wordcount}:~\@wordcount
    \fi

    \ifseqempty{authors}{
      \vskip 10em
    }{
      \vskip 5em
      \tl_set:Nx \l_@@_authortable_tl { \printseq{authorswaff}{\cr}{\cr}{\cr} }
      {\fontsize{12}{15}\selectfont
        \leavevmode\vbox{\halign{##\hfil&\hskip1em##\hfil\cr
            \l_@@_authortable_tl
            \cr}}
      }
      \ifx\@studentnr\@empty\else
      \translatekey{studentnr}:~\@studentnr
      \fi
      \vskip 5em
    }

    \ifseqempty{lecturers}{}{
      {\fontsize{12}{15}\selectfont
        \getseqcaption{lecturers}{}:~\printseq{lecturers}{~\&~}{,~}{\translatekey{andlist}~}}
      \vskip 2 em
    }

    \ifx\@address\@empty\else
    {\fontsize{12}{15}\selectfont\@address}
    \vskip 2 em
    \fi

    \ifx\@academicyear\@empty\else
    {\fontsize{12}{15}\selectfont\translatekey{acyear}:~\@academicyear}
    \fi
    \endgroup
  };
}
\ExplSyntaxOff
%</rp>
%<bama|ex>\newcommand{\@coverbodyreport}{}
%    \end{macrocode}
%
% \DescribeObject[custom]{\@coverbodyexam}
%   The |exam| cover body consists of
%   the course titles,
%   the exam part,
%   the course codes,
%   the exam series,
%   the exam date,
%   a fill-in section for the student's surname, name, and ID,
%   the exam duration, start time, and end time,
%   the examination room, lecturers, and degree:
%    \begin{macrocode}
%<*ex>
\ExplSyntaxOn
\newcommand{\@coverbodyexam}{
  % Top data
  \node[anchor=north~west,text~width={\paperwidth-\@MTLR-\gridunit},align=flush~left]
  at (\@MTLR,{\paperheight-\@HTS-\gridunit}) {%
    \color{covertitlecolor}{
      \fontsize{18}{22}\selectfont%
      \textsf{\textbf{\printseq{courses}{\\}{\\}{\\}}}\par
      \ifx\@exampart\@empty\else
        \textsf{\textbf{\@exampart}}\par
      \fi
      \fontsize{12}{18}\selectfont%
      \textsf{\printseq{coursecodes}{\\}{\\}{\\}}
    }
    \color{coverdatacolor}{
      \vskip 2em
      \fontsize{12}{18}\selectfont%
      \textsf{
        \ifx\@examseries\@empty{}~\else\translatekey{series}~\@examseries{}\fi
      }
      \vskip 2em
      \fontsize{14}{19}\selectfont%
      \textsf{\translatekey{exam}~\@date{}}
    }
  };

  % Fill-in of surname, name, and student ID
  \node[anchor=south~west,align=left,inner~sep=0pt]
  at (\@MTLR,18){%
    \fontsize{12}{18}\selectfont%
    \color{coverdatacolor}{%
      \textsf{\translatekey{lastname}}
    }
  };
  \foreach \nn in {0,1,...,33} {
    \draw[fill=white] (\@MTLR,17) ++({0.5*\nn},0) rectangle +(0.5,0.8);
  }

  \node[anchor=south~west,align=left,inner~sep=0pt]
  at (\@MTLR,16){%
    \fontsize{12}{18}\selectfont%
    \color{coverdatacolor}{%
      \textsf{\translatekey{firstname}}
    }
  };
  \foreach \nn in {0,1,...,23} {
    \draw[fill=white] (\@MTLR,15) ++({0.5*\nn},0) rectangle +(0.5,0.8);
  }

  \node[anchor=south~west,align=left,inner~sep=0pt]
  at (\@MTLR+26*0.5cm,16){%
    \fontsize{12}{18}\selectfont%
    \color{coverdatacolor}{%
      \textsf{\translatekey{studentnr}}
    }
  };
  \foreach \nn in {0,1,...,7} {
    \draw[fill=white] (\@MTLR+26*0.5cm,15) ++({0.5*\nn},0) rectangle +(0.5,0.8);
  }

  % Bottom data
  \node[anchor=south~west,align=flush~left,inner~sep=0pt,text~width={\paperwidth-\@MTLR-\gridunit}]
  at (\@MTLR,5\gridunit){%
    \color{coverdatacolor}{
      \fontsize{12}{21}\selectfont%
      \textsf{\translatekey{examduration}:~\@examduration}\\
      \textsf{\begin{tabular}{@{}rl}%
        \translatekey{examstart}:~& \@examstart\\
        \translatekey{examend}:~& \@examend
        \end{tabular}}
      \vskip 2em
      \textsf{\getseqcaption{rooms}{:
        {}~\printseq{rooms}{~\&~}{,~}{\translatekey{andlist}~}}}
      \vskip 2em
       \begin{tabular}{@{}l@{~\,}p{14.5cm}}
        \getseqcaption{lecturers}{
        & \textbf{\printseq{lecturers}{~\&~}{,~}{\translatekey{andlist}~}}}
      \end{tabular}
      \vskip 2em
      \textsf{\printseq{degrees}{\\}{\\}{\\}}
    }
  };
}
\ExplSyntaxOff
%</ex>
%<bama|rp>\newcommand{\@coverbodyexam}{}
%    \end{macrocode}
%
% \DescribeObject[custom]{\@coverbodycourse}
%   The |course| cover body consists of
%   the title, subtitle (if present),
%   lecturers (if given),
%   degrees (if given),
%   and the academic year:
%    \begin{macrocode}
%<*bkc|crs>
\newcommand\@coverbodycourse{
  \newlength\@parboxheight
  \newlength\@parboxwidth
  \pgfmathsetlength{\@parboxheight}{\@HD-2*\@MTTB}
  \pgfmathsetlength{\@parboxwidth}{\@WD-2*\@MTLR}

  \node[anchor=north west, inner sep=0pt, text=coverdatacolor]
  at (\@MS+\@MTLR, \@HBS+\@HD-\@MTTB) {
    \parbox[t][\@parboxheight][t]{\@parboxwidth}{
      \raggedright
      {\fontsize{35}{42}\selectfont\bfseries
        \MakeUppercase{\uline{\@title}}\par}
      %
      \ifx\@subtitle\@empty\else
        \vspace{5pt}
        \hyphenpenalty=100000
        {\fontsize{30}{36}\selectfont\bfseries
          \@subtitle}
      \fi
      \par
      \vfill
      \par
      {\fontsize{18}{22}\selectfont \printseq{lecturers}{\\}{\\}{\\}}%
      %
      \vskip 2 em
      %
      {\fontsize{15}{20}\selectfont
        \printseq{degrees}{\\}{\\}{\\}\\
        \translatekey{acyear}~\@academicyear}%
    }
  };
}
%</bkc|crs>
%    \end{macrocode}
%
% \DescribeObject[custom]{\@coverbodyphd}
%   The |phd| cover body consists of
%   the title, subtitle (if present),
%   author(s), supervisors, academic year,
%   and the ``Submitted to\ldots'' text.
%   A FBW variant of the PhD cover exists with only
%   the title, subtitle, and author(s) listed:
%    \begin{macrocode}
%<*bkc|phd>
\ExplSyntaxOn
\newcommand\@coverbodyphd{
  % Title, subtitle, author
  \bool_if:NTF \l_@@_bwphdcover_bool {
    \node[anchor=south~east, text~width=\@PW-2*\@MTLR, align=flush~right, text=covertitlecolor]
    at (\@PW-\@MTLR, \@HT) {
      {\fontsize{28}{30}\selectfont\bfseries\nohyphens{\@title}\par}%
      \ifx\@subtitle\@empty\else\vspace{4pt}\hyphenpenalty=100000%
      {\fontsize{20}{28}\selectfont\bfseries\@subtitle\par}%
      \fi%
      \vspace{30pt}\hyphenpenalty=100000%
      {\fontsize{20}{24}\selectfont\printseq{authors}{\\}{\\}{\\}}};
  }{
    \node[anchor=west, text~width=\@PW-2*\@MTLR-\@MS, align=flush~left, text=covertitlecolor]
    at (\@MS+\@MTLR, \@HT) {
      {\fontsize{28}{30}\selectfont\bfseries\nohyphens{\@title}\par}%
      \ifx\@subtitle\@empty\else\vspace{5pt}\hyphenpenalty=100000%
        {\fontsize{20}{28}\selectfont\bfseries\@subtitle\par}
      \fi
    };

    \node[anchor=north~west, text~width=\@WD-2*\@MTLR, align=flush~left, text=coverdatacolor]
    at (\@MS+\@MTLR, \@HBS+\@HD-\@MTTB) {
      {\fontsize{20}{24}\selectfont\bfseries\printseq{authors}{\\}{\\}{\\}}%
      \\[15pt]
      {\fontsize{14}{17}\selectfont\getseqcaption{supervisors}{:\newline}
        \printseq{supervisors}{\\}{\\}{\\}}%
      \\[15pt]
      {\fontsize{11}{15}\selectfont\translatekey{acyear}~\@academicyear}};

    \node[anchor=south~west, text~width=\@WD-2*\@MTLR, align=flush~left, text=coverdatacolor]
    at (\@MS+\@MTLR, \@HBS+\@MTTB){%
      \fontsize{11}{15}\selectfont\nohyphens{%
        \@doctype{}~\translatekey[lowercase]{submittedto}%
        \ifx\@fselector\@empty\else{}%
          {}~\translatekey[lowercase]{the-de}~\@faculty{}~\translatekey[lowercase]{of}%
        \fi{}%
        {}~\translatekey{org-deugent},%
        {}~\translatekey{phdfulfil}~\printseq{degrees}{~\&~}{,~}{\translatekey{andlist}~}}};
  }

  \bool_if:NT \l_@@_embargo_bool {
    \@printconfidentialcover
  }
}
\ExplSyntaxOff
%</bkc|phd>
%    \end{macrocode}

% \DescribeObject[custom]{\@printconfidentialcover}
%   Prints the confidentiality word for PhD covers.
%   This appears in the top right of the front cover:
%    \begin{macrocode}
%<*phd|bkc|crs>
\ExplSyntaxOn
\newcommand{\@printconfidentialcover}{
  \bool_if:NTF \l_@@_bwphdcover_bool {
    \node[anchor=north~east,font=\fontsize{15}{18}\selectfont,covertitlecolor]
    at (\@PW-\gridunit,\@PH-\gridunit)
    {\textbf{\translatekey[uppercase]{confidential}}};

  }{
    \node[anchor=north~east,font=\fontsize{15}{18}\selectfont,ugent@main]
    at (\@PW-\gridunit,\@PH-\gridunit)
    {\textbf{\translatekey[uppercase]{confidential}}};
  }
}
\ExplSyntaxOff
%</phd|bkc|crs>
%    \end{macrocode}
%
% \DescribeObject[custom]{\@coverbody}
%   Finally, the appropriate cover body is selected:
%    \begin{macrocode}
%<*phd|bkc|crs|bama|rp|ex>
\ExplSyntaxOn
\newcommand*\@coverbody{
  \exp_args:Nx \str_case:nnF { \l_@@_covertype_tl } {
    { phd }    { \@coverbodyphd }
    { course } { \@coverbodycourse }
    { bama }   { \@coverbodybama }
    { report } { \@coverbodyreport }
    { exam }   { \@coverbodyexam }
  }{
    \msg_error:nnx { ugentdocs } { cover~type~not~implemented } { \l_@@_covertype_tl }
  }
}
\ExplSyntaxOff
%</phd|bkc|crs|bama|rp|ex>
%    \end{macrocode}
%
%
% \subsubsection{Front and back covers}
% This section contains the visual layout or canvas of the covers.
% These are used in the |\maketitle| and |\makefinalpage| commands.
%
% \DescribeObject[custom]{\@frontcover}
%   The front cover of the document.
%
% For |bama|, |report|, and |exam|, this consists of
% the logo placements,
% an optional background colour area,
% the |\@coverbody|,
% and frontcoverlogos:
%    \begin{macrocode}
%<*bama|rp|ex>
\ExplSyntaxOn
\newcommand{\@frontcover}{
  \begin{tikzpicture}[inner~sep=0pt, outer~sep=0pt]
  \clip (0,0) rectangle (\@PW,\@PH);

  % Faculty logo
  \begin{scope}[shift={(0,\@PH-3*\gridunit)}]
    \faclogo{3*\gridunit}{ugent@\@fselector}{0}
  \end{scope}

  % Coloured background
  \bool_if:NT \l_@@_coverbg_bool {
    \fill[coverbgcolor] (\gridunit,4*\gridunit) rectangle (\@PW,\@PH-\@HTS);
    \begingroup
    \colorlet{hypercolor}{covertitlecolor}
  }

  % Cover body
  \@coverbody

  % UGent logo
  \begin{scope}[shift={(0,0)}]
    \ugentlogo{4*\gridunit}{ugent@main}{0}
  \end{scope}

  % Front cover logos
  \ifx\@frontcoverlogos\@empty\else
    \node[anchor=south~east, inner~sep=0pt,
      text~width=\paperwidth-(2+\@ugenttextw/\@logounit)*\gridunit,
      minimum~height=2*\gridunit, align=flush~right]
    at (\paperwidth-\gridunit,\gridunit)
      {\@frontcoverlogos};
  \fi

  \bool_if:NT \l_@@_coverbg_bool {
    \endgroup
  }
  \end{tikzpicture}
}
\ExplSyntaxOff
%</bama|rp|ex>
%    \end{macrocode}
%
% For the |phd| and |course|, the layout is similar,
% but a faintly coloured area is always included,
% and a coloured data area is present:
%    \begin{macrocode}
%<*phd|bkc|crs>
\ExplSyntaxOn
\newcommand{\@frontcover}{%
  \begin{tikzpicture}[inner~sep=0pt,outer~sep=0pt]
  \useasboundingbox (0,0) rectangle (\@PW,\@PH);

  % Faculty logo
  \bool_if:NTF \l_@@_bwphdcover_bool {
    \begin{scope}[shift={(\@PW,0)}]
      \faclogo{3\gridunit}{ugent@\@fselector}{1}
    \end{scope}
  } {
    \begin{scope}[shift={(\@MS-\gridunit,\@PH-\@HTS)}]
      \faclogo{3\gridunit}{ugent@\@fselector}{0}
    \end{scope}
  }

  % Image zone
  {\ifx\@coverimage\@empty%
    \fill[coverbgcolor] (\@MS,\@HBS) rectangle (\@PW+\@B,\@PH-\@HTS+\@BT);%
    \@coverblankimage
  \else%
    \begin{scope}%
      \pgfmathsetlength{\@WI}{\@PW+\@B-\@MS}
      \pgfmathsetlength{\@HI}{\@PH-\@HBS-\@HTS+\@BT}
      \clip (\@MS,\@HBS) rectangle (\@PW+\@B,\@PH-\@HTS+\@BT);
      \node[anchor=south~west, inner~sep=0pt] at (\@MS, \@HBS)%
      {\adjustbox{min~width=\@WI, min~height=\@HI, keepaspectratio}{%
        \includegraphics[width=\@WI]{\@coverimage}%
      }%
    };%
    \end{scope}
  \fi}

  % Front cover data area
  \fill[coverareacolor] (\@MS,\@HBS) rectangle (\@MS+\@WD,\@HBS+\@HD);

  % Cover body
  \@coverbody

  % UGent logo
  \pgfmathsetmacro{\@ugentlogoxoffset}{max(\@MS-\gridunit,0)}
  \begin{scope}[shift={(\@ugentlogoxoffset pt,0mm)}]
    \ugentlogo{\@HBS}{ugent@main}{0}
  \end{scope}

  % Front cover logos
  \ifx\@frontcoverlogos\@empty\else
    \node[anchor=south~east, inner~sep=0pt,
      text~width=\@PW-(2+\@ugenttextw/\@logounit)*\gridunit,
      minimum~height=2*\gridunit, align=flush~right]
    at (\@PW-\gridunit,\gridunit)
      {\@frontcoverlogos};
  \fi

  \end{tikzpicture}
}
\ExplSyntaxOff
%</phd|bkc|crs>
%    \end{macrocode}
%
% \DescribeObject[custom]{\@coverblankimage}
% When no cover image is provided for the |course| or |phd| classes,
% |\@coverblankimage| is executed.
% For |phds|, it's just blank. For |courses|, it's the faculty icon:
%    \begin{macrocode}
%<*phd|bkc|crs>
\ExplSyntaxOn
\newcommand*\@coverblankimage{
  \exp_args:Nx \str_case:nnF { \l_@@_covertype_tl } {
    { phd } { }
    { course } {
      \bool_if:NF \l_@@_neutralcolors_bool {
        \newlength{\@WFI}      % Width Faculty Icon
        \newlength{\@FIoffset} % Faculty Icon offset
        \pgfmathsetlength{\@WFI}{\@PW-\@MS-4*\gridunit}
        \pgfmathsetlength{\@FIoffset}{0.5*(\@ficonw/\@logounit)}
        \begin{scope}[shift={(\@PW-\gridunit-0.5*\@WFI,\@PH-\@HTS-\gridunit-\@WFI)}]
          \ficon{\@WFI}{coverbgcolor!60}{\@FIoffset}
        \end{scope}
      }
    }
  }{
    \msg_error:nnx { ugentdocs } { cover~type~not~implemented } { \l_@@_covertype_tl }
  }
}
\ExplSyntaxOff
%</phd|bkc|crs>
%    \end{macrocode}
%
% \DescribeObject[custom]{\@backcover}
% The back cover of the documents.
%
% The |bama|, |report|, and |exam| classes don't use one:
%    \begin{macrocode}
%<*bama|rp|ex>
\newcommand{\@backcover}{}
%</bama|rp|ex>
%    \end{macrocode}
%
% The |course| and |phd| classes share the same cover,
% which includes an auto-generated ISBN barcode,
% and optional backcoverlogos:
%    \begin{macrocode}
%<*phd|bkc|crs>
\newcommand\@backcover{%
  \begin{tikzpicture}[inner sep=0pt,outer sep=0pt]
  \useasboundingbox (0,0) rectangle (\@PW,\@PH);

  % ISBN barcode
  \pgfmathsetmacro{\@isbnscale}{0.81}% GS1 minimum scale
  \pgfmathsetlengthmacro{\@isbnheight}{0.75*25.01mm}
  \pgfmathsetlengthmacro{\@grpH}{\@isbnscale*\@isbnheight+15pt}% box+spacing+text
  \begin{scope}[shift={(10mm, 0.5*\@HBS - 0.5*\@grpH)}]
  \ifx\@isbn\@empty% ISBN text and barcode placeholder
  %\fill[coverareacolor] (0,0) rectangle (34.2mm, \@isbnscale*\@isbnmoduleht);
  \else
  \node[anchor=south] at (0.5*34.2mm,0)
  {\edef\@@_isbnbarcodecall{\noexpand\EANBarcode[%
      scale=\@isbnscale,module_height=\@isbnheight]{%
        ISBN\space\@isbn%
    }}%
    \@@_isbnbarcodecall};
  \fi

    \node[anchor=south, font=\usefont{OT1}{ocrb}{m}{n}\fontsize{5}{5}\selectfont,
      text=black, inner sep=0pt]
    at (0.5*34.2mm, \@isbnscale*\@isbnheight+ 10pt) {
      \ifx\@isbn\@empty% {ISBN: XXX-X-XXX-XXXXX-X}
      \else {ISBN:  \@isbn}
      \fi
    };
  \end{scope}

  % Back cover logos
  \pgfmathsetmacro{\@backcoverlogosxoffset}{min(\@PW-\@MS,\@PW-10mm)}
  \begin{scope}[inner sep=0pt, shift = {(\@backcoverlogosxoffset pt, 0.5*\@HBS)}]
    \node[anchor=east, inner sep=0pt]
    at (0, 0)
    {\@backcoverlogos};
  \end{scope}

  % Full background
  \fill[coverbgcolor] (0-\@B,\@HBS) rectangle (\@PW-\@MS,\@PH-\@HTS+\@BT);
  \end{tikzpicture}
}
%</phd|bkc|crs>
%    \end{macrocode}
%
%
% \newpage
% \subsection{Copyright notices}
% \label{S:style:copyright}
%
% This section defines the copyright notices of
% the |bama|, |phd|, |course|, |report|, and |article| classes.
% These can be overridden using the |\copyrightnotices| macro
% (see Section \ref{S:usage:macros:data}).
%
% For the |bama| class, the autograph fields code is not shown here,
% since it is too complex to customize.
% \iffalse
%<*bama>
\ExplSyntaxOn
\cs_new:Nn \@@_sigblock:nn {
  \begin{minipage}[t]{\linewidth}
    \centering
    \rule{0pt}{1.25cm}\\
    \rule{0.8\linewidth}{0.4pt}\\[0.3em]
    #2\\
    {\small\itshape #1}
  \end{minipage}
}

\int_new:N \l_@@_sigcount_int

\cs_new:Nn \@@_sigrow_step:nn {
  \int_incr:N \l_@@_sigcount_int
  \@@_sigblock:nn {#1} {#2}
  \int_compare:nNnTF {\int_mod:nn {\l_@@_sigcount_int}{2}} = {1}
  { & }
  { \tabularnewline[2em] }
}

\tl_new:N \l_@@_sigrow_tl
\seq_new:N \l_@@_sigpairs_seq

\cs_new:Nn \@@_siggroup:Nn {
  \int_compare:nNnTF {\seq_count:N #1} = {1}
  {
    \noindent
    \begin{tabularx}{\textwidth}{@{}X@{\hspace{1.5cm}}X@{}}
      \seq_map_inline:Nn #1 { \@@_sigblock:nn {#2} {##1} } & \tabularnewline
    \end{tabularx}
  }{
    \seq_clear:N \l_@@_sigpairs_seq
    \int_zero:N \l_@@_sigcount_int
    \tl_clear:N \l_@@_sigrow_tl
    \seq_map_inline:Nn #1 {
      \int_incr:N \l_@@_sigcount_int
      \int_compare:nNnTF {\int_mod:nn {\l_@@_sigcount_int}{2}} = {1}
      {
        \tl_set:Nn \l_@@_sigrow_tl { \@@_sigblock:nn {#2} {##1} }
      }{
        \seq_put_right:Nx \l_@@_sigpairs_seq
        { \exp_not:V \l_@@_sigrow_tl & \exp_not:n { \@@_sigblock:nn {#2} {##1} } }
        \tl_clear:N \l_@@_sigrow_tl
      }
    }
    \tl_if_empty:NF \l_@@_sigrow_tl {
      \seq_put_right:Nx \l_@@_sigpairs_seq { \exp_not:V \l_@@_sigrow_tl & }
    }
    \noindent
    \begin{tabularx}{\textwidth}{@{}X@{\hspace{1.5cm}}X@{}}
      \seq_use:Nn \l_@@_sigpairs_seq { \tabularnewline[2em] }
    \end{tabularx}
  }
}

\cs_new:Nn \@@_autographpage: {
  \seq_if_empty:NF \g_@@_authors_seq {
    \translatekey{the-de}~\getseqcaption[lowercase]{authors}{}, \par\vskip 1em
    \@@_siggroup:Nn \g_@@_authors_seq { } % Sub-name key not implemented
  }
  \vskip 2em
  \seq_if_empty:NF \g_@@_allsupervisors_seq {
    \translatekey{the-de}~\getseqcaption[lowercase]{allsupervisors}{}
    \ifseqempty{tutors}{}{~\translatekey[lowercase]{and}~\getseqcaption[lowercase]{tutors}{}}, \par\vskip 1em
    \@@_siggroup:Nn \g_@@_allsupervisorstutors_seq { } % Sub-name key not implemented
  }
}
\ExplSyntaxOff
%</bama>
% \fi
% The copyright notices of the |bama| class include
% the |\@bamadisclaimer| in both English and Dutch for an English dissertation,
% a line with the location and date, and the autograph page:
%    \begin{macrocode}
%<*bama>
\ExplSyntaxOn
\renewcommand{\@copyrightnotices}{%
  \clearpage
  \str_if_eq:VnTF \l_@@_language_tl {dutch} {
    \@bamadisclaimer
  }{
    \begingroup % Has to be with selectlanguage for the date translation
    \selectlanguage{dutch}
    \@bamadisclaimer
    \endgroup
    \\[\baselineskip]
    \selectlanguage{english}
    \@bamadisclaimer
  }
  \\[\baselineskip]
  \@location,~\@date
  \\[\baselineskip]
  \@@_autographpage:

  \vspace*{\stretch{1}}
  \clearpage
}
\newcommand{\@bamadisclaimer}{
  {\translatekey{the-de}~\getseqcaption[lowercase]{authors}{}
    {}~\translatekey[lowercase]{and}~\getseqcaption[lowercase]{allsupervisors}{}}
  \bool_if:NTF \l_@@_embargo_bool {
    \bool_if:NTF \l_@@_embargotemp_bool {
      {~\@embargotempwithdates}
    }{
      {~\translatekey{embargofullbama}}
    }
  }{
    {~\translatekey{arrbama}}
  }
}
\ExplSyntaxOff
%</bama>
%    \end{macrocode}
%
% For a |phd|, it contains the colophon page, which consists of
% the author contact information,
% the title of the dissertation in Dutch (for English dissertations),
% the cover image designer,
% the scientific integrity clause,
% any applicable grants,
% the confidentiality or copyright notice itself,
% and the citation format, ISBN, and DOI (where applicable):
%    \begin{macrocode}
%<*phd>
\ExplSyntaxOn
\renewcommand{\@copyrightnotices}{%
  \noindent\begin{minipage}[b]{\textwidth}
    \textbf{Contact}\\
    \smallskip
    \printseq{authorswaff}{~|~}{~|~}{~|~}\\
    \@address
    \str_if_eq:VnF \l_@@_language_tl {dutch} {
      \\[\baselineskip]
      \textbf{Titel~van~het~doctoraat~in~het~Nederlands:}\\
      {\renewcommand{\\}[1][]{~}\@titel{}\ifx\@subtitel\@empty\else{}:~\@subtitel\fi}
    }
    \ifx\@coverdesigner\@empty\else
    \\[\baselineskip]
    \textbf{\translatekey{coverdesigner}:}\\
    \@coverdesigner
    \fi
    %
    \\[\baselineskip]
    \translatekey{integrityclause}
    %
    \ifx\@grants\@empty\else
    \\[\baselineskip]
    {\translatekey{supportedby}~\@grants.}
    \fi
    \bool_if:NTF \l_@@_embargo_bool {
      \\[\baselineskip]
      {\textbf{\translatekey{confidentiality}}}\\
      \bool_if:NTF \l_@@_embargotemp_bool {
        \@embargotempwithdates
      }{
        \translatekey{embargofullphd}
      }
    }{
      \\[\baselineskip]
      \textbf{\translatekey{crdisclaimer}~\textcopyright{}~\the\year}\\
      {\translatekey{arrphd}}%
    }
    \\[\baselineskip]
    {\textbf{\translatekey{pleaserefer}:}\\
      \printseq{authorlist}{~\&~}{,~}{\translatekey{andlist}~}~(\the\year).~
      {\renewcommand{\\}[1][]{~}\@title{}\ifx\@subtitle\@empty\else{}:~\@subtitle\fi}.
      {}~\@doctype{}.~Ghent~University,~Belgium.}%
    \ifx\@isbn\@empty\else
    \\[\baselineskip]{\small ISBN~\@isbn}%
    \fi
    \ifdefempty{\@doi}{}{
      \ifx\@isbn\@empty\\[\baselineskip]\else\\\fi
      {\small DOI~
        \@ifpackageloaded{hyperref}{
          \exp_args:NV \href \l_@@_doiurl_str {\@doi}
          }{
          \@doi
          }
      }
    }
  \end{minipage}
}
\ExplSyntaxOff
%</phd>
%    \end{macrocode}
%
% For courses, the copyright page consists of
% the course version, the course codes,
% the authors,
% a ``typeset using \LaTeX{} and the |ugentdocs| package'' notice,
% user-defined |\@extranotices| (see Section \ref{S:usage:macros:data}),
% the publisher information and code, and a general copyright notice:
%    \begin{macrocode}
%<*crs>
\renewcommand{\@copyrightnotices}{
  \null\par
  \vspace*{\stretch{1}}
  {
    \setlength\parindent{0em}
    \ifx\@courseversion\@empty\else\small\translatekey{version}~\@courseversion\\\fi
    \printseq{courseswcodes}{\\}{\\}{\\}
    \ifseqempty{authors}{}{
      \vskip 1em
      \getseqcaption{authors}{}:~\printseq{authors}{~\&~}{,~}{\translatekey{andlist}~}
    }

    \translatekey{typeset}~\textrm{\LaTeX{}}~\translatekey[lowercase]{and}
    {}~\translatekey[lowercase]{the-het}~\texttt{ugentdocs}~\translatekey[lowercase]{package}.\\
    \@extranotices

    \vskip 1em
    \@publisher\\
    \@publishercode

    \vskip 1em
    \copyright{}~\the\year~\translatekey{org-ugent},
    \translatekey[lowercase]{arr}.
  }
}
%</crs>
%    \end{macrocode}
%
% For a |report|, the copyright simply contains
% the ``typeset using \LaTeX{} and the |ugentdocs| package'' notice,
% user-defined |\@extranotices| (see Section \ref{S:usage:macros:data}),
% and a general copyright notice:
%    \begin{macrocode}
%<*rp>
\renewcommand{\@copyrightnotices}{
  \null\par
  \vspace*{\stretch{1}}
  {
    \setlength\parindent{0em}
    \translatekey{typeset}~\textrm{\LaTeX{}}~\translatekey[lowercase]{and}
    {}~\translatekey[lowercase]{the-het}~\texttt{ugentdocs}~\translatekey[lowercase]{package}.\\
    \@extranotices

    \copyright{}~\the\year~\translatekey{org-ugent},
    \translatekey[lowercase]{arr}.
  }
}
%</rp>
%    \end{macrocode}
%
%
% \newpage
% \subsection{Bookcover components}
%
% A few custom bookcover components are defined here for the spine, being
% the title, the authoryear, and the UGent logo.
%    \begin{macrocode}
%<*bkc>
\newbookcovercomponenttype{title}{
  \newlength{\@HST}  % Height spine title
  \pgfmathsetlength{\@HST}{3*\gridunit}
  \vspace{\@HST}\centering
  \rotatebox[origin=c]{-90}{%
    \begin{tabular}{@{}l@{}}
      {\renewcommand{\\}[1][]{~}%
        \fontsize{15}{0}\selectfont\color{spinetextcolor}\textbf{#1}}
      \ifx\@subtitle\@empty\else
      \\[0.25em]
      {\fontsize{10}{0}\selectfont\color{spinetextcolor}\@subtitle}
      \fi
    \end{tabular}
  }%
  \vfill
}
\ExplSyntaxOn
\newbookcovercomponenttype{authoryear}{
  \vfill\centering
  \bool_if:NTF \l_@@_bwphdcover_bool {
    \rotatebox[origin=c]{-90}{
      \fontsize{13}{0}\selectfont\color{spinetextcoloralt}\textbf{\vphantom{Ag}#1%
        \hspace{30pt}\the\year%
        }
    }
  }{
    \rotatebox[origin=c]{-90}{
      \fontsize{13}{0}\selectfont\color{spinetextcoloralt}\textbf{\vphantom{Ag}#1}
    }
  }
  \vspace{10mm}
}
\ExplSyntaxOff
\newbookcovercomponenttype{logo}{
  \vspace{0mm}\centering
  \rotatebox{-90}{
  \begin{tikzpicture}[overlay,x=1pt,y=1pt]
  \begin{scope}[shift={(0,-7.75mm)}]
    \ugentlogo{15.5mm}{#1}{0.0}
  \end{scope}
  \end{tikzpicture}%
}
  \vfill
}
%</bkc>
%    \end{macrocode}
%
%
% \clearpage
% \newgeometry{left=3cm,right=2cm,top=2cm,bottom=2.5cm}
% \section{Examples}
% \label{S:examples}
%
% Below you can find an example for every class. They also serve as
% their quick-start documentation.
%
% Remember to
% \begin{itemize}
% \item Use a modern compiler: no pdf\LaTeX{},
%    use \LuaLaTeX{} or \XeLaTeX{} instead!
% \item Compile your source file twice or thrice. Most modern editors do this
%    automatically
% \end{itemize}
%
% \iffalse
% ==============================================================================
% Constructing examples
%
% Document classes and options -------------------------------------------------
%
%<crs1>\documentclass[lw,11pt,twoside,openright,dutch]{ugentcourse}
%<bama1>\documentclass[pp,11pt,twoside,openright,coverbg]{ugentbama}
%<bama2>\documentclass[ea,kortrijk,11pt,twoside,openright,dutch,surnamefirst]{ugentbama}
%<phd1>\documentclass[ps,10pt,twoside,openright,dutch,surnamefirst]{ugentphd}
%<phd2>\documentclass[bw,10pt,twoside,openright,cameraready]{ugentphd}
%<rp1>\documentclass[eb,10pt,twoside,openright,dutch]{ugentreport}
%<rp2>\documentclass[10pt,oneside,openany,coverbg]{ugentreport}
%<le1>\documentclass[bw]{ugentletter}
%<ex1>\documentclass[we,10pt, dutch]{ugentexam}
%<ex2>\documentclass[we,10pt, coverbg]{ugentexam}
%<art1>\documentclass[10pt]{ugentarticle}
%
%
% Class options notes ----------------------------------------------------------
%
% Common options ...............................................................
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|ex1|ex2|art1>
%% neutralcolors      Uses ugent colour scheme instead of faculty colours
%%                    Options: true, false*
%% colormodel         Uses rgb (display) or cmyk (print) colouring
%%                    Options: rgb*, cmyk
%% faculty            Specifies the faculty abbreviation, can be empty*.
%%                    Used in colouring, logos, and text.
%%                    Options: bw, di, ea, re, we, pp, lw, eb, ps, ge, fw
%% campus             Specifies the campus, overriding UGent logo
%%                    Options: ugent*, gugc, kortrijk
%% language           Sets the document main language. Determines, i.a., logo
%%                    and copyright text. Can be overridden locally for the text
%%                    using \selectlanguage or \foreignlanguage (babel package)
%%                    Options: english* / dutch
%% localizedates      Localizes any dates using the current language,
%%                    provided the dates are supplied in ISO format YYYY-MM-DD
%%                    Options: true*/false
%% nameformat         Format all names as "surname firstname"
%%                    or "firstname surname"
%%                    Options: surnamefirst, surnamelast*
%% affiliationformat  Format affiliation indexes as "a,b,c" (alph)
%%                    or "1,2,3" (arabic)
%%                    Options: alph*, arabic
%</crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|ex1|ex2|art1>
%
%
% Base class options ...........................................................
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|ex1|ex2|art1>
%% xxpt               Sets the font size to e.g. 10pt or 11pt
%</crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|ex1|ex2|art1>
%
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|art1>
%% twoside            If you want a two-sided document, change to oneside if you
%%                    want a recto only document
%</crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|art1>
%
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2>
%% openright          Causes you chapters to start on a right-hand page when
%%                    your document is two-sided
%</crs1|bama1|bama2|phd1|phd2|rp1|rp2>
%
%
% Class-specific options .......................................................
%
%<*crs1|phd1|phd2>
%% cameraready        Embeds the official 24 cm x 18 cm into an A4 page and
%%                    trigger alignment and cut marks for your printing service.
%%                    This will also apply to the generated bookcover file.
%%                    Options: true, false*
%% bare               Removes front and back cover. Many
%%                    print services require this format for the contents.
%%                    Options: true, false*
%% thumbs             Adds chapter thumbs to the side of the pages
%%                    Options: true*, false
%</crs1|phd1|phd2>
%
%
%<*crs1>
%% copyright          Prints a copyright watermark
%%                    Options: true, false*
%</crs1>
%
%
%<*bama1|bama2|rp1|rp2|ex1|ex2>
%% coverbg            Adds a coloured background area to the cover page
%%                    Options: true, false*
%</bama1|bama2|rp1|rp2|ex1|ex2>
%
%
%<*le1>
%% foldline           Prints a fold line at 2/3 page height
%%                    Options: true*, false
%</le1>
%
%
%<*ex1|ex2>
%% examiner           Compiles an examiner version
%%                    with watermark and "examiner version" in the headers
%%                    Options: true, false*
%</ex1|ex2>
%
%
% Add default note .............................................................
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|ex1|ex2|art1>
%% *default

%</crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|ex1|ex2|art1>
%
%
% Packages ---------------------------------------------------------------------
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|art1>
%% This is just for some dummy text, please remove in your copy
\usepackage{kantlipsum}

%</crs1|bama1|bama2|phd1|phd2|rp1|rp2|le1|art1>
%
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
%% This package allows to generate a PDF with clickable links
\usepackage[hyperindex=true]{hyperref}
%% You must load the hyperref package yourself, to allow putting it
%% in the correct order with the other packages you load!

%% Use this package if you want text spanning multiple columns in a table,
%% e.g., in a two-column summary at the start of your document.
\usepackage{multicol}

%% Use this package if you want multi-row tables
\usepackage{multirow}

%% Use these packages if you want prettier tables
\usepackage{booktabs}
\usepackage{threeparttable}

%% Use this package for exact float placements (e.g., in a multicols environment)
\usepackage{float}

%% Use biblatex for references
\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib} %% Change this to your own bibliography

%</crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2|ex1|ex2|art1>
%% Use this package if you want uniform and clean quantities and units
%% following SI conventions.
\usepackage{siunitx}
\sisetup{mode = text}

%% Use this package if you want to easily typeset chemical equations.
\usepackage[version=4]{mhchem}

%</crs1|bama1|bama2|rp1|rp2|phd1|phd2|ex1|ex2|art1>
%<*art1>
%% Use this package if you want a CC license notice
\usepackage[type={CC},modifier={by-nc-nd},version={4.0},]{doclicense}

%</art1>
%
% Font override to Arial -------------------------------------------------------
%
%<*crs1|bama1|phd2|rp1|ex1|art1>
%% You may want to use common fonts such as Arial (still within house style)
%% Works with installed fonts, and with font files placed
%% next to the document or in a fonts/ folder (e.g., on Overleaf).
%% Use * to refer to the font itself in the options.
%%\trysetsansfont[Arial]{Arial}[
%%  BoldFont            = *,
%%  BoldFeatures        = {FakeBold=2.5},
%%  ItalicFont          = *,
%%  ItalicFeatures      = {FakeSlant=0.15},
%%  BoldItalicFont      = *,
%%  BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
%%]{}
%%\tryoverridemathfont[Arial]{Arial}{}

%</crs1|bama1|phd2|rp1|ex1|art1>
%
%
%<*bama2|phd1|rp2|le1|ex2>
%% You may want to use common fonts such as Arial (still within house style)
%% Works with installed fonts, and with font files placed
%% next to the document or in a fonts/ folder (e.g., on Overleaf).
%% Use * to refer to the font itself in the options.
\trysetsansfont[Arial]{Arial}[
  BoldFont            = *,
  BoldFeatures        = {FakeBold=2.5},
  ItalicFont          = *,
  ItalicFeatures      = {FakeSlant=0.15},
  BoldItalicFont      = *,
  BoldItalicFeatures  = {FakeBold=2.5, FakeSlant=0.15},
]{}
\tryoverridemathfont[Arial]{Arial}{}

%</bama2|phd1|rp2|le1|ex2>
%
%
% Faculty and unit -------------------------------------------------------------
%
%<*le1>
%% Override faculty name (if needed for e.g. UGent university services, GUGC, etc.)
%% \faculty{Directie ICT}
\team{TRASLAB}

%</le1>
%
% Time and location ------------------------------------------------------------
%
%<*bama1|bama2|phd1|phd2|le1|ex1|ex2>
%%Date defaults to today if not specified, input date via ISO format YYYY-MM-DD
\date{2026-08-19}

%</bama1|bama2|phd1|phd2|le1|ex1|ex2>
%
%<*art1>
%% Optionally specify submission, acceptance, and publication date
\date[submitted]{2026-05-19}
\date[accepted]{2026-09-04}
\date[published]{2026-10-05}

%</art1>
%
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2|art1>
%% Year defaults to the current year, override with:
\year=2026

%</crs1|bama1|bama2|phd1|phd2|rp1|rp2|art1>
%
%
%<*crs1|bama1|bama2|rp1|phd1|phd2|ex1|ex2>
%% Specify academic year
\academicyear{2026--2027}

%</crs1|bama1|bama2|rp1|phd1|phd2|ex1|ex2>
%
%
%<*rp2>
%% Specify academic year
%%\academicyear{2026--2027}

%</rp2>
%
%
%<*bama1|bama2|phd1|phd2>
%% Set location, defaults to translated 'Ghent'
%%\location{Somewhere else}

%</bama1|bama2|phd1|phd2>
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2|ex1|ex2|art1>
%% Document data ---------------------------------------------------------------
%</crs1|bama1|bama2|phd1|phd2|rp1|rp2|ex1|ex2|art1>
%
%
% Titles .......................................................................
%<*crs1>
%% Set title and subtitle
\title{<Document or course title>}
\subtitle{<Course Notes>}

%</crs1>
%<*bama1|phd2|rp2>
%% Set title and subtitle
\title{<This is quite a long example document title with not much information>}
\subtitle{<This is your subtitle>}

%</bama1|phd2|rp2>
%<*bama2|phd1>
%% Set title and subtitle
\title{<Dit is een vrij lange voorbeeldtitel met niet al te veel informatie>}
\subtitle{<Dit is je subtitel>}

%</bama2|phd1>
%<*phd1>
%% Add title and subtitle in Dutch for an English dissertation
%%\titel{<Dit is een vrij lange voorbeeldtitel met niet al te veel informatie>}
%%\subtitel{<Dit is je subtitel>}

%</phd1>
%<*phd2>
%% Add title and subtitle in Dutch for an English dissertation
\titel{<Dit is een vrij lange voorbeeldtitel met niet al te veel informatie>}
\subtitel{<Dit is je subtitel>}

%</phd2>
%<*rp1>
%% Set title, subtitle, and extra information
\title{<Titel>}
\subtitle{<Opdracht>}
\extra{<Vak>}

%</rp1>
%<*rp2>
%% Set title, subtitle, and extra information
\title{<Title>}
\subtitle{<Subtitle or project number>}
\extra{<additional text to title>}

%</rp2>
%<*art1>
%% Set title
\title{<This is the title of your article which is probably way too long
  and you should generally avoid this>}

%</art1>
%
%
% Images and logos .............................................................
%
%<*phd1|crs1>
%% Specify a fancy photo for your cover page and its designer
%%\coverimage{Images/ugent-oehoe}
%%\coverdesigner{De Kat, Kroketje}

%% Change title colour if it clashes with your image
%% \letcolor{covertitlecolor}{black}

%</phd1|crs1>
%<*phd2>
%% Specify a fancy photo for your cover page and its designer
\coverimage{Images/ugent-oehoe}
\coverdesigner{De Kat, Kroketje}

%% Change title colour if it clashes with your image
%% \letcolor{covertitlecolor}{black}

%</phd2>
%
%
%<*crs1>
%% Add publisher logo, e.g., Academia Press
\frontcoverlogos{\includegraphics[height=2\gridunit]{example-image-a}}
\backcoverlogos{\includegraphics[height = 2\gridunit]{example-image-a}}

%</crs1>
%
%
%<*bama1|rp1|phd1>
%% You can specify company logos. Height should be (at most) 2\gridunit
%% (or about 2.12cm), multiple logos should be spaced 1 \gridunit
\frontcoverlogos{
  \includegraphics[height=2\gridunit]{example-image-a}
  \hspace{\gridunit}
  \includegraphics[height=2\gridunit]{example-image-b}
}

%</bama1|rp1|phd1>
%<*bama2|rp2|phd2>
%% You can specify company logos. Height should be (at most) 2\gridunit
%% (or about 2.12cm), multiple logos should be spaced 1 \gridunit
%%\frontcoverlogos{
%%  \includegraphics[height=2\gridunit]{example-image-a}
%%  \hspace{\gridunit}
%%  \includegraphics[height=2\gridunit]{example-image-b}
%%}

%</bama2|rp2|phd2>
%<*phd1|phd2>
%% Add different publisher logo, e.g., University Press
\backcoverlogos{\includegraphics[height = \gridunit]{example-image-c}}

%</phd1|phd2>
%
%<*art1>
%% Add the graphical abstract
\graphicalabstract{%
  \begin{center}%
    \includegraphics[width=0.5\textwidth]{example-image-a}%
  \end{center}%
}

%</art1>
%
%
% Degree, doctype, wordcount ...................................................
%
%<*crs1>
%% Specify the degree(s):
\degree{Master of Arts in de wijsbegeerte}

%</crs1>
%<*ex1|ex2>
%% Specify the degree(s):
\degree{Master of Science in Biology}

%</ex1|ex2>
%<*bama1>
%% Specify your degree and doctype (dissertation-ma/dissertation-ba)
\degree{Master of Science in Psychology}
\doctype{dissertation-ma}

%</bama1>
%<*bama2>
%% Specify your degree and doctype (dissertation-ma/dissertation-ba)
\degree{Bachelor of Science in de industriële wetenschappen}
\doctype{dissertation-ba}

%</bama2>
%<*phd1>
%% Specify your degree and doctype (dissertation-phd)
\degree{Doctor in Political Sciences}
\doctype{dissertation-phd}

%</phd1>
%<*phd2>
%% Specify your degree and doctype (dissertation-phd)
\degree{Doctor in Bioscience Engineering}
\doctype{dissertation-phd}

%</phd2>
%
%
%<*bama1|bama2>
%% Specify word count
\wordcount{2501}
%% You can also let wordcount be fetched automatically by using
%%\wordcount{\runwordcount}
%% To use this, you need to add --shell-escape to your latex build command.
%% !!See the docs for notes on accuracy and safety!!

%</bama1|bama2>
%<*rp1|rp2>
%% Specify word count
%%\wordcount{2501}
%% You can also let wordcount be fetched automatically by using
%%\wordcount{\runwordcount}
%% To use this, you need to add --shell-escape to your latex build command.
%% !!See the docs for notes on accuracy and safety!!

%</rp1|rp2>
%
%
% PhD or article information ...................................................
%
%<*art1>
%% Optionally specify the journal
\journal{<The Journal>}

%% Optionally specify the keywords and highlights
\keywords{keyword one, keyword two, keyword three}
\highlights{
  \item This is a first fine highlight
  \item This is some finding highlighted
  \item This is a key conclusion
  \item Perhaps some perspective
}

%</art1>
%
%<*phd1|phd2|art1>
%% Optionally specify your funding if any
\grants{FWO PhD Fellowship strategic basic research 1SXXXXXXN}

%% Specify your DOI if applicable
\doi{10.1000/182}

%</phd1|phd2|art1>
%<*phd1|phd2|crs1>
%% Specify your ISBN
\isbn{978-92-95055-12-4}

%</phd1|phd2|crs1>
%
%
% Embargo and copyright ........................................................
%
%<*bama1|phd1>
%% If your manuscript is under an embargo, use the \embargo macro.
%% If the embargo is temporary (1, 2 or 5 years), please
%% specify (language agnostic) start and end date of the embargo period:
\embargo[start = 2027-05-21, end = 2032-05-20]

%</bama1|phd1>
%<*bama2|phd2>
%% If your manuscript is under an embargo, use the \embargo macro.
%% If the embargo is temporary (1, 2 or 5 years), please
%% specify (language agnostic) start and end date of the embargo period:
%%\embargo[start = 2027-05-21, end = 2032-05-20]

%</bama2|phd2>
%
%
%<*bama1|bama2>
%% If you have a signed copyright page (after extracting the one in this
%% document), you can include it back in using
%% \usepackage{pdfpages}
%% \copyrightnotices{\includepdf[pages={1}]{copyright_signed.pdf}}

%</bama1|bama2>
%<*rp1|crs1>
%% You can skip copyright notices (replace all content with empty):
%% \copyrightnotices{}

%</rp1|crs1>
%<*rp2>
%% You can skip copyright notices (replace all content with empty):
\copyrightnotices{}

%</rp2>
%<*art1>

%% Print the notice from the doclicense package
\makeatletter
\newsavebox\cclogobox   % Save CC image box with
\copyrightnotices{%
  \sbox\cclogobox{\doclicenseImage}% License box
  \usebox\cclogobox\hspace{1em}%
  \begin{minipage}[b]{\dimexpr\linewidth-\wd\cclogobox-1em\relax}
    \raggedright
    \textcopyright\ <publisher> \the\year.
    The definitive peer-reviewed and edited version of this article
    is published in \@journal{} <issue information>,
    \href{https://doi.org/\@doi}{DOI: \@doi}
    and is available at \href{<publisherwebsite>.com}{<publisherwebsite>}
  \end{minipage}
}
\makeatother

%</art1>
%
%
%<*rp1|rp2>
%% You can specify additional copyright notices on the copyright page
\extranotices{%
  De figuren in dit document zijn opgemaakt met \textrm{TikZ}.\\
  Dit document werd ge-\textrm{\TeX}-ed op een GNU/Linux desktop.
}

%</rp1|rp2>
%<*crs1>
%% You can specify additional copyright notices on the copyright page
\makeatletter
\extranotices{%
  De figuren in dit document zijn opgemaakt met \textrm{TikZ}.\\
  Dit document werd ge-\textrm{\TeX}-ed op een GNU/Linux desktop.
    \ifx\@empty\@coverdesigner\else
      \\Omslagontwerp: \@coverdesigner.
    \fi
}
\makeatother

%</crs1>
%
%
%<*phd1|phd2|crs1|bama1|bama2|rp1|ex1|ex2|art1>
%% People ----------------------------------------------------------------------
%</phd1|phd2|crs1|bama1|bama2|rp1|ex1|ex2|art1>
%
%<*crs1|ex1>
%% Authors
\author{}{Tupolev, Rudolf}{, Ghent University, Belgium}
\author{}{Tupolev, Adolf}{, Ghent University, Belgium}

%</crs1|ex1>
%<*bama1>
%% Author
\author{}{Poppe, Ludo}{}
\studentnr{<studentnr>}

%</bama1>
%<*bama2|rp1>
%% Specify the author and their title, and affiliation
\author{}{Poppe, Ludo}{& (<studentnr>)}
\author{}{Van Callenberghe, Palmyra}{& (<studentnr>)}
\author{}{Van Hoebeecke, Cesar}{& (<studentnr>)}

%</bama2|rp1>
%<*phd1>
%% Specify the author and their title, and affiliation
\author{Ir.}{De Bruyne, Henri}{\\Universiteit Gent\\
  Faculteit Politieke en Sociale Wetenschappen\\
  Vakgroep Politieke Wetenschappen}

%</phd1>
%<*phd2>
%% Specify the author and their title, and affiliation
\author{}{Callewaert, Gerrit}{\\Ghent University\\
  Faculty of Bioscience Engineering\\
  Department of Biotechnology}

%</phd2>
%
%
%<*crs1|rp1|ex1|ex2>
%% Mention who lectures the course
\lecturer{prof. dr.}{Gretarsson, Elma}{, Ghent University, Belgium}
\lecturer{prof. dr.}{Blum, Stephen}{, Ghent University, Belgium}

%</crs1|rp1|ex1|ex2>
%
%
%<*bama1|bama2|phd1|phd2>
%% Specify your supervisors (NL: promotoren) and their affiliation
\supervisor{prof. dr. ir.}{Walput, Eddie}{, Ghent University, Belgium}
\supervisor{prof. dr. ir.}{Dhaese, Gaston}{, Ghent University, Belgium}

%</bama1|bama2|phd1|phd2>
%
%<*bama1|bama2>
%% Specify cosupervisors and external supervisors (if any) and their affiliation
\cosupervisor{ing.}{Thijs, Pol}{, Universiteit Gent, Belgi\"e}
\extsupervisor{prof. dr.}{Protut, Lydia}{, Cynalco Medics, U.S.A.}

%</bama1|bama2>
%
%<*bama1|bama2>
%% Specify your tutor or mentor
\tutor{}{, Marcel}{}

%</bama1|bama2>
%
%
%<*phd1|phd2>
%% Specify the chair of the jury and their affiliation
\jurychair{prof. dr.}{Gooris, Willy}{, Universiteit Gent, Belgi\"e}

%% Specify the members of the jury and their affiliations
\jurymember{prof. dr.}{Opdenbosch, Lydia}{, Universiteit Gent, Belgi\"e}
\jurymember{prof. dr.}{Helsen, Rob}{, Butsel, N.V., Belgi\"e}
\jurymember{prof. dr.}{Beirnaert, Mia}{, H. Hart, Belgi\"e}

%% Specify the dean of the faculty and rector of Ghent University
\dean{prof. dr.}{Decaan, Nona}
\rector{prof. dr.}{De Sutter, Petra}

%</phd1|phd2>
%
%
%<*art1>
%% Specify the author and their title, and affiliation
\affiliation{%
  Technologies for a Resource Agile Society Laboratory (TRASLAB), %
  Ghent University, %
  Frieda Saeysstraat 1, 9052 Ghent, %
  East-Flanders, Belgium%
}
\affiliation{
  Center for Advanced Process Technology for Urban Resource Recovery (CAPTURE), %
  Frieda Saeysstraat 1, 9052 Ghent, %
  East-Flanders, Belgium
}
\author
  [email=Ludo.Poppe,
  orcid=0000-00000-0000-0001]
  {}{Poppe, Ludo}{a}
\author
  [email=Palmyra.VanCallenberghe,
  orcid=0000-00000-0000-0002]
  {}{Van Callenberghe, Palmyra}{a,b}
\author
  [corresponding,
  email=Cesar.VanHoebeecke,
  orcid=0000-00000-0000-0003]
  {}{Van Hoebeecke, Cesar}{b}

%</art1>
%
%
%<*phd1|phd2|rp2|le1>
%% Contact ----------------------------------------------------------------------
%</phd1|phd2|rp2|le1>
%<*phd1>
%% Set author's address
\address{Sint-Pietersnieuwstraat 41, 9000 Gent, Belgi\"e\\
  M: henri.debruyne@ugent.be\\
  T: +32 9 264 51 19
}

%</phd1>
%<*phd2>
%% Set author's address
\address{Frieda Saeysstraat 1, 9052 Gent, Belgi\"e\\
  M: gerrit.callewaert@ugent.be\\
  T: +32 9 264 51 19
}

%</phd2>
%<*rp2>
%% Set full contact info in address
\address{
  <Faculty \ldots>\\
  <Department or Office \ldots>\\\sisetup{
    reset-text-family = false,
    reset-text-series = false,
    reset-text-shape  = false,
  }
  <Research group \ldots>
  \vskip 1em
  \ifseqempty{emails}{}{E~\printseq{emails} {\\\phantom{E~}}{\\\phantom{E~}}{\\\phantom{E~}}\\}
  \ifseqempty{phones}{}{T~\printseq{phones} {\\\phantom{T~}}{\\\phantom{T~}}{\\\phantom{T~}}\\}
  \ifseqempty{mobiles}{}{M~\printseq{mobiles} {\\\phantom{M~}}{\\\phantom{M~}}{\\\phantom{M~}}\\}
  \vskip 1em
  <Campus \ldots, building \ldots>\\
  <Street 123 c >, <0000 City>
  \newline\newline
  \href{https://www.ugent.be}{www.ugent.be}
}

%</rp2>
%<*le1>
%% Set sender's address
\address{
  CAPTURE building\\
  Frieda Saeysstraat 1\\
  9052 Ghent\\
  BELGIUM
}

%</le1>
%
%
%<*rp2>
%% Set email, phone, and mobile (multiple of each possible).
\email{firstname.name}
\phone{+32 9 000 00 00}
\mobile{+32 400 00 00 00}

%</rp2>
%<*le1>
%% Set email, phone, and mobile (multiple of each possible).
\email{seppe.ongena}
\phone{+32 9 000 00 00}
\mobile{+32 400 000 000}

%</le1>
%
%
%<*crs1>
%% Course-specific preamble ----------------------------------------------------
%% Specify the course(s) this document apply to:
%% - first  argument is the course number
%% - second argument is the course name
\course{I009160}{Veldbiologie: Soortherkenning en Habitatbeoordeling}
\course{I009000}{Veldwerkmethoden voor Hydrologische Systemen}

%% Better keep track of the different versions of your course
%% (and the corresponding publication year)
\courseversion{1.3}

%% Leave this as is if you use Academia Press as print shop
\publisher{Academia Press |
  Coupure Rechts 88 |
  9000 Gent |
  T +32 9 233 80 88 |
  E info@academiapress.be}

%% The publisher may provide you with a code, that you can provide on
%% your PDF copy (if you distribute any to your students.
%% This can also just be your ISBN code:
\makeatletter
\publishercode{ISBN \@isbn}
\makeatother

%</crs1>
%
%
%<*ex1|ex2>
%% Exam-specific preamble ----------------------------------------------------
%</ex1|ex2>
%
%<*ex1>
%% Course information
\course{I009160}{Veldbiologie: Soortherkenning en Habitatbeoordeling}
\title{Veldbiologie: Soortherkenning en Habitatbeoordeling}

%</ex1>
%<*ex2>
%% Course information
\course{I009000}{Field Biology: Species Recognition and Habitat Assessment}
\title{Field Biology: Species Recognition and Habitat Assessment}

%</ex2>
%
%
%<*ex1>
%% Specify the particular examination form
\exampart{Schriftelijk Examen}

%</ex1>
%<*ex2>
%% Specify the particular examination form
\exampart{Written Exam}

%</ex2>
%
%
%<*ex1|ex2>
%% Specify the group
\examseries{1 (eerste examenkans-inhaal)}

%% Specify important time-related info about the exam
\examduration{4h}
\examstart{08h30}
\examend{12h30}

%% Same for the room(s)
\room{LES A2.1}
\room{LES A2.2}

%</ex1|ex2>
%
%
%<*ex1>
%% Set whatever multiple choice symbol you fancy
\mcsymb{\bigcirc}

%</ex1>
%<*ex2>
%% Set whatever multiple choice symbol you fancy
%%\mcsymb{\bigcirc}

%</ex2>
%
%
%<*ex1>
%% Exam rules text adapted from uantwerpendocs v4.12, (C) Walter Daems, LPPL 1.3c
%% Instruct your students about important details.
\extrainfo{
  Belangrijke informatie:\par\medskip
  Het volledige Onderwijs- en Examenregelement (OER) is van toepassing
  op dit examen.
  Toch wil ik vooraf nog een aantal regels duidelijk stellen:
  \begin{enumerate}
    \item Mogen op je tafeltje aanwezig zijn:
    (1) schrijfgerief, los d.w.z. \emph{niet} in een pennenzak (geen
    papier; er zit examenpapier bij de opgaven),
    (2) je rekenmachine (zonder alfanumerieke data en zonder
    geheugenkaarten),
    (3) het formularium.
    \item Volledig \emph{verboden te gebruiken}: alle apparatuur met
    geheugen- of communicatiefunctionaliteit zoals GSM, smartphone,
    smartwatch, muziekspeler, \ldots
    Je tas staat vooraan in het lokaal. Hang je jas aan de kapstok of
    leg hem bij je tas.
    \item Schrijf je naam op het titelblad van de opgave in het daartoe
    voorziene vak. Op de andere bladen schrijf je je naam
    \emph{niet}. Je examenopgave heeft een uniek nummer dat toelaat het
    te identificeren.
    \item Op het einde van het examen geef je \emph{alle} bladen weer af
    aan de aanwezige docent.
  \end{enumerate}
  Succes!
}
%</ex1>
%
%
%<*ex2>
%% Exam rules text adapted from uantwerpendocs v4.12, (C) Walter Daems, LPPL 1.3c
%% Instruct your students about important details.
\extrainfo{
  %% The bilingual command allows you to specify a left column in English
  %% and right column in Dutch
  %% use multiple bilingual-environments to keep the page flow synchronized
  \bilingual{
    Important information:\par\medskip
    The Education and Examination Regulations (EER) hold for this
    examination in full.
    However, before starting, I'd like to set some rules straight:
  }{
    Belangrijke informatie:\par\medskip
    Het volledige Onderwijs- en Examenregelement (OER) is van toepassing
    op dit examen.
    Toch wil ik vooraf nog een aantal regels duidelijk stellen:
  }

  \bilingual{
    \begin{itemize}
      \item \emph{Can be used:} (1) writing gear (\emph{not} in a pencil
      case); you don't need paper; there's plenty of paper in your exam
      copy;
      (2) your calculator (without alphanumerical data and without memory
      cards); (3) the formula collection.
    \end{itemize}
  }{
    \begin{itemize}
      \item Mogen op je tafeltje aanwezig zijn:
      (1) schrijfgerief, los d.w.z. \emph{niet} in een pennenzak (geen
      papier; er zit examenpapier bij de opgaven),
      (2) je rekenmachine (zonder alfanumerieke data en zonder
      geheugenkaarten),
      (3) het formularium.
    \end{itemize}
  }

  \bilingual{
    \begin{itemize}
      \item \emph{May not be used:} all equipment with memory or
      communications facilities, like cell phones, smart phones, smart
      watches, music players, \ldots
      Your bag must be put in the front of the room. Put your coat on the
      hallstand or next to your bag.
    \end{itemize}
  }{
    \begin{itemize}
      \item Volledig \emph{verboden te gebruiken}: alle apparatuur met
      geheugen- of communicatiefunctionaliteit zoals GSM, smartphone,
      smartwatch, muziekspeler, \ldots
      Je tas staat vooraan in het lokaal. Hang je jas aan de kapstok of
      leg hem bij je tas.
    \end{itemize}
  }

  \bilingual{
    \begin{itemize}
      \item Write your name on the title page. Don't write your name on
      the subsequent pages. Your copy has a unique number to identify it
      as yours.
    \end{itemize}
  }{
    \begin{itemize}
      \item Schrijf je naam op het titelblad van de opgave in het daartoe
      voorziene vak. Op de andere bladen schrijf je je naam
      \emph{niet}. Je examenopgave heeft een uniek nummer dat toelaat het
      te identificeren.
    \end{itemize}
  }

  \bilingual{
    \begin{itemize}
      \item Take your time to \emph{answer all questions in writing}. The
      point weights are listed above every question. Be complete in your
      answer, but stick to the point. Take into account the available time.
    \end{itemize}
  }{
    \begin{itemize}
      \item Neem je tijd om \emph{alle vragen schriftelijk te
        beantwoorden}. Het puntengewicht van een vraag is bovenaan de vraag
      op de opgavebladen vermeld. Wees volledig in je antwoord, maar ter
      zake. Houd rekening met de beschikbare tijd.
    \end{itemize}
  }

  \bilingual{
    \begin{itemize}
      \item Hand in \emph{all} papers to the staff member on duty, at the
      end of the examination.
    \end{itemize}
  }{
    \begin{itemize}
      \item Op het einde van het examen geef je \emph{alle} bladen weer af
      aan de aanwezige docent.
    \end{itemize}
  }

  \bilingual{Succes!}{Succes!}
}

%% Adjust colours for better to print cover page with background
\colorlet{coverbgcolor}{ugent@faculty!10}
\colorlet{covertitlecolor}{ugent@main}
\colorlet{coverdatacolor}{black}

%</ex2>
%
%
%
%<*le1>
%% Letter-specific preamble ----------------------------------------------------

%% Provide info on who sends the letter, you can put this in a
%% configuration file, see the documentation of the letter class!
\sender{ir.~Seppe Ongena}{PhD Student}

%% Set a return address
\returnaddress{UGent-CAPTURE -- Frieda Saeysstraat 1, 9052 Ghent, BELGIUM}

%% provide some details on who you want to write to
\to{Sandy Claws}
\toorganization{Joulumaa University}
\toaddress{
  Tähtikuja 1,\\
  96930 Rovaniemi,\\
  Finland.
}

%% Add subject and reference
\subject{Incoherent ramblings}
\reference{2608001}

%</le1>
%
%
%<*art1>
%% Article abstract ------------------------------------------------------------
\abstract{
  \kant[1]
}
%</art1>
%
%
%<*bama1|bama2|phd1|phd2|rp1|rp2|le1|crs1|ex1|ex2|art1>
%% Document --------------------------------------------------------------------
\begin{document}

%% Create the cover and title pages
\maketitle

%</bama1|bama2|phd1|phd2|rp1|rp2|le1|crs1|ex1|ex2|art1>
%
%<*crs1|phd1|phd2>
%% Creates a bookcover file \jobname-cover.tex
%% It currently assumes a 80 g/m² paper with a bulk of 1.25 cm³/g, resulting in
%% a caliper (paper thickness) of 0.1 mm:
%% Spine width = page count / 2 * grammage * bulk = page count / 2 * caliper
%% If you're using a different paper type, override the spine width
%% in the \jobname-cover.tex file using the formula above.
\generatebookcover

%</crs1|phd1|phd2>
%
%<*bama1|bama2|phd1|phd2|rp1|rp2|crs1>
%% Frontmatter -----------------------------------------------------------------
%% Causes the first pages to be Roman numbered
\frontmatter

%</bama1|bama2|phd1|phd2|rp1|rp2|crs1>
%
%<*bama2|phd1>
\chapter*{Dankwoord}
\kant[1]

%</bama2|phd1>
%
%<*bama1|phd2>
\chapter*{Acknowledgements}
\kant[1]

%</bama1|phd2>
%
%<*crs1>
\chapter*{Voorwoord}
\kant[1]

%</crs1>
%
%<*rp2>
%% Report data page
\textcolor{titlecolor}{\uppercase{%
    Date}}\\
\today

\textcolor{titlecolor}{\uppercase{%
    Location}}\\
\makeatletter
\@location
\makeatother

\textcolor{titlecolor}{\uppercase{%
    Attendees}}\\
    < names separated by commas>

    \textcolor{titlecolor}{\uppercase{%
        Excused}}\\
    < names separated by commas>

    \textcolor{titlecolor}{\uppercase{%
        Chair}}\\
    < chair>

    \textcolor{titlecolor}{\uppercase{%
        Minute taker}}\\
    < minute taker>

%</rp2>
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2>
%% Sets the table of contents (automatically for you)
\tableofcontents

%</crs1|bama1|bama2|phd1|phd2|rp1|rp2>
%
% Code adapted from Joris Meys' LaTeX at UGent
%<*bama2>
%% AI use disclaimer
\newpage
\begin{itemize}
  \item[$\Box$] Geen gebruik van GAI tools
  \item[$\CheckedBox$] Één of meerdere GAI tools gebruikt
\end{itemize}

Duid aan en omschrijf in geval van gebruik van één of meerdere GAI-tools hoe je deze hebt gebruikt:

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
\begin{tabularx}{\linewidth}{|c|L{0.24\linewidth}|Y|L{0.2\linewidth}|}
  \hline
  & GAI-tool gebruikt als & Omschrijving & Gebruikte tool(s) \\
  \hline
  $\CheckedBox$ & Ideeënverstrekker &
  Bijvoorbeeld: brainstorm met de tool over een bepaald thema, bereid een discussie voor door argumenten te laten genereren, enz. & (...) \\ \hline
  $\Box$        & Zoekmachine &
  Bijvoorbeeld : extra literatuur zoeken over een bepaald onderwerp, enz. & (...) \\ \hline
  $\Box$        & Schrijfassistent &
  Bijvoorbeeld: Spelings- en tipvauten laten verbeteren, een tekst formeler laten schrijven, genereren van tekst enz. & (...) \\ \hline
  $\Box$        & Ontwerper &
  Bijvoorbeeld: maak een nieuwe, unieke afbeelding, laat je tekst herschrijven in een meer academische stijl, enz. & (...) \\ \hline
  $\Box$        & Oefentool &
  Bijvoorbeeld: gebruik de tool als een buddy en vraag extra uitleg bij specifieke leerstof, vraag om extra oefeningen te maken, enz. & (...)\\ \hline
  $\Box$        & Data-analyse &
  Bijvoorbeeld: berekenen van statistieken, scatterplot genereren enz. & ( ...) \\ \hline
  $\Box$        & Efficiëntie bevorderen &
  Bijvoorbeeld: samenvatten van bestaande teksten, bronnenlijst in BibTeX-stijl zetten, LaTeX tabellen genereren, enz. & (...) \\ \hline
  $\Box$        & Op een andere manier &
  Bijvoorbeeld: programmeercode genereren, tabellen en grafieken genereren van online data, enz. & (...) \\ \hline
\end{tabularx}

%</bama2>
%<*bama1>
%% AI use disclaimer
\newpage
\begin{itemize}
  \item[$\Box$] No use of GAI tools
  \item[$\CheckedBox$] One or multiple GAI tools used
\end{itemize}

Indicate and describe the use case if one or multiple GAI tools have been used:

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
\begin{tabularx}{\linewidth}{|c|L{0.24\linewidth}|Y|L{0.2\linewidth}|}
  \hline
  & GAI-tool used as & Description & Used tool(s) \\
  \hline
  $\CheckedBox$ & Ideation &
  For example: brainstorm with the tool on a specific subject, preparation of a discussion by generation arguments, etc. & (...) \\ \hline
  $\Box$        & Search engine &
  For example: searching for additional literature on a specific subject, etc. & (...) \\ \hline
  $\Box$        & Writing assistant &
  For example: correction of speling and tiping mistakes, rewrite a text in a formal style, generating text, etc. & (...) \\ \hline
  $\Box$        & Designer &
  For example: creating new, unique images, rewriting your text in a more academic style, etc. & (...) \\ \hline
  $\Box$        & Exercise tool &
  For example: using the tool as a buddy, requesting additional explanation on a specific subject, requesting additional exercises to complete, etc. & (...)\\ \hline
  $\Box$        & Data analysis &
  For example: calculating statistics, generating scatter plots, etc. & ( ...) \\ \hline
  $\Box$        & Improving efficiency &
  For example: summarize existing text, adjust reference list to BibTeX-style, generate LaTeX tables, etc. & (...) \\ \hline
  $\Box$        & Other &
  For example: generate program code, generate tables and graphs from online data, etc. & (...) \\ \hline
\end{tabularx}

%</bama1>
%
%<*crs1|bama1|bama2|phd1|phd2|rp1|rp2>
%% Mainmatter -------------------------------------------------------------------
%% Changes the numbering system to arabic and restart from 1
\mainmatter

%</crs1|bama1|bama2|phd1|phd2|rp1|rp2>
%
%<*bama1|bama2|rp1|phd1>
\chapter*{Samenvatting}
\makeatletter
\begin{multicols}{2}
  [
  \begin{center}
    \textbf{\renewcommand{\\}[1][]{~}
      \Large\@title~\\[1ex]
      \large \@subtitle\\[0.5ex]}
    \printseq{authors}{~\&~}{,~}{\translatekey{andlist}~}
  \end{center}
  ]

  \kant[2]

  \kant[3]

  \kant[4]

\end{multicols}
\makeatother

%</bama1|bama2|rp1|phd1>
%
%<*bama1|rp2|phd2>
\chapter*{Summary}
\makeatletter
\begin{multicols}{2}
  [
  \begin{center}
    \textbf{\renewcommand{\\}[1][]{~}
      \Large\@title~\\[1ex]
      \large \@subtitle\\[0.5ex]}
    \printseq{authors}{~\&~}{,~}{\translatekey{andlist}~}
  \end{center}
  ]

  \kant[2]

  \kant[3]

  \kant[4]

\end{multicols}
\makeatother

%</bama1|rp2|phd2>
%<*art1>
\begin{multicols}{2}
\raggedcolumns

\section*{<An unnumbered introduction>}
\kant[5]

%</art1>
%
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2>
\chapter*{<An unnumbered chapter>}
\kant[5]

\chapter{Tutorial}
%</crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
\section{\textrm{\LaTeX} 101}
\label{S:Tutorial}
%</crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2>
\insettext{Tutorial}{
%</crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
  In this small example section (Section \ref{S:Tutorial}),
  we will show some of the functionality you will need most often.
  Online guides such as \href{https://www.overleaf.com/learn/latex/}{those from Overleaf}
  are more complete and useful, or a simple internet search, Stack Overflow or
  -- increasingly -- LLMs can be used to find answers to
  ``How do I do this in \textrm{\LaTeX}?''
%</crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2>
}
%</crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>

Still, some basics may be helpful. Adding a new paragraph is as simple as pressing enter twice:

No need for multiple \verb!\\!, \verb!\newline!s, or \verb!\par!.
You can adjust the indentation and spacing of the paragraph using\\
\verb!\setlength{\parindent}{0pt}!\\
and\\
\verb!\setlength{\parskip}{0.75\baselineskip}!.

Citations are input using BibLaTeX, e.g.,\\
\verb!\textcite{sigfridsson}!: \textcite{sigfridsson}\\
\verb!\autocite{aristotle:physics}!: \autocite{aristotle:physics}.\\
The bibliography is printed at the end of this section using\\
\verb!\printbibliography!.

%</crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2>
Figures such as Figure \ref{F:FigExample} are added as follows:

\begin{figure}[ht]
  \centering
  \includegraphics[width = 0.5\linewidth]{example-image-a} %% Your figure path
  \caption[<short figure caption>]{<This is the long caption of your figure.>}
  \label{F:FigExample}
\end{figure}

Tables such as Table \ref{T:TabExample} are added as follows:

\begin{table}[htbp]
  \centering
  \begin{threeparttable}
    \caption[<Short table caption>]{<This is the long caption of your table.>}
    \label{T:TabExample}
    \begin{tabular}{lrl}
      \toprule
      \multirow{2}{*}{Variable} & \multicolumn{2}{c}{Value}\\
      \cmidrule(lr){2-3}
      & Number\tnote{a} & Unit \\
      \midrule
      One & 1.01 & \unit{\gram\per\metre} \\
      Two & 52.4 & \unit{\milli\gram\per\cubic\metre\per\hour} \\
      \bottomrule
    \end{tabular}
    \begin{tablenotes}
      \footnotesize\raggedright
      \item[a] This is a footnote over multiple columns and rows
    \end{tablenotes}
  \end{threeparttable}
\end{table}
%</crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%<*art1>
\newpage
Figures within a muticols column such as Figure \ref{F:FigExampleCol}
are added as follows:

\begin{figure}[H]
  \centering
  \includegraphics[width = \linewidth]{example-image-a} %% Your figure path
  \caption[<short figure caption>]{<This is the long caption of your figure.>}
  \label{F:FigExampleCol}
\end{figure}

\textcolor{lightgray}{\kant[9-11]}

Figures spanning the full width such as Figure \ref{F:FigExampleWdth}
are added as follows:

\end{multicols}
\begin{figure}[H]
\centering
\includegraphics[width = \linewidth,max height=5cm]{example-image-a} %% Your figure path
\caption[<short figure caption>]{<This is the long caption of your figure.>}
\label{F:FigExampleWdth}
\end{figure}
\begin{multicols}{2}

\textcolor{lightgray}{\kant[9-10]}

You can also specify a figure such as Figure \ref{F:FigExamplePage}
within the multicols environment, and place it at the top of the next page.
\begin{figure*}[t]
  \centering
  \includegraphics[width = \linewidth,max height=5cm]{example-image-a} %% Your figure path
  \caption[<short figure caption>]{<This is the long caption of your figure.>}
  \label{F:FigExamplePage}
\end{figure*}

Tables such as Table \ref{T:TabExInline} are added as follows:

\begin{table}[H]
  \centering
  \begin{threeparttable}
    \caption[<Short table caption>]{<This is the long caption of your table.>}
    \label{T:TabExInline}
    \begin{tabular}{lrl}
      \toprule
      \multirow{2}{*}{Variable} & \multicolumn{2}{c}{Value}\\
      \cmidrule(lr){2-3}
      & Number\tnote{a} & Unit \\
      \midrule
      One & 1.01 & \unit{\gram\per\metre} \\
      Two & 52.4 & \unit{\milli\gram\per\cubic\metre\per\hour} \\
      \bottomrule
    \end{tabular}
    \begin{tablenotes}
      \footnotesize\raggedright
      \item[a] This is a footnote over multiple columns and rows
    \end{tablenotes}
  \end{threeparttable}
\end{table}
%</art1>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>

You can use inline math such as \verb!$X_{sludge}$! ($X_{sludge}$)
or have equations with a label, such as Equation \ref{E:EqExample}:

\begin{equation}
  e^{-j\pi} + 1 = 0
  \label{E:EqExample}
\end{equation}

Or multiple, aligned equations without label or number:

\begin{align}
 f(t) & ={\mathcal {L}}^{-1}\{F(s)\}(t)\nonumber \\
      & ={\frac {1}{2\pi i}}\lim _{T\to \infty }\int _{\gamma -iT}^{\gamma +iT}e^{st}F(s)\,ds \nonumber
\end{align}

You can use different lists, such as description, itemize, or enumerate:

\begin{description}
  \item[Term 1] A first description
  \item[Term 2] A second description
\end{description}

\begin{itemize}
  \item[$\Box$] A first item with custom bullet
  \item[$\CheckedBox$] A second item with custom bullet
\end{itemize}

\begin{enumerate}
  \item A first numbered item
  \item A second numbered item
\end{enumerate}

You can use the \verb!siunitx! package for units and quantities, e.g.,\\
\verb!\qty{1.2e5}{\metre}!: \qty{1.2e5}{\metre}\\
\verb!\unit{\cubic\metre\per\second}!: \unit{\cubic\metre\per\second}.

Chemical equations can be easily typeset using \verb!mhchem!, e.g.,\\
\verb!\ce{H2O + e- -> 1/2H2 + OH-}!: \ce{H2O + e- -> 1/2H2 + OH-}

For all else, we trust you can find what you need with a bit of decent searching.

%</crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2>
\insetquote{Good luck!}{The ugentdocs devs}

%</crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%<*art1>
Good luck!

%</art1>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
\printbibliography
%</crs1|bama1|bama2|rp1|rp2|phd1|phd2|art1>
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%% Fix underfull vbox messages for these \kant chapters, but
%% if you use this in your documentm the text will not fill rhe page fully
\raggedbottom

\chapter{<Second chapter>}
\kant[6]

\section{<A section>}
\kant[7]

\subsection{<A subsection>}
\kant[8]

%</crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%<*art1>
\section{<A second section>}
\kant[6]

\section{<A third section>}
\kant[7]

\subsection{<A subsection>}
\kant[8]

\section*{Data availability}
Specify where you can find your data

\section*{Declaration of competing interests}
The authors declare that they have some interesting competitions.

\section*{Acknowledgements}
I'd like to thank\ldots

\section*{CReDIT author statement}
\textbf{Poppe, L.:} Methodology, Software, Formal analysis, Data Curation, Writing - Original Draft, Visualization.
\textbf{Van Callenberghe, P:} Writing - Original Draft.
\textbf{Van Hoebeecke, C.:} Conceptualization, Writing - Review \& Editing, Supervision, Project administration, Funding acquisition.

\printbibliography
\end{multicols}
%</art1>
%
%<*phd1|phd2>
%% Some dummy chapters to have enough spine width
\foreach \i in {A,B,C,D,E} {
  \chapter{Dummy chapter \i}
  \foreach \j in {1,...,50} {
    \kant[22-24]
  }
}
%</phd1|phd2>
%
%<*crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%% Appendix -------------------------------------------------------------------
%% Changes the chapter numbering to letters and uses 'Appendix' or
%% 'Bijlage' (in Dutch) as chapter name.
\appendix

\chapter{<First appendix>}
\chapter{<Second appendix>}

%</crs1|bama1|bama2|rp1|rp2|phd1|phd2>
%<*crs1|phd1|phd2>
%% Typeset the final page (back cover)
\makefinalpage

%</crs1|phd1|phd2>
%
%<*le1>
%% Be polite when starting a letter, and address your audience
\opening{Dear prof. Sandy Claws,}

%% Below, you can find a few dummy paragraphs to illustrate that
%% this class can generate multi-page letters.
\kant[1-3]

%% Time to say goodbye
\closing{Kind regards,}

%% You might want to insert a signature picture or text.
%% \signature{\includegraphics{signature.jpg}}

%% You can also remove the signature space altogether:
%% \signature{}

%% Mention who receives a copy of this letter if needed
\carboncopy{prof.~R.~Rudolph, Department of Flight and Product Design Engineering, Joulumaa University}

%% Specify what extras can be found in the envelope if needed
\enclosed{
  \begin{enumerate}
    \item list of research equipment I would like to receive this December (5pp)
    \item a technical drawing of an airborne horse-drawn carriage (1pp)
  \end{enumerate}
}
%</le1>
%
%<*ex1|ex2>
%% Insert the point overview of the questions
\vspace{3em}
\pointoverview
\clearpage

%</ex1|ex2>
%<*ex1>
%% Q1
\question[weight=6]{%
  Beschrijf het twee-periodensysteem van de Kommomaan.%
}

\answerspacing{2\baselineskip}
\answerspace[lines=12,style=lines]

%% Q2
\question[weight=10]{%
  Tijdens een populatieonderzoek werden 42 Kommomanen gevangen en gemerkt tijdens een A-periode.
  Twee weken later, tijdens een tweede A-periode waarneming, werden 60 individuen gevangen,
  waarvan er 15 reeds een merkteken droegen van de eerste vangst.
}
  \subquestion[weight = 4]{%
    Bereken, met behulp van de Lincoln-Petersen methode,
    de geschatte totale Kommomaanpopulatie in het onderzoeksgebied.

    $\symbf{\hat{N}=}$

    Berekeningsmethode:
  }
  \answerspacing{\baselineskip}
  \answerspace[lines=6,style=grid]
  \subquestion[weight=6]{
    Bespreek één aanname van de merk-hervangstmethode die specifiek ondermijnd zou kunnen worden
    door het twee-perioden-systeem van de Kommomaan, en verklaar waarom.
  }
  \answerspacing{2\baselineskip}
  \answerspace[lines=15]

%% Q3
\question[weight=4]{%
  De wetenschappelijke naam van de Kommomaan, \textit{Homo kommomanis},
  suggereert een aparte soort binnen het genus \textit{Homo}.
  De geobserveerde individuen zijn echter morfologisch volledig niet
  te onderscheiden van gewone \textit{Homo sapiens}.
  Waarom is de classificatie als aparte soort hierdoor problematisch?
}
%% This is how you specify the multiple choice answering options
\mc{
  Een aparte soortnaam vereist aantoonbare reproductieve isolatie
  of onderscheidende erfelijke kenmerken, en die ontbreken hier volledig.
}
\mc{Het genus \textit{Homo} mag geen fictieve of hypothetische soorten bevatten.}
\mc{Soortnamen mogen niet verwijzen naar menselijke eigenschappen of gedrag.}
\mc{De naam is grammaticaal incorrect volgens de regels van de binominale nomenclatuur.}

%% Special 'scrap' pages with a watermark on them: three in this case
\foreach \i in {1,...,3} {
  \gridpage{Kladpapier}
}
%</ex1>
%<*ex2>
%% Q1
\question[weight=6]{\par
  \bilingual{
    Describe the two-period system of the Homo Kommomanis.%
  }{
    Beschrijf het twee-periodensysteem van de Kommomaan.%
  }
}
\answerspacing{2\baselineskip}
\answerspace[lines=12,style=lines]


%% Q2
\question[weight=10]{\par
  \bilingual{
    During a population survey, researchers captured and tagged 42 \textit{Homo kommomanis} individuals
    during an A-period. Two weeks later, during a second A-period survey,
    they captured 60 individuals, of which 15 carried a tag from the first capture.
  }{
    Tijdens een populatieonderzoek werden 42 Kommomanen gevangen en gemerkt tijdens een A-periode.
    Twee weken later, tijdens een tweede A-periode waarneming, werden 60 individuen gevangen,
    waarvan er 15 reeds een merkteken droegen van de eerste vangst.
  }
}
\subquestion[weight = 4]{\par
  \bilingual{
    Using the Lincoln-Petersen method,
    estimate the total \textit{Homo kommomanis} population size in the study area.
  }{
    Bereken, met behulp van de Lincoln-Petersen methode,
    de geschatte totale Kommomaanpopulatie in het onderzoeksgebied.
  }

  \bilingual{$\symbf{\hat{N}=}$}{}

  \bilingual{
    Calculations:
  }{
    Berekeningsmethode:
  }
}
\answerspacing{\baselineskip}
\answerspace[lines=6,style=grid]

\newpage
\subquestion[weight=6]{\par
  \bilingual{
    Describe one assumption of the mark-recapture method that could specifically be undermined
    by the Kommomaan's two-period system, and explain why.
  }{
    Bespreek één aanname van de merk-hervangstmethode die specifiek ondermijnd zou kunnen worden
    door het twee-periodensysteem van de Kommomaan, en verklaar waarom.
  }
}
\answerspacing{2\baselineskip}
\answerspace[lines=15]

%% Q3
\question[weight=4]{\par
  \bilingual{
    The scientific name of the Komomaan, \textit{Homo kommomanis},
    suggests a distinct species within the genus \textit{Homo}.
    However, the observed individuals are morphologically completely
    indistinguishable from ordinary \textit{Homo sapiens}.
    Why is this classification as a separate species problematic?
  }{
    De wetenschappelijke naam van de Kommomaan, \textit{Homo kommomanis},
    suggereert een aparte soort binnen het genus \textit{Homo}.
    De geobserveerde individuen zijn echter morfologisch volledig niet
    te onderscheiden van gewone \textit{Homo sapiens}.
    Waarom is de classificatie als aparte soort hierdoor problematisch?
  }
}
%% This is how you specify multiple choice answering options in two languages
\mc{
  \bilingual{
    A separate species designation requires demonstrable reproductive isolation
    or distinct hereditary traits, and these are entirely absent here.
  }{
    Een aparte soortnaam vereist aantoonbare reproductieve isolatie
    of onderscheidende erfelijke kenmerken, en die ontbreken hier volledig.
  }
}
\mc{
  \bilingual{
    The genus \textit{Homo} may not contain fictional or hypothetical species.
  }{
    Het genus \textit{Homo} mag geen fictieve of hypothetische soorten bevatten.
  }
}
\mc{
  \bilingual{
    Species names may not refer to human traits or behavior.
  }{
    Soortnamen mogen niet verwijzen naar menselijke eigenschappen of gedrag.
  }
}
\mc{
  \bilingual{
    The name is grammatically incorrect according to the rules of binomial nomenclature.
  }{
    De naam is grammaticaal incorrect volgens de regels van de binominale nomenclatuur.
  }
}


%% Special 'scrap' pages with a watermark on them: three in this case
\foreach \i in {1,...,3} {
  \gridpage{Scrap/Klad}
}
%</ex2>
%
%<*bama1|bama2|phd1|phd2|rp1|rp2|le1|crs1|ex1|ex2|art1>
\end{document}
%</bama1|bama2|phd1|phd2|rp1|rp2|le1|crs1|ex1|ex2|art1>
% ==============================================================================
% \fi
%
% \subsection{\texttt{ugentcourse}}
% \VerbatimInput[firstline=48]{example-ugentcourse.tex}
%
% \subsection{\texttt{ugentbama}}
% \VerbatimInput[firstline=48]{example-ugentbama-1.tex}
% \VerbatimInput[firstline=48]{example-ugentbama-2.tex}
%
% \subsection{\texttt{ugentphd}}
% \paragraph{Dutch}
% \VerbatimInput[firstline=48]{example-ugentphd-1}
% \paragraph{English}
% \VerbatimInput[firstline=48]{example-ugentphd-2}
%
% \subsection{\texttt{ugentarticle}}
% \VerbatimInput[firstline=48]{example-ugentarticle.tex}
%
% \subsection{\texttt{ugentreport}}
% \VerbatimInput[firstline=48]{example-ugentreport-1.tex}
% \VerbatimInput[firstline=48]{example-ugentreport-2.tex}
%
%
% \subsection{\texttt{ugentletter}}
% \paragraph{Plain example}
% \VerbatimInput[firstline=48]{example-ugentletter.tex}
%
% \paragraph{Example with configuration file}~\\
% If you have to write many letters, you can avoid having to input
% the sender information by using a configuration file, e.g.,
% \texttt{ugentletter.cfg},
% which can then be loaded in the preamble of your letter using
% |\input{ugentletter.cfg}|:
%
% \begin{Verbatim}
%<*le-cfg>
%% Configuration file for ugentletter class

%% Font setup
\trysetsansfont[Arial]{Arial}[
  BoldFont           = *,
  BoldFeatures       = {FakeBold=2.5},
  ItalicFont         = *,
  ItalicFeatures     = {FakeSlant=0.15},
  BoldItalicFont     = *,
  BoldItalicFeatures = {FakeBold=2.5, FakeSlant=0.15},
]{}
\tryoverridemathfont[Arial]{Arial}{}

%% Sender information
\sender{ir.~Seppe Ongena}{PhD Student}
\team{TRASLAB}
\address{
  CAPTURE building\\
  Frieda Saeysstraat 1\\
  9052 Ghent\\
  BELGIUM
}
\email{seppe.ongena}
\phone{+32 9 000 00 00}
\mobile{+32 400 000 000}
\returnaddress{UGent-CAPTURE -- Frieda Saeysstraat 1, 9052 Ghent, BELGIUM}
%</le-cfg>
% \end{Verbatim}
%
%
% \subsection{\texttt{ugentexam}}
% \paragraph{Single column (single language)}
% \VerbatimInput[firstline=48]{example-ugentexam-1.tex}
% \paragraph{Double column (bilingual EN-NL)}
% \VerbatimInput[firstline=48]{example-ugentexam-2.tex}
%
%
% \StopEventually{\clearpage\PrintChanges\clearpage\PrintIndex}
%
%
%
% \clearpage
% \part{The beamer theme}
% \label{P:II}
% \setcounter{section}{0}
% The user guide (adapted from uantwerpendocs v4.12, \textcopyright Walter Daems, LPPL 1.3c)
%
% \begin{Verbatim}
%<*bmrug>
\documentclass{beamer}
\usetheme[bw]{ugent}

%% The packages below are for demonstration purpose only.
%% They are not required for the template to work
\usepackage{metalogo}  % For \XeLaTeX / \LuaLaTeX commands
\usepackage{kantlipsum}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{booktabs}

%% Some stuff to typeset code, you can remove this if not needed
\newcommand*\cmd[1]{{\ttfamily \textbackslash #1}}
\NewEnviron{codesnippet}[1][0.8\textwidth]{%
  {\scriptsize
  \qquad\framebox[#1][l]{%
  \begin{minipage}{0.9\dimexpr#1\relax}%
    \ttfamily\raggedright
    \hyphenpenalty=10000 \exhyphenpenalty=10000
    \BODY
  \end{minipage}%
  }}%
  \ignorespacesafterend
}
\newcommand*\ind[1][2ex]{\hspace*{#1}}
\newcommand*\bframe[1][]{\cmd{begin}\{#1frame\}}
\newcommand*\eframe[1][]{\cmd{end}\{#1frame\}}

\title{Beamer theme user guide}
\author{Seppe Ongena}

\begin{document}

\begin{frame}[title]
\maketitle
\end{frame}

%% ----------------------------------------------------------------------------
%% PUT THIS BEFORE YOUR \begin{document}
%% THIS WAS PUT HERE TO HAVE SEPARATE DATA FOR THE EXAMPLE TITLE SLIDES
%% BUT A CORRECT ONE FOR THE BEAMER USER GUIDE
\makeatletter\beamer@autopdfinfofalse\makeatother % REMOVE THIS LINE
\title{This is your \texttt{\textbackslash{}title{}}}
\subtitle[my short title]{This is your \texttt{\textbackslash{}subtitle{}}}
\date{This is your \texttt{\textbackslash{}date{}}}
\author[my short author]{This is your \texttt{\textbackslash{}author{}}}
\authorrole{This is your \texttt{\textbackslash{}authorrole{}}}
\department{Your department}
\team{Your team}
\phone{Your phone number}
\email{Your email.address}
\mobile{Your cell phone number}

\titlelogos{%
  \includegraphics[height=2\gridunit]{example-image-a}%
  \hspace{\gridunit}%
  \includegraphics[height=2\gridunit]{example-image-b}%
  \hspace{\gridunit}%
  \includegraphics[height=2\gridunit]{example-image-c}%
}

%% ----------------------------------------------------------------------------

\begin{frame}[logo=false]
  {In this guide}
  \tableofcontents
\end{frame}

\section{Loading the theme and theme options}
\begin{frame}[section]
  \sectionpage
\end{frame}

\begin{frame}
  {Using the beamer theme}

  The \texttt{ugent} beamer theme is distributed by CTAN. It
  should be installed with your \textrm{\TeX{}} distribution by default.

  You can load the package in your preamble as:

  \begin{codesnippet}
    \cmd{documentclass}\{beamer\}\\
    \cmd{usetheme}[<theme options>]\{ugent\}
  \end{codesnippet}

  \heading{Remarks}
  \begin{itemize}
  \item The theme's default aspect ratio is $16\times 9$, but you might be able to override it by
    re-loading the \texttt{beamerposter} package with custom width and height, and
    redefining \cmd{@PW} (page width), \cmd{@PH} (page height), and \cmd{gridunit}.
    This is not officially supported.
  \item Only \texttt{dutch} and \texttt{english} are officially supported through the \texttt{language} option.
  \end{itemize}
\end{frame}

\begin{graphicframe}[t,graphicpos=r,graphicproportion=0.2,graphic={
    \begin{minipage}{0.2\textwidth}
      \footnotesize
      \begin{center}
        \begin{tabular}{c}
          \toprule
          \bfseries faculties\\
          \midrule
          \texttt{lw}  \\
          \texttt{re}  \\
          \texttt{we}  \\
          \texttt{ge}  \\
          \texttt{ea}  \\
          \texttt{eb}  \\
          \texttt{di}  \\
          \texttt{pp}  \\
          \texttt{bw}  \\
          \texttt{fw}  \\
          \texttt{ps}  \\
          \bottomrule
        \end{tabular}
      \end{center}
    \end{minipage}
  }]
  {Theme options}{}
  The following theme options may come in handy --
    see also the \texttt{ugentdocs} documentation:
  \begin{description}
  \item[\texttt{faculty}] to set your own faculty's colours and logos (can be empty)\\
  \item[\texttt{campus}] to set the campus for the UGent logo. One of \texttt{ugent},
    \texttt{gugc}, or \texttt{kortrijk}.
  \item[\texttt{neutralcolors}] to disable your faculty colours and use the
  standard UGent colours
  \item[\texttt{colormodel}] to set the colour model. Select \texttt{rgb}
    colour encoding for projecting (default) or \texttt{cmyk} for printing.
  \item[\texttt{secnums}] to enable (\texttt{true}) or disable (\texttt{false})
    displaying of section numbers in the frames or TOC.
  \end{description}

\end{graphicframe}

\begin{frame}[t]
{Colours}
{What a wonderful world}

\heading{Standard colours}\\
  You can select the theme colours using:\\
  \textcolor{ugent@main}{Main colour}:
    can be specified as \textrm{\LaTeX}-colour \emph{ugent@main}\\
  \textcolor{ugent@accent}{Accent colour}:
    can be specified as \textrm{\LaTeX}-colour \emph{ugent@accent}\\
  \textcolor{ugent@faculty}{Faculty colour}:
    can be specified as \textrm{\LaTeX}-colour
    \emph{ugent@faculty}

\heading{Alert}\\
  You can use \alert{\cmd{alert{}}} to grab the attention of the
  user. It will typeset your content in \alert{yellow}.
\end{frame}

\begin{graphicframe}[t,graphicproportion=0.38,graphicpos=r,logo=false,
graphic={
  \begin{minipage}{0.38\textwidth}
  \vspace{1.5cm}
  \begin{tikzpicture}
    \ugentlogo{2.8cm}{ugent@main}{0}
  \end{tikzpicture}
  \begin{tikzpicture}
    \faclogo{2.1cm}{ugent@faculty}{0}
  \end{tikzpicture}\\[0.5ex]
  \begin{tikzpicture}
    \draw[fill] (0,0) rectangle (0,0) rectangle (3.5,2.8);
    \ugentlogo{2.8cm}{white}{0}
  \end{tikzpicture}
  \begin{tikzpicture}
    \draw[fill] (0,0) rectangle (6.3,2.1);
    \faclogo{2.1cm}{white}{0}
  \end{tikzpicture}\\[0.5ex]
  \foreignlanguage{dutch}{
    \begin{tikzpicture}
      \ugentlogo{2.8cm}{ugent@main}{0}
    \end{tikzpicture}
    \begin{tikzpicture}
      \faclogo{2.1cm}{ugent@faculty}{0}
    \end{tikzpicture}
  }
  \end{minipage}
}]
{Logo demo}

The logo's can be used as follows within a tikzpicture\\ (arguments: height, colour, alignment):
  \begin{itemize}
  \item \cmd{ugentlogo\{2.8cm\}\{ugent@main\}\{0\}} and\\
    \cmd{faclogo\{2.1cm\}\{ugent@faculty\}\{0\}}\\[2ex]
  \item \cmd{ugentlogo\{2.8cm\}\{white\}\{0\}} and\\
    \cmd{faclogo\{2.1cm\}\{white\}\{0\}}\\[2ex]
  \item \cmd{ugentlogo\{2.8cm\}\{ugent@main\}\{0\}} and\\
    \cmd{faclogo\{2.1cm\}\{ugent@faculty\}\{0\}}\\
    within \cmd{foreignlanguage\{dutch\}\{\ldots\}}\\
  \end{itemize}

You can turn off the logo in the bottom left corner using the
  \texttt{logo=false} frame option.
\end{graphicframe}

\begin{frame}[t]
  {Compilers and fonts}

  The logos require UGent Panno Text to be installed, and an OTF/TTF compatible compiler:
  \begin{description}
  \item[\textrm{\LaTeX} and \textrm{pdf\LaTeX}] --- Old compilers -
   don't support OTF/TTF. \textbf{Don't use!}
  \item[\textrm{\XeLaTeX} and \textrm{\LuaLaTeX}] --- more modern compilers -
   either works\\
  \item[\textrm{\LaTeX{}mk}] --- A compiler script, not a compiler. Use with flags \texttt{-pdfxe} or \texttt{-pdflua}.
  \end{description}

  The default font is UGent Panno Text, but this can be overridden to Arial using:
  \begin{codesnippet}
  \cmd{setsansfont\{Arial\}}[\\
  \ind BoldFont           = \{Arial\},\\
  \ind BoldFeatures       = \{FakeBold=2.5\},\\
  \ind ItalicFont         = \{Arial\},\\
  \ind ItalicFeatures     = \{FakeSlant=0.15\},\\
  \ind BoldItalicFont     = \{Arial\},\\
  \ind BoldItalicFeatures = \{FakeBold=2.5, FakeSlant=0.15\},\\
  ]
  \cmd{overridemathfont\{Arial\}}
  \end{codesnippet}

\end{frame}

\section{Structural slides}
\subsection{Title slides}
\begin{frame}[section]
  \sectionpage
\end{frame}

\begin{frame}[t,logo=false]
  {Title slides}
  \heading{Contents}\\
  \begin{itemize}
  \item The contents of the title slide can be set in your preamble
    using the \textrm{\LaTeX} commands:
    \cmd{title\{\}}, \cmd{subtitle\{\}}, \cmd{author\{\}}, and \cmd{date\{\}}
  \item Some UGent-specific content can be added,
    such as \cmd{department\{\}}, \cmd{team\{\}}, and \cmd{titlelogos\{\}}
  \end{itemize}

  \heading{Code} --- The title slide is easily typeset as:\\
  \begin{codesnippet}
    \bframe[][title=<background image>, <options>]\\
    \ind\cmd{maketitle}\\
    \eframe
  \end{codesnippet}\\
  The options are \texttt{graphicproportion} (0--1, default 0.5) and
    the \texttt{inversetext} (true/false).\\
  The next slides use:
  \begin{itemize}
    \item Plain \texttt{title}, no image
    \item An image: \texttt{title=}\cmd{includegraphics\{example-image-a\}}
    \item A darkened image (see later) with \texttt{graphicproportion=1}
    \item A lightened image with \texttt{graphicproportion=1}
      and \texttt{inversetext=false}
  \end{itemize}
\end{frame}

\begin{frame}[title]
  \maketitle
\end{frame}

\begin{frame}[title=
  {\includegraphics[width=0.6\paperwidth]{example-image-a}}]
  \maketitle
\end{frame}

\begin{frame}[title=
  {\brightness[-0.5]{\includegraphics[width=\paperwidth]{example-image-a}}},
  graphicproportion=1]
  \maketitle
\end{frame}

\begin{frame}[title=
  {\brightness[0.75]{\includegraphics[width=\paperwidth]{example-image-a}}},
  graphicproportion=1,
  inversetext=false]
  \maketitle
\end{frame}

\subsection{Section slides}
\begin{frame}[t]
{Section slides}

The section slides work quite similar to the title slide,
 although the \texttt{section} or \texttt{subsection} option is used instead of the \texttt{title} option,
 and \cmd{sectionpage} and \cmd{subsectionpage} are used instead of \cmd{maketitle}.
 The title slides support the same graphics options.

Example:\\[1ex]
\begin{codesnippet}[0.8\textwidth]
  \bframe[][section]\\
  \ind \cmd{sectionpage}\\
  \eframe\\[\baselineskip]
  \bframe[][subsection]\\
  \ind \cmd{subsectionpage}\\
  \eframe
\end{codesnippet}\\[1ex]
(the subsection slide is how the next slide was generated)
\end{frame}

\subsection{Closing slides}
\begin{frame}[subsection]
\subsectionpage
\end{frame}

\begin{frame}[t]
{Closing slides}

The closing slide at the end of a presentation is inserted using:\\

\begin{codesnippet}[0.8\textwidth]
\bframe[][title]\\
\ind \cmd{closingpage}\\
\eframe
\end{codesnippet}\\[1ex]

An example can be found in the next slide.

You can customize the content
  by renewing the \cmd{closingpage} macro, e.g.:\\
\begin{codesnippet}[0.8\textwidth]
  \cmd{renewcommand*}\{\cmd{closingpage}\}\{\\
  \ind \cmd{begin}\{tikzpicture\}\\
  \ind\ind \texttt{[}overlay,remember picture, shift=\{(current page.south west)\}\texttt{]}\\
  \ind\ind \cmd{clip} (0,0) rectangle (\cmd{@PW},\cmd{@PH});\\
  \ind\ind <CLOSING PAGE CONTENT>\\
  \ind \cmd{end}\{tikzpicture\}\\
  \}
\end{codesnippet}\\[1ex]
\end{frame}

\begin{frame}[title]
  \closingpage
\end{frame}


\section{Regular slides}

\subsection{Bare}
\begin{frame}[subsection]
  \subsectionpage
\end{frame}

\begin{frame}[t]
  {Frame titles}
  {And subtitles}
  \heading{How to specify them}\\
  Titles are specified using \cmd{frametitle\{\}} or
  \cmd{framesubtitle\{\}} or even easier as first and second argument
  to the \texttt{frame} environment (or their derived versions).

  \begin{codesnippet}
    \bframe[][options go here, comma separated]\\
    \ind\{first argument\}\\
    \ind\{second argument\}\\
    \ind frame contents \\
    \eframe
  \end{codesnippet}
  \bigskip

  \heading{Don't need them?}\\
  If you need a slide without titles: just don't specify them
\end{frame}

\begin{frame}[t]
  {The canvas}

  \heading{Flavours} --- The canvas of the slide has five flavours:
  \begin{description}
  \item[normal (default)]
    the ordinary white background slide
  \item[plain]
    a slide without footer or UGent logo
  \item[shaded]
    a slide on a light background (in \texttt{ugent@main!10})
  \item[negative]
    a reverse video slide on a background (in \texttt{ugent@main}) with white
    text
  \item[graphic] a graphic canvas (graphic can be anything)
  \end{description}
  They are specified as options to the frame environment (or its
  derivatives).

  \heading{Remarks}
  \begin{itemize}
  \item In handout mode the shaded and negative canvas will be
    typeset as normal canvas (to allow for easy printing).
  \item The graphic option has many variants that we will discuss later.
  \end{itemize}
\end{frame}

\begin{frame}[shaded]
  {A shaded slide}
  {with a subtitle}
  \kant[1]
\end{frame}

\begin{frame}[negative,t]
  {A negative slide}
  {with a subtle subtitle}
  \kant[2]
\end{frame}

\begin{frame}[t]
  {Vertical alignment}

  You can easily specify the vertical alignment of your frame
  contents, using the options
  \begin{description}
  \item[\texttt{t}] for top
  \item[\texttt{c}] for centre
  \item[\texttt{b}] for bottom
  \end{description}

  Example:\\[1ex]
  \begin{codesnippet}
    \bframe[][t]\\
    \ind\{Title\}\\
    \ind\{Subtitle\}\\
    \ind frame contents\\
    \eframe
  \end{codesnippet}

\end{frame}

\subsection{The graphic frame}
\begin{frame}[subsection]
  \subsectionpage
\end{frame}

\begin{frame}[t]
  {Basic idea}

  \heading{The idea} --- put support material (photo or graph) on the
  slide next to the frame content.
  This is done by specifying the \texttt{graphicframe} environment and choosing
  the appropriate options:
  \begin{itemize}
  \item \texttt{graphic=<your graphic content>}
  \item \texttt{graphicpos=<t/l/r/b>}: the side of the slide your graphic is on.
    If none is specified, the graphic fills the slide similar to a section slide.
  \item \texttt{graphicproportion=<0-1>}: the proportion of the slide your graphic fills
  \item \texttt{fill=<true/false>}: if the graphic should fill the whole slide, with no margins
  \end{itemize}

  Some examples are shown in the next seven slides. The next two slides are typeset as:

  \begin{codesnippet}
  \bframe[graphicframe][graphic,logo=false]\\
  \ind \{\}\{\}\\
  \eframe[graphicframe]
  \\[\baselineskip]
  \bframe[graphicframe][graphic,fill=true,logo=false]\\
  \ind \{\}\{\}\\
  \eframe[graphicframe]
  \end{codesnippet}
\end{frame}

\begin{graphicframe}[graphic,logo=false]
  {}{}
\end{graphicframe}

\begin{graphicframe}[graphic,fill=true,logo=false]
  {}{}
\end{graphicframe}

\begin{graphicframe}
[graphic={\includegraphics[width=0.25\paperwidth, min height=\paperheight-2\gridunit]{example-image-a}},
  graphicpos=r,graphicproportion=0.25,
  logo=false]
  {Some Random Title}
  {Please, adapt!}

  \small
  The slide has been typeset as:\\
  \begin{codesnippet}[\textwidth]
    \bframe[graphicframe]\\
    \texttt{[graphic=\{<load photo here>\},\\
    graphicpos=r,graphicproportion=0.25,\\
    logo=false]\\}
    \ind\{Title\}\\
    \ind\{Subtitle\}\\
    \ind frame contents\\
    \eframe[graphicframe]
  \end{codesnippet}
  \smallskip

  \subheading{Remarks}
  \begin{itemize}
  \item Load photo as:\\
    \cmd{includegraphics[width=0.25\cmd{paperwidth}, min height=\cmd{paperheight}-2\cmd{gridunit}]
      \{example-image-a\}}
  \item If \texttt{graphic} is specified without argument, an example image is loaded.
  \end{itemize}
\end{graphicframe}

\begin{graphicframe}
[graphic={\includegraphics[width=0.5\paperwidth, min height=\paperheight-2\gridunit]{example-image-a}},
graphicpos=r,logo=false]
  {Some Random Title}

  \small
  The slide has been typeset as:\\
  \begin{codesnippet}[\textwidth]
    \bframe[graphicframe]\\
    \texttt{[graphic=\{<load photo here>\},\\
    graphicpos=r,\\
    logo=false]\\}
    \ind\{Title\}\\
    \ind\{Subtitle\}\\
    \ind frame contents\\
  \eframe[graphicframe]
  \end{codesnippet}
  \smallskip

  \subheading{Remarks}
  \begin{itemize}
  \item   Load photo as:\\
    \cmd{includegraphics[min
      width=0.5\cmd{paperwidth}, min height=\cmd{paperheight}-2\cmd{gridunit}]
      \{example-image-a\}}
  \item If \texttt{graphic} is specified without argument, an example image is loaded.
  \end{itemize}
\end{graphicframe}

\begin{graphicframe}
[graphic={\includegraphics[width=0.5\paperwidth, min height=\paperheight-2\gridunit]{example-image-a}},
graphicpos=l,logo=false]
  {Some Random Title}

  \small
  The slide has been typeset as:\\
  \begin{codesnippet}[\textwidth]
    \bframe[graphicframe]\\
    \texttt{[graphic=\{<load photo here>\},\\
    graphicpos=l,\\
    logo=false]\\}
    \ind\{Title\}\\
    \ind\{Subtitle\}\\
    \ind frame contents\\
    \eframe[graphicframe]
    \end{codesnippet}
  \smallskip

  \subheading{Remarks}
  \begin{itemize}
  \item   Load photo as:\\
    \cmd{includegraphics[min
      width=0.5\cmd{paperwidth}, min height=\cmd{paperheight}-2\cmd{gridunit}]
      \{example-image-a\}}
    \item If \texttt{graphic} is specified without argument, an example image is loaded.
  \end{itemize}
\end{graphicframe}

\begin{graphicframe}
[graphic={\includegraphics[width=\textwidth, min height=0.5\textheight]{example-image-a}},
graphicpos=t,logo=false,b]
  {Some Random Title}{Please, adapt!}
  \small
  The slide has been typeset as:\\
  \begin{codesnippet}[\textwidth]
    \bframe[graphicframe]\texttt{[graphic=\{<load photo here>\}, graphicpos=t, logo=false,b]\\}
    \ind\{Title\}\\
    \ind\{Subtitle\}\\
    \ind frame contents\\
    \eframe[graphicframe]
  \end{codesnippet}
\end{graphicframe}

\begin{graphicframe}
[graphic={\includegraphics[width=\textwidth, min height=0.5\textheight]{example-image-a}},
graphicpos=b,logo=false,t]
  {Some Random Title}{Please, adapt!}
  \small
  The slide has been typeset as:\\
  \begin{codesnippet}[\textwidth]
    \bframe[graphicframe]\texttt{[graphic=\{<load photo here>\}, graphicpos=b, logo=false,t]\\}
    \ind\{Title\}\\
    \ind\{Subtitle\}\\
    \ind frame contents\\
    \eframe[graphicframe]
  \end{codesnippet}
\end{graphicframe}

\subsection{Place, brightness, and textbox}
\begin{frame}[subsection]
  \subsectionpage
\end{frame}

\begin{frame}[logo=false,t]
  {Place}

  You can place any graphic material on the slide using\\[1ex]
  \qquad\cmd{place[node options] at (x,y) \{<graphic material>\}}\\[1ex]
  with
  \begin{itemize}
  \item $(x,y)$ the coordinates to insert the content, with the bottom left as origin $(0,0)$.
    The coordinates can be relative (0--1) to the slide dimensions if unit-less,
    or absolute in cm, pt,\ldots
  \item \texttt{node options} any options you want to hand over to the
    tikz node that is used to position the material, e.g., \texttt{anchor = south east}.
  \end{itemize}
  \medskip

  The next slide was created using:\\[1ex]
  \begin{codesnippet}[0.8\textwidth]
    \bframe[][plain,logo=false]\\
    \ind\cmd{place} at (0.5,0.5) \{\\
    \ind\ind\cmd{begin\{tikzpicture\}}\\
    \ind\ind\cmd{ugentlogo\{12\cmd{gridunit}\}\{ugent@main\}\{0\}}\\
    \ind\ind\cmd{end\{tikzpicture\}}\\
    \ind\}\\
    \eframe
  \end{codesnippet}
\end{frame}

\begin{frame}[logo=false,plain]{}{}
  \place at (0.5,0.5){
    \begin{tikzpicture}
      \ugentlogo{12\gridunit}{ugent@main}{0}
    \end{tikzpicture}
  }
\end{frame}

\begin{graphicframe}[graphicpos=r,graphicproportion=0.25,t,
graphic={
\brightness[-0.5]{\includegraphics[width=0.2\paperwidth]{example-image-a}}\\
\brightness[0]{\includegraphics[width=0.2\paperwidth]{example-image-a}}\\
\brightness[+0.5]{\includegraphics[width=0.2\paperwidth]{example-image-a}}
}
]
  {Brightness}

  You can lighten or darken a photograph using the following command\\[1ex]
  \qquad\cmd{brightness[s]\{<graphic material>\}}\\[1ex]
  with $s$ a value between -1 and 1 to specify the level of lightening ($>0$)
  or darkening ($<0$).

  To the right, you can see an image with brightness\\
   $-0.5$ (top), $0$ (middle), and $+0.5$ (bottom).
\end{graphicframe}

\begin{frame}[logo=false,t]
  {Textbox}

  You can insert a text box using:\\[1ex]
  \qquad\cmd{textbox[options]\{width\}\{height\}\{contents\}}

  Where the supported options are
  \begin{itemize}
  \item \texttt{fill = <colour>}: textbox colour
  \item \texttt{fill opacity = <0-1>}
  \item \texttt{text = <colour>}: text colour
  \item \texttt{text opacity = <0-1>}
  \item \texttt{align= <left/right/center/justify>}: text alignment
  \end{itemize}

  Some examples can be found in the next slides. E.g., the next one is created using:\\[1ex]
  \begin{codesnippet}[0.8\textwidth]
    \bframe[][graphic,logo=false]\\
    \ind\cmd{place[anchor = south east]} at (\cmd{paperwidth}-\cmd{gridunit},\cmd{gridunit}) \{\\
    \ind\ind\cmd{textbox}\{16cm\}\{10cm\}\{Some example text\}\\
    \ind\}\\
    \eframe
  \end{codesnippet}
\end{frame}

\begin{graphicframe}[framenumber=false,graphic]{}{}
  \place [anchor=south east] at (\paperwidth-\gridunit,\gridunit) {
    \textbox{16cm}{10cm}{Some example text}
  }
\end{graphicframe}
\begin{graphicframe}[logo=false,framenumber=false,graphic]{}{}
  \place [anchor=north west] at (\gridunit,\paperheight-\gridunit) {
    \textbox[fill=white,text=ugent@main]{10cm}{6cm}{\textbf{All}}
  }
  \place [anchor=north east] at (\paperwidth-\gridunit,\paperheight-\gridunit) {
    \textbox[fill=ugent@main!10!white,text=ugent@main]{10cm}{6cm}{\textbf{the}}
  }
  \place [anchor=center] at (0.5,0.5) {
  \textbox[fill=ugent@main, fill opacity=0.2,text=ugent@main]{10cm}{6cm}{\textbf{colours}}
  }
  \place [anchor=south west] at (\gridunit,\gridunit) {
    \textbox[fill=ugent@accent]{10cm}{6cm}{of}
  }
  \place [anchor=south east] at (\paperwidth-\gridunit,\gridunit) {
  \textbox[fill=ugent@main]{10cm}{6cm}{UGent}
  }
\end{graphicframe}

\section{Demo of some inner theme parts}
\begin{frame}[section]
  \sectionpage
\end{frame}

\begin{frame}[logo=false,t]
  {Headings}
  {on two levels}
  You can set headings on two levels, by using
  \begin{itemize}
  \item\cmd{heading\{\}}
  \item\cmd{subheading\{\}}
  \end{itemize}
  \heading{Main subject}~\\
  blabla
  \subheading{Subtopic 1}~\\
  blabla
  \subheading{Subtopic 2}~\\
  blabla
  \heading{Next main subject}~\\
  blabla
\end{frame}

\newcommand\listdemo[1][itemize]{
  \begin{#1}
  \item First level
    \begin{#1}
    \item Second level
      \begin{#1}
      \item Third level
      \end{#1}
    \end{#1}
  \end{#1}
}

\begin{frame}[t]
  {Itemize / enumerations}
  {Different styles}
  Usage:\\
  Set them (in your preamble) using: \cmd{setbeamertemplate\{itemize items\}[circle]}\\
  The default of the \texttt{ugent} beamer template is set to \cmd{textendash} following the Office
  templates.
  \medskip

  \begin{columns}
    \column[T]{0.3\textwidth}
    \alert{\cmd{textendash} (default)}
    \setbeamertemplate{itemize items}{\textendash}
    \listdemo
    \column[T]{0.3\textwidth}
    \alert{triangle}
    \setbeamertemplate{itemize items}[triangle]
    \listdemo
    \column[T]{0.3\textwidth}
    \alert{circle}
    \setbeamertemplate{itemize items}[circle]
    \listdemo
  \end{columns}~\\
  \bigskip

  \begin{columns}
    \column[T]{0.3\textwidth}
    \alert{ball}
    \setbeamertemplate{itemize items}[ball]
    \listdemo
    \column[T]{0.3\textwidth}
    \alert{square}
    \setbeamertemplate{itemize items}[square]
    \listdemo
    \column[T]{0.3\textwidth}
    \alert{enumeration}
    \setbeamertemplate{itemize items}[circle]
    \listdemo[enumerate]
  \end{columns}
\end{frame}

\begin{frame}[t]
  {Block material}
  {Nothing special}

  \vfill
  \begin{block}{This is a block}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac
    arcu est, vel posuere velit. In congue erat vel lorem ornare pretium.
  \end{block}
  \vfill
  \begin{exampleblock}{This is an example block}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac
    arcu est, vel posuere velit. In congue erat vel lorem ornare pretium.
  \end{exampleblock}
  \vfill
  \begin{alertblock}{This is an alert block}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac
    arcu est, vel posuere velit. In congue erat vel lorem ornare pretium.
  \end{alertblock}
  \vfill
\end{frame}

\renewcommand{\closingpage}{
That's all, folks!
}

\begin{frame}[title]
  \closingpage
\end{frame}

\end{document}
%</bmrug>
% \end{Verbatim}
%
%
%
% \iffalse
%<*bmr>
\setlength\@PW{33.87cm}
\setlength\@PH{19.05cm}

\pgfmathsetmacro{\@PWnum}{\@PW/1cm}
\pgfmathsetmacro{\@PHnum}{\@PH/1cm}
\pgfmathsetlength{\gridunit}{max(\@PW,\@PH)/7/4/1.3} % Gridunit seems 1.3x smaller than its actual official definition

\newlength{\@HBS}\setlength\@HBS{4\gridunit}
\newlength{\@HTS}

\ifx\@fselector\@empty
  \setlength\@HTS{0mm}
\else
  \setlength\@HTS{3\gridunit}
\fi

\mode<presentation>

\RequirePackage[orientation=landscape,size=custom,width=\@PWnum,height=\@PHnum,scale=1]{beamerposter}
\RequirePackage{tikz}
\RequirePackage{graphicx}
\RequirePackage{graphbox}
\RequirePackage[export]{adjustbox}
\RequirePackage{environ}
\RequirePackage{fontawesome}

\setbeamersize{
  text margin left=2\gridunit,
  text margin right=2\gridunit
}

\usecolortheme{ugent}
\usefonttheme{ugent}
\useinnertheme{ugent}
\useoutertheme{ugent}

\setlength{\beamer@frametopskip}{0mm}
\setlength{\beamer@framebottomskip}{0pt}
\addtolength{\textheight}{-2\gridunit}

% BEAMER PATCHES ---------------------------------------------------------------
\begingroup
\catcode`\@=11\relax
\gdef\@AT{@}%
\endgroup

% Patch circle not working for OTF fonts
\@ifundefined{beamer\@AT\@AT tmpop\@AT itemize item\@AT circle}{}{%
  \expandafter\let\csname beamer\@AT\@AT tmpop\@AT itemize item\@AT circle\endcsname\relax
  \expandafter\let\csname beamer\@AT\@AT tmpop\@AT itemize subitem\@AT circle\endcsname\relax
  \expandafter\let\csname beamer\@AT\@AT tmpop\@AT itemize subsubitem\@AT circle\endcsname\relax
}

\defbeamertemplate{itemize item}{circle}{%
  \usebeamercolor[fg]{itemize item}\tikz[baseline=-0.5ex]\fill[fg] (0,0) circle (0.4ex);%
}
\defbeamertemplate{itemize subitem}{circle}{%
  \usebeamercolor[fg]{itemize subitem}\tikz[baseline=-0.5ex]\fill[fg] (0,0) circle (0.32ex);%
}
\defbeamertemplate{itemize subsubitem}{circle}{%
  \usebeamercolor[fg]{itemize subsubitem}\tikz[baseline=-0.5ex]\fill[fg] (0,0) circle (0.28ex);%
}

% Patch support of differently-sized fonts in title and body of blocks
\@ifundefined{beamer\@AT\@AT tmpop\@AT block begin\@AT default}{}{%
  \expandafter\let\csname beamer\@AT\@AT tmpop\@AT block begin\@AT default\endcsname\relax
  \expandafter\let\csname beamer\@AT\@AT tmpop\@AT block alerted begin\@AT default\endcsname\relax
  \expandafter\let\csname beamer\@AT\@AT tmpop\@AT block example begin\@AT default\endcsname\relax
}

\newdimen\@blockcolsep
{\usebeamerfont{block body}\global\@blockcolsep=.75ex} % Setting colsep once

\defbeamertemplate*{block begin}{default}[1][]{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep=\@blockcolsep,#1]{block title}
    \usebeamerfont*{block title}\insertblocktitle%
  \end{beamercolorbox}\noframebreak%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title}{}
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body}%
  \begin{beamercolorbox}[colsep=\@blockcolsep,vmode,#1]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\defbeamertemplate*{block alerted begin}{default}[1][]{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep=\@blockcolsep,#1]{block title alerted}
    \usebeamerfont*{block title alerted}\insertblocktitle%
  \end{beamercolorbox}\noframebreak%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title alerted}{}{\ifbeamercolorempty[bg]{block body alerted}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body alerted}%
  \begin{beamercolorbox}[colsep=\@blockcolsep,vmode,#1]{block body alerted}%
    \ifbeamercolorempty[bg]{block body alerted}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\defbeamertemplate*{block example begin}{default}[1][]{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep=\@blockcolsep,#1]{block title example}
    \usebeamerfont*{block title example}\insertblocktitle%
  \end{beamercolorbox}\noframebreak%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title example}{}{\ifbeamercolorempty[bg]{block body example}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body example}%
  \begin{beamercolorbox}[colsep=\@blockcolsep,vmode,#1]{block body example}%
    \ifbeamercolorempty[bg]{block body example}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

% ------------------------------------------------------------------------------

\mode
<all>
%</bmr>
%<*bmrcolor>
\mode<presentation>

\RequirePackage{ugentcolor}

%% define main color
\setbeamercolor{palette primary}{fg=ugent@main}
\setbeamercolor{palette secondary}{fg=ugent@accent}
\setbeamercolor{palette tertiary}{fg=ugent@faculty}
%\setbeamercolor{palette quaternary}{fg=ugent@main}

\setbeamercolor{normal text}{fg=black}
\setbeamercolor{inverse normal text}{fg=white!95!ugent@main}
\setbeamercolor{alerted text}{fg=ugent@accent}
\setbeamercolor{example text}{fg=ugent@faculty}

\setbeamercolor{heading}{fg=ugent@main}
\setbeamercolor{subheading}{fg=white!25!ugent@main}
\setbeamercolor{inverse heading}{fg=white}
\setbeamercolor{inverse subheading}{fg=white!75!ugent@main}

\setbeamercolor{block body}{bg=ugent@main!10}
\setbeamercolor{block title}{fg=white,bg=ugent@main}
\setbeamercolor{block body example}{bg=ugent@faculty!10}
\setbeamercolor{block title example}{fg=white,bg=ugent@faculty}
\setbeamercolor{block body alerted}{bg=ugent@accent!10}
\setbeamercolor{block title alerted}{fg=white,bg=ugent@accent}

\setbeamercolor{itemize item}{parent=normal text}
\setbeamercolor{enumerate item}{parent=normal text}
\setbeamercolor{itemize subitem}{parent=normal text}
\setbeamercolor{enumerate subitem}{parent=normal text}
\setbeamercolor{itemize subsubitem}{parent=normal text}
\setbeamercolor{enumerate subsubitem}{parent=normal text}

\setbeamercolor{frametitle}{fg=ugent@main}
\setbeamercolor{framesubtitle}{fg=ugent@main}
\setbeamercolor{inverse frametitle}{fg=white}
\setbeamercolor{inverse framesubtitle}{fg=white!80!ugent@main}

\setbeamercolor{title in title page}{fg=ugent@main}
\setbeamercolor{subtitle in title page}{fg=ugent@accent}
\setbeamercolor{author in title page}{fg=ugent@accent}
\setbeamercolor{date in title page}{fg=ugent@accent}
\setbeamercolor{inverse title in title page}{fg=white}
\setbeamercolor{inverse subtitle in title page}{fg=ugent@accent}
\setbeamercolor{inverse author in title page}{fg=ugent@accent}
\setbeamercolor{inverse date in title page}{fg=ugent@accent}

\setbeamercolor{pageno in head/foot}{fg=ugent@main}
\setbeamercolor{inverse pageno in head/foot}{fg=white}

\setbeamercolor{section in toc}{fg=black}
\setbeamercolor{subsection in toc}{fg=black}
\setbeamercolor{section number projected}{fg=white,bg=ugent@main}
\setbeamercolor{subsection number projected}{fg=white,bg=ugent@main}

\setbeamercolor{section title}{fg=ugent@faculty}
\setbeamercolor{section name}{fg=ugent@faculty}
\setbeamercolor{inverse section title}{fg=white}
\setbeamercolor{inverse section name}{fg=white}

\setbeamercolor{subsection title}{fg=ugent@accent}
\setbeamercolor{subsection name}{fg=ugent@accent}
\setbeamercolor{inverse subsection title}{fg=white!75!ugent@faculty}
\setbeamercolor{inverse subsection name}{fg=white!75!ugent@faculty}
\mode
<all>
%</bmrcolor>
%<*bmrfont>
\mode<presentation>

\setbeamerfont{title}{size=\large}
\setbeamerfont{subtitle}{size=\small}
\setbeamerfont{frametitle}
  {size=\renewcommand*{\baselinestretch}{0.85}\LARGE\bfseries}
\setbeamerfont{framesubtitle}{size=\normalsize\bfseries}
\setbeamerfont{block body}{size=\scriptsize}
\setbeamerfont{block body alerted}{parent=block body}
\setbeamerfont{block body example}{parent=block body}
\setbeamerfont{block title}{size=\small,series=\bfseries}
\setbeamerfont{pageno in head/foot}{size=\tiny}

\mode<all>
%</bmrfont>
%<*bmrinner>
\usetikzlibrary{calc}

\mode<presentation>

\setlength\parskip{0.5\baselineskip}
\setlength\parindent{0em}

\newcommand*\@rect[3][]{
	\coordinate (bl) at #2;
	\coordinate (tr) at #3;
	\path[#1] (bl) rectangle (tr);
}

\DeclareRobustCommand\place{\@ifnextchar[{\@placeat}{\@placeat[align=left] }}
\def\@placeat[#1] at (#2,#3)#4{
  \begin{tikzpicture}[overlay,remember picture]
  \coordinate (place@px)
    at ($(current page.south west)!#2!(current page.south west-|current page.north east)$);
  \coordinate (place@py)
    at ($(current page.south west)!#3!(current page.south west|-current page.north east)$);
  \node[inner sep=0pt,#1] at (place@px |- place@py) {#4};
  \end{tikzpicture}
}

\ExplSyntaxOn
\fp_new:N \l_@@_fillalpha_fp
\tl_new:N \l_@@_fillcol_tl
\newcommand*\brightness[2][-0.5]{%
  \fp_compare:nNnTF {#1} > {0} {
    \tl_set:Nn \l_@@_fillcol_tl {white}
    \fp_set:Nn \l_@@_fillalpha_fp {#1}
  }{
    \tl_set:Nn \l_@@_fillcol_tl {black}
    \fp_set:Nn \l_@@_fillalpha_fp {-(#1)}
  }
  \begin{tikzpicture}[inner~sep=0pt,outer~sep=0pt]
    \node (a) {#2};
    \fill[fill=\l_@@_fillcol_tl, opacity=\fp_to_decimal:N\l_@@_fillalpha_fp]
      (a.south~west) rectangle (a.north~east);
  \end{tikzpicture}
}


\tl_new:N \l_@@_textbox_fillcolor_tl
\tl_new:N \l_@@_textbox_fillalpha_tl
\tl_new:N \l_@@_textbox_textcolor_tl
\tl_new:N \l_@@_textbox_textalpha_tl
\tl_new:N \l_@@_textbox_align_tl

\keys_define:nn { ugentdocs/textbox } {
  fill          .tl_set:N  = \l_@@_textbox_fillcolor_tl,
  fill          .initial:n = ugent@faculty,
  fill~opacity  .tl_set:N  = \l_@@_textbox_fillalpha_tl,
  fill~opacity  .initial:n = 1,
  text          .tl_set:N  = \l_@@_textbox_textcolor_tl,
  text          .initial:n = white,
  text~opacity  .tl_set:N  = \l_@@_textbox_textalpha_tl,
  text~opacity  .initial:n = 1,
  align         .tl_set:N  = \l_@@_textbox_align_tl,
  align         .initial:n = left,
}

\NewDocumentCommand \textbox { O{} m m m } {
  \keys_set:nn { ugentdocs/textbox } { #1 }
  \dim_set:Nn \l_tmpa_dim{#2-2\gridunit} % width
  \dim_set:Nn \l_tmpb_dim{#3-2\gridunit} % height
  \begin{tikzpicture}
  \node[align=flush~left,
    text~width=\l_tmpa_dim,
    inner~sep=\gridunit,
    text=\l_@@_textbox_textcolor_tl,
    text~opacity=\l_@@_textbox_textalpha_tl] (body)
    {\parbox[t][\l_tmpb_dim][t]{\l_tmpa_dim}{#4}};
  \begin{scope}[on~background~layer]
    \node[fill=\l_@@_textbox_fillcolor_tl,
      fill~opacity=\l_@@_textbox_fillalpha_tl, fit=(body), inner~sep=0mm] {};
  \end{scope}
  \end{tikzpicture}
}

\ExplSyntaxOff

\newcommand*{\@titlelogos}{}
\newcommand*{\titlelogos}[1]{\renewcommand*{\@titlelogos}{#1}}

\newcommand*{\@authorrole}{}
\newcommand*{\authorrole}[1]{\renewcommand*{\@authorrole}{#1}}

\NewDocumentCommand{\@printsocialitem}{mmm}{%
  % FA icon command, label text, URL
  \raisebox{-0.25\gridunit}{%
    \tikz[baseline]\node[fill=white,
    minimum width=\gridunit, minimum height=\gridunit,
    inner sep=0pt]{\color{ugent@main}\scalebox{0.75}{#1}};
  }%
  \hspace{0.25\gridunit}%
  \@ifpackageloaded{hyperref}{%
    \href{#3}{\uline{#2}}%
  }{%
    \uline{#2}%
  }
}

\newcommand*{\closingpage}{
  \begin{tikzpicture}
  [overlay,remember picture, shift={(current page.south west)}]
  \clip (0,0) rectangle (\@PW,\@PH);
  \node[anchor=north west,
  text width=\@PW-3\gridunit,
  text=white,
  align=flush left] at (3\gridunit,\@PH-4\gridunit) {
    \begin{beamercolorbox}[wd=\linewidth,left]{\@ugentbeamercolor{title in title page}}
      \small
      \textbf{\insertauthor}\\[0.5ex]
      \ifx\@authorrole\@empty\else
      \@authorrole\\[0.5ex]
      \fi
      \vspace{\gridunit}
      \@department[uppercase]~\@team[uppercase]\\[0.5ex]
      \vspace{\gridunit}
      \ifseqempty{emails}{}{\printseq{emails}{}{}{}\\[0.5ex]}
      \ifseqempty{phones}{}{\printseq{phones}{}{}{}\\[0.5ex]}
      \ifseqempty{mobiles}{}{\printseq{mobiles}{}{}{}\\[0.5ex]}
    \end{beamercolorbox}
  };
  \node[anchor=south west,
  text width=9\gridunit,
  text=white,
  align=flush left] at (\@PW-9\gridunit,\@HBS+\gridunit) {
    \begin{beamercolorbox}[wd=\linewidth,left]{\@ugentbeamercolor{title in title page}}
      \small
      \@printsocialitem{\faFacebook}{Universiteit Gent}
        {https://facebook.com/ugent/}\\[0.6ex]
      \@printsocialitem{\faInstagram}{@ugent}
        {https://instagram.com/ugent/}\\[0.6ex]
      \@printsocialitem{\faLinkedin}{Ghent University}
        {https://www.linkedin.com/school/ghent-university/}\\[0.6ex]
      \@printsocialitem{\faYoutubePlay}{youtube.com/ugent}
        {http://www.youtube.com/user/UniversiteitGent}\\%
      \vspace{\gridunit}
      \textcolor{ugent@accent}{
        \normalsize
        \@ifpackageloaded{hyperref}{%
          \href{https://www.ugent.be/}{www.ugent.be}%
        }{%
          www.ugent.be%
        }
      }
    \end{beamercolorbox}
  };
  \end{tikzpicture}
}

\newcommand\heading[1]{
  \par{
    \usebeamercolor{\@ugentbeamercolor{heading}}
    \color{fg}{\small\textbf{#1}~}
  }
}
\newcommand\subheading[1]{
  \par{
    \usebeamercolor{\@ugentbeamercolor{subheading}}
    \color{fg}{\footnotesize\textbf{\textit{#1}}~}
  }
}

\mode
<all>
%</bmrinner>
%<*bmrouter>
\mode<presentation>

\setbeamertemplate{navigation symbols}{}

\ExplSyntaxOn
% Declare vars for graphic frames and title frames
\dim_new:N  \l_@@_graphdim_dim
\tl_new:N   \l_@@_graphpos_tl
\fp_new:N   \l_@@_graphprop_fp
\bool_new:N \l_@@_graphgiven_bool
\bool_new:N \l_@@_graphfill_bool
\bool_new:N \g_@@_showlogo_bool
\tl_new:N   \g_@@_framenumberkey_tl
\tl_new:N   \g_@@_logocolor_tl
\tl_new:N   \l_@@_graphcontent_tl
\tl_new:N   \l_@@_titlebgimg_tl
\fp_new:N   \l_@@_bodyfrac_fp
\bool_new:N \g_@@_inverse_bool
\bool_new:N \g_@@_framenumber_bool

\newlength{\@titletextwidth}

\msg_new:nnn { ugentdocs } { unknown-framenumber }
{ Unknown~value~'#1'~for~framenumber.~Use~true~or~false. }

% HELPERS ---------------------------------------------------------------------
% Helper CS for colour names, prefixed with "inverse " on inverted frames
\cs_new:Npn \@@_beamercolor:n #1 { \bool_if:NT \g_@@_inverse_bool { inverse~ } #1 }

% Helper CS to set inversion and switch text colour
\cs_new_protected:Npn \@@_setinverse:n #1 {
  \bool_gset_eq:Nc \g_@@_inverse_bool { c_#1_bool }
  \usebeamercolor[fg]{ \@@_beamercolor:n { normal~text } }
}

% Helper CS to set framenumber unless the user set the framenumber key
\cs_new_protected:Npn \@@_setframenumber:n #1 {
  \tl_if_empty:NTF \g_@@_framenumberkey_tl {
    \bool_gset_eq:Nc \g_@@_framenumber_bool { c_#1_bool }
  }{
    \bool_gset_eq:Nc \g_@@_framenumber_bool { c_ \g_@@_framenumberkey_tl _bool }
  }
}

% Helper CS to set frame style
% Args: background canvas, inverse text (true/false)
\cs_new_protected:Npn \@@_framestyle:nn #1#2 {
  \@@_setinverse:n {#2}
  \clist_map_inline:nn { title~page, section~page, subsection~page }
  { \setbeamertemplate{##1}[main] }
  \setbeamertemplate{background~canvas}[#1]
}

% LaTeX2e aliases
\cs_new_eq:NN \@ugentbeamercolor \@@_beamercolor:n
\cs_new_eq:NN \@setinverse       \@@_setinverse:n
\cs_new_eq:NN \@framestyle       \@@_framestyle:nn

% Helper CS for split graph frames
\cs_new_protected:Npn \@IfGraphSplit #1#2 {
  \bool_if:NTF \l_@@_graphfill_bool {
    #2
  }{
    \tl_if_empty:NTF \l_@@_graphpos_tl {#2}{#1}
  }
}

% Helper CS to compute graphic dimensions and position
\cs_new_protected:Npn \@ComputeGraphDims {
  \bool_if:NTF \l_@@_graphfill_bool {
    \pgfmathsetmacro\@shx{0}
    \pgfmathsetmacro\@shy{0}
    \pgfmathsetmacro\@dx{\@PW/1cm}
    \pgfmathsetmacro\@dy{\@PH/1cm}
  }{
    \pgfmathsetmacro\@shx{\gridunit/1cm}
    \pgfmathsetmacro\@shy{4\gridunit/1cm}
    \pgfmathsetmacro\@dx{(\@PW-\gridunit)/1cm}
    \pgfmathsetmacro\@dy{(\@PH-4*\gridunit)/1cm}
  }
  \@IfGraphSplit{
    \pgfmathsetmacro\@oy{\gridunit/1cm}
    \pgfmathsetmacro\@prop{\fp_to_decimal:N\l_@@_graphprop_fp}
    \str_case:VnF \l_@@_graphpos_tl {
      { l } {
        \pgfmathsetmacro\@dx{\@prop*(\@PW-\beamer@leftmargin-\beamer@rightmargin)/1cm}
        \pgfmathsetmacro\@shx{\beamer@leftmargin/1cm}
        \pgfmathsetmacro\@dy{\@PH/1cm-2*\@oy}
        \pgfmathsetmacro\@shy{\@oy}
      }
      { r } {
        \pgfmathsetmacro\@dx{\@prop*(\@PW-\beamer@leftmargin-\beamer@rightmargin)/1cm}
        \pgfmathsetmacro\@shx{\@PW/1cm-\beamer@rightmargin/1cm-\@dx}
        \pgfmathsetmacro\@dy{\@PH/1cm-2*\@oy}
        \pgfmathsetmacro\@shy{\@oy}
      }
      { t } {
        \pgfmathsetmacro\@dx{(\@PW-\beamer@leftmargin-\beamer@rightmargin)/1cm}
        \pgfmathsetmacro\@shx{\beamer@leftmargin/1cm}
        \pgfmathsetmacro\@dy{\@prop*(\@PH/1cm-2*\@oy)}
        \pgfmathsetmacro\@shy{\@PH/1cm-\@oy-\@dy}
      }
      { b } {
        \pgfmathsetmacro\@dx{(\@PW-\beamer@leftmargin-\beamer@rightmargin)/1cm}
        \pgfmathsetmacro\@shx{\beamer@leftmargin/1cm}
        \pgfmathsetmacro\@dy{\@prop*(\@PH/1cm-2*\@oy)}
        \pgfmathsetmacro\@shy{\@oy}
      }
    }{ \msg_error:nnn { ugentdocs } { unknown~graphpos } { \l_@@_graphpos_tl } }
  }{}
}

% Helper CS to determine title width
\cs_new_protected:Npn \@ComputeTitleDims {
  \fp_compare:nNnTF {\l_@@_graphprop_fp} > {0.5} {
    \tl_clear:N \l_@@_graphpos_tl
  }{
    \tl_set:Nn \l_@@_graphpos_tl {r}
  }
  \tl_if_empty:NTF \l_@@_titlebgimg_tl {
    \pgfmathsetlength{\@titletextwidth}{\@PW-3\gridunit}%
  }{
    \fp_compare:nNnTF {\l_@@_graphprop_fp} > {0.5} {
      \pgfmathsetlength{\@titletextwidth}{\@PW-3\gridunit}%
    }{
      \pgfmathsetmacro\@titleprop{\fp_to_decimal:N\l_@@_graphprop_fp}%
      \pgfmathsetlength{\@titletextwidth}{\@PW-\@titleprop*(\@PW-\gridunit)-3\gridunit}%
    }
  }
}

% Helper CS to set inverse or normal text for graphic frames
\cs_new_protected:Npn \@SetInverse {
  \@IfGraphSplit { \@@_setinverse:n {false} } { \@@_setinverse:n {true} }
}

% Helper CS to set frame title dimensions and position
\dim_new:N \l_@@_tempdima_dim
\dim_new:N \l_@@_tempdimb_dim
\dim_new:N \l_@@_vskip_dim
\bool_new:N \l_@@_dovskip_bool
\cs_new_protected:Npn \@SetFrameTitleDims {
  \bool_set_false:N \l_@@_dovskip_bool
  \@IfGraphSplit {
    \str_case:VnF \l_@@_graphpos_tl {
      { l } {
        \dim_set:Nn \l_@@_graphdim_dim { \fp_to_decimal:N \l_@@_graphprop_fp \textwidth }
        \dim_set:Nn \l_@@_tempdima_dim { \l_@@_graphdim_dim + \gridunit }
        \dim_set:Nn \l_@@_tempdimb_dim { \textwidth - \l_@@_tempdima_dim }
      }
      { r } {
        \dim_set:Nn \l_@@_graphdim_dim { \fp_to_decimal:N \l_@@_graphprop_fp \textwidth }
        \dim_set:Nn \l_@@_tempdima_dim { 0em }
        \dim_set:Nn \l_@@_tempdimb_dim { \textwidth - \l_@@_graphdim_dim - \gridunit }
      }
      { t } {
        \dim_set:Nn \l_@@_tempdima_dim { 0em }
        \dim_set:Nn \l_@@_tempdimb_dim { \textwidth }
        \bool_set_true:N \l_@@_dovskip_bool
        \dim_set:Nn \l_@@_vskip_dim { \fp_to_decimal:N \l_@@_graphprop_fp \textheight + \gridunit }
      }
      { b } {
        \dim_set:Nn \l_@@_tempdima_dim { 0em }
        \dim_set:Nn \l_@@_tempdimb_dim { \textwidth }
      }
    }{
      \dim_set:Nn \l_@@_tempdima_dim { 0em }
      \dim_set:Nn \l_@@_tempdimb_dim { \textwidth }
    }
  }{
    \dim_set:Nn \l_@@_tempdima_dim { 0em }
    \dim_set:Nn \l_@@_tempdimb_dim { \textwidth }
  }
  \bool_if:NT \l_@@_dovskip_bool { \vskip \l_@@_vskip_dim }
  \@tempdima=\l_@@_tempdima_dim
  \@tempdimb=\l_@@_tempdimb_dim
}

% KEYS ------------------------------------------------------------------------
\define@key{beamerframe}{inversetext}[true]{ \@@_setinverse:n {#1} }
\ExplSyntaxOff

\define@key{beamerframe}{normal}[true]{\@framestyle{normal}{false}}

\mode<handout|trans>

\define@key{beamerframe}{shaded}[true]{}
\define@key{beamerframe}{negative}[true]{}

\mode
<all>

\mode<beamer|second>

\define@key{beamerframe}{shaded}[true]{\@framestyle{shaded}{false}}
\define@key{beamerframe}{negative}[true]{\@framestyle{negative}{true}}

\mode
<all>

\ExplSyntaxOn
\define@key{beamerframe}{title}[{}]{%
  \@@_setinverse:n {true}
  \setbeamertemplate{title~page}[main]%
  \tl_set:Nn \l_@@_titlebgimg_tl {#1}%
  \setbeamertemplate{background~canvas}[title]{#1}%
}

\define@key{beamerframe}{section}[{}]{%
  \@@_setinverse:n {true}
  \setbeamertemplate{subsection~page}[main]%
  \tl_set:Nn \l_@@_titlebgimg_tl {#1}%
  \setbeamertemplate{background~canvas}[section]{#1}%
}

\define@key{beamerframe}{subsection}[{}]{%
  \@@_setinverse:n {true}
  \setbeamertemplate{section~page}[main]%
  \tl_set:Nn \l_@@_titlebgimg_tl {#1}%
  \setbeamertemplate{background~canvas}[section]{#1}%
}

\define@key{beamerframe}{graphicpos}{\tl_set:Nn \l_@@_graphpos_tl {#1}}
\define@key{beamerframe}{graphicproportion}{\fp_set:Nn \l_@@_graphprop_fp {#1}}
\define@key{beamerframe}{fill}[true]{\bool_set_true:N \l_@@_graphfill_bool}
\define@key{beamerframe}{logo}[true]{\str_if_eq:nnTF {#1} {true} {
    \bool_gset_true:N \g_@@_showlogo_bool
  }{
    \bool_gset_false:N \g_@@_showlogo_bool
  }
}
\define@key{beamerframe}{framenumber}[true]{
  \str_case:nnF {#1} {
    {true}{}
    {false}{}
  }{
    \msg_error:nnn { ugentdocs } { unknown-framenumber } {#1}
  }
  \tl_gset:Nn \g_@@_framenumberkey_tl {#1}
}

\define@key{beamerframe}{graphic}
[{\includegraphics[scale=0.1,min~width=\paperwidth,min~height=\paperheight]{example-image-a}}]{%
  \bool_set_true:N \l_@@_graphgiven_bool
  \tl_set:Nn \l_@@_graphcontent_tl {#1}%
}

% Reset state at the beginning of a new frame:
\BeforeBeginEnvironment{frame}{%
  \@@_setinverse:n {false}
  \tl_set:Nn \l_@@_graphpos_tl {}%
  \fp_set:Nn \l_@@_graphprop_fp {0.5}%
  \tl_gset:Nn \g_@@_logocolor_tl {ugent@main}
  \bool_set_false:N \l_@@_graphgiven_bool
  \bool_set_false:N \l_@@_graphfill_bool
  \bool_gset_true:N \g_@@_showlogo_bool
  \tl_gclear:N \g_@@_framenumberkey_tl
  \tl_clear:N \l_@@_graphcontent_tl
  \tl_clear:N \l_@@_titlebgimg_tl
  \setbeamertemplate{title~page}[main]%
  \setbeamertemplate{section~page}[main]%
  \setbeamertemplate{subsection~page}[main]%
  \setbeamertemplate{background~canvas}[normal]%
}

% GRAPHIC FRAME ---------------------------------------------------------------
\NewEnviron{graphicframe}[3][]{%
  \begin{frame}[#1]{#2}{#3}
    \@IfGraphSplit {
      \str_case:VnF \l_@@_graphpos_tl {
        { l } {
          \fp_set:Nn \l_@@_bodyfrac_fp
          { 1 - \l_@@_graphprop_fp - \gridunit/\textwidth }
          \begin{minipage}[t]{\fp_to_decimal:N\l_@@_graphprop_fp\textwidth}
            \hspace{0pt}
          \end{minipage}%
          \hspace{\gridunit}%
          \begin{minipage}[t]{\fp_to_decimal:N\l_@@_bodyfrac_fp\textwidth}
            \BODY
          \end{minipage}%
        }
        { r } {
          \fp_set:Nn \l_@@_bodyfrac_fp
          { 1 - \l_@@_graphprop_fp - \gridunit/\textwidth }
          \begin{minipage}[t]{\fp_to_decimal:N\l_@@_bodyfrac_fp\textwidth}
            \BODY
          \end{minipage}%
          \hspace{\gridunit}%
          \begin{minipage}[t]{\fp_to_decimal:N\l_@@_graphprop_fp\textwidth}
            \hspace{0pt}
          \end{minipage}%
        }
        { t } {
          \begin{minipage}[t]{\textwidth}
            \BODY
          \end{minipage}%
        }
        { b } {
          \begin{minipage}[t]{\textwidth}
            \BODY
          \end{minipage}%
        }
      }
      { \msg_error:nnn { ugentdocs } { unknown~graphpos } { \l_@@_graphpos_tl } }
    }{
      \BODY
    }
  \end{frame}
}


% BACKGROUND CANVASES ---------------------------------------------------------
\def\ps@ugent@titlepage{%
  \setbeamercolor{title~in~title~page}{parent=palette~primary}
  \setbeamertemplate{footline}[empty]
  \@nameuse{ps@ugent}
}

\defbeamertemplate*{background~canvas}{title}[1] {%
  \@ComputeTitleDims
  \tl_gset:Nn \g_@@_logocolor_tl {ugent@main}
  \@@_setframenumber:n {false}
  \begin{tikzpicture}
    \clip (0,0) rectangle (\@PW,\@PH);
    \begin{scope}[shift={(0,\@PH-\@HTS)}]
      \faclogo{\@HTS}{ugent@faculty}{0}
    \end{scope}
    \def\@titlebgimg{#1}%
    \ifx\@titlebgimg\@empty
      \@rect[fill=ugent@main]{(\gridunit,\@HBS)}{(\@PW,\@PH-\@HTS)}
    \else
      \tl_if_empty:NTF \l_@@_graphpos_tl {
        \begin{scope}
          \@rect[clip]{(\gridunit,\@HBS)}{(\@PW,\@PH-\@HTS)}
          \node[align=center]
          at (0.5*\gridunit+0.5*\@PW,0.5*\@HBS+0.5*\@PH-0.5*\@HTS) {#1};
        \end{scope}
      }{
        \pgfmathsetmacro\@titlex{%
          \@PW/1cm-(1-\fp_to_decimal:N\l_@@_graphprop_fp)*(\@PW/1cm-\gridunit/1cm)%
        }%
        \@rect[fill=ugent@main]{(\gridunit,\@HBS)}{(\@titlex cm,\@PH-\@HTS)}
        \begin{scope}
          \@rect[clip]{(\@titlex cm,\@HBS)}{(\@PW,\@PH-\@HTS)}
          \node[align=center]
          at (0.5*\@titlex cm+0.5*\@PW,0.5*\@HBS+0.5*\@PH-0.5*\@HTS) {#1};
        \end{scope}
      }
    \fi
    \ugentlogo{\@HBS}{ugent@main}{0}
    \ifx\@titlelogos\@empty\else
      \node[anchor=south~west, inner~sep=0pt,
        text~width=\@PW-2\gridunit-\@ugenttextw/\@logounit*\gridunit,
        minimum~height=2\gridunit, align=flush~left]
      at (2\gridunit+\@ugenttextw/\@logounit*\gridunit,\gridunit)
        {\@titlelogos};
    \fi
  \end{tikzpicture}
}

\defbeamertemplate*{background~canvas}{section}[1] {%
  \tl_gset:Nn \g_@@_logocolor_tl {ugent@main}
  \@@_setframenumber:n {false}
  \@ComputeTitleDims
  \begin{tikzpicture}
    \clip (0,0) rectangle (\@PW,\@PH);
    \def\@titlebgimg{#1}%
    \ifx\@titlebgimg\@empty
      \@rect[fill=ugent@main]{(\gridunit,\@HBS)}{(\@PW,\@PH)}
    \else
      \tl_if_empty:NTF \l_@@_graphpos_tl {
        \begin{scope}
          \@rect[clip]{(\gridunit,\@HBS)}{(\@PW,\@PH)}
          \node[align=center] at (0.5*\gridunit+0.5*\@PW,0.5*\@HBS+0.5*\@PH) {#1};
        \end{scope}
      }{
        \pgfmathsetmacro\@titlex{%
          \@PW/1cm-(1-\fp_to_decimal:N\l_@@_graphprop_fp)*(\@PW/1cm-\gridunit/1cm)%
        }%
        \@rect[fill=ugent@main]{(\gridunit,\@HBS)}{(\@titlex cm,\@PH)}
        \begin{scope}
          \@rect[clip]{(\@titlex cm,\@HBS)}{(\@PW,\@PH)}
          \node[align=center] at (0.5*\@titlex cm+0.5*\@PW,0.5*\@HBS+0.5*\@PH) {#1};
        \end{scope}
      }
    \fi
  \end{tikzpicture}
}

\defbeamertemplate*{background~canvas}{negative}[1] {%
  \tl_gset:Nn \g_@@_logocolor_tl {white}
  \@@_setframenumber:n {true}
  \color{ugent@main}\vrule width\paperwidth height\paperheight
}

\defbeamertemplate*{background~canvas}{shaded}[1] {%
  \tl_gset:Nn \g_@@_logocolor_tl {ugent@main}
  \@@_setframenumber:n {true}
  \color{ugent@main!10}\vrule width\paperwidth height\paperheight
}

\defbeamertemplate*{background~canvas}{normal} {%
  \tl_gset:Nn \g_@@_logocolor_tl {ugent@main}%
  \@@_setframenumber:n {true}
  \bool_if:NTF \l_@@_graphgiven_bool {
    \@ComputeGraphDims
    \begin{tikzpicture}[
      overlay, remember~picture, shift={(current~page.south~west)}]
      \clip (0,0) rectangle (\@PW,\@PH);
      \begin{scope}[shift={(\@shx,\@shy)}]
        \@rect[clip]{(0,0)}{(\@dx,\@dy)}
        \node[align=center] at (0.5*\@dx,0.5*\@dy) {\l_@@_graphcontent_tl};
      \end{scope}
    \end{tikzpicture}%
  }{}%
}

% PAGES -----------------------------------------------------------------------
\defbeamertemplate*{title~page}{main}[1][] {%
  \thispagestyle{ugent@titlepage}%
  \@ComputeTitleDims
  \begin{tikzpicture}
    [overlay,remember~picture, shift={(current~page.south~west)}]
    \clip (0,0) rectangle (\textwidth,\paperheight-0.075cm);
    \node[anchor=north~west,
      text~width=\@titletextwidth, text=white, align=flush~left]
    at (2\gridunit,\@PH-\@HTS-\gridunit) {
      \begin{beamercolorbox}[wd=\linewidth,left]{\@@_beamercolor:n {title~in~title~page}}
        \footnotesize\textbf{\@department[uppercase]}\\\@team[uppercase]
      \end{beamercolorbox}
    };
    \node[anchor=south~west,
      text~width=\@titletextwidth, text=white, align=flush~left]
    at (2\gridunit,\@HBS+\gridunit) {%
      \begin{beamercolorbox}[wd=\linewidth,left]{\@@_beamercolor:n {title~in~title~page}}%
        \Huge\bfseries\MakeUppercase{\inserttitle}%
      \end{beamercolorbox}%
      \par\nointerlineskip\Huge\bfseries\vspace{1ex}%
      \begin{beamercolorbox}[wd=\linewidth,left]{\@@_beamercolor:n {subtitle~in~title~page}}%
        \small\MakeUppercase{\insertsubtitle{}~\insertauthor{}~\insertdate}%
      \end{beamercolorbox}%
    };
  \end{tikzpicture}
}

\defbeamertemplate*{section~page}{main}[1][] {%
  \@ComputeTitleDims
  \begin{tikzpicture}
    [overlay,remember~picture, shift={(current~page.south~west)}]
    \begin{scope}
      \@rect[clip]{(2\gridunit,\@HBS+\gridunit)}{(\@PW-\gridunit,\@PH-\gridunit)}
      \node[anchor=south~west,
        text~width=\@titletextwidth, text=white, align=flush~left]
      at (2\gridunit,\@HBS+\gridunit) {
        \begin{beamercolorbox}[wd=\linewidth,left]{\@@_beamercolor:n {section~title}}
          \Huge\bfseries
          \bool_if:NTF {\l_@@_secnums_bool}{
            \MakeUppercase{\insertsectionnumber.~\insertsection}
          }{
            \MakeUppercase{\insertsection}
          }
        \end{beamercolorbox}
      };
    \end{scope}
  \end{tikzpicture}
}

\defbeamertemplate*{subsection~page}{main}[1][] {%
  \@ComputeTitleDims
  \begin{tikzpicture}
  [overlay,remember~picture, shift={(current~page.south~west)}]
    \begin{scope}
      \@rect[clip]{(2\gridunit,\@HBS+\gridunit)}{(\@PW-\gridunit,\@PH-\gridunit)}
      \node[anchor=south~west,
        text~width=\@titletextwidth, text=white, align=flush~left]
      at (2\gridunit,\@HBS+\gridunit) {
        \begin{beamercolorbox}[wd=\linewidth,left]{\@@_beamercolor:n {section~title}}
          \Huge\bfseries
            \bool_if:NTF {\l_@@_secnums_bool}{
              \MakeUppercase{\insertsectionnumber.~\insertsection\\}
              \begin{beamercolorbox}[wd=\linewidth,left]{\@@_beamercolor:n {subsection~title}}
                \LARGE\bfseries\MakeUppercase{\insertsubsection}
              \end{beamercolorbox}
            }{
              \MakeUppercase{\insertsection\\}
              \begin{beamercolorbox}[wd=\linewidth,left]{\@@_beamercolor:n {subsection~title}}
                \LARGE\bfseries\MakeUppercase{\insertsubsection}
              \end{beamercolorbox}
            }
        \end{beamercolorbox}
      };
    \end{scope}
  \end{tikzpicture}
}

% TOC, FOOTLINE, FRAME TITLE --------------------------------------------------
% secnums option: no section numbers in TOC
\bool_if:NF \l_@@_secnums_bool {
  \setbeamertemplate{section~in~toc}{%
    % Based on beamer source, slightly smaller squares
    \leavevmode
    \leftskip=1.75ex
    \llap{%
      \usebeamerfont*{section~number~projected}%
      \usebeamercolor[bg]{section~number~projected}%
      %\vrule width2.25ex height1.85ex depth.4ex% original
      \raisebox{0.24ex}{\vrule width1.35ex height1.11ex depth.24ex}%
    }%
    \kern1.25ex
    \inserttocsection
    \par
  }
}
\ExplSyntaxOff

% Use square for TOC and dash for itemize
\setbeamertemplate{sections/subsections in toc}[square]
\setbeamertemplate{itemize items}{\textendash}


\defbeamertemplate*{footline}{empty}{}

\ExplSyntaxOn
\defbeamertemplate*{footline}{normal} {%
  \begin{beamercolorbox}[wd=\paperwidth,ht=0.55cm,dp=0.25cm]
    {\@@_beamercolor:n {pageno~in~head/foot}}%
    \begin{tikzpicture}
      [overlay,remember~picture,shift={(current~page.south~west)}]
      \bool_if:NT \g_@@_showlogo_bool {
         \ugentlogo{\@HBS}{\g_@@_logocolor_tl}{0}
      }
      \bool_if:NT \g_@@_framenumber_bool {
        \node[anchor=south~east, inner~sep=0pt, text=fg,
          font=\usebeamerfont{pageno~in~head/foot}]
        at (\@PW-\gridunit,\gridunit)
          {\insertframenumber/\inserttotalframenumber};
      }
    \end{tikzpicture}%
  \end{beamercolorbox}%
}

\defbeamertemplate*{frametitle}{empty} {}

\defbeamertemplate*{frametitle}{normal} {%
  \bool_if:NTF \l_@@_graphgiven_bool {\@SetInverse}{}%
  \vskip\gridunit%
  \@SetFrameTitleDims
  \hskip\@tempdima%
  \begin{beamercolorbox}[wd=\@tempdimb]{\@@_beamercolor:n {frametitle}}%
    \usebeamerfont{frametitle}\MakeUppercase{\insertframetitle}\\[0.5ex]%
    \ifx\insertframesubtitle\@empty%
    {\usebeamerfont{framesubtitle}%
      \usebeamercolor[fg]{\@@_beamercolor:n {framesubtitle}}~\strut\par}%
    \vskip-1ex%
    \else%
    {\usebeamerfont{framesubtitle}%
      \usebeamercolor[fg]{\@@_beamercolor:n {framesubtitle}}%
      \insertframesubtitle\strut\par}%
    \fi%
    \if@tempswa\else\vskip-.3cm\fi%
  \end{beamercolorbox}%
}
\ExplSyntaxOff

\mode
<all>
%</bmrouter>
% \fi
%
% \Finale
\endinput
