[latex3-commits] [latex3/hyperref] develop: handle TextOrMath in pdfstringdef, issue #303 (d2280f6)
github at latex-project.org
github at latex-project.org
Thu Oct 12 15:46:12 CEST 2023
Repository : https://github.com/latex3/hyperref
On branch : develop
Link : https://github.com/latex3/hyperref/commit/d2280f691e76555fa2094769f55aabad08548afc
>---------------------------------------------------------------
commit d2280f691e76555fa2094769f55aabad08548afc
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Thu Oct 12 15:46:12 2023 +0200
handle TextOrMath in pdfstringdef, issue #303
>---------------------------------------------------------------
d2280f691e76555fa2094769f55aabad08548afc
ChangeLog.txt | 3 +++
hyperref.dtx | 6 ++++++
testfiles/303-textormath.lvt | 11 +++++++++++
testfiles/303-textormath.tlg | 11 +++++++++++
4 files changed, 31 insertions(+)
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 870e5ec..2683714 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,6 @@
+2023-10-12 Ulrike Fischer
+ * hyperref.dtx: handle \TextOrMath in \pdfstringdef, issue 303
+
2023-10-05 Ulrike Fischer
* nameref.dtx: add missing nameref nopatches issue 302
diff --git a/hyperref.dtx b/hyperref.dtx
index 0ffe2c4..525515c 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -1311,6 +1311,12 @@
\def\MakeLowercase{\MakeLowercaseUnsupportedInPdfStrings}%
% \end{macrocode}
%
+% \paragraph{TextOrMath}
+% The \cs{TextOrMath} command is protected in a current \LaTeX{} and
+% so can not be processed.
+% \begin{macrocode}
+ \def\TextOrMath{\ifmmode\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}%
+% \end{macrocode}
% \paragraph{Support of math commands without prefix \texttt{text}.}
% This is controlled by option ``psdextra'' and only
% activated with Unicode PDF strings.
diff --git a/testfiles/303-textormath.lvt b/testfiles/303-textormath.lvt
new file mode 100644
index 0000000..bcbe3c4
--- /dev/null
+++ b/testfiles/303-textormath.lvt
@@ -0,0 +1,11 @@
+\documentclass{article}
+\input{regression-test}
+\usepackage{hyperref}
+\protected\def\blub{xxx}
+\START
+\SHOWFILE{\jobname.out}
+\OMIT
+\begin{document}
+\TIMO
+\section{\TextOrMath{Bär}{Duck}\blub}
+\end{document}
\ No newline at end of file
diff --git a/testfiles/303-textormath.tlg b/testfiles/303-textormath.tlg
new file mode 100644
index 0000000..0497a3b
--- /dev/null
+++ b/testfiles/303-textormath.tlg
@@ -0,0 +1,11 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+-------- 303-textormath.out (start) ---------
+(303-textormath.out) \BOOKMARK [1][-]{section.1}{\376\377\000B\000\344\000r}{}% 1^^M
+-------- 303-textormath.out (end) -----------
+Package hyperref Warning: Token not allowed in a PDF string (Unicode):
+(hyperref) removing `\blub' on input line ....
+[1
+] (303-textormath.aux)
+Package rerunfilecheck Info: File `303-textormath.out' has not changed.
+(rerunfilecheck) Checksum: 681929493D7C0B5F0BED0E986A6B097E;61.
More information about the latex3-commits
mailing list.