unicode-math
unicode-math copied to clipboard
Error on using math in section name with hyperref
Description
I get the following error
Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `math shift'
Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `math shift'
Error: Improper alphabetic constant.
Error: Fatal error occurred, no output PDF file produced!
when I compile the following code
\documentclass[a4,12pt]{report}
\usepackage{fontspec}
\usepackage{libertine}
\usepackage{unicode-math}
\usepackage[unicode=true]{hyperref}
\begin{document}
\section{$\lambda = 1$}
\end{document}
Add info or delete as appropriate:
- Relevant for XeTeX
- Relevant for LuaTeX
#530 says something similar, but there it's a warning.
Some digging in stackoverflow yields the following solution
\usepackage[unicode=true,psdextra]{hyperref}
Is this the correct way to resolve the issue?
I would guess this is more of a hyperref issue unicode. actually two issues
- probably psdextra probably ought to be set by default for luatex and xetex
and
- for the actual error itself that is already logged as https://github.com/latex3/hyperref/issues/63
although that does leave the remaining unicode-math issue over whether \let
is the best definition form to use here (as opposed to say \def
or \Umathchardef
)
Oh, I always \texorpdfstring{}{}
’ed those assuming math in PDF toc wasn’t supported. Now I’ll have to try psdextra. :)