[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: add \@currentcounter to \refstepcounter, gh300 (#333) (a8401acf)

GitHub noreply at github.com
Thu May 7 16:46:58 CEST 2020


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

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

commit a8401acfc4e5132032088ad11b30dc212fefc3eb
Author: Ulrike Fischer <news3 at nililand.de>
Date:   Thu May 7 16:46:58 2020 +0200

    add \@currentcounter to \refstepcounter, gh300 (#333)
    
    * add \@currentcounter to \refstepcounter, issue #300
    
    * repair changes.txt
    
    * update rollback tests
    
    Co-authored-by: Ulrike Fischer <fischer at troubleshooting-tex.de>


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

a8401acfc4e5132032088ad11b30dc212fefc3eb
 base/changes.txt                                       |  5 +++++
 base/doc/ltnews32.tex                                  |  6 ++++++
 base/ltxref.dtx                                        | 18 +++++++++++++++---
 ...{github-0124.lvt => github-0300-currentcounter.lvt} |  7 +++----
 base/testfiles/github-0300-currentcounter.tlg          |  6 ++++++
 ...thub-0327-rollback.lvt => github-0300-rollback.lvt} | 13 ++-----------
 .../github-0300-rollback.tlg}                          |  8 +++-----
 .../tlb-latexrelease-rollback-003-often.luatex.tlg     |  2 ++
 base/testfiles/tlb-latexrelease-rollback-003-often.tlg |  2 ++
 .../tlb-latexrelease-rollback-003-often.xetex.tlg      |  2 ++
 base/testfiles/tlb-rollback-004-often.luatex.tlg       |  1 +
 base/testfiles/tlb-rollback-004-often.tlg              |  1 +
 base/testfiles/tlb-rollback-004-often.xetex.tlg        |  1 +
 13 files changed, 49 insertions(+), 23 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 3621c93f..b93f908c 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,11 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2020-05-07  Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+
+	* ltxref.dtx:
+	added \@currentcounter to \refstepcounter (gh/300)
+
 2020-05-02  Johannes Braams  <texniek at braams.xs4all.nl>
 
 	* ltexpl.dtx: Created aliases for two expl3 macros in order to use
diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index fe11844a..3796b23a 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -401,6 +401,12 @@ are ignored as elsewhere.
 \githubissue{327}
 
 
+\subsection{Record the counter name stepped by \cs{refstepcounter}}
+\cs{refstepcounter} now stores the name of counter in \cs{\@currentcounter}. 
+This allows packages like \pkg{zref} and \pkg{hyperref} to store the name without
+having to patch \cs{refstepcounter}.
+%
+\githubissue{300}
 
 
 \section{Changes to packages in the \pkg{graphics} category}
diff --git a/base/ltxref.dtx b/base/ltxref.dtx
index c20a3245..98187571 100644
--- a/base/ltxref.dtx
+++ b/base/ltxref.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltxref.dtx}
-             [2019/09/16 v1.1m LaTeX Kernel (Cross Referencing)]
+             [2020/05/07 v1.1n LaTeX Kernel (Cross Referencing)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltxref.dtx}
@@ -311,14 +311,16 @@
 %    \begin{macrocode}
 %</2ekernel>
 %<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2019/10/01}%
-%<latexrelease>                 {\refstepcounter}{Add \labelformat and \Ref}%
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>                 {\refstepcounter}{Add \@currentcounter}%
 %    \end{macrocode}
 %
 %  \begin{macro}{\refstepcounter}
 %     Step the counter and allow for labels to point to its current value.
+%  \changes{v1.1n}{2020/05/05}{record the counter name in \cs{@currentcounter}}
 %    \begin{macrocode}
 \def\refstepcounter#1{\stepcounter{#1}%
+    \edef\@currentcounter{#1}%
     \protected at edef\@currentlabel
 %    \end{macrocode}
 %    By generating the second csname first the |\p at ...| command can
@@ -381,6 +383,16 @@
 %    \begin{macrocode}
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2019/10/01}%
+%<latexrelease>                 {\refstepcounter}{Add \labelformat and \Ref}%
+%<latexrelease>\def\refstepcounter#1{\stepcounter{#1}%
+%<latexrelease>    \protected at edef\@currentlabel
+%<latexrelease>      {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
+%<latexrelease>}
+%<latexrelease>\def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1}
+%<latexrelease>\DeclareRobustCommand\Ref[1]{\protected at edef\@tempa{\ref{#1}}%
+%<latexrelease>   \expandafter\MakeUppercase\@tempa}
+%<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{0000/00/00}%
 %<latexrelease>                 {\refstepcounter}{Add \labelformat and \Ref}%
 %<latexrelease>
diff --git a/base/testfiles/github-0124.lvt b/base/testfiles/github-0300-currentcounter.lvt
similarity index 57%
copy from base/testfiles/github-0124.lvt
copy to base/testfiles/github-0300-currentcounter.lvt
index be32ece1..66a925f0 100644
--- a/base/testfiles/github-0124.lvt
+++ b/base/testfiles/github-0300-currentcounter.lvt
@@ -1,11 +1,10 @@
 \documentclass{article}
-
 \input{test2e}
 
 \begin{document}
 
 \START
-
-  \symbol{"1D400}
-
+\refstepcounter{section}
+\makeatletter\show\@currentcounter
 \end{document}
+
diff --git a/base/testfiles/github-0300-currentcounter.tlg b/base/testfiles/github-0300-currentcounter.tlg
new file mode 100644
index 00000000..28eccc92
--- /dev/null
+++ b/base/testfiles/github-0300-currentcounter.tlg
@@ -0,0 +1,6 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+> \@currentcounter=macro:
+->section.
+l. ...\makeatletter\show\@currentcounter
+(github-0300-currentcounter.aux)
diff --git a/base/testfiles/github-0327-rollback.lvt b/base/testfiles/github-0300-rollback.lvt
similarity index 51%
copy from base/testfiles/github-0327-rollback.lvt
copy to base/testfiles/github-0300-rollback.lvt
index 3441373c..987a8829 100644
--- a/base/testfiles/github-0327-rollback.lvt
+++ b/base/testfiles/github-0300-rollback.lvt
@@ -3,19 +3,10 @@
 \documentclass{article}
 \input{test2e}
 
-\showoutput
-
 \begin{document}
 
 \START
-
-\verb|~ ~| W \verb|~|
-
-\verb |~ ~| X \verb |~|
-
-\verb* |~ ~| Y \verb* |~|
-
-\verb*  |~ ~| Z \verb*  |~|
-
+\refstepcounter{section}
+\makeatletter\show\@currentcounter
 \end{document}
 
diff --git a/base/testfiles-TU/tu-tlb4500.tlg b/base/testfiles/github-0300-rollback.tlg
similarity index 50%
copy from base/testfiles-TU/tu-tlb4500.tlg
copy to base/testfiles/github-0300-rollback.tlg
index 6c7661c3..1f45bdc0 100644
--- a/base/testfiles-TU/tu-tlb4500.tlg
+++ b/base/testfiles/github-0300-rollback.tlg
@@ -1,7 +1,5 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-> \box...=
-\hbox(7.5+2.49998)x45.84
-.\TU/lmr/m/n/10 $<>\_{|}
-! OK.
-l. ...\showbox0
+> \@currentcounter=undefined.
+l. ...\makeatletter\show\@currentcounter
+(github-0300-rollback.aux)
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
index 2bfa2040..76dd481d 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
@@ -272,6 +272,7 @@ Skipping: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] alias size function on input line ....
 Skipping: [....-..-..] NFSS version1 commands on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Skipping: [....-..-..] Add \labelformat and \Ref  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 Skipping: [....-..-..] Mask line endings on input line ....
@@ -663,6 +664,7 @@ Skipping: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
 Already applied: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 Already applied: [....-..-..] Add \labelformat and \Ref  on input line ....
 Applying: [....-..-..] Mask line endings on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
index 832de98b..274dccb7 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
@@ -270,6 +270,7 @@ Skipping: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] alias size function on input line ....
 Skipping: [....-..-..] NFSS version1 commands on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Skipping: [....-..-..] Add \labelformat and \Ref  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 Skipping: [....-..-..] Mask line endings on input line ....
@@ -655,6 +656,7 @@ Skipping: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
 Already applied: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 Already applied: [....-..-..] Add \labelformat and \Ref  on input line ....
 Applying: [....-..-..] Mask line endings 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 08faf5a9..3a474b4e 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
@@ -270,6 +270,7 @@ Skipping: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] alias size function on input line ....
 Skipping: [....-..-..] NFSS version1 commands on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Skipping: [....-..-..] Add \labelformat and \Ref  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 Skipping: [....-..-..] Mask line endings on input line ....
@@ -664,6 +665,7 @@ Skipping: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
 Already applied: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 Already applied: [....-..-..] Add \labelformat and \Ref  on input line ....
 Applying: [....-..-..] Mask line endings on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.luatex.tlg b/base/testfiles/tlb-rollback-004-often.luatex.tlg
index 3932b05c..8840e86b 100644
--- a/base/testfiles/tlb-rollback-004-often.luatex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.luatex.tlg
@@ -669,6 +669,7 @@ Applying: [....-..-..] alias size function on input line ....
 Already applied: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
 Already applied: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 LaTeX Info: Redefining \Ref on input line ....
 Already applied: [....-..-..] Add \labelformat and \Ref  on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.tlg b/base/testfiles/tlb-rollback-004-often.tlg
index 7946d612..5f32c231 100644
--- a/base/testfiles/tlb-rollback-004-often.tlg
+++ b/base/testfiles/tlb-rollback-004-often.tlg
@@ -667,6 +667,7 @@ Applying: [....-..-..] alias size function on input line ....
 Already applied: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
 Already applied: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 LaTeX Info: Redefining \Ref on input line ....
 Already applied: [....-..-..] Add \labelformat and \Ref  on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.xetex.tlg b/base/testfiles/tlb-rollback-004-often.xetex.tlg
index 7466cc82..0fd10b12 100644
--- a/base/testfiles/tlb-rollback-004-often.xetex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.xetex.tlg
@@ -667,6 +667,7 @@ Applying: [....-..-..] alias size function on input line ....
 Already applied: [....-..-..] alias size function on input line ....
 Applying: [....-..-..] NFSS version1 commands on input line ....
 Already applied: [....-..-..] NFSS version1 commands on input line ....
+Skipping: [....-..-..] Add \@currentcounter  on input line ....
 Applying: [....-..-..] Add \labelformat and \Ref  on input line ....
 LaTeX Info: Redefining \Ref on input line ....
 Already applied: [....-..-..] Add \labelformat and \Ref  on input line ....





More information about the latex3-commits mailing list.