[latex3-commits] [git/LaTeX3-latex3-hyperref] cleanup-patches: allow to suppress an amspatch (f97b1e2)

Ulrike Fischer fischer at troubleshooting-tex.de
Mon Feb 6 17:09:15 CET 2023


Repository : https://github.com/latex3/hyperref
On branch  : cleanup-patches
Link       : https://github.com/latex3/hyperref/commit/f97b1e2f3065d9e4b4d9a8cbc5f0701a884d9fd5

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

commit f97b1e2f3065d9e4b4d9a8cbc5f0701a884d9fd5
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Mon Feb 6 17:09:15 2023 +0100

    allow to suppress an amspatch


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

f97b1e2f3065d9e4b4d9a8cbc5f0701a884d9fd5
 ChangeLog.txt        |  2 +-
 doc/hyperref-doc.tex |  5 +++++
 hyperref.dtx         | 52 +++++++++++++++++++++++++++++-----------------------
 3 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/ChangeLog.txt b/ChangeLog.txt
index bf4e22b..9c2269b 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -2,7 +2,7 @@
     * if babel is loaded casing with \MakeUppercase and \MakeLowercase
       respects the rules of the current locale/language in the bookmarks.
     * removed old amstex patch of \@seteqlabel
-    * 
+    * add \hyper at nopatch@amsmath at tag to allow to suppress an amsmath patch
 
 2023-02-04 Yukai Chou
     * change puenc-greek.def to puenc-greekbasic.def in docs, to sync with file
diff --git a/doc/hyperref-doc.tex b/doc/hyperref-doc.tex
index 2c5dd94..0685117 100644
--- a/doc/hyperref-doc.tex
+++ b/doc/hyperref-doc.tex
@@ -537,6 +537,11 @@ Check the \xpackage{nameref} documentation about a way to suppress these patches
 \item \emph{All} those redefinitions can be suppressed by defining \cs{hyper at nopatch@footnote}. Be aware that this can suppress links but also make unwanted links appear.
 \end{itemize}
 
+\item[amsmath tags] hyperref defines two internal commands of amsmath related the |\tag| command to add
+   an anchor. This code can be suppressed by defining \cs{hyper at nopatch@amsmath at tag}. 
+   (This normally make not sense in packages will probably be needed when math environments are change to allow tagging.)
+   
+
 \end{description}
 
 \section{Package options}
diff --git a/hyperref.dtx b/hyperref.dtx
index e9abb66..ec6fd44 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -12126,30 +12126,36 @@
 % up. They'll change all the code again anyway, I expect (SR).
 %
 % Version 6.77p uses a patch by Ross Moore.
+%
+% If |\hyper at nopatch@amsmath at tag| is defined we don't patch but assume
+% that kernel code adds anchors to equations.
 %    \begin{macrocode}
-\@ifpackageloaded{amsmath}{%
-  \def\Hy at make@anchor{%
-    \Hy at MakeCurrentHrefAuto{AMS}%
-    \Hy at raisedlink{\hyper at anchorstart{\@currentHref}\hyper at anchorend}%
-  }%
-  \def\Hy at make@df at tag@@#1{%
-    \gdef\df at tag{%
-      \maketag@@@{\Hy at make@anchor#1}%
-      \def\@currentlabel{#1}%
-    }%
-  }%
-  \def\Hy at make@df at tag@@@#1{%
-    \gdef\df at tag{%
-      \tagform@{\Hy at make@anchor#1}%
-      \toks@\@xp{\p at equation{#1}}%
-      \edef\@currentlabel{\the\toks@}%
-    }%
-  }%
-  \let\HyOrg at make@df at tag@@\make at df@tag@@
-  \let\HyOrg at make@df at tag@@@\make at df@tag@@@
-  \let\make at df@tag@@\Hy at make@df at tag@@
-  \let\make at df@tag@@@\Hy at make@df at tag@@@
-}{}
+\@ifundefined{hyper at nopatch@amsmath at tag}
+   {%
+    \@ifpackageloaded{amsmath}{%
+      \def\Hy at make@anchor{%
+        \Hy at MakeCurrentHrefAuto{AMS}%
+        \Hy at raisedlink{\hyper at anchorstart{\@currentHref}\hyper at anchorend}%
+      }%
+      \def\Hy at make@df at tag@@#1{%
+        \gdef\df at tag{%
+          \maketag@@@{\Hy at make@anchor#1}%
+          \def\@currentlabel{#1}%
+        }%
+      }%
+      \def\Hy at make@df at tag@@@#1{%
+        \gdef\df at tag{%
+          \tagform@{\Hy at make@anchor#1}%
+          \toks@\@xp{\p at equation{#1}}%
+          \edef\@currentlabel{\the\toks@}%
+        }%
+      }%
+      \let\HyOrg at make@df at tag@@\make at df@tag@@
+      \let\HyOrg at make@df at tag@@@\make at df@tag@@@
+      \let\make at df@tag@@\Hy at make@df at tag@@
+      \let\make at df@tag@@@\Hy at make@df at tag@@@
+    }{}
+  }{} 
 %    \end{macrocode}
 % This code I simply cannot remember what I was trying to achieve.
 % The final result seems to do nothing anyway.





More information about the latex3-commits mailing list.