diff options
Diffstat (limited to 'macros/latex-dev/base/ltcounts.dtx')
-rw-r--r-- | macros/latex-dev/base/ltcounts.dtx | 132 |
1 files changed, 82 insertions, 50 deletions
diff --git a/macros/latex-dev/base/ltcounts.dtx b/macros/latex-dev/base/ltcounts.dtx index 445cac2f2e..39fb47728d 100644 --- a/macros/latex-dev/base/ltcounts.dtx +++ b/macros/latex-dev/base/ltcounts.dtx @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltcounts.dtx} - [2020/12/04 v1.1l LaTeX Kernel (Counters)] + [2021/07/08 v1.1m LaTeX Kernel (Counters)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltcounts.dtx} @@ -106,20 +106,22 @@ % % % \DescribeMacro\counterwithin -% |\counterwithin|\marg{counter}\marg{within-counter}: +% |\counterwithin|\oarg{format}\marg{counter}\marg{within-counter}: % Resets \meta{counter} whenever % \meta{within-counter} is stepped. Also % redefines |\the|\meta{counter} command to produce -% |\the|\meta{within-counter}|.\arabic|\marg{counter}. +% |\the|\meta{within-counter}.\meta{format}\marg{counter} with \cs{arabic} as +% the default for \meta{format}. % Star form omits redefining the print representation. % % \DescribeMacro\counterwithout -% |\counterwithout|\marg{counter}\marg{within-counter}: +% |\counterwithout|\oarg{format}\marg{counter}\marg{within-counter}: % Removes \meta{counter} from the reset list of \meta{within-counter}. % Also % redefines |\the|\meta{counter} command to produce -% |\arabic|\marg{counter}. +% \meta{format}\marg{counter} with \cs{arabic} as +% the default for \meta{format}. % Star form omits redefining the print representation. % % \StopEventually{} @@ -371,67 +373,94 @@ #3}}} % \end{macrocode} % \end{macro} - - -% \begin{macro}{\counterwithout} % -% \changes{v1.1k}{2018/03/08}{Interface added} % \begin{macrocode} -\def\counterwithout {\@ifstar\counterwithout@s\counterwithout@x} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000-00-00} +%<latexrelease> {\@removefromreset}{Add interfaces}% +%<latexrelease>\let \@removefromreset \undefined +%<latexrelease>\let \@ifbothcounters \undefined +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % -% \begin{macrocode} -\def\counterwithout@s#1#2{% - \@ifbothcounters{#1}{#2}{\@removefromreset{#1}{#2}}} -% \end{macrocode} % -% \begin{macrocode} -\def\counterwithout@x#1#2{% - \@ifbothcounters{#1}{#2}% - {\@removefromreset{#1}{#2}% - \expandafter - \gdef\csname the#1\expandafter\endcsname\expandafter - {\expandafter - \@arabic\csname c@#1\endcsname}}} -% \end{macrocode} -% \end{macro} - - - -% \begin{macro}{\counterwithin} % -% \changes{v1.1k}{2018/03/08}{Interface added} +% +% \begin{macro}{\counterwithout,\counterwithin} +% New implementation using xparse and supporting an optional +% format argument. +% \changes{v1.1m}{2021/07/08}{New implementation for +% \cs{counterwithout} and \cs{counterwithin}} % \begin{macrocode} -\def\counterwithin{\@ifstar\counterwithin@s\counterwithin@x} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2021/11/15}% +%<latexrelease> {\counterwithout}{counter without/within}% % \end{macrocode} % % \begin{macrocode} -\def\counterwithin@s#1#2{% - \@ifbothcounters{#1}{#2}{\@addtoreset{#1}{#2}}} +\NewDocumentCommand \counterwithout {sO{\arabic}mm}{% + \@ifbothcounters{#3}{#4}{% + \@removefromreset{#3}{#4}% + \IfBooleanF #1% + {\expandafter + \gdef\csname the#3\endcsname {#2{#3}}}% + }% +} +% \end{macrocode} +% +% \begin{macrocode} +\NewDocumentCommand \counterwithin {sO{\arabic}mm}{% + \@ifbothcounters{#3}{#4}{% + \@addtoreset{#3}{#4}% + \IfBooleanF #1% + {\expandafter + \gdef\csname the#3\expandafter\endcsname + \expandafter + {\csname the#4\endcsname .#2{#3}}}% + }% +} % \end{macrocode} % -% \changes{v1.1l}{2018/04/11}{Correct default (issue/38)} +% \changes{v1.1k}{2018/03/08}{Interface added} % \begin{macrocode} -\def\counterwithin@x#1#2{% - \@ifbothcounters{#1}{#2}% - {\@addtoreset{#1}{#2}% - \expandafter - \gdef\csname the#1\expandafter\endcsname\expandafter - {\csname the#2\expandafter\endcsname\expandafter - .\expandafter - \@arabic\csname c@#1\endcsname}}} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{2018-04-01} +%<latexrelease> {\counterwithout}{counter without/within}% +%<latexrelease> +%<latexrelease>\def\counterwithout {\@ifstar\counterwithout@s\counterwithout@x} +%<latexrelease>\def\counterwithout@s#1#2{% +%<latexrelease> \@ifbothcounters{#1}{#2}{\@removefromreset{#1}{#2}}} +%<latexrelease>\def\counterwithout@x#1#2{% +%<latexrelease> \@ifbothcounters{#1}{#2}% +%<latexrelease> {\@removefromreset{#1}{#2}% +%<latexrelease> \expandafter +%<latexrelease> \gdef\csname the#1\expandafter\endcsname\expandafter +%<latexrelease> {\expandafter +%<latexrelease> \@arabic\csname c@#1\endcsname}}} +%<latexrelease> +%<latexrelease>\def\counterwithin{\@ifstar\counterwithin@s\counterwithin@x} +%<latexrelease>\def\counterwithin@s#1#2{% +%<latexrelease> \@ifbothcounters{#1}{#2}{\@addtoreset{#1}{#2}}} % \end{macrocode} -% \end{macro} - - % +% \changes{v1.1l}{2018/04/11}{Correct default (issue/38)} % \begin{macrocode} -%</2ekernel|latexrelease> +%<latexrelease>\def\counterwithin@x#1#2{% +%<latexrelease> \@ifbothcounters{#1}{#2}% +%<latexrelease> {\@addtoreset{#1}{#2}% +%<latexrelease> \expandafter +%<latexrelease> \gdef\csname the#1\expandafter\endcsname\expandafter +%<latexrelease> {\csname the#2\expandafter\endcsname\expandafter +%<latexrelease> .\expandafter +%<latexrelease> \@arabic\csname c@#1\endcsname}}} +%<latexrelease> %<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{0000-00-00} -%<latexrelease> {\@removefromreset}{Add interfaces}% -%<latexrelease>\let \@removefromreset \undefined -%<latexrelease>\let \@ifbothcounters \undefined +%<latexrelease> {\counterwithout}{counter without/within}% %<latexrelease>\let \counterwithout \undefined %<latexrelease>\let \counterwithout@s \undefined %<latexrelease>\let \counterwithout@x \undefined @@ -441,6 +470,9 @@ %<latexrelease>\EndIncludeInRelease %<*2ekernel> % \end{macrocode} +% \end{macro} +% +% % % % Numbering commands for definitions of |\theCOUNTER| and |\list| @@ -596,7 +628,7 @@ % recommended) this unfortunate side effect is not present. % \begin{macrocode} %</2ekernel> -%<latexrelease>\IncludeInRelease{2015/01/01}{\@fnsymbol}{Use \TexOrMath}% +%<latexrelease>\IncludeInRelease{2015/01/01}{\@fnsymbol}{Use \TextOrMath}% %<*2ekernel|latexrelease> \def\@fnsymbol#1{% \ifcase#1\or \TextOrMath\textasteriskcentered *\or @@ -612,7 +644,7 @@ }% %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease -%<latexrelease>\IncludeInRelease{0000/00/00}{\@fnsymbol}{Use \TexOrMath}% +%<latexrelease>\IncludeInRelease{0000/00/00}{\@fnsymbol}{Use \TextOrMath}% %<latexrelease>\def\@fnsymbol#1{\ensuremath{% %<latexrelease> \ifcase#1\or *\or \dagger\or \ddagger\or \mathsection\or %<latexrelease> \mathparagraph\or \|\or **\or \dagger\dagger |