Update some old commands

This commit is contained in:
2026-02-21 11:32:53 +01:00
parent 2c37a724ee
commit 2a592753bf
9 changed files with 404 additions and 198 deletions

View File

@@ -1,7 +1,7 @@
# Auto-generate labels and version numbers
def generate_labels():
data = ""
reset_func = "\\newcommand{\\newsectionNoPB}{"
reset_func = "\\newcommand{\\resetNumbering}{"
for label in [
"definition",

View File

@@ -159,6 +159,8 @@
\newcommand{\usagenumbering}{default}
\newcommand{\recallnumbering}{default}
\newcommand{\propertiesnumbering}{default}
\newcommand{\tablenumbering}{default}
\newcommand{\figurenumbering}{default}
% ┌ ┐
@@ -449,7 +451,7 @@
\renewcommand{\thecombineparagraph}{\theparagraph.\arabic{combineparagraph}}
\newcommand{\inlinecombine}[1][NONAME]{\inline[#1]{combine}}\newcommand{\shortcombine}[1][NONAME]{\short[#1]{combine}}
\newcommand{\newsectionNoPB}{
\newcommand{\resetNumbering}{
\setcounter{definitionnone}{0}
\setcounter{definitionsection}{0}
\setcounter{definitionsubsection}{0}
@@ -595,6 +597,27 @@
}
% ___ _ _____ _ _
% ( _ \ _( ) (_ _) ( ) ( )
% | (_) )_) |_ | | __ \ \/ /
% | _ (| | _ \ | | / __ \ ) (
% | (_) ) | |_) ) | | ( ___// /\ \
% (____/(_)_ __/ (_) \____)_) (_)
% 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}]
}
% ┌ ┐
% │ Math │
% └ ┘
@@ -790,6 +813,170 @@
}
% ── 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}%
}{}%
}%
}
% ── 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}%
}
% ┌ ┐
% │ Counter numbering │
% └ ┘
\newcommand{\preEnvHook}[1]{%
\ifthenelse{\boolean{numberingDisabled}}{}{
\ifthenelse{\equal{\numberingpreset}{combined} \AND \equal{\printNumberingConfigForDescriptor{#1}}{default}}{%
\stepLabelNumber{combined}%
}{%
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{combined}}{%
\stepLabelNumber{combined}%
}{}%
}%
}%
}
% Decides on the numbering to use (combined or not)
\newcommand{\tableAndFigureNumberingHelper}[1]{%
\ifthenelse{\boolean{numberingDisabled}}{}{
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}{default}}}{% Using default
\ifthenelse{\equal{\numberingpreset}{combined}}{%
\tableAndFigureSubsectionPrinting{\value{combined\subsectionnumbering}}%
}{%
\ifthenelse{\equal{\numberingpreset}{separate}}{%
\tableAndFigureSubsectionPrinting{\value{#1}}%
}{}%
}%
}{% if we get here, default has been changed
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}{combined}}}{%
\tableAndFigureSubsectionPrinting{\value{combined\subsectionnumbering}}%
}{%
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}{separate}}}{%
\tableAndFigureSubsectionPrinting{\value{#1}}%
}{}%
}%
}%
}%
}
% Prints the preceding subsection numbers
\newcommand{\tableAndFigureSubsectionPrinting}[1]{%
\ifthenelse{\equal{\subsectionnumbering}{section}}{%
\thesection.#1%
}{%
\ifthenelse{\equal{\subsectionnumbering}{subsection}}{%
\thesubsection.#1%
}{%
\ifthenelse{\equal{\subsectionnumbering}{subsubsection}}{%
\thesubsubsection.#1%
}{%
\ifthenelse{\equal{\subsectionnumbering}{paragraph}}{%
\theparagraph.#1
}{%
#1
}%
}%
}%
}%
}
\renewcommand{\thetable}{\tableAndFigureNumberingHelper{table}}
\renewcommand{\thefigure}{\tableAndFigureNumberingHelper{figure}}
\AtBeginEnvironment{table}{\preEnvHook{table}}
\AtBeginEnvironment{figure}{\preEnvHook{figure}}
\newcommand{\newsection}{%
\newpage
\newsectionNoPB
}
\newcommand{\newsectionNoPB}{
\ifthenelse{\equal{\numberingpreset}{off}}{}{%
\resetNumbering%
}%
}
\newcommand{\resetTableAndFigureNumbering}{%
\ifthenelse{\equal{\printNumberingConfigForDescriptor{table}}{combined} \OR \equal{\printNumberingConfigForDescriptor{table}{default}}}{%
\setcounter{table}{0}
}{}%
\ifthenelse{\equal{\printNumberingConfigForDescriptor{figure}}{combined} \OR \equal{\printNumberingConfigForDescriptor{figure}{default}}}{%
\setcounter{figure}{0}
}{}%
}
% Numbering toggling
\newboolean{numberingDisabled}
\setboolean{numberingDisabled}{false}
\newcommand{\numberingOff}{\setboolean{numberingDisabled}{true}}
\newcommand{\numberingOn}{\setboolean{numberingDisabled}{false}}
% Add glossaries functionality
\newcommand{\setupGlossary}{
\usepackage[nonumberlist, toc]{glossaries}
\usepackage[nottoc, numbib]{tocbibind}
\makenoidxglossaries
}
\newcommand{\printGlossary}{
\glsaddall
\printnoidxglossaries
}
% ┌ ┐
% │ Translation │
% └ ┘
@@ -943,6 +1130,24 @@
\newcommand{\proven}{$\hspace{17cm}\square$}
% ── Inline environments ─────────────────────────────────────────────
\newcommand{\inline}[2][NONAME]{%
\ifthenelse{\equal{NONAME}{#1}}{%
\anonymousInlineDescriptorTemplate{#2}{\printLabel{#2}}%
}{%
\inlineDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
}
}
\newcommand{\short}[2][NONAME]{%
\ifthenelse{\equal{NONAME}{#1}}{%
\anonymousShortDescriptorTemplate{#2}{\printLabel{#2}}%
}{%
\shortDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
}
}
% ┌ ┐
% │ STYLE: Common tcolorboxes │
% └ ┘
@@ -1001,105 +1206,6 @@
\newtcolorbox{simplebox}[2][]{colback=#2!5!white,colframe=#2!75!black,#1}
% ── Label generator ─────────────────────────────────────────────────
\newcommand{\printNumberingConfigForDescriptor}[1]{\csname #1numbering\endcsname}
\newcommand{\printCounter}[1]{\refstepcounter{#1}\csname the#1\endcsname}
\newcommand{\printLabel}[1]{%
\ifcsdef{#1numbering}{% Extra config present
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{default}}{%
\printCounter{#1\subsectionnumbering}%
}{%
\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}%
}{}
}
}
% Inline environments (inline)
\newcommand{\inline}[2][NONAME]{%
\ifthenelse{\equal{NONAME}{#1}}{%
\anonymousInlineDescriptorTemplate{#2}{\printLabel{#2}}%
}{%
\inlineDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
}
}
\newcommand{\short}[2][NONAME]{%
\ifthenelse{\equal{NONAME}{#1}}{%
\anonymousShortDescriptorTemplate{#2}{\printLabel{#2}}%
}{%
\shortDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
}
}
% ── 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}%
}
% ┌ ┐
% │ Counter numbering │
% └ ┘
% TODO: Update
\newcommand{\preTableAndFigHook}[1]{%
\ifnum\value{numberingConfig}>1%
\ifnum\value{numberSubsections}=1%
\stepcounter{allss}%
\else
\ifnum\value{numberSubsections}=2%
\stepcounter{allsss}%
\else%
\stepcounter{all}%
\fi
\fi
\fi
\renewcommand{\thetable}{\arabic{table}}
\renewcommand{\thefigure}{\arabic{figure}}
}
\AtBeginEnvironment{table}{\preTableAndFigHook{table}}
\AtBeginEnvironment{figure}{\preTableAndFigHook{figure}}
\newcommand{\newsection}{
\newpage
\newsectionNoPB
}
% ┌ ┐
% │ STYLE: Computer Science │
% └ ┘

View File

@@ -35,3 +35,5 @@
\newcommand{\usagenumbering}{default}
\newcommand{\recallnumbering}{default}
\newcommand{\propertiesnumbering}{default}
\newcommand{\tablenumbering}{default}
\newcommand{\figurenumbering}{default}

19
src/core/bib.sty Normal file
View File

@@ -0,0 +1,19 @@
% ___ _ _____ _ _
% ( _ \ _( ) (_ _) ( ) ( )
% | (_) )_) |_ | | __ \ \/ /
% | _ (| | _ \ | | / __ \ ) (
% | (_) ) | |_) ) | | ( ___// /\ \
% (____/(_)_ __/ (_) \____)_) (_)
% Configs if you want to use BibTeX
\newcommand{\setupBibtex}[1]{
\RequirePackage{biblatex}
\RequirePackage[nottoc, numbib]{tocbibind}
\addbibresource{#1}
}
\newcommand{\printbib}{
\addcontentsline{toc}{section}{\translate{Sources}{Quellen}}
\printbibliography[title=\translate{Sources}{Quellen}]
}

148
src/core/counters.sty Normal file
View File

@@ -0,0 +1,148 @@
% ── 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}%
}{}%
}%
}
% ── 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}%
}
% ┌ ┐
% │ Counter numbering │
% └ ┘
\newcommand{\preEnvHook}[1]{%
\ifthenelse{\boolean{numberingDisabled}}{}{
\ifthenelse{\equal{\numberingpreset}{combined} \AND \equal{\printNumberingConfigForDescriptor{#1}}{default}}{%
\stepLabelNumber{combined}%
}{%
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{combined}}{%
\stepLabelNumber{combined}%
}{}%
}%
}%
}
% Decides on the numbering to use (combined or not)
\newcommand{\tableAndFigureNumberingHelper}[1]{%
\ifthenelse{\boolean{numberingDisabled}}{}{
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}{default}}}{% Using default
\ifthenelse{\equal{\numberingpreset}{combined}}{%
\tableAndFigureSubsectionPrinting{\value{combined\subsectionnumbering}}%
}{%
\ifthenelse{\equal{\numberingpreset}{separate}}{%
\tableAndFigureSubsectionPrinting{\value{#1}}%
}{}%
}%
}{% if we get here, default has been changed
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}{combined}}}{%
\tableAndFigureSubsectionPrinting{\value{combined\subsectionnumbering}}%
}{%
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}{separate}}}{%
\tableAndFigureSubsectionPrinting{\value{#1}}%
}{}%
}%
}%
}%
}
% Prints the preceding subsection numbers
\newcommand{\tableAndFigureSubsectionPrinting}[1]{%
\ifthenelse{\equal{\subsectionnumbering}{section}}{%
\thesection.#1%
}{%
\ifthenelse{\equal{\subsectionnumbering}{subsection}}{%
\thesubsection.#1%
}{%
\ifthenelse{\equal{\subsectionnumbering}{subsubsection}}{%
\thesubsubsection.#1%
}{%
\ifthenelse{\equal{\subsectionnumbering}{paragraph}}{%
\theparagraph.#1
}{%
#1
}%
}%
}%
}%
}
\renewcommand{\thetable}{\tableAndFigureNumberingHelper{table}}
\renewcommand{\thefigure}{\tableAndFigureNumberingHelper{figure}}
\AtBeginEnvironment{table}{\preEnvHook{table}}
\AtBeginEnvironment{figure}{\preEnvHook{figure}}
\newcommand{\newsection}{%
\newpage
\newsectionNoPB
}
\newcommand{\newsectionNoPB}{
\ifthenelse{\equal{\numberingpreset}{off}}{}{%
\resetNumbering%
}%
}
\newcommand{\resetTableAndFigureNumbering}{%
\ifthenelse{\equal{\printNumberingConfigForDescriptor{table}}{combined} \OR \equal{\printNumberingConfigForDescriptor{table}{default}}}{%
\setcounter{table}{0}
}{}%
\ifthenelse{\equal{\printNumberingConfigForDescriptor{figure}}{combined} \OR \equal{\printNumberingConfigForDescriptor{figure}{default}}}{%
\setcounter{figure}{0}
}{}%
}
% Numbering toggling
\newboolean{numberingDisabled}
\setboolean{numberingDisabled}{false}
\newcommand{\numberingOff}{\setboolean{numberingDisabled}{true}}
\newcommand{\numberingOn}{\setboolean{numberingDisabled}{false}}

12
src/core/glossary.sty Normal file
View File

@@ -0,0 +1,12 @@
% Add glossaries functionality
\newcommand{\setupGlossary}{
\RequirePackage[nonumberlist, toc]{glossaries}
\RequirePackage[nottoc, numbib]{tocbibind}
\makenoidxglossaries
}
\newcommand{\printGlossary}{
\glsaddall
\printnoidxglossaries
}

View File

@@ -1,97 +0,0 @@
% ── Label generator ─────────────────────────────────────────────────
\newcommand{\printNumberingConfigForDescriptor}[1]{\csname #1numbering\endcsname}
\newcommand{\printCounter}[1]{\refstepcounter{#1}\csname the#1\endcsname}
\newcommand{\printLabel}[1]{%
\ifcsdef{#1numbering}{% Extra config present
\ifthenelse{\equal{\printNumberingConfigForDescriptor{#1}}{default}}{%
\printCounter{#1\subsectionnumbering}%
}{%
\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}%
}{}
}
}
% Inline environments (inline)
\newcommand{\inline}[2][NONAME]{%
\ifthenelse{\equal{NONAME}{#1}}{%
\anonymousInlineDescriptorTemplate{#2}{\printLabel{#2}}%
}{%
\inlineDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
}
}
\newcommand{\short}[2][NONAME]{%
\ifthenelse{\equal{NONAME}{#1}}{%
\anonymousShortDescriptorTemplate{#2}{\printLabel{#2}}%
}{%
\shortDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
}
}
% ── 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}%
}
% ┌ ┐
% │ Counter numbering │
% └ ┘
% TODO: Update
\newcommand{\preTableAndFigHook}[1]{%
\ifnum\value{numberingConfig}>1%
\ifnum\value{numberSubsections}=1%
\stepcounter{allss}%
\else
\ifnum\value{numberSubsections}=2%
\stepcounter{allsss}%
\else%
\stepcounter{all}%
\fi
\fi
\fi
\renewcommand{\thetable}{\arabic{table}}
\renewcommand{\thefigure}{\arabic{figure}}
}
\AtBeginEnvironment{table}{\preTableAndFigHook{table}}
\AtBeginEnvironment{figure}{\preTableAndFigHook{figure}}
\newcommand{\newsection}{
\newpage
\newsectionNoPB
}

View File

@@ -0,0 +1,16 @@
% ── Inline environments ─────────────────────────────────────────────
\newcommand{\inline}[2][NONAME]{%
\ifthenelse{\equal{NONAME}{#1}}{%
\anonymousInlineDescriptorTemplate{#2}{\printLabel{#2}}%
}{%
\inlineDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
}
}
\newcommand{\short}[2][NONAME]{%
\ifthenelse{\equal{NONAME}{#1}}{%
\anonymousShortDescriptorTemplate{#2}{\printLabel{#2}}%
}{%
\shortDescriptorTemplate{#2}{\printLabel{#2}}{#1}%
}
}