[latex3-commits] [latex3/hyperref] fixcleveref: fix cleveref loop (fffd2e0)

github at latex-project.org github at latex-project.org
Tue Nov 5 00:58:53 CET 2024


Repository : https://github.com/latex3/hyperref
On branch  : fixcleveref
Link       : https://github.com/latex3/hyperref/commit/fffd2e030c7aff952c0e9f34265fe4a03a8efd46

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

commit fffd2e030c7aff952c0e9f34265fe4a03a8efd46
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Nov 5 00:58:53 2024 +0100

    fix cleveref loop


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

fffd2e030c7aff952c0e9f34265fe4a03a8efd46
 ChangeLog.txt                    |  4 ++++
 hyperref.dtx                     | 15 +++++++++++++++
 testfiles-pdftex/fixcleveref.lvt | 10 ++++++++++
 testfiles-pdftex/fixcleveref.tlg |  0
 4 files changed, 29 insertions(+)

diff --git a/ChangeLog.txt b/ChangeLog.txt
index c2833e5..89d9a61 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,7 @@
+
+2024-11-05 Ulrike Fischer
+	* hyperref.dtx: add a fix for cleveref to update its data in refstepcounter.
+
 Version: 2024-10-30 v7.01k
 
 2024-10-14 Ulrike Fischer
diff --git a/hyperref.dtx b/hyperref.dtx
index d9e99cd..6a06051 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -10377,6 +10377,21 @@
  {
   \NewSocketPlug{refstepcounter}{hyperref}{\ifHy at pdfstring\else#1\fi}
   \AssignSocketPlug{refstepcounter}{hyperref}
+%    \end{macrocode}
+% change 2024-11-05: cleveref relies on refstepcounter to update its data. 
+%    \begin{macrocode}
+  \AddToHook{package/cleveref/after}
+   {
+     \@ifpackagelater{cleveref}{2018/03/28}{}
+      {
+      \NewSocketPlug{refstepcounter}{hyperref/fixcleveref}
+       {\ifHy at pdfstring\else
+         #1%
+         {\firstaid at cref@updatelabeldata{\@currentcounter}}%
+        \fi}
+       \AssignSocketPlug{refstepcounter}{hyperref/fixcleveref}   
+      }
+   }
   \NewSocketPlug{refstepcounter/target}{hyperref}
     {   
       \bool_lazy_and:nnT
diff --git a/testfiles-pdftex/fixcleveref.lvt b/testfiles-pdftex/fixcleveref.lvt
new file mode 100644
index 0000000..ae10d5d
--- /dev/null
+++ b/testfiles-pdftex/fixcleveref.lvt
@@ -0,0 +1,10 @@
+\documentclass{book}
+\usepackage{listings}
+\DebugSocketsOn
+\usepackage{hyperref}
+\usepackage{cleveref}
+\begin{document}
+\begin{lstlisting}
+blub
+\end{lstlisting}
+\end{document}
diff --git a/testfiles-pdftex/fixcleveref.tlg b/testfiles-pdftex/fixcleveref.tlg
new file mode 100644
index 0000000..e69de29





More information about the latex3-commits mailing list.