[latex3-commits] [git/LaTeX3-latex3-hyperref] cleanup-patches: protect links commands in contentsline, issue #121 (7bf9ab4)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Nov 13 18:35:56 CET 2022


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

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

commit 7bf9ab4c99c434c30d0d00771326ae3d487fb092
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Nov 13 18:35:56 2022 +0100

    protect links commands in contentsline, issue #121


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

7bf9ab4c99c434c30d0d00771326ae3d487fb092
 ChangeLog.txt |  1 +
 hyperref.dtx  | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/ChangeLog.txt b/ChangeLog.txt
index 06a26cd..86921dd 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -3,6 +3,7 @@
     * avoid error from old labels if hyperref is loaded, issue #261
     * fixed issue #260
     * fixed a nopatch command, issue #258
+    * Use protected commands in \contentsline to allow the use of \MakeUppercase, issue #121
     
 2022-09-22 Ulrike Fischer/David Carlisle
     * adapt setpagesize option to changes in LaTeX (stockwidth is always defined)
diff --git a/hyperref.dtx b/hyperref.dtx
index f144368..25f60c5 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -12016,7 +12016,14 @@
 %    \begin{macro}{\contentsline}
 %    The page number might be empty. In this case the link for the
 %    page number is suppressed to avoid little link boxes.
+%    
+%    change 2022-11-13: To avoid problems if |MakeUppercase| is used
+%    around the entry we use special protected commands:
+%    
 %    \begin{macrocode}
+\protected\def\Hy at toclinkstart{\hyper at linkstart{link}{\Hy at tocdestname}}
+\protected\def\Hy at toclinkend{\hyper at linkend}
+
 \def\contentsline#1#2#3#4{%
   \begingroup
     \Hy at safe@activestrue
@@ -12030,7 +12037,7 @@
       \csname l@#1\endcsname{#2}{#3}%
     \or % section
       \csname l@#1\endcsname{%
-        \hyper at linkstart{link}{\Hy at tocdestname}{#2}\hyper at linkend
+        \Hy at toclinkstart{#2}\Hy at toclinkend
       }{#3}%
     \or % page
       \def\Hy at temp{#3}%
@@ -12038,20 +12045,20 @@
         \csname l@#1\endcsname{#2}{#3}%
       \else
         \csname l@#1\endcsname{{#2}}{%
-          \hyper at linkstart{link}{\Hy at tocdestname}{#3}\hyper at linkend
+          \Hy at toclinkstart{#3}\Hy at toclinkend
         }%
       \fi
     \else % all
       \def\Hy at temp{#3}%
       \ifx\Hy at temp\ltx at empty
         \csname l@#1\endcsname{%
-          \hyper at linkstart{link}{\Hy at tocdestname}{#2}\hyper at linkend
+          \Hy at toclinkstart{#2}\Hy at toclinkend
         }{}%
       \else
         \csname l@#1\endcsname{%
-          \hyper at linkstart{link}{\Hy at tocdestname}{#2}\hyper at linkend
+          \Hy at toclinkstart{#2}\Hy at toclinkend
         }{%
-          \hyper at linkstart{link}{\Hy at tocdestname}{#3}\hyper at linkend
+          \Hy at toclinkstart{#3}\Hy at toclinkend
         }%
       \fi
     \fi





More information about the latex3-commits mailing list.