Update docs (mostly), fixes, etc
This commit is contained in:
69
src/counters/figures-tables.sty
Normal file
69
src/counters/figures-tables.sty
Normal file
@@ -0,0 +1,69 @@
|
||||
% ┌ ┐
|
||||
% │ 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}}
|
||||
33
src/counters/generator.sty
Normal file
33
src/counters/generator.sty
Normal file
@@ -0,0 +1,33 @@
|
||||
% ── 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}%
|
||||
}{}%
|
||||
}%
|
||||
}
|
||||
70
src/counters/usercommands.sty
Normal file
70
src/counters/usercommands.sty
Normal file
@@ -0,0 +1,70 @@
|
||||
% ── 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}
|
||||
\loadNumberingConfig
|
||||
}
|
||||
|
||||
\newcommand{\setnumberingpreset}[1]{
|
||||
\renewcommand{\numberingpreset}{#1}
|
||||
\loadNumberingConfig
|
||||
}
|
||||
Reference in New Issue
Block a user