[Counters] Finish up refs
This commit is contained in:
BIN
docs/docs.pdf
BIN
docs/docs.pdf
Binary file not shown.
@@ -66,9 +66,21 @@ See \ref{sec:counters} for a guide on how to change the current number.
|
|||||||
\label{sec:counters}
|
\label{sec:counters}
|
||||||
\textit{Included in \texttt{most} and up}
|
\textit{Included in \texttt{most} and up}
|
||||||
|
|
||||||
|
\textit{Starting from the version of October 18, 2025, the counter numbers need to be $<$number$>$ - 1}
|
||||||
|
|
||||||
You may set the current number for the elements by setting their corresponding counter to the selected number.
|
You may set the current number for the elements by setting their corresponding counter to the selected number.
|
||||||
You can do this using \verb|\setcounter|\{\textit{name of the counter}\}\{\textit{number}\}, where you replace \textit{name of the counter} with one of the following:
|
You can do this using \verb|\setcounter|\{\textit{name of the counter}\}\{\textit{number}\}, where you replace \textit{name of the counter} with one of the following:
|
||||||
\texttt{definitions}, \texttt{lemmas}, \texttt{theorems}, \texttt{corollaries}, \texttt{propositions}, \texttt{facts}, \texttt{axioms}, \texttt{examples}, \texttt{remarks}
|
\texttt{definitions}, \texttt{lemmas}, \texttt{theorems}, \texttt{corollaries}, \texttt{propositions}, \texttt{facts}, \texttt{axioms}, \texttt{examples}, \texttt{remarks}
|
||||||
|
|
||||||
This only applies if you have set numberingConfig to $1$ (for all of them) and $2$ (only for \texttt{definitions}).
|
This only applies if you have set numberingConfig to $1$ (for all of them) and $2$ (only for \texttt{definitions}).
|
||||||
To change the combined numbering, set \texttt{all} to your desired number.
|
To change the combined numbering, set \texttt{all} to your desired number.
|
||||||
|
|
||||||
|
|
||||||
|
\subsubsection{Referencing counters}
|
||||||
|
\textit{Included in \texttt{most} and up}
|
||||||
|
|
||||||
|
If you wish to reference a counter, you can do so by writing
|
||||||
|
|
||||||
|
\verb|\ref{<counter name>:<section>-<subsection>-<subsubsection>-<counter value>}|,
|
||||||
|
|
||||||
|
or of course, if you do not label subsections and / or subsubsection, dropping them.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
These ones also have two settings, namely, you can change the counter behaviour and the inclusion of subsections in the numbering. See \ref{sec:perFileConf}.
|
These ones also have two settings, namely, you can change the counter behaviour and the inclusion of subsections in the numbering. See \ref{sec:perFileConf}.
|
||||||
|
|
||||||
See \ref{sec:counters} for a guide on how to change the current number.
|
See \ref{sec:counters} for a guide on how to change the current number and how to reference them.
|
||||||
|
|
||||||
\begin{definition}[]{Title here}
|
\begin{definition}[]{Title here}
|
||||||
\begin{minted}{latex}
|
\begin{minted}{latex}
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ You have most likely forgotten about the second argument. Then, the first letter
|
|||||||
\subsection{pgfkeys: Don't know mainboxstyle}
|
\subsection{pgfkeys: Don't know mainboxstyle}
|
||||||
You have most likely forgotten about \verb|\usetcolorboxes| after \verb|\startDocument|.
|
You have most likely forgotten about \verb|\usetcolorboxes| after \verb|\startDocument|.
|
||||||
|
|
||||||
|
\subsection{Numbering incorrect after numberingOn}
|
||||||
|
Check the start of the document and make sure you have used \verb|\setNumberingStyle| to set the numbering style and not
|
||||||
|
\verb|\setcounter{numberingConfig}|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\subsection{Undefined commands}
|
\subsection{Undefined commands}
|
||||||
|
|||||||
@@ -7,57 +7,100 @@
|
|||||||
|
|
||||||
\usepackage{xstring}
|
\usepackage{xstring}
|
||||||
% tcolorbox and other stylistic elements (i.e. inline versions of them) that have counters
|
% tcolorbox and other stylistic elements (i.e. inline versions of them) that have counters
|
||||||
\newcounter{lemmas}
|
\newcounter{lemmas}[section]
|
||||||
\newcounter{definitions}
|
\newcounter{definitions}[section]
|
||||||
\newcounter{corollaries}
|
\newcounter{corollaries}[section]
|
||||||
\newcounter{theorems}
|
\newcounter{theorems}[section]
|
||||||
\newcounter{axioms}
|
\newcounter{axioms}[section]
|
||||||
\newcounter{examples}
|
\newcounter{examples}[section]
|
||||||
\newcounter{facts}
|
\newcounter{facts}[section]
|
||||||
\newcounter{propositions}
|
\newcounter{propositions}[section]
|
||||||
\newcounter{formulas}
|
\newcounter{formulas}[section]
|
||||||
\newcounter{remarks}
|
\newcounter{remarks}[section]
|
||||||
\newcounter{all}
|
\newcounter{all}[section]
|
||||||
|
|
||||||
|
|
||||||
% ┌ ┐
|
% ┌ ┐
|
||||||
% │ Numbering of sections │
|
% │ Counter numbering │
|
||||||
% └ ┘
|
% └ ┘
|
||||||
\newcommand{\subsectionRendering}[1]{%
|
\newcommand{\setSubsectionRendering}{
|
||||||
|
\renewcommand{\thelemmas}{\sectionNumbering.\arabic{lemmas}}
|
||||||
|
\renewcommand{\thedefinitions}{\sectionNumbering.\arabic{definitions}}
|
||||||
|
\renewcommand{\thecorollaries}{\sectionNumbering.\arabic{corollaries}}
|
||||||
|
\renewcommand{\thetheorems}{\sectionNumbering.\arabic{theorems}}
|
||||||
|
\renewcommand{\theaxioms}{\sectionNumbering.\arabic{axioms}}
|
||||||
|
\renewcommand{\theexamples}{\sectionNumbering.\arabic{examples}}
|
||||||
|
\renewcommand{\thefacts}{\sectionNumbering.\arabic{facts}}
|
||||||
|
\renewcommand{\thepropositions}{\sectionNumbering.\arabic{propositions}}
|
||||||
|
\renewcommand{\theformulas}{\sectionNumbering.\arabic{formulas}}
|
||||||
|
\renewcommand{\theremarks}{\sectionNumbering.\arabic{remarks}}
|
||||||
|
\renewcommand{\theall}{\sectionNumbering.\arabic{all}}
|
||||||
|
}
|
||||||
|
|
||||||
|
% ── Picks the correct subsection numbering ──────────────────────────
|
||||||
|
\newcommand{\sectionNumbering}{%
|
||||||
\ifnum\value{numberSubsections}=1
|
\ifnum\value{numberSubsections}=1
|
||||||
\arabic{section}#1\arabic{subsection}%
|
\thesubsection
|
||||||
\else
|
\else
|
||||||
\ifnum\value{numberSubsections}=2
|
\ifnum\value{numberSubsections}=2
|
||||||
\arabic{section}#1\arabic{subsection}#1\arabic{subsubsection}%
|
\thesubsubsection
|
||||||
|
\else
|
||||||
|
\thesection
|
||||||
|
\fi
|
||||||
|
\fi
|
||||||
|
}
|
||||||
|
\setSubsectionRendering
|
||||||
|
|
||||||
|
|
||||||
|
% ── Label generation ────────────────────────────────────────────────
|
||||||
|
\newcommand{\labelSectionGeneration}{%
|
||||||
|
\ifnum\value{numberSubsections}=1
|
||||||
|
\arabic{section}-\arabic{subsection}%
|
||||||
|
\else
|
||||||
|
\ifnum\value{numberSubsections}=2
|
||||||
|
\arabic{section}-\arabic{subsection}-\arabic{subsubsection}%
|
||||||
\else
|
\else
|
||||||
\arabic{section}%
|
\arabic{section}%
|
||||||
\fi
|
\fi
|
||||||
\fi}
|
\fi}
|
||||||
|
|
||||||
|
\newcommand{\labelIt}[1]{\refstepcounter{#1}\edef\tempLabel{\genLabel{#1}{\arabic{#1}}}\label{\tempLabel}}
|
||||||
|
\newcommand{\genLabel}[2]{#1:\labelSectionGeneration-#2}
|
||||||
|
|
||||||
|
% TODO: Add support for subsection counter reset and subsubsection as well
|
||||||
|
% -> The way is to use a counter for each mode and then concatenate
|
||||||
|
|
||||||
|
|
||||||
|
% ┌ ┐
|
||||||
|
% │ Number the counters appropriately │
|
||||||
|
% └ ┘
|
||||||
|
\newcommand{\printcounter}[1]{%
|
||||||
|
\csname the#1\endcsname
|
||||||
|
}
|
||||||
|
|
||||||
\newcommand{\usenumberArabic}[1]{%
|
\newcommand{\usenumberArabic}[1]{%
|
||||||
\ifnum\value{numberingConfig}=1
|
\ifnum\value{numberingConfig}=1
|
||||||
\edef\tempLabel{\genLabel{#1}{\arabic{#1}}}\label{\tempLabel}
|
\labelIt{#1}
|
||||||
\subsectionRendering{.}.\arabic{#1}\stepcounter{#1}%
|
\printcounter{#1}\stepcounter{#1}%
|
||||||
\else
|
\else
|
||||||
\ifnum\value{numberingConfig}=2
|
\ifnum\value{numberingConfig}=2
|
||||||
\ifthenelse{\equal{#1}{definitions}}{%
|
\ifthenelse{\equal{#1}{definitions}}{%
|
||||||
\edef\tempLabel{\genLabel{#1}{\arabic{definitions}}}\label{\tempLabel}
|
\labelIt{definitions}
|
||||||
\subsectionRendering{.}.\arabic{definitions}\stepcounter{definitions}%
|
\thedefinitions%
|
||||||
}{%
|
}{%
|
||||||
\edef\tempLabel{\genLabel{#1}{\arabic{all}}}\label{\tempLabel}
|
\labelIt{all}
|
||||||
\subsectionRendering{.}.\arabic{all}\stepcounter{all}%
|
\theall%
|
||||||
}%
|
}%
|
||||||
\else
|
\else
|
||||||
\ifnum\value{numberingConfig}=3
|
\ifnum\value{numberingConfig}=3
|
||||||
\edef\tempLabel{\genLabel{#1}{\arabic{all}}}\label{\tempLabel}
|
\labelIt{all}
|
||||||
\subsectionRendering{.}.\arabic{all}\stepcounter{all}%
|
\theall%
|
||||||
\else
|
\else
|
||||||
\relax%
|
\relax%
|
||||||
\fi
|
\fi
|
||||||
\fi
|
\fi
|
||||||
\fi}
|
\fi}
|
||||||
|
|
||||||
\newcommand{\genLabel}[2]{#1:\subsectionRendering{-}-#2}
|
|
||||||
|
|
||||||
% ────────────────────────────────────────────────────────────────────
|
% ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -77,27 +120,27 @@
|
|||||||
\setcounter{numberingConfig}{\value{numberingConfigStore}}
|
\setcounter{numberingConfig}{\value{numberingConfigStore}}
|
||||||
}
|
}
|
||||||
|
|
||||||
% Reset definition, lemma, etc counters, add a new page
|
% ── Reset definition, lemma, etc counters, add a new page ───────────
|
||||||
\newcommand{\newsection}{
|
\newcommand{\newsection}{
|
||||||
\newpage
|
\newpage
|
||||||
\newsectionNoPB
|
\newsectionNoPB
|
||||||
}
|
}
|
||||||
|
|
||||||
% Reset definitions, lemma, etc counters, do not add new page
|
% ── Reset definitions, lemma, etc counters, do not add new page ─────
|
||||||
\newcommand{\newsectionNoPB}{
|
\newcommand{\newsectionNoPB}{
|
||||||
\setcounter{lemmas}{1}
|
\setcounter{lemmas}{0}
|
||||||
\setcounter{definitions}{1}
|
\setcounter{definitions}{0}
|
||||||
\setcounter{corollaries}{1}
|
\setcounter{corollaries}{0}
|
||||||
\setcounter{theorems}{1}
|
\setcounter{theorems}{0}
|
||||||
\setcounter{axioms}{1}
|
\setcounter{axioms}{0}
|
||||||
\setcounter{examples}{1}
|
\setcounter{examples}{0}
|
||||||
\setcounter{facts}{1}
|
\setcounter{facts}{0}
|
||||||
\setcounter{propositions}{1}
|
\setcounter{propositions}{0}
|
||||||
\setcounter{formulas}{1}
|
\setcounter{formulas}{0}
|
||||||
\setcounter{remarks}{1}
|
\setcounter{remarks}{0}
|
||||||
\setcounter{all}{1}
|
\setcounter{all}{0}
|
||||||
}
|
}
|
||||||
\newsectionNoPB
|
\newsectionNoPB % Initializes
|
||||||
|
|
||||||
|
|
||||||
% ────────────────────────────────────────────────────────────────────
|
% ────────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user