Skip to content

Commit

Permalink
guard star in counterwithin/out, from review #1632
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcarlisle committed Jan 25, 2025
1 parent c6902bc commit f9f49c3
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions base/ltcounts.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
% |\the|\meta{within-counter}.\meta{format}\marg{counter} with \cs{arabic} as
% the default for \meta{format}.
% Star form omits redefining the print representation.

%
% The |*| alias for the current counter may not be used in either argument.
%
% \DescribeMacro\counterwithout
% |\counterwithout|\oarg{format}\marg{counter}\marg{within-counter}:
Expand All @@ -127,6 +128,8 @@
% the default for \meta{format}.
% Star form omits redefining the print representation.
%
% The |*| alias for the current counter may not be used in either argument.
%
% \MaybeStop{}
%
% \begin{macrocode}
Expand Down Expand Up @@ -260,7 +263,7 @@
\def\csname c@*\endcsname{\value\@currentcounter}
% \end{macrocode}
% \end{macro}

%
%\begin{macro}{\@newctr}
% \changes{v1.0d}{1994/04/09}
% {\cs{@nocnterr} now has counter name argument}
Expand Down Expand Up @@ -437,19 +440,27 @@
\endgroup}}
% \end{macrocode}
% \end{macro}



%
% \begin{macro}{\@ifbothcounters}
% \changes{v1.1k}{2018/03/08}{Interface added}
% \changes{v1.2a}{2025/01/22}{Guard against star alias.}
% Test if arg |#1| and |#2| are counters and if so execute |#3|.
% \begin{macrocode}
\begingroup\catcode`\*=11 \lowercase{\endgroup
\def\@ifbothcounters#1#2#3{%
% \end{macrocode}
% \begin{macrocode}
\begingroup\let\c@*\@undefined
% \end{macrocode}
% \begin{macrocode}
\@ifundefined{c@#1}{\@nocounterr{#1}}%
{% else counter is defined
\@ifundefined{c@#2}{\@nocounterr{#2}}%
{% else both counter and within are defined
#3}}}
#3}}%
% \end{macrocode}
% \begin{macrocode}
\endgroup}}
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -636,7 +647,7 @@
% |\@Roman\FOOcounter|
% Representation of |\FOOcounter| as upper-case
% Roman numerals.

%
% \changes{v1.1f}{1997/10/06}{Change \cs{@Roman} to be fully
% expandable, so that the result is written properly to files.}
% \begin{macrocode}
Expand Down

0 comments on commit f9f49c3

Please sign in to comment.