[latex3-commits] [git/LaTeX3-latex3-hyperref] main: test nameref, issue #234 (235d697)

Ulrike Fischer fischer at troubleshooting-tex.de
Mon May 16 10:48:50 CEST 2022


Repository : https://github.com/latex3/hyperref
On branch  : main
Link       : https://github.com/latex3/hyperref/commit/235d697f3bc02a6d400e1caf10794e357050b72a

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

commit 235d697f3bc02a6d400e1caf10794e357050b72a
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Mon May 16 10:48:50 2022 +0200

    test nameref, issue #234


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

235d697f3bc02a6d400e1caf10794e357050b72a
 ChangeLog.txt                |  4 ++++
 nameref.dtx                  | 14 +++++++++++---
 testfiles/gh234-ltugboat.lvt |  9 +++++++++
 testfiles/gh234-ltugboat.tlg |  6 ++++++
 4 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/ChangeLog.txt b/ChangeLog.txt
index e2d01e4..544f0fa 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,7 @@
+2022-05-16 Ulrike Fischer/David Carlisle
+    * fixed: check if \nameref is already defined for compability
+      with ltugboat.cls (issue #234)
+
 2022-05-13 Ulrike Fischer/David Carlisle
 
     * added new interface for package authors to create targets for internal
diff --git a/nameref.dtx b/nameref.dtx
index dabe4b6..d49735c 100644
--- a/nameref.dtx
+++ b/nameref.dtx
@@ -33,7 +33,7 @@
 %<driver>\ProvidesFile{nameref.drv}
 % \fi
 % \ProvidesFile{nameref.dtx}
-  [2022-05-13 v2.48 Cross-referencing by name of section]%
+  [2022-05-16 v2.49 Cross-referencing by name of section]%
 %
 %
 % \iffalse
@@ -843,8 +843,16 @@
 %    \end{macrocode}
 %    \begin{macro}{\nameref}
 %    \begin{macrocode}
-\NewDocumentCommand\nameref{s}
-   {\IfBooleanTF{#1}{\@namerefstar}{\T at nameref}}
+\@ifundefined{nameref}
+  {
+   \NewDocumentCommand\nameref{s}
+    {\IfBooleanTF{#1}{\@namerefstar}{\T at nameref}}
+  }
+  {
+    \PackageWarning{nameref}{Redefining \string\nameref}
+    \RenewDocumentCommand\nameref{s}
+    {\IfBooleanTF{#1}{\@namerefstar}{\T at nameref}}
+  }
 %    \end{macrocode}
 %    \end{macro}
 %    \begin{macro}{\Nameref}
diff --git a/testfiles/gh234-ltugboat.lvt b/testfiles/gh234-ltugboat.lvt
new file mode 100644
index 0000000..a637167
--- /dev/null
+++ b/testfiles/gh234-ltugboat.lvt
@@ -0,0 +1,9 @@
+\input{regression-test}
+\documentclass{ltugboat}
+\usepackage{nameref}
+\begin{document}
+\START
+
+\ShowCommand\nameref
+
+\end{document}
\ No newline at end of file
diff --git a/testfiles/gh234-ltugboat.tlg b/testfiles/gh234-ltugboat.tlg
new file mode 100644
index 0000000..2a4289a
--- /dev/null
+++ b/testfiles/gh234-ltugboat.tlg
@@ -0,0 +1,6 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+> \nameref=document command:
+  #1:s
+->\IfBooleanTF {#1}{\@namerefstar }{\T at nameref }.
+(gh234-ltugboat.aux)





More information about the latex3-commits mailing list.