%%
%% Copyright (C) 2026 Janis Hutz
%%
%% This file 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:
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2008-05-04 or later.

\NeedsTeXFormat{LaTeX2e}


% Package imports
\usepackage{tocloft}
\usepackage[table, dvipsnames]{xcolor}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[export]{adjustbox}
\usepackage[most]{tcolorbox}
\usepackage{cancel}
\usepackage{dsfont}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{lipsum}
\usepackage{ulem}
\usepackage{soul}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{wasysym}
\usepackage{wrapfig}
\usepackage{multicol}
\usepackage{ifthen}
\usepackage[hidelinks]{hyperref}
\usepackage{enumitem}
\usepackage{gensymb}
\usepackage{pifont}
\usepackage{xstring}
\usepackage{etoolbox}
\usepackage{makecell}
\usepackage{parskip}
\usepackage{titlesec}
\usepackage{centernot}

\newcounter{descriptorShadeStrength}
\newcounter{shadeStrength}
\newcommand{\currentLanguage}{en}

\setcounter{secnumdepth}{4}

\newcommand{\printTranslationOptionEN}[1]{\csname #1NamingEN\endcsname}
\newcommand{\printTranslationOptionDE}[1]{\csname #1NamingDE\endcsname}
\newcommand{\printShortTranslationOptionEN}[1]{\csname #1ShortNamingEN\endcsname}
\newcommand{\printShortTranslationOptionDE}[1]{\csname #1ShortNamingDE\endcsname}

\newboolean{numberingDisabled}
\setboolean{numberingDisabled}{false}

\newcommand{\loadGerman}{
    \usepackage[ngerman]{babel}
    \renewcommand{\currentLanguage}{de}
}


% ┌                                                ┐
% │                    Colours                     │
% └                                                ┘
% The colour-saturation of the short / inline descriptors (default = 40)
\setcounter{descriptorShadeStrength}{40}

% The colour-saturation of the shade command (default = 20)
\setcounter{shadeStrength}{20}

% You may also use \definecolor{<name>}{rgb}{r, g, b} to define a fully custom color
% see https://www.overleaf.com/learn/latex/Using_colors_in_LaTeX#Creating_your_own_colors for more information
\colorlet{definitioncolor}{blue}
\colorlet{theoremcolor}{ForestGreen}
\colorlet{lemmacolor}{Aquamarine}
\colorlet{corollarycolor}{teal}
\colorlet{axiomcolor}{JungleGreen}
\colorlet{factcolor}{SeaGreen}
\colorlet{propositioncolor}{Cyan}
\colorlet{examplecolor}{gray}
\colorlet{formulacolor}{red}
\colorlet{remarkcolor}{green}
\colorlet{proofcolor}{magenta}
\colorlet{intuitioncolor}{Emerald}
\colorlet{termcolor}{orange}
\colorlet{notationcolor}{Peach}
\colorlet{taskcolor}{gray}
\colorlet{usagecolor}{LimeGreen}
\colorlet{recallcolor}{yellow}
\colorlet{propertiescolor}{purple}


% ┌                                                ┐
% │                     Naming                     │
% └                                                ┘
% Here you may specify how each descriptor is named
\newcommand{\definitionNamingEN}{Definition}
\newcommand{\theoremNamingEN}{Theorem}
\newcommand{\lemmaNamingEN}{Lemma}
\newcommand{\corollaryNamingEN}{Corollary}
\newcommand{\axiomNamingEN}{Axiom}
\newcommand{\factNamingEN}{Fact}
\newcommand{\propositionNamingEN}{Proposition}
\newcommand{\exampleNamingEN}{Example}
\newcommand{\formulaNamingEN}{Formula}
\newcommand{\remarkNamingEN}{Remark}
\newcommand{\proofNamingEN}{Proof}
\newcommand{\intuitionNamingEN}{Intuition}
\newcommand{\termNamingEN}{Term}
\newcommand{\notationNamingEN}{Notation}
\newcommand{\taskNamingEN}{Task}
\newcommand{\usageNamingEN}{Usage}
\newcommand{\recallNamingEN}{Recall}
\newcommand{\propertiesNamingEN}{Properties}

\newcommand{\definitionNamingDE}{Definition}
\newcommand{\theoremNamingDE}{Theorem}
\newcommand{\lemmaNamingDE}{Lemma}
\newcommand{\corollaryNamingDE}{Korollar}
\newcommand{\axiomNamingDE}{Axiom}
\newcommand{\factNamingDE}{Fakt}
\newcommand{\propositionNamingDE}{Satz}
\newcommand{\exampleNamingDE}{Beispiel}
\newcommand{\formulaNamingDE}{Formel}
\newcommand{\remarkNamingDE}{Bemerkung}
\newcommand{\proofNamingDE}{Beweis}
\newcommand{\intuitionNamingDE}{Intuition}
\newcommand{\termNamingDE}{Begriff}
\newcommand{\notationNamingDE}{Notation}
\newcommand{\taskNamingDE}{Aufgabe}
\newcommand{\usageNamingDE}{Nutzung}
\newcommand{\recallNamingDE}{Repetition}
\newcommand{\propertiesNamingDE}{Eigenschaften}


% Specify here what they should be shortened to
\newcommand{\definitionShortNamingEN}{D}
\newcommand{\theoremShortNamingEN}{T}
\newcommand{\lemmaShortNamingEN}{L}
\newcommand{\corollaryShortNamingEN}{C}
\newcommand{\axiomShortNamingEN}{A}
\newcommand{\factShortNamingEN}{F}
\newcommand{\propositionShortNamingEN}{P}
\newcommand{\exampleShortNamingEN}{E}
\newcommand{\formulaShortNamingEN}{F}
\newcommand{\remarkShortNamingEN}{R}
\newcommand{\proofShortNamingEN}{Proof}
\newcommand{\intuitionShortNamingEN}{Intuition}
\newcommand{\termShortNamingEN}{Term}
\newcommand{\notationShortNamingEN}{Not.}
\newcommand{\taskShortNamingEN}{Task}
\newcommand{\usageShortNamingEN}{Usage}
\newcommand{\recallShortNamingEN}{Recall}
\newcommand{\propertiesShortNamingEN}{P}

\newcommand{\definitionShortNamingDE}{D}
\newcommand{\theoremShortNamingDE}{T}
\newcommand{\lemmaShortNamingDE}{L}
\newcommand{\corollaryShortNamingDE}{K}
\newcommand{\axiomShortNamingDE}{A}
\newcommand{\factShortNamingDE}{F}
\newcommand{\propositionShortNamingDE}{S}
\newcommand{\exampleShortNamingDE}{Bsp}
\newcommand{\formulaShortNamingDE}{F}
\newcommand{\remarkShortNamingDE}{B}
\newcommand{\proofShortNamingDE}{Bew.}
\newcommand{\intuitionShortNamingDE}{Int.}
\newcommand{\termShortNamingDE}{Begriff}
\newcommand{\notationShortNamingDE}{Not.}
\newcommand{\taskShortNamingDE}{Aufg.}
\newcommand{\usageShortNamingDE}{Nutz.}
\newcommand{\recallShortNamingDE}{Rep.}
\newcommand{\propertiesShortNamingDE}{E}


% ┌                                                ┐
% │                   Numbering                    │
% └                                                ┘
% Set a preset, can be combined, separate or off.
% If set to custom, all type specific commands need to be set below.
\newcommand{\numberingpreset}{combined}

% Specify how elements are to be numbered. Can be (X is the current number of the element):
% - none (X)
% - section (section.X)
% - subsection (section.subsection.X)
% - subsubsection (section.subsection.subsubsection.X)
% - paragraph (section.subsection.subsubsection.paragraph.X)
\newcommand{\subsectionnumbering}{subsection}


% Set for a specific type. Can each be combined, separate, default or off:
% If set to anything but 'default', it will override the overarching style
% set by \numberingpreset
\newcommand{\definitionnumbering}{default}
\newcommand{\theoremnumbering}{default}
\newcommand{\lemmanumbering}{default}
\newcommand{\corollarynumbering}{default}
\newcommand{\axiomnumbering}{default}
\newcommand{\factnumbering}{default}
\newcommand{\propositionnumbering}{default}
\newcommand{\examplenumbering}{default}
\newcommand{\formulanumbering}{default}
\newcommand{\remarknumbering}{default}
\newcommand{\proofnumbering}{default}
\newcommand{\intuitionnumbering}{default}
\newcommand{\termnumbering}{default}
\newcommand{\notationnumbering}{default}
\newcommand{\tasknumbering}{default}
\newcommand{\usagenumbering}{default}
\newcommand{\recallnumbering}{default}
\newcommand{\propertiesnumbering}{default}


% ┌                                                ┐
% │                 General config                 │
% └                                                ┘
% Configure your author name here
\newcommand{\authorTitle}{Janis Hutz\\\url{https://janishutz.com}}
\newcommand{\authorHeaders}{Janis Hutz}


% ┌                                                ┐
% │                   Rendering                    │
% └                                                ┘
% This is used to render the optional name argument in the descriptors
% Updating this function only has an effect if you are using the
% unmodified templates below or have updated them, but still use this function
\newcommand{\descriptorNameDisplay}[1]{\textit{(#1)}}

% Specify how the inline and short descriptors (e.g. Lemma, etc) are rendered. 
% - #1 is the name of the descriptor
% - #2 is the number (correctly rendered according to settings and preceded with space if not disabled)
% - #3 is the name passed (non-empty asserted)
\newcommand{\shortDescriptorTemplate}[3]{\bg{#1color}{\shortNamingTranslate{#1} #2} \descriptorNameDisplay{#3}}
\newcommand{\inlineDescriptorTemplate}[3]{\bg{#1color}{\namingTranslate{#1} #2} \descriptorNameDisplay{#3}}

% These are used if no name is provided and argument #4 from above is the missing argument
\newcommand{\anonymousShortDescriptorTemplate}[2]{\bg{#1color}{\shortNamingTranslate{#1} #2}\ }
\newcommand{\anonymousInlineDescriptorTemplate}[2]{\bg{#1color}{\namingTranslate{#1} #2}\ }
\newcommand{\tcbDescriptorTemplate}[2]{\namingTranslate{#1} #2}

% background command config (draws a small box around the content)
\newcommand{\backgroundPadding}{2pt}
\newcommand{\backgroundRounding}{1pt}


\newcounter{definitionnone}
\newcounter{definitionsection}[section]
\renewcommand{\thedefinitionsection}{\thesection.\arabic{definitionsection}}
\newcounter{definitionsubsection}[subsection]
\renewcommand{\thedefinitionsubsection}{\thesubsection.\arabic{definitionsubsection}}
\newcounter{definitionsubsubsection}[subsubsection]
\renewcommand{\thedefinitionsubsubsection}{\thesubsubsection.\arabic{definitionsubsubsection}}
\newcounter{definitionparagraph}[paragraph]
\renewcommand{\thedefinitionparagraph}{\theparagraph.\arabic{definitionparagraph}}
\newtcolorbox{definition}[2][]{
        mainboxstyle,
        colback=definitioncolor!5!white,
        colframe=definitioncolor!75!black,
        colbacktitle=definitioncolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=definitioncolor!75!black,
                fill=definitioncolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{definition}{\printLabel{definition}}
            };
        }, #1
    }

\newcommand{\inlinedefinition}[1][NONAME]{\inline[#1]{definition}}\newcommand{\shortdefinition}[1][NONAME]{\short[#1]{definition}}\newcounter{examplenone}
\newcounter{examplesection}[section]
\renewcommand{\theexamplesection}{\thesection.\arabic{examplesection}}
\newcounter{examplesubsection}[subsection]
\renewcommand{\theexamplesubsection}{\thesubsection.\arabic{examplesubsection}}
\newcounter{examplesubsubsection}[subsubsection]
\renewcommand{\theexamplesubsubsection}{\thesubsubsection.\arabic{examplesubsubsection}}
\newcounter{exampleparagraph}[paragraph]
\renewcommand{\theexampleparagraph}{\theparagraph.\arabic{exampleparagraph}}
\newtcolorbox{example}[2][]{
        mainboxstyle,
        colback=examplecolor!5!white,
        colframe=examplecolor!75!black,
        colbacktitle=examplecolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=examplecolor!75!black,
                fill=examplecolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{example}{\printLabel{example}}
            };
        }, #1
    }

\newcommand{\inlineexample}[1][NONAME]{\inline[#1]{example}}\newcommand{\shortexample}[1][NONAME]{\short[#1]{example}}\newcounter{theoremnone}
\newcounter{theoremsection}[section]
\renewcommand{\thetheoremsection}{\thesection.\arabic{theoremsection}}
\newcounter{theoremsubsection}[subsection]
\renewcommand{\thetheoremsubsection}{\thesubsection.\arabic{theoremsubsection}}
\newcounter{theoremsubsubsection}[subsubsection]
\renewcommand{\thetheoremsubsubsection}{\thesubsubsection.\arabic{theoremsubsubsection}}
\newcounter{theoremparagraph}[paragraph]
\renewcommand{\thetheoremparagraph}{\theparagraph.\arabic{theoremparagraph}}
\newtcolorbox{theorem}[2][]{
        mainboxstyle,
        colback=theoremcolor!5!white,
        colframe=theoremcolor!75!black,
        colbacktitle=theoremcolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=theoremcolor!75!black,
                fill=theoremcolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{theorem}{\printLabel{theorem}}
            };
        }, #1
    }

\newcommand{\inlinetheorem}[1][NONAME]{\inline[#1]{theorem}}\newcommand{\shorttheorem}[1][NONAME]{\short[#1]{theorem}}\newcounter{lemmanone}
\newcounter{lemmasection}[section]
\renewcommand{\thelemmasection}{\thesection.\arabic{lemmasection}}
\newcounter{lemmasubsection}[subsection]
\renewcommand{\thelemmasubsection}{\thesubsection.\arabic{lemmasubsection}}
\newcounter{lemmasubsubsection}[subsubsection]
\renewcommand{\thelemmasubsubsection}{\thesubsubsection.\arabic{lemmasubsubsection}}
\newcounter{lemmaparagraph}[paragraph]
\renewcommand{\thelemmaparagraph}{\theparagraph.\arabic{lemmaparagraph}}
\newtcolorbox{lemma}[2][]{
        mainboxstyle,
        colback=lemmacolor!5!white,
        colframe=lemmacolor!75!black,
        colbacktitle=lemmacolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=lemmacolor!75!black,
                fill=lemmacolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{lemma}{\printLabel{lemma}}
            };
        }, #1
    }

\newcommand{\inlinelemma}[1][NONAME]{\inline[#1]{lemma}}\newcommand{\shortlemma}[1][NONAME]{\short[#1]{lemma}}\newcounter{corollarynone}
\newcounter{corollarysection}[section]
\renewcommand{\thecorollarysection}{\thesection.\arabic{corollarysection}}
\newcounter{corollarysubsection}[subsection]
\renewcommand{\thecorollarysubsection}{\thesubsection.\arabic{corollarysubsection}}
\newcounter{corollarysubsubsection}[subsubsection]
\renewcommand{\thecorollarysubsubsection}{\thesubsubsection.\arabic{corollarysubsubsection}}
\newcounter{corollaryparagraph}[paragraph]
\renewcommand{\thecorollaryparagraph}{\theparagraph.\arabic{corollaryparagraph}}
\newtcolorbox{corollary}[2][]{
        mainboxstyle,
        colback=corollarycolor!5!white,
        colframe=corollarycolor!75!black,
        colbacktitle=corollarycolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=corollarycolor!75!black,
                fill=corollarycolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{corollary}{\printLabel{corollary}}
            };
        }, #1
    }

\newcommand{\inlinecorollary}[1][NONAME]{\inline[#1]{corollary}}\newcommand{\shortcorollary}[1][NONAME]{\short[#1]{corollary}}\newcounter{propositionnone}
\newcounter{propositionsection}[section]
\renewcommand{\thepropositionsection}{\thesection.\arabic{propositionsection}}
\newcounter{propositionsubsection}[subsection]
\renewcommand{\thepropositionsubsection}{\thesubsection.\arabic{propositionsubsection}}
\newcounter{propositionsubsubsection}[subsubsection]
\renewcommand{\thepropositionsubsubsection}{\thesubsubsection.\arabic{propositionsubsubsection}}
\newcounter{propositionparagraph}[paragraph]
\renewcommand{\thepropositionparagraph}{\theparagraph.\arabic{propositionparagraph}}
\newtcolorbox{proposition}[2][]{
        mainboxstyle,
        colback=propositioncolor!5!white,
        colframe=propositioncolor!75!black,
        colbacktitle=propositioncolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=propositioncolor!75!black,
                fill=propositioncolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{proposition}{\printLabel{proposition}}
            };
        }, #1
    }

\newcommand{\inlineproposition}[1][NONAME]{\inline[#1]{proposition}}\newcommand{\shortproposition}[1][NONAME]{\short[#1]{proposition}}\newcounter{axiomnone}
\newcounter{axiomsection}[section]
\renewcommand{\theaxiomsection}{\thesection.\arabic{axiomsection}}
\newcounter{axiomsubsection}[subsection]
\renewcommand{\theaxiomsubsection}{\thesubsection.\arabic{axiomsubsection}}
\newcounter{axiomsubsubsection}[subsubsection]
\renewcommand{\theaxiomsubsubsection}{\thesubsubsection.\arabic{axiomsubsubsection}}
\newcounter{axiomparagraph}[paragraph]
\renewcommand{\theaxiomparagraph}{\theparagraph.\arabic{axiomparagraph}}
\newtcolorbox{axiom}[2][]{
        mainboxstyle,
        colback=axiomcolor!5!white,
        colframe=axiomcolor!75!black,
        colbacktitle=axiomcolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=axiomcolor!75!black,
                fill=axiomcolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{axiom}{\printLabel{axiom}}
            };
        }, #1
    }

\newcommand{\inlineaxiom}[1][NONAME]{\inline[#1]{axiom}}\newcommand{\shortaxiom}[1][NONAME]{\short[#1]{axiom}}\newcounter{factnone}
\newcounter{factsection}[section]
\renewcommand{\thefactsection}{\thesection.\arabic{factsection}}
\newcounter{factsubsection}[subsection]
\renewcommand{\thefactsubsection}{\thesubsection.\arabic{factsubsection}}
\newcounter{factsubsubsection}[subsubsection]
\renewcommand{\thefactsubsubsection}{\thesubsubsection.\arabic{factsubsubsection}}
\newcounter{factparagraph}[paragraph]
\renewcommand{\thefactparagraph}{\theparagraph.\arabic{factparagraph}}
\newtcolorbox{fact}[2][]{
        mainboxstyle,
        colback=factcolor!5!white,
        colframe=factcolor!75!black,
        colbacktitle=factcolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=factcolor!75!black,
                fill=factcolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{fact}{\printLabel{fact}}
            };
        }, #1
    }

\newcommand{\inlinefact}[1][NONAME]{\inline[#1]{fact}}\newcommand{\shortfact}[1][NONAME]{\short[#1]{fact}}\newcounter{formulanone}
\newcounter{formulasection}[section]
\renewcommand{\theformulasection}{\thesection.\arabic{formulasection}}
\newcounter{formulasubsection}[subsection]
\renewcommand{\theformulasubsection}{\thesubsection.\arabic{formulasubsection}}
\newcounter{formulasubsubsection}[subsubsection]
\renewcommand{\theformulasubsubsection}{\thesubsubsection.\arabic{formulasubsubsection}}
\newcounter{formulaparagraph}[paragraph]
\renewcommand{\theformulaparagraph}{\theparagraph.\arabic{formulaparagraph}}
\newtcolorbox{formula}[2][]{
        mainboxstyle,
        colback=formulacolor!5!white,
        colframe=formulacolor!75!black,
        colbacktitle=formulacolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=formulacolor!75!black,
                fill=formulacolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{formula}{\printLabel{formula}}
            };
        }, #1
    }

\newcommand{\inlineformula}[1][NONAME]{\inline[#1]{formula}}\newcommand{\shortformula}[1][NONAME]{\short[#1]{formula}}\newcounter{remarknone}
\newcounter{remarksection}[section]
\renewcommand{\theremarksection}{\thesection.\arabic{remarksection}}
\newcounter{remarksubsection}[subsection]
\renewcommand{\theremarksubsection}{\thesubsection.\arabic{remarksubsection}}
\newcounter{remarksubsubsection}[subsubsection]
\renewcommand{\theremarksubsubsection}{\thesubsubsection.\arabic{remarksubsubsection}}
\newcounter{remarkparagraph}[paragraph]
\renewcommand{\theremarkparagraph}{\theparagraph.\arabic{remarkparagraph}}
\newtcolorbox{remark}[2][]{
        mainboxstyle,
        colback=remarkcolor!5!white,
        colframe=remarkcolor!75!black,
        colbacktitle=remarkcolor!75!black,
        title={\large #2},
        overlay={
            \node[overlaystyle,
                draw=remarkcolor!75!black,
                fill=remarkcolor!75!black
            ] at (frame.north east)
            {
                \large \tcbDescriptorTemplate{remark}{\printLabel{remark}}
            };
        }, #1
    }

\newcommand{\inlineremark}[1][NONAME]{\inline[#1]{remark}}\newcommand{\shortremark}[1][NONAME]{\short[#1]{remark}}\newcounter{combinednone}
\newcounter{combinedsection}[section]
\renewcommand{\thecombinedsection}{\thesection.\arabic{combinedsection}}
\newcounter{combinedsubsection}[subsection]
\renewcommand{\thecombinedsubsection}{\thesubsection.\arabic{combinedsubsection}}
\newcounter{combinedsubsubsection}[subsubsection]
\renewcommand{\thecombinedsubsubsection}{\thesubsubsection.\arabic{combinedsubsubsection}}
\newcounter{combinedparagraph}[paragraph]
\renewcommand{\thecombinedparagraph}{\theparagraph.\arabic{combinedparagraph}}
\newcommand{\inlinecombined}[1][NONAME]{\inline[#1]{combined}}\newcommand{\shortcombined}[1][NONAME]{\short[#1]{combined}}

\newcommand{\resetNumbering}{
    \setcounter{definitionnone}{0}
    \setcounter{definitionsection}{0}
    \setcounter{definitionsubsection}{0}
    \setcounter{definitionsubsubsection}{0}
    \setcounter{definitionparagraph}{0}

    \setcounter{examplenone}{0}
    \setcounter{examplesection}{0}
    \setcounter{examplesubsection}{0}
    \setcounter{examplesubsubsection}{0}
    \setcounter{exampleparagraph}{0}

    \setcounter{theoremnone}{0}
    \setcounter{theoremsection}{0}
    \setcounter{theoremsubsection}{0}
    \setcounter{theoremsubsubsection}{0}
    \setcounter{theoremparagraph}{0}

    \setcounter{lemmanone}{0}
    \setcounter{lemmasection}{0}
    \setcounter{lemmasubsection}{0}
    \setcounter{lemmasubsubsection}{0}
    \setcounter{lemmaparagraph}{0}

    \setcounter{corollarynone}{0}
    \setcounter{corollarysection}{0}
    \setcounter{corollarysubsection}{0}
    \setcounter{corollarysubsubsection}{0}
    \setcounter{corollaryparagraph}{0}

    \setcounter{propositionnone}{0}
    \setcounter{propositionsection}{0}
    \setcounter{propositionsubsection}{0}
    \setcounter{propositionsubsubsection}{0}
    \setcounter{propositionparagraph}{0}

    \setcounter{axiomnone}{0}
    \setcounter{axiomsection}{0}
    \setcounter{axiomsubsection}{0}
    \setcounter{axiomsubsubsection}{0}
    \setcounter{axiomparagraph}{0}

    \setcounter{factnone}{0}
    \setcounter{factsection}{0}
    \setcounter{factsubsection}{0}
    \setcounter{factsubsubsection}{0}
    \setcounter{factparagraph}{0}

    \setcounter{formulanone}{0}
    \setcounter{formulasection}{0}
    \setcounter{formulasubsection}{0}
    \setcounter{formulasubsubsection}{0}
    \setcounter{formulaparagraph}{0}

    \setcounter{remarknone}{0}
    \setcounter{remarksection}{0}
    \setcounter{remarksubsection}{0}
    \setcounter{remarksubsubsection}{0}
    \setcounter{remarkparagraph}{0}

    \setcounter{combinednone}{0}
    \setcounter{combinedsection}{0}
    \setcounter{combinedsubsection}{0}
    \setcounter{combinedsubsubsection}{0}
    \setcounter{combinedparagraph}{0}

    \setcounter{table}{0}
    \setcounter{figure}{0}
}
% ┌                                                ┐
% │                 STYLE: Globals                 │
% └                                                ┘
% ── Fonts ───────────────────────────────────────────────────────────
\newcommand{\setFont}[1]{\fontfamily{#1}\selectfont}
\newcommand{\setFontType}[1]{
    \ifthenelse{\equal{#1}{mono}}{
        \renewcommand{\familydefault}{\ttdefault}
    }{
        \ifthenelse{\equal{#1}{serif}}{
            \renewcommand{\familydefault}{\rmdefault}
        }{
            \renewcommand{\familydefault}{\sfdefault}
        }
    }
}

% ── Small common style elements ─────────────────────────────────────
% Spacing (vertical)
\newcommand{\rmvspace}[1][0.5]{\vspace{-#1pc}}

% Spacing (horizontal)
\newcommand{\smallhspace}{\hspace{2mm}}
\newcommand{\mediumhspace}{\hspace{5mm}}
\newcommand{\largehspace}{\hspace{1cm}}

% other elements
\renewcommand{\footrulewidth}{0.4pt}
\newcommand{\TODO}{\color{red} \hl{TODO:} \color{black}}
\newcommand{\bi}[1]{\textbf{\textit{#1}}}
\renewcommand{\quote}[1]{``\textit{#1}''}

% Add a color shade (similar to \fhlc, but nicer boxes)
\newcommand{\background}[3]{%
    \tcbox[on line,
        boxsep=\backgroundPadding,
        arc=\backgroundRounding,
        left=0pt,
        right=0pt,
        top=0pt,
        bottom=0pt,
        frame empty,
        colback=#1!#2!white,
        highlight math style={enhanced}
    ] {\textbf{#3}}%
}

% Abstraction of background, where the brightness is set to 20%
\newcommand{\shade}[2]{\background{#1}{\arabic{shadeStrength}}{#2}}

% This command is used for the short and inline descriptors
\newcommand{\bg}[2]{\background{#1}{\arabic{descriptorShadeStrength}}{#2}}

% Add a gray backdrop
\newcommand{\backdrop}[1]{\shade{black}{#1}}

% Print a table of contents as a tcolorbox
\newcommand{\printtoc}[1]{
    \renewcommand{\cfttoctitlefont}{}
    \renewcommand{\cftaftertoctitle}{\vspace{-0.75cm}}
    \renewcommand{\contentsname}{}
    \begin{tcolorbox}[
            colback=black!5!white,
            colbacktitle=#1!75!black,
            coltitle=black,
            enhanced,
            attach boxed title to top center={yshift=-2mm},
            title={\Large \tr{Contents}{Inhaltsverzeichnis}},
            fonttitle=\bfseries,
            breakable
        ]
        \hspace{1cm}
        \tableofcontents
    \end{tcolorbox}
}


% Draw box around links. First arg link, second arg display
\newcommand{\hlhref}[2]{\color{MidnightBlue}\fbox{\href{#1}{#2}}\color{black}}

% Same for urls (just one arg tho)
\newcommand{\hlurl}[1]{\color{MidnightBlue}\fbox{\url{#1}}\color{black}}

\makeatletter
\renewcommand\paragraph{%
    \@startsection{paragraph}{4}{0mm}%
    {-\baselineskip}%
    {.5\baselineskip}%
    {\normalfont\normalsize\bfseries}}
\makeatother


%  ___     _     _____       _    _ 
% (  _ \ _( )   (_   _)     ( )  ( )
% | (_) )_) |_    | |    __  \ \/ / 
% |  _ (| |  _ \  | |  / __ \ )  (  
% | (_) ) | |_) ) | | (  ___// /\ \ 
% (____/(_)_ __/  (_)  \____)_)  (_)

% Configs if you want to use BibTeX

\newcommand{\setupBibtex}[1]{
    \usepackage{biblatex}
    \usepackage[nottoc, numbib]{tocbibind}
    \addbibresource{#1}
}

\newcommand{\printbib}{
    \addcontentsline{toc}{section}{\translate{Sources}{Quellen}}
    \printbibliography[title=\translate{Sources}{Quellen}]
}


% Add glossaries functionality

\newcommand{\setupGlossary}{
    \usepackage[nonumberlist, toc]{glossaries}
    \usepackage[nottoc, numbib]{tocbibind}
    \makenoidxglossaries
}

\newcommand{\refgls}[1]{\textbf{\gls{#1}}}
\newcommand{\refacr}[1]{\textbf{\acrshort{#1}}}

\newcommand{\printGlossary}{
    \glsaddall
    \printnoidxglossaries
}


% ┌                                                ┐
% │                      Math                      │
% └                                                ┘

% BB shortcuts (for number spaces, etc)
\newcommand{\A}{\ensuremath{\mathbb{A}}}
\newcommand{\B}{\ensuremath{\mathbb{B}}}
\newcommand{\C}{\ensuremath{\mathbb{C}}}
\newcommand{\D}{\ensuremath{\mathbb{D}}}
\newcommand{\E}{\ensuremath{\mathbb{E}}}
\newcommand{\F}{\ensuremath{\mathbb{F}}}
\newcommand{\G}{\ensuremath{\mathbb{G}}}
\renewcommand{\H}{\ensuremath{\mathbb{H}}}
\newcommand{\I}{\ensuremath{\mathbb{I}}}
\newcommand{\J}{\ensuremath{\mathbb{J}}}
\newcommand{\K}{\ensuremath{\mathbb{K}}}
\renewcommand{\L}{\ensuremath{\mathbb{L}}}
\newcommand{\M}{\ensuremath{\mathbb{M}}}
\newcommand{\N}{\ensuremath{\mathbb{N}}}
\renewcommand{\O}{\ensuremath{\mathbb{O}}}
\renewcommand{\P}{\ensuremath{\mathbb{P}}}
\newcommand{\Q}{\ensuremath{\mathbb{Q}}}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\renewcommand{\S}{\ensuremath{\mathbb{S}}}
\newcommand{\T}{\ensuremath{\mathbb{T}}}
\newcommand{\U}{\ensuremath{\mathbb{U}}}
\newcommand{\V}{\ensuremath{\mathbb{V}}}
\newcommand{\W}{\ensuremath{\mathbb{W}}}
\newcommand{\X}{\ensuremath{\mathbb{X}}}
\newcommand{\Y}{\ensuremath{\mathbb{Y}}}
\newcommand{\Z}{\ensuremath{\mathbb{Z}}}

% Caligraphic
\newcommand{\cA}{\ensuremath{\mathcal{A}}}
\newcommand{\cB}{\ensuremath{\mathcal{B}}}
\newcommand{\cC}{\ensuremath{\mathcal{C}}}
\newcommand{\cD}{\ensuremath{\mathcal{D}}}
\newcommand{\cE}{\ensuremath{\mathcal{E}}}
\newcommand{\cF}{\ensuremath{\mathcal{F}}}
\newcommand{\cG}{\ensuremath{\mathcal{G}}}
\newcommand{\cH}{\ensuremath{\mathcal{H}}}
\newcommand{\cI}{\ensuremath{\mathcal{I}}}
\newcommand{\cJ}{\ensuremath{\mathcal{J}}}
\newcommand{\cK}{\ensuremath{\mathcal{K}}}
\newcommand{\cL}{\ensuremath{\mathcal{L}}}
\newcommand{\cM}{\ensuremath{\mathcal{M}}}
\newcommand{\cN}{\ensuremath{\mathcal{N}}}
\newcommand{\cO}{\ensuremath{\mathcal{O}}}
\newcommand{\cP}{\ensuremath{\mathcal{P}}}
\newcommand{\cQ}{\ensuremath{\mathcal{Q}}}
\newcommand{\cR}{\ensuremath{\mathcal{R}}}
\newcommand{\cS}{\ensuremath{\mathcal{S}}}
\newcommand{\cT}{\ensuremath{\mathcal{T}}}
\newcommand{\cU}{\ensuremath{\mathcal{U}}}
\newcommand{\cV}{\ensuremath{\mathcal{V}}}
\newcommand{\cW}{\ensuremath{\mathcal{W}}}
\newcommand{\cX}{\ensuremath{\mathcal{X}}}
\newcommand{\cY}{\ensuremath{\mathcal{Y}}}
\newcommand{\cZ}{\ensuremath{\mathcal{Z}}}

% other useful shortcuts
\newcommand{\elementstack}[2]{\genfrac{}{}{0pt}{}{#1}{#2}}
\newcommand{\8}{\infty}
\newcommand{\cond}{\text{cond}}
\newcommand{\argmin}[1]{\underset{#1}{\text{argmin}}}
\newcommand{\dx}{\text{ d}}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\ceil}[1]{\left\lceil #1 \right\rceil}
\newcommand{\Leftrightarrowequiv}{\overset{\cdot}{\Leftrightarrow}}
\newcommand{\Longleftrightarrowequiv}{\overset{\cdot}{\Longleftrightarrow}}
\newcommand{\Rightarrowequiv}{\overset{\cdot}{\Rightarrow}}
\newcommand{\Leftarrowequiv}{\overset{\cdot}{\Leftarrow}}
\newcommand{\defAs}{\overset{\text{def}}{=}}
\newcommand{\defEquiv}{\overset{\text{def}}{\Leftrightarrow}}
\newcommand{\defImplies}{\overset{\text{def}}{\Rightarrow}}
\newcommand{\diff}[1]{\frac{\mbox{d}}{\mbox{d}#1}}
\newcommand{\diffn}[2]{\frac{\mbox{d}^{#2}}{\mbox{d}^{#2}#1}}
\newcommand{\pardiff}[1]{\frac{\partial}{\partial #1}}
\newcommand{\pardiffn}[2]{\frac{\partial^{#2}}{\partial^{#2} #1}}
\newcommand{\divider}{\hspace{0.25em}|\hspace{0.25em}}
\newcommand{\lcm}{\text{lcm}}
\newcommand{\limit}[2]{\underset{#1 \rightarrow #2}{\lim}}
\newcommand{\limni}{\limit{n}{\infty}}
\newcommand{\limnz}{\limit{n}{0}}
\newcommand{\limxz}{\limit{x_0}{0}}
\newcommand{\limhz}{\limit{h}{0}}
\newcommand{\liminfni}{\liminf_{n \rightarrow \infty}}
\newcommand{\limsupni}{\limsup_{n \rightarrow \infty}}
\newcommand{\sequence}[1]{\ensuremath{(#1_n)_{n \geq 1}}}
\newcommand{\series}[2]{\ensuremath{\sum_{k = 1}^{#2} #1_k}}

\DeclareMathOperator\arctanh{arctanh}
\DeclareMathOperator\arccosh{arccosh}
\DeclareMathOperator\arcsinh{arcsinh}


% ┌                                                ┐
% │                     Minted                     │
% └                                                ┘
\usepackage{minted}
\usepackage{fancyvrb}

% Args: Language, Code
\newenvironment{code}[1]{
    \VerbatimEnvironment
    \begin{minted}[
    autogobble,
    breaklines,
    breakindentnchars=2,
    frame=lines,
    framesep=2mm,
    mathescape,
    baselinestretch=1.1,
    linenos
    ]{#1}}
{\end{minted}}

% Args: Language, file relative to root file
\newcommand{\inputcode}[2]{
    \inputminted[
        autogobble,
        breaklines,
        breakindentnchars=2,
        frame=lines,
        framesep=2mm,
        mathescape,
        baselinestretch=1.1,
        linenos
    ]{#1}{#2}
}

% Args: Language, Base directory (with trailing slash), file (no slash at start)
\newcommand{\inputcodewithfilename}[3]{
    \begin{figure}[h!]
        \texttt{File: \detokenize{#3}}
        \rmvspace
        \inputcode{#1}{#2#3}
    \end{figure}
}


% ┌                                                ┐
% │                     Setup                      │
% └                                                ┘
% Set up the latex document, configure author, title (as first argument), as well as headers and footers
\newcommand{\setup}[1]{
    \typeout{[Setup] Setting up...}
    \usepackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
    \title{\Huge \textbf{#1}}
    \author{\authorTitle}
    \makeatletter
    \makeatother
    \fancyhead{}
    \fancyhead[L]{#1}
    \fancyhead[R]{\authorHeaders}
    \fancyfoot{}
    \fancyfoot[L]{\today}
    \fancyfoot[R]{\thepage\ /\ \pageref{LastPage}}
    \fancypagestyle{plain}{%
        \fancyhead{}
        \fancyhead[L]{#1}
        \fancyhead[R]{\authorHeaders}
        \fancyfoot{}
        \fancyfoot[L]{\today}
        \fancyfoot[R]{\thepage\ /\ \pageref{LastPage}}
    }
}

% Set up the latex document, only configuring the author, title and page size
\newcommand{\setupBarebones}[1]{
    \usepackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
    \title{\Huge \textbf{#1}}
    \author{\authorTitle}
}


% Set up the latex document for exam summaries (Extra wide body, small margins, no header)
\newcommand{\setupCheatSheet}[2][true]{
    \ifthenelse{\equal{#1}{true}}{
        \usepackage[a4paper,textwidth=28.5cm,textheight=20cm,landscape]{geometry}
        \usepackage{flowfram}
        \ffvadjustfalse
        \setlength{\columnsep}{1cm}
        \Ncolumn{3}
    }{
        \usepackage[a4paper,textwidth=28.5cm,textheight=20cm]{geometry}
    }
    \title{\Huge \textbf{#2}}
    \author{\authorTitle}
}


% ┌                                                ┐
% │                 Document start                 │
% └                                                ┘
% Start document command (required)
\newcommand{\startDocument}{
    % TODO: Cheat sheet needs different setup?
    \maketitle
    \pagestyle{fancy}
    \thispagestyle{fancy}

    \tcbset{
        mainboxstyle/.style={
                arc=3mm,
                colback=red!5!white,
                colframe=red!75!black,
                colbacktitle=red!75!black,
                fonttitle=\bfseries,
                enhanced,
                attach boxed title to top left={yshift=-2mm,xshift=5mm},
                breakable,
                top=0.4cm,
            }
    }
    \tikzset{
        overlaystyle/.style={
                draw=red!75!black,
                thick,
                fill=red!75!black,
                left,
                anchor=east,
                text=white,
                rounded corners=1mm,
                font=\bfseries,
                xshift=-5mm,
                yshift=1mm,
                inner xsep=3mm,
                inner ysep=1.5mm
            }
    }
}


% ┌                                                ┐
% │                  Translation                   │
% └                                                ┘
\newcommand{\translate}[2]{%
    \ifthenelse{\equal{\currentLanguage}{en}}{#1}{#2}%
}
\newcommand{\tr}[2]{\translate{#1}{#2}}
\newcommand{\safetr}[2]{\protecting{\translate{#1}{#2}}}
\newcommand{\namingTranslate}[1]{\translate{\printTranslationOptionEN{#1}}{\printTranslationOptionDE{#1}}}
\newcommand{\shortNamingTranslate}[1]{\translate{\printShortTranslationOptionEN{#1}}{\printShortTranslationOptionDE{#1}}}

% Translation aids (commonly used)
\newcommand{\trif}{\translate{if }{falls }}
\newcommand{\trIf}{\translate{If }{Falls }}
\newcommand{\trLet}{\translate{Let }{Sei }}
\newcommand{\trLets}{\translate{Let }{Seien }}
\newcommand{\trFor}{\translate{For }{Für }}
\newcommand{\trfor}{\translate{for }{für }}
\newcommand{\trand}{\translate{and }{und }}
\newcommand{\tror}{\translate{or }{oder }}
\newcommand{\trst}{\translate{s.t. }{s.d. }}
\newcommand{\trsuchthat}{\translate{such that }{so dass }}
\newcommand{\trwith}{\translate{with }{mit }}


% ┌                                                ┐
% │                     Index                      │
% └                                                ┘

% For using index package
\newcommand{\prepareIndex}{
    \usepackage[T1]{fontenc}
    \usepackage{imakeidx}
    \makeindex
}

\newcommand{\addIndexBold}[1]{\textbf{\index{\MakeLowercase{#1}} #1}}
\newcommand{\addIndexBI}[1]{\textbf\textit{{\index{\MakeLowercase{#1}} #1}}}
\newcommand{\addIndexItalic}[1]{\textit{\index{\MakeLowercase{#1}} #1}}
\newcommand{\addIndex}[1]{\index{\MakeLowercase{#1}} #1}




% ░▒█▀▀▄░▄▀▀▄░█▀▄▀█░▄▀▀▄░█░▒█░▀█▀░█▀▀░█▀▀▄░░░▒█▀▀▀█░█▀▄░░▀░░█▀▀░█▀▀▄░█▀▄░█▀▀
% ░▒█░░░░█░░█░█░▀░█░█▄▄█░█░▒█░░█░░█▀▀░█▄▄▀░░░░▀▀▀▄▄░█░░░░█▀░█▀▀░█░▒█░█░░░█▀▀
% ░▒█▄▄▀░░▀▀░░▀░░▒▀░█░░░░░▀▀▀░░▀░░▀▀▀░▀░▀▀░░░▒█▄▄▄█░▀▀▀░▀▀▀░▀▀▀░▀░░▀░▀▀▀░▀▀▀

% Extra imports
\usepackage{stmaryrd}
\usepackage{algorithm}
\usepackage{algpseudocodex}
\usepackage{setspace}
\usepackage{verbatim}
\usepackage{turnstile}
\usepackage{forloop}

\newcommand{\Indent}{\hspace{\algorithmicindent}}

\newcommand{\tct}[1]{\ensuremath{\Theta\left(#1\right)}}
\newcommand{\tco}[1]{\ensuremath{\mathcal{O}\left(#1\right)}}
\newcommand{\tcl}[1]{\ensuremath{\Omega\left(#1\right)}}
\newcommand{\wordbool}{(\Sigma_{\text{bool}})^*}
\newcommand{\words}[1]{(\Sigma_{\text{#1}})^*}
\newcommand{\word}{\Sigma^*}
\newcommand{\wordm}[1]{\Sigma_{\text{#1}}^*}
\newcommand{\alphabets}[1]{\Sigma_{\text{#1}}}
\newcommand{\alphabetbool}{\Sigma_{\text{bool}}}
\newcommand{\tR}{\text{R}}
\newcommand{\tC}{\text{C}}
\newcommand{\tN}{\text{N}}
\newcommand{\bigvdash}[2]{\sststile{#1}{#2}}
\newcommand{\class}{\text{\tr{Cl}{Kl}}}


% ┌                                                ┐
% │                     Tables                     │
% └                                                ┘

\usepackage{booktabs}
\usepackage{tabulary}

% Create new table. #1 Layout, #2 title row
\newenvironment{tables}[2]{
    \begin{center}
        \begin{tabular}{#1}
            \toprule
            #2 \\
            \midrule
            }{
            \bottomrule
        \end{tabular}
    \end{center}
}

% Create new table in table env. #1 layout, #2 title row, #3 caption
\newenvironment{fullTable}[3]{
    \edef\tableCaption{#3}
    \begin{table}[h!]
        \begin{tables}{#1}{#2}
            }{
        \end{tables}
        \caption{\tableCaption}
    \end{table}
}


% ┌                                                ┐
% │               Counter numbering                │
% └                                                ┘
\newcommand{\preEnvHook}[1]{%
    \stepLabelNumber{combined}%
    \ifthenelse{\equal{\numberingpreset}{combined}}{%
        \ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{default}}{
            \stepLabelNumber{combined}%
        }{}%
    }{%
        \ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{combined}}{%
            \stepLabelNumber{combined}%
        }{}%
    }%
}

% Decides on the numbering to use (combined or not)
\newcommand{\loadNumberingConfiguration}{%
    \ifthenelse{\boolean{numberingDisabled}}{%
        \renewcommand{\thetable}{\arabic{table}}
        \renewcommand{\thefigure}{\arabic{figure}}
    }{
        \ifthenelse{\equal{\numberingpreset}{combined}}{%
            \ifthenelse{\equal{\subsectionnumbering}{none}}{
                \renewcommand{\thetable}{\arabic{combinednone}}
                \renewcommand{\thefigure}{\arabic{combinednone}}
            }{%
                \renewcommand{\thetable}{\ssprinter.\arabic{combined\subsectionnumbering}}
                \renewcommand{\thefigure}{\ssprinter.\arabic{combined\subsectionnumbering}}
            }%
        }{%
            \ifthenelse{\equal{\numberingpreset}{separate}}{
                \ifthenelse{\equal{\subsectionnumbering}{none}}{}{
                    \renewcommand{\thetable}{\ssprinter.\arabic{table}}
                    \renewcommand{\thefigure}{\ssprinter.\arabic{figure}}
                }
            }{%
                \renewcommand{\thetable}{\arabic{table}}
                \renewcommand{\thefigure}{\arabic{figure}}
            }%
        }%
    }%
}

% Prints the preceding subsection numbers
\newcommand{\ssprinter}{\thesection}
\newcommand{\generateSubsection}{%
    \ifthenelse{\equal{\subsectionnumbering}{section}}{%
        \renewcommand{\ssprinter}{\thesection}
    }{%
        \ifthenelse{\equal{\subsectionnumbering}{subsection}}{%
            \renewcommand{\ssprinter}{\thesubsection}
        }{%
            \ifthenelse{\equal{\subsectionnumbering}{subsubsection}}{%
                \renewcommand{\ssprinter}{\thesubsubsection}
            }{%
                \ifthenelse{\equal{\subsectionnumbering}{paragraph}}{%
                    \renewcommand{\ssprinter}{\theparagraph}
                }{
                    \renewcommand{\ssprinter}{}
                }%
            }%
        }%
    }%
}
\loadNumberingConfiguration

\AtBeginEnvironment{table}{\preEnvHook{table}}
\AtBeginEnvironment{figure}{\preEnvHook{figure}}


% ── Set the current number of a label ───────────────────────────────
\newcommand{\setLabelNumber}[2]{%
    \setcounter{#1none}{#2}%
    \addtocounter{#1none}{-1}%
    \setcounter{#1section}{#2}%
    \addtocounter{#1section}{-1}%
    \setcounter{#1subsection}{#2}%
    \addtocounter{#1subsection}{-1}%
    \setcounter{#1subsubsection}{#2}%
    \addtocounter{#1subsubsection}{-1}%
    \setcounter{#1paragraph}{#2}%
    \addtocounter{#1paragraph}{-1}%
}

\newcommand{\stepLabelNumber}[1]{%
    \stepcounter{#1none}%
    \stepcounter{#1section}%
    \stepcounter{#1subsection}%
    \stepcounter{#1subsubsection}%
    \stepcounter{#1paragraph}%
}


\newcommand{\newsection}{%
    \newpage
    \newsectionNoPB
}

\newcommand{\newsectionNoPB}{
    \ifthenelse{\equal{\numberingpreset}{off}}{}{%
        \resetNumbering%
        \resetTableAndFigureNumbering%
    }%
}

\newcommand{\resetTableAndFigureNumbering}{%
    \ifthenelse{\equal{\printNumberingConfigForDescriptor{table}}{combined}}{
        \setcounter{table}{0}
    }{}%
    \ifthenelse{\equal{\printNumberingConfigForDescriptor{table}}{default}}{
        \setcounter{table}{0}
    }{}%
    \ifthenelse{\equal{\printNumberingConfigForDescriptor{figure}}{combined}}{%
        \setcounter{figure}{0}
    }{}%
    \ifthenelse{\equal{\printNumberingConfigForDescriptor{figure}}{default}}{
        \setcounter{figure}{0}
    }{}%
}


% Numbering toggling
\newcommand{\numberingOff}{
    \setboolean{numberingDisabled}{true}
    \loadNumberingConfig
}
\newcommand{\numberingOn}{
    \setboolean{numberingDisabled}{false}
    \loadNumberingConfig
}

\newcommand{\setsubsectionnumbering}[1]{
    \renewcommand{\subsectionnumbering}{#1}
    \loadNumberingConfiguration
}

\newcommand{\setnumberingpreset}[1]{
    \renewcommand{\numberingpreset}{#1}
    \loadNumberingConfiguration
}


% ── Label generator ─────────────────────────────────────────────────
\newcommand{\printNumberingConfigForDescriptor}[1]{\csname #1numbering\endcsname}
\newcommand{\printCounter}[1]{\refstepcounter{#1}\csname the#1\endcsname}

\newcommand{\printLabel}[1]{%
    \ifthenelse{\boolean{numberingDisabled}}{%
%
    }{%
        \ifcsdef{#1numbering}{% Extra config present
            \ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{default}}{%
                \labelPrintBackendRoutine{#1}%
            }{%
                \ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{separate}}{%
                    \printCounter{#1\subsectionnumbering}%
                }{%
                    \ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{combined}}{%
                        \printCounter{combined\subsectionnumbering}%
                    }{%
%
                    }%
                }%
            }%
        }{%
            \labelPrintBackendRoutine{#1}%
        }%
    }%
}

\newcommand{\labelPrintBackendRoutine}[1]{%
    \ifthenelse{\equal{\numberingpreset}{combined}}{%
        \printCounter{combined\subsectionnumbering}%
    }{%
        \ifthenelse{\equal{\numberingpreset}{separate}}{%
            \printCounter{#1\subsectionnumbering}%
        }{%
%
        }%
    }%
}


\newcommand{\noverticalspacing}{
    \titlespacing*{\section}{0pt}{2pt plus 2pt minus 1pt}{2pt plus 2pt minus 2pt}
    \titlespacing*{\subsection}{0pt}{1pt plus 2pt minus 1pt}{1pt plus 2pt minus 1pt}
    \titlespacing*{\subsubsection}{0pt}{1pt plus 1pt minus 1pt}{1pt plus 1pt minus 1pt}
    \titlespacing*{\paragraph}{0pt}{0pt plus 1pt minus 0pt}{1pt plus 0pt minus 1pt}
    \abovedisplayskip 1pt plus 2pt minus 1pt
    \belowdisplayskip 1pt plus 2pt minus 1pt
    \abovedisplayshortskip -10pt
    \belowdisplayshortskip 1pt plus 2pt minus 1pt
    \floatsep 1pt plus 2pt minus 1pt
    \intextsep 1pt plus 2pt minus 1pt
    \textfloatsep 1pt plus 2pt minus 1pt
    \multicolsep 1pt plus 2pt minus 1pt
    \abovecaptionskip 2pt
    \setlist{noitemsep,topsep=1pt,partopsep=0pt}
}
\newcommand{\smallverticalspacing}{
    \titlespacing*{\section}{0pt}{4pt plus 3pt minus 2pt}{3pt plus 2pt minus 1pt}
    \titlespacing*{\subsection}{0pt}{3pt plus 2pt minus 1pt}{2pt plus 2pt minus 0pt}
    \titlespacing*{\subsubsection}{0pt}{2pt plus 2pt minus 1pt}{2pt plus 1pt minus 0pt}
    \titlespacing*{\paragraph}{0pt}{1pt plus 1pt minus 1pt}{1pt plus 0pt minus 0pt}
    \abovedisplayskip 4pt plus 3pt minus 2pt
    \belowdisplayskip 5pt plus 5pt minus 2pt
    \abovedisplayshortskip -5pt
    \belowdisplayshortskip 3pt plus 4pt minus 2pt
    \floatsep 4pt plus 3pt minus 2pt
    \intextsep 4pt plus 3pt minus 2pt
    \textfloatsep 4pt plus 3pt minus 2pt
    \multicolsep 4pt plus 3pt minus 2pt
    \abovecaptionskip 4pt
    \setlist{itemsep=2pt,topsep=2pt,partopsep=1pt}
}
\newcommand{\mediumverticalspacing}{
    \titlespacing*{\section}{0pt}{6pt plus 2pt minus 2pt}{4pt plus 2pt minus 2pt}
    \titlespacing*{\subsection}{0pt}{4pt plus 2pt minus 2pt}{3pt plus 2pt minus 1pt}
    \titlespacing*{\subsubsection}{0pt}{3pt plus 1pt minus 1pt}{2pt plus 1pt minus 0pt}
    \titlespacing*{\paragraph}{0pt}{2pt plus 1pt minus 1pt}{1pt plus 0pt minus 0pt}
    \abovedisplayskip 7pt plus 4pt minus 3pt
    \belowdisplayskip 9pt plus 6pt minus 3pt
    \abovedisplayshortskip 0pt
    \belowdisplayshortskip 5pt plus 4pt minus 2pt
    \floatsep 7pt plus 4pt minus 3pt
    \intextsep 7pt plus 4pt minus 3pt
    \textfloatsep 7pt plus 4pt minus 3pt
    \multicolsep 7pt plus 4pt minus 3pt
    \abovecaptionskip 7pt
    \setlist{itemsep=4pt,topsep=4pt,partopsep=2pt}
}
\newcommand{\largeverticalspacing}{
    \titlespacing*{\section}{0pt}{8pt plus 2pt minus 4pt}{5pt plus 2pt minus 3pt}
    \titlespacing*{\subsection}{0pt}{6pt plus 2pt minus 3pt}{4pt plus 2pt minus 2pt}
    \titlespacing*{\subsubsection}{0pt}{4pt plus 1pt minus 2pt}{3pt plus 1pt minus 1pt}
    \titlespacing*{\paragraph}{0pt}{3pt plus 1pt minus 1pt}{2pt plus 1pt minus 1pt}
    \abovedisplayskip 13pt plus 5pt minus 4pt
    \belowdisplayskip 15pt plus 9pt minus 6pt
    \abovedisplayshortskip 5pt plus 2pt minus 3pt
    \belowdisplayshortskip 7pt plus 5pt minus 2pt
    \floatsep 12pt plus 5pt minus 4pt
    \intextsep 12pt plus 5pt minus 4pt
    \textfloatsep 12pt plus 5pt minus 4pt
    \multicolsep 12pt plus 5pt minus 4pt
    \abovecaptionskip 10pt
    \setlist{itemsep=6pt,topsep=6pt,partopsep=2pt}
}


% ┌                                                ┐
% │           STYLE: Common tcolorboxes            │
% └                                                ┘

\newtcolorbox{recall}[2][]{mainboxstyle,colback=recallcolor!5!white,colframe=recallcolor!75!black,colbacktitle=recallcolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=recallcolor!75!black,fill=recallcolor!75!black] at (frame.north east) {\large \namingTranslate{recall}};},#1}

\newtcolorbox{properties}[2][]{mainboxstyle,colback=propertiescolor!5!white,colframe=propertiescolor!75!black,colbacktitle=propertiescolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=propertiescolor!75!black,fill=propertiescolor!75!black] at (frame.north east) {\large \namingTranslate{properties}};},#1}

\newtcolorbox{restrictions}[2][]{mainboxstyle,colback=propertiescolor!5!white,colframe=propertiescolor!75!black,colbacktitle=propertiescolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=propertiescolor!75!black,fill=propertiescolor!75!black] at (frame.north east) {\large \namingTranslate{restrictions}};},#1}

\newtcolorbox{limitations}[2][]{mainboxstyle,colback=propertiescolor!5!white,colframe=propertiescolor!75!black,colbacktitle=propertiescolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=propertiescolor!75!black,fill=propertiescolor!75!black] at (frame.north east) {\large \namingTranslate{limitations}};},#1}

\newtcolorbox{intuition}[2][]{mainboxstyle,colback=intuitioncolor!5!white,colframe=intuitioncolor!75!black,colbacktitle=intuitioncolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=intuitioncolor!75!black,fill=intuitioncolor!75!black] at (frame.north east) {\large \namingTranslate{intuition}};},#1}

\newcommand{\inlineintuition}{\bg{intuitioncolor}{Intuition:}}


% Terms and notation
\newtcolorbox{terms}[2][]{mainboxstyle,colback=termcolor!5!white,colframe=termcolor!75!black,colbacktitle=termcolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=termcolor!75!black,fill=termcolor!75!black] at (frame.north east) {\large \namingTranslate{terms}};},#1}

\newtcolorbox{notation}[2][]{mainboxstyle,colback=notationcolor!5!white,colframe=notationcolor!75!black,colbacktitle=notationcolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=notationcolor!75!black,fill=notationcolor!75!black] at (frame.north east) {\large \namingTranslate{notation}};},#1}


\newtcolorbox{usage}[2][]{mainboxstyle,colback=usagecolor!5!white,colframe=usagecolor!75!black,colbacktitle=usagecolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=usagecolor!75!black,fill=usagecolor!75!black] at (frame.north east) {\large \namingTranslate{usage}};},#1}


% Task
\newtcolorbox{task}[2][]{mainboxstyle,colback=taskcolor!5!white,colframe=taskcolor!75!black,colbacktitle=taskcolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=taskcolor!75!black,fill=taskcolor!75!black] at (frame.north east) {\large \namingTranslate{task}};},#1}


% Proof
\newtcolorbox{proof}[2][]{mainboxstyle,colback=proofcolor!5!white,colframe=proofcolor!75!black,colbacktitle=proofcolor!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=proofcolor!75!black,fill=proofcolor!75!black] at (frame.north east) {\large \namingTranslate{proof}};},#1}


% General
\newtcolorbox{general}[4][]{mainboxstyle,colback=#4!5!white,colframe=#4!75!black,colbacktitle=#4!75!black,title={\large #2},
    overlay={\node[overlaystyle,draw=#4!75!black,fill=#4!75!black] at (frame.north east) {\large #3};},#1}

% Simple
\newtcolorbox{simplebox}[2][]{colback=#2!5!white,colframe=#2!75!black,#1}


% ┌                                                ┐
% │                  STYLE: Math                   │
% └                                                ┘

% Add shortcuts to commonly used commands
\newcommand{\vect}[1]{\overrightarrow{#1}}
\renewcommand{\hat}[1]{\widehat{#1}}
\renewcommand{\tilde}[1]{\widetilde{#1}}
\newcommand{\proven}{$\hspace{17cm}\square$}


% ── Inline environments ─────────────────────────────────────────────
% TODO: ref label generation
\newcommand{\inline}[2][NONAME]{%
    \ifthenelse{\equal{NONAME}{#1}}{%
        \anonymousInlineDescriptorTemplate{#2}{\printLabel{#2}}%
    }{%
        \inlineDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
    }%
}

\newcommand{\labeledInline}[3][NONAME]{%
    \edef{\tempLabel}{#3}
    \label{\tempLabel}
    \inline[#1]{#2}
}

\newcommand{\unnumberedInline}[2][NONAME]{%
    \ifthenelse{\equal{NONAME}{#1}}{%
        \anonymousInlineDescriptorTemplate{#2}{}%
    }{%
        \inlineDescriptorTemplate{#2}{}{#1}%
    }%
}

\newcommand{\short}[2][NONAME]{%
    \ifthenelse{\equal{NONAME}{#1}}{%
        \anonymousShortDescriptorTemplate{#2}{\printLabel{#2}}%
    }{%
        \shortDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
    }%
}

\newcommand{\labeledShort}[3][NONAME]{%
    \edef{\tempLabel}{#3}
    \label{\tempLabel}
    \short[#1]{#2}
}

\newcommand{\unnumberedShort}[2][NONAME]{%
    \ifthenelse{\equal{NONAME}{#1}}{%
        \anonymousShortDescriptorTemplate{#2}{}%
    }{%
        \shortDescriptorTemplate{#2}{}{#1}%
    }%
}

\newcommand{\inlineproof}[1][NONAME]{\unnumberedInline[#1]{proof}}
\newcommand{\inlineterm}[1][NONAME]{\unnumberedInline[#1]{term}}
\newcommand{\inlinenotation}[1][NONAME]{\unnumberedInline[#1]{notation}}

\newcommand{\shortproof}[1][NONAME]{\unnumberedShort[#1]{proof}}
\newcommand{\shortterm}[1][NONAME]{\unnumberedShort[#1]{term}}
\newcommand{\shortnotation}[1][NONAME]{\unnumberedShort[#1]{notation}}


% ┌                                                ┐
% │            STYLE: Computer Science             │
% └                                                ┘
\usepackage{forest}
\tikzset{algpxIndentLine/.style={draw=lightgray}}
\algrenewcommand{\alglinenumber}[1]{#1}

\newenvironment{algo}[1]{
    \begin{algorithm}
        \begin{spacing}{1.2}
            \caption{\textsc{#1}}
            \begin{algorithmic}[1]
                }{
            \end{algorithmic}
        \end{spacing}
    \end{algorithm}
}


\endinput