From a9d0083bcc66de9ea863ed14cf8cde44e88e4355 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Wed, 1 Nov 2023 03:03:53 +0000
Subject: CTAN sync 202311010303

---
 macros/latex/contrib/hyperref/hyperref.dtx | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'macros/latex/contrib/hyperref/hyperref.dtx')

diff --git a/macros/latex/contrib/hyperref/hyperref.dtx b/macros/latex/contrib/hyperref/hyperref.dtx
index 228069a9ee..0c5340d50b 100644
--- a/macros/latex/contrib/hyperref/hyperref.dtx
+++ b/macros/latex/contrib/hyperref/hyperref.dtx
@@ -51,7 +51,7 @@
 %<puvnenc>\ProvidesFile{puvnenc.def}
 %<puarenc>\ProvidesFile{puarenc.def}
 %<psdextra>\ProvidesFile{psdextra.def}
-%<!none&!packageEnd>  [2023-10-21 v7.01c %
+%<!none&!packageEnd>  [2023-10-27 v7.01d %
 %<package>  Hypertext links for LaTeX]
 %<nohyperref>  Dummy hyperref (SR)]
 %<driver>  Hyperref documentation driver file]
@@ -10990,6 +10990,26 @@
        }%
      }%  
   } 
+%    \end{macrocode}
+% amsthm doesn't issue an item in the theorem, we delay the target into
+% \cs{deferred@thm@head} and hope that it always begins a paragraph.
+%    \begin{macrocode}
+\AddToHook{package/amsthm/after}
+ {
+  \renewcommand\Hy@theorem@refstepcounter[1]
+   {%
+    \H@refstepcounter{#1}%
+    \hyper@makecurrent{#1}%
+    \global\let\Hy@dth@currentHref\@currentHref
+    \AddToHookNext{cmd/deferred@thm@head/before}
+     {\AddToHookNext{para/begin}
+       {\let\Hy@tempa\@currentHref
+        \MakeLinkTarget*{\Hy@dth@currentHref}%
+        \global\let\@currentHref\Hy@tempa
+       }%
+     }%  
+   }
+ }  
 \@ifundefined{hyper@nopatch@thm}{%  
 \AtBeginDocument{%  
  \@ifpackageloaded{cleveref}
-- 
cgit v1.2.3

