[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Counterwithin (#612) (81725114)

GitHub noreply at github.com
Mon Jul 12 16:55:31 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/81725114cd9ff73b082be5e642ed882084d8fbe3

>---------------------------------------------------------------

commit 81725114cd9ff73b082be5e642ed882084d8fbe3
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Jul 12 16:55:31 2021 +0200

    Counterwithin (#612)
    
    * test before change
    
    * new implementation
    
    * update the typical test files
    
    * fix documentation and correct a comment in rollback
    
    * Mention \counterwithin in the amsmath documentation.


>---------------------------------------------------------------

81725114cd9ff73b082be5e642ed882084d8fbe3
 base/changes.txt                                   |   7 ++
 base/doc/ltnews34.tex                              |  11 ++
 base/ltcounts.dtx                                  | 128 +++++++++++++--------
 base/testfiles/github-0479-often.luatex.tlg        |   7 +-
 base/testfiles/github-0479-often.tlg               |   7 +-
 base/testfiles/github-0479-often.xetex.tlg         |   7 +-
 base/testfiles/github-robust-0123.luatex.tlg       |   4 +
 base/testfiles/github-robust-0123.lvt              |   4 +-
 base/testfiles/github-robust-0123.tlg              |   4 +
 base/testfiles/github-robust-0123.xetex.tlg        |   4 +
 .../tlb-latexrelease-rollback-003-often.luatex.tlg |  14 ++-
 .../tlb-latexrelease-rollback-003-often.tlg        |  14 ++-
 .../tlb-latexrelease-rollback-003-often.xetex.tlg  |  14 ++-
 base/testfiles/tlb-remreset-002.tlg                |  12 +-
 .../{tlb-remreset-002.lvt => tlb-remreset-004.lvt} |  42 +++----
 .../{tlb-remreset-002.tlg => tlb-remreset-004.tlg} |  39 ++++---
 base/testfiles/tlb-rollback-004-often.luatex.tlg   |   7 +-
 base/testfiles/tlb-rollback-004-often.tlg          |   7 +-
 base/testfiles/tlb-rollback-004-often.xetex.tlg    |   7 +-
 base/testfiles/tlb-rollback-005.luatex.tlg         |   7 +-
 base/testfiles/tlb-rollback-005.tlg                |   7 +-
 base/testfiles/tlb-rollback-005.xetex.tlg          |   7 +-
 required/amsmath/amsmath.dtx                       |   6 +-
 23 files changed, 239 insertions(+), 127 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 85ec9f09..8f08cc44 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,13 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2021-07-08  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltcounts.dtx (subsection{Environment Counter Macros}):
+	New implementation for \counterwithout and \counterwithin
+	with an additional optional arg so it becomes a drop-in
+	replacement for amsmath \numberwithin
+
 2021-06-21  David Carlisle  <David.Carlisle at latex-project.org>
 
 	* base/utf8ienc.dtx: additional characters for gh/593
diff --git a/base/doc/ltnews34.tex b/base/doc/ltnews34.tex
index 215ddadc..2519c446 100644
--- a/base/doc/ltnews34.tex
+++ b/base/doc/ltnews34.tex
@@ -145,6 +145,17 @@
 
 \section{New or improved commands}
 
+
+\subsection{New implementation for \cs{counterwithin}}
+
+New implementation for \cs{counterwithout} and \cs{counterwithin} with
+an additional optional arg so it becomes a drop-in replacement for
+amsmath \cs{numberwithin}.
+
+\emph{write appropriate description}
+  
+
+
 \subsection{???}
 
 %
diff --git a/base/ltcounts.dtx b/base/ltcounts.dtx
index 445cac2f..39fb4772 100644
--- a/base/ltcounts.dtx
+++ b/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 at s\counterwithout at 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 at s#1#2{%
-  \@ifbothcounters{#1}{#2}{\@removefromreset{#1}{#2}}}
-%    \end{macrocode}
 %
+%
+%
+%  \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\counterwithout at x#1#2{%
-  \@ifbothcounters{#1}{#2}%
-      {\@removefromreset{#1}{#2}%
-       \expandafter
-       \gdef\csname the#1\expandafter\endcsname\expandafter
-            {\expandafter
-             \@arabic\csname c@#1\endcsname}}}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2021/11/15}%
+%<latexrelease>                 {\counterwithout}{counter without/within}%
 %    \end{macrocode}
-%  \end{macro}
-
-
-
-%  \begin{macro}{\counterwithin}
 %
-%    \changes{v1.1k}{2018/03/08}{Interface added}
 %    \begin{macrocode}
-\def\counterwithin{\@ifstar\counterwithin at s\counterwithin at x}
+\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}
-\def\counterwithin at s#1#2{%
-  \@ifbothcounters{#1}{#2}{\@addtoreset{#1}{#2}}}
+\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 at 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 at s\counterwithout at x}
+%<latexrelease>\def\counterwithout at s#1#2{%
+%<latexrelease>  \@ifbothcounters{#1}{#2}{\@removefromreset{#1}{#2}}}
+%<latexrelease>\def\counterwithout at 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 at s\counterwithin at x}
+%<latexrelease>\def\counterwithin at 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 at 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 at s \undefined
 %<latexrelease>\let \counterwithout at 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
diff --git a/base/testfiles/github-0479-often.luatex.tlg b/base/testfiles/github-0479-often.luatex.tlg
index e5900f87..06cefd68 100644
--- a/base/testfiles/github-0479-often.luatex.tlg
+++ b/base/testfiles/github-0479-often.luatex.tlg
@@ -193,8 +193,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/github-0479-often.tlg b/base/testfiles/github-0479-often.tlg
index f5dcc979..fa160b46 100644
--- a/base/testfiles/github-0479-often.tlg
+++ b/base/testfiles/github-0479-often.tlg
@@ -183,8 +183,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/github-0479-often.xetex.tlg b/base/testfiles/github-0479-often.xetex.tlg
index 922a7c07..69885e25 100644
--- a/base/testfiles/github-0479-often.xetex.tlg
+++ b/base/testfiles/github-0479-often.xetex.tlg
@@ -183,8 +183,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/github-robust-0123.luatex.tlg b/base/testfiles/github-robust-0123.luatex.tlg
index 810206b2..5401e3f8 100644
--- a/base/testfiles/github-robust-0123.luatex.tlg
+++ b/base/testfiles/github-robust-0123.luatex.tlg
@@ -87,6 +87,10 @@ l. ...\mruntest{ccc}
 > \\ccc =undefined.
 <recently read> \\ccc  
 l. ...\mruntest{ccc}
+\counterwithin{section}{footnote} -> \counterwithin {section}{footnote}
+---------------------------------------
+\counterwithout{section}{footnote} -> \counterwithout {section}{footnote}
+---------------------------------------
 ====================================
  Not worth making robust ...
 ====================================
diff --git a/base/testfiles/github-robust-0123.lvt b/base/testfiles/github-robust-0123.lvt
index 574d2f85..a917136d 100644
--- a/base/testfiles/github-robust-0123.lvt
+++ b/base/testfiles/github-robust-0123.lvt
@@ -68,8 +68,8 @@
 %%\test{\cleardoublepage}     -- breaks badly
 %%\test{\clearpage}     -- breaks badly
 %%\test{\contentsline}     -- breaks badly
-%%\test{\counterwithin{section}{footnote}}     -- breaks badly
-%%\test{\counterwithout{section}{footnote}}     -- breaks badly
+\test{\counterwithin{section}{footnote}}      %  -- breaks badly no longer
+\test{\counterwithout{section}{footnote}}     %  -- breaks badly no longer
 %%\test{\displaylines{foo}}     -- breaks badly
 %%\test{\enlargethispage{5pt}}     -- breaks badly
 %%\test{\enumerate}     -- breaks badly
diff --git a/base/testfiles/github-robust-0123.tlg b/base/testfiles/github-robust-0123.tlg
index f91361bc..2afb3959 100644
--- a/base/testfiles/github-robust-0123.tlg
+++ b/base/testfiles/github-robust-0123.tlg
@@ -87,6 +87,10 @@ l. ...\mruntest{ccc}
 > \\ccc =undefined.
 <recently read> \\ccc  
 l. ...\mruntest{ccc}
+\counterwithin{section}{footnote} -> \counterwithin {section}{footnote}
+---------------------------------------
+\counterwithout{section}{footnote} -> \counterwithout {section}{footnote}
+---------------------------------------
 ====================================
  Not worth making robust ...
 ====================================
diff --git a/base/testfiles/github-robust-0123.xetex.tlg b/base/testfiles/github-robust-0123.xetex.tlg
index dc3bf5dd..d8b5041b 100644
--- a/base/testfiles/github-robust-0123.xetex.tlg
+++ b/base/testfiles/github-robust-0123.xetex.tlg
@@ -87,6 +87,10 @@ l. ...\mruntest{ccc}
 > \\ccc =undefined.
 <recently read> \\ccc  
 l. ...\mruntest{ccc}
+\counterwithin{section}{footnote} -> \counterwithin {section}{footnote}
+---------------------------------------
+\counterwithout{section}{footnote} -> \counterwithout {section}{footnote}
+---------------------------------------
 ====================================
  Not worth making robust ...
 ====================================
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
index 2cf0a67b..eaf17685 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
@@ -166,8 +166,11 @@ Skipping: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Reset nested counters on input line ....
 Skipping: [....-..-..] Add interfaces on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
-Skipping: [....-..-..] Use \TexOrMath  on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Skipping: [....-..-..] Use \TextOrMath  on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
 Skipping: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Skipping: [....-..-..] Using \setlength with \dimen 0 on input line ....
@@ -710,8 +713,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
index 8d92130d..0e550e29 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
@@ -160,8 +160,11 @@ Skipping: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Reset nested counters on input line ....
 Skipping: [....-..-..] Add interfaces on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
-Skipping: [....-..-..] Use \TexOrMath  on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Skipping: [....-..-..] Use \TextOrMath  on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
 Skipping: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Skipping: [....-..-..] Using \setlength with \dimen 0 on input line ....
@@ -694,8 +697,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
index aa7008c1..c8eef1ca 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
@@ -160,8 +160,11 @@ Skipping: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Reset nested counters on input line ....
 Skipping: [....-..-..] Add interfaces on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
-Skipping: [....-..-..] Use \TexOrMath  on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Skipping: [....-..-..] Use \TextOrMath  on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
 Skipping: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Skipping: [....-..-..] Using \setlength with \dimen 0 on input line ....
@@ -703,8 +706,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/tlb-remreset-002.tlg b/base/testfiles/tlb-remreset-002.tlg
index 72b47c94..1281578f 100644
--- a/base/testfiles/tlb-remreset-002.tlg
+++ b/base/testfiles/tlb-remreset-002.tlg
@@ -75,7 +75,7 @@ l. ...\show\cl at subsection
 l. ...\show\thesection
                          % \arabic{section}
 > \thesection=macro:
-->\@arabic \c at section .
+->\arabic {section}.
 l. ...\show\thesection
                          % unchanged as it wasn't on before
 > \cl at subsection=macro:
@@ -91,7 +91,7 @@ l. ...\show\cl at section
 l. ...\show\thesubsection
                          % \thesubsection . \arabic{subsubsection}
 > \thesubsection=macro:
-->\@arabic \c at subsection .
+->\arabic {subsection}.
 l. ...\show\thesubsection
                          % changed to \arabic{subsection}
 > \cl at subsection=macro:
@@ -103,7 +103,7 @@ l. ...\show\cl at subsection
 l. ...\show\cl at section
                          % now empty
 > \thefootnote=macro:
-->\thesubsection .\@arabic \c at footnote .
+->\thesubsection .\arabic {footnote}.
 l. ...\show\thefootnote
                          % \thesubsection.\arabic{footnote}
 > \cl at subsection=macro:
@@ -111,7 +111,7 @@ l. ...\show\thefootnote
 l. ...\show\cl at subsection
                          % footnote added
 > \thefootnote=macro:
-->\@arabic \c at footnote .
+->\arabic {footnote}.
 l. ...\show\thefootnote
                          % back to \arabic{footnote}
 > \cl at subsection=macro:
@@ -149,7 +149,7 @@ l. ...\show\thefootnot
 l. ...\show\cl at subsection
                          % unchanged
 > \thefootnote=macro:
-->\thesubsection .\@arabic \c at footnote .
+->\thesubsection .\arabic {footnote}.
 l. ...\show\thefootnote
                          % \thesubsection.\arabic{footnote}
 > \cl at subsection=macro:
@@ -157,7 +157,7 @@ l. ...\show\thefootnote
 l. ...\show\cl at subsection
                          % 3 footnote resets?
 > \thefootnote=macro:
-->\@arabic \c at footnote .
+->\arabic {footnote}.
 l. ...\show\thefootnote
                          % \arabic{footnote}
 > \cl at subsection=macro:
diff --git a/base/testfiles/tlb-remreset-002.lvt b/base/testfiles/tlb-remreset-004.lvt
similarity index 54%
copy from base/testfiles/tlb-remreset-002.lvt
copy to base/testfiles/tlb-remreset-004.lvt
index 2523b9d8..2da1d251 100644
--- a/base/testfiles/tlb-remreset-002.lvt
+++ b/base/testfiles/tlb-remreset-004.lvt
@@ -17,19 +17,19 @@
 \show\cl at chapter
 \show\cl at section
 
-\counterwithout{foo}{baz}
+\counterwithout[\roman]{foo}{baz}
 
 \show\thefoo  % undefined
 \show\cl at foo  % undefined
 \show\cl at baz  % undefined
 
-\counterwithout{footnote}{baz}
+\counterwithout[\roman]{footnote}{baz}
 
-\show\thefootnote  % \arabic{footnote}
+\show\thefootnote  % \arabic{footnote}  -- unchanged
 \show\cl at baz       % undefined
 \show\cl at footnote  % empty
 
-\counterwithout{chapter}{section}
+\counterwithout[\roman]{chapter}{section}
 
 \show\thechapter   % undefined
 \show\cl at chapter   % undefined
@@ -40,17 +40,19 @@
 
 \show\thesection    % \arabic{section}
 
-\counterwithout{section}{subsection}
+\typeout{Next case is weird, perhaps a check after all?}
 
-\show\thesection    % unchanged as it wasn't on before
+\counterwithout[\roman]{section}{subsection}
+
+\show\thesection    % \roman --- even though there is no without
 \show\cl at subsection % unchanged
 \show\cl at section    % unchanged
 
 \show\thesubsection % \thesubsection . \arabic{subsubsection}
 
-\counterwithout{subsection}{section}
+\counterwithout[\roman]{subsection}{section}
 
-\show\thesubsection % changed to \arabic{subsection}
+\show\thesubsection % unchanged 
 \show\cl at subsection % unchanged
 \show\cl at section    % now empty
 
@@ -59,36 +61,36 @@
 
 \counterwithin{footnote}{subsection}
 
-\show\thefootnote   % \thesubsection.\arabic{footnote} 
+\show\thefootnote   % \arabic{footnote} 
 \show\cl at subsection % footnote added
 
-\counterwithout{footnote}{subsection}
+\counterwithout[\roman]{footnote}{subsection}
 
-\show\thefootnote   % back to \arabic{footnote}
+\show\thefootnote   % \arabic{footnote} 
 \show\cl at subsection % footnote removed
 
 
-\counterwithin{footnot}{subsection}
+\counterwithin[\roman]{footnot}{subsection}
 
 \show\thefootnot    % undefined
 \show\cl at subsection % unchanged
 
-\counterwithout{footnot}{subsection}
+\counterwithout[\roman]{footnot}{subsection}
 
 \show\thefootnot    % undefined
 \show\cl at subsection % unchanged
 
 
-\counterwithin{footnote}{subsection}
-\counterwithin{footnote}{subsection}
-\counterwithin{footnote}{subsection}
+\counterwithin[\roman]{footnote}{subsection}
+\counterwithin[\arabic]{footnote}{subsection}
+\counterwithin[\Roman]{footnote}{subsection}
 
-\show\thefootnote   % \thesubsection.\arabic{footnote}
-\show\cl at subsection % 3 footnote resets?
+\show\thefootnote   % \Roman{footnote}
+\show\cl at subsection % 3 footnote?
 
-\counterwithout{footnote}{subsection}
+\counterwithout[\roman]{footnote}{subsection}
 
-\show\thefootnote   % \arabic{footnote}
+\show\thefootnote   % \roman{footnote}
 \show\cl at subsection % all footnotes removed?
 
 \END
diff --git a/base/testfiles/tlb-remreset-002.tlg b/base/testfiles/tlb-remreset-004.tlg
similarity index 85%
copy from base/testfiles/tlb-remreset-002.tlg
copy to base/testfiles/tlb-remreset-004.tlg
index 72b47c94..e111d3a7 100644
--- a/base/testfiles/tlb-remreset-002.tlg
+++ b/base/testfiles/tlb-remreset-004.tlg
@@ -16,7 +16,7 @@ l. ...\show\cl at section
 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H <return>  for immediate help.
  ...                                              
-l. ...\counterwithout{foo}{baz}
+l. ...\counterwithout[\roman]{foo}{baz}
 Your command was ignored.
 Type  I <command> <return>  to replace it with another command,
 or  <return>  to continue without it.
@@ -33,14 +33,14 @@ l. ...\show\cl at baz
 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H <return>  for immediate help.
  ...                                              
-l. ...\counterwithout{footnote}{baz}
+l. ...\counterwithout[\roman]{footnote}{baz}
 Your command was ignored.
 Type  I <command> <return>  to replace it with another command,
 or  <return>  to continue without it.
 > \thefootnote=macro:
 ->\@arabic \c at footnote .
 l. ...\show\thefootnote
-                        % \arabic{footnote}
+                        % \arabic{footnote}  -- unchanged
 > \cl at baz=undefined.
 l. ...\show\cl at baz
                         % undefined
@@ -52,7 +52,7 @@ l. ...\show\cl at footnote
 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H <return>  for immediate help.
  ...                                              
-l. ...\counterwithout{chapter}{section}
+l. ...\counterwithout[\roman]{chapter}{section}
 Your command was ignored.
 Type  I <command> <return>  to replace it with another command,
 or  <return>  to continue without it.
@@ -74,10 +74,11 @@ l. ...\show\cl at subsection
 ->\@arabic \c at section .
 l. ...\show\thesection
                          % \arabic{section}
+Next case is weird, perhaps a check after all?
 > \thesection=macro:
-->\@arabic \c at section .
+->\roman {section}.
 l. ...\show\thesection
-                         % unchanged as it wasn't on before
+                         % \roman --- even though there is no without
 > \cl at subsection=macro:
 ->\@elt {subsubsection}.
 l. ...\show\cl at subsection
@@ -91,9 +92,9 @@ l. ...\show\cl at section
 l. ...\show\thesubsection
                          % \thesubsection . \arabic{subsubsection}
 > \thesubsection=macro:
-->\@arabic \c at subsection .
+->\roman {subsection}.
 l. ...\show\thesubsection
-                         % changed to \arabic{subsection}
+                         % unchanged
 > \cl at subsection=macro:
 ->\@elt {subsubsection}.
 l. ...\show\cl at subsection
@@ -103,17 +104,17 @@ l. ...\show\cl at subsection
 l. ...\show\cl at section
                          % now empty
 > \thefootnote=macro:
-->\thesubsection .\@arabic \c at footnote .
+->\thesubsection .\arabic {footnote}.
 l. ...\show\thefootnote
-                         % \thesubsection.\arabic{footnote}
+                         % \arabic{footnote}
 > \cl at subsection=macro:
 ->\@elt {subsubsection}\@elt {footnote}.
 l. ...\show\cl at subsection
                          % footnote added
 > \thefootnote=macro:
-->\@arabic \c at footnote .
+->\roman {footnote}.
 l. ...\show\thefootnote
-                         % back to \arabic{footnote}
+                         % \arabic{footnote}
 > \cl at subsection=macro:
 ->\@elt {subsubsection}.
 l. ...\show\cl at subsection
@@ -122,7 +123,7 @@ l. ...\show\cl at subsection
 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H <return>  for immediate help.
  ...                                              
-l. ...\counterwithin{footnot}{subsection}
+l. ...\counterwithin[\roman]{footnot}{subsection}
 Your command was ignored.
 Type  I <command> <return>  to replace it with another command,
 or  <return>  to continue without it.
@@ -137,7 +138,7 @@ l. ...\show\cl at subsection
 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H <return>  for immediate help.
  ...                                              
-l. ...\counterwithout{footnot}{subsection}
+l. ...\counterwithout[\roman]{footnot}{subsection}
 Your command was ignored.
 Type  I <command> <return>  to replace it with another command,
 or  <return>  to continue without it.
@@ -149,17 +150,17 @@ l. ...\show\thefootnot
 l. ...\show\cl at subsection
                          % unchanged
 > \thefootnote=macro:
-->\thesubsection .\@arabic \c at footnote .
+->\thesubsection .\Roman {footnote}.
 l. ...\show\thefootnote
-                         % \thesubsection.\arabic{footnote}
+                         % \Roman{footnote}
 > \cl at subsection=macro:
 ->\@elt {subsubsection}\@elt {footnote}\@elt {footnote}\@elt {footnote}.
 l. ...\show\cl at subsection
-                         % 3 footnote resets?
+                         % 3 footnote?
 > \thefootnote=macro:
-->\@arabic \c at footnote .
+->\roman {footnote}.
 l. ...\show\thefootnote
-                         % \arabic{footnote}
+                         % \roman{footnote}
 > \cl at subsection=macro:
 ->\@elt {subsubsection}.
 l. ...\show\cl at subsection
diff --git a/base/testfiles/tlb-rollback-004-often.luatex.tlg b/base/testfiles/tlb-rollback-004-often.luatex.tlg
index 91600746..e2d570d6 100644
--- a/base/testfiles/tlb-rollback-004-often.luatex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.luatex.tlg
@@ -194,8 +194,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.tlg b/base/testfiles/tlb-rollback-004-often.tlg
index 63d1c0c5..a21e3609 100644
--- a/base/testfiles/tlb-rollback-004-often.tlg
+++ b/base/testfiles/tlb-rollback-004-often.tlg
@@ -183,8 +183,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.xetex.tlg b/base/testfiles/tlb-rollback-004-often.xetex.tlg
index 1ba0e5b2..85aa7783 100644
--- a/base/testfiles/tlb-rollback-004-often.xetex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.xetex.tlg
@@ -183,8 +183,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/tlb-rollback-005.luatex.tlg b/base/testfiles/tlb-rollback-005.luatex.tlg
index 6f54c4e8..6f9ef2c1 100644
--- a/base/testfiles/tlb-rollback-005.luatex.tlg
+++ b/base/testfiles/tlb-rollback-005.luatex.tlg
@@ -197,8 +197,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/tlb-rollback-005.tlg b/base/testfiles/tlb-rollback-005.tlg
index 21059410..8a25b86a 100644
--- a/base/testfiles/tlb-rollback-005.tlg
+++ b/base/testfiles/tlb-rollback-005.tlg
@@ -187,8 +187,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/base/testfiles/tlb-rollback-005.xetex.tlg b/base/testfiles/tlb-rollback-005.xetex.tlg
index 75cd4fed..87dfe891 100644
--- a/base/testfiles/tlb-rollback-005.xetex.tlg
+++ b/base/testfiles/tlb-rollback-005.xetex.tlg
@@ -187,8 +187,11 @@ Applying: [....-..-..] Reset nested counters on input line ....
 Already applied: [....-..-..] Reset nested counters on input line ....
 Applying: [....-..-..] Add interfaces on input line ....
 Already applied: [....-..-..] Add interfaces on input line ....
-Applying: [....-..-..] Use \TexOrMath  on input line ....
-Already applied: [....-..-..] Use \TexOrMath  on input line ....
+Skipping: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] counter without/within on input line ....
+Already applied: [....-..-..] counter without/within on input line ....
+Applying: [....-..-..] Use \TextOrMath  on input line ....
+Already applied: [....-..-..] Use \TextOrMath  on input line ....
 Applying: [....-..-..] \TextOrMath  on input line ....
 Already applied: [....-..-..] \TextOrMath  on input line ....
 Applying: [....-..-..] Using \setlength with \dimen 0 on input line ....
diff --git a/required/amsmath/amsmath.dtx b/required/amsmath/amsmath.dtx
index 88578611..4300dded 100644
--- a/required/amsmath/amsmath.dtx
+++ b/required/amsmath/amsmath.dtx
@@ -86,7 +86,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\ProvidesPackage{amsmath}[2021/04/20 v2.17j AMS math features]
+\ProvidesPackage{amsmath}[2021/07/08 v2.17j AMS math features]
 %    \end{macrocode}
 %
 % \section{Catcode defenses}
@@ -2627,7 +2627,9 @@ ill-advised in LaTeX.%
 %
 %    \begin{macro}{\numberwithin}
 %    Provide a convenient way to specify that equations should be
-%    numbered within sections.
+%    numbered within sections. The \LaTeX{} kernel contains a similar command
+%    \cs{counterwithin} (with a slightly extended syntax) that can be used
+%    as a drop-in replacement for \cs{numberwithin}.
 %    \begin{macrocode}
 \newcommand{\numberwithin}[3][\arabic]{%
   \@ifundefined{c@#2}{\@nocounterr{#2}}{%





More information about the latex3-commits mailing list.