unicode-math icon indicating copy to clipboard operation
unicode-math copied to clipboard

Error on using math in section name with hyperref

Open navdeeprana opened this issue 5 years ago • 3 comments

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.

navdeeprana avatar Nov 10 '19 13:11 navdeeprana

Some digging in stackoverflow yields the following solution

\usepackage[unicode=true,psdextra]{hyperref}

Is this the correct way to resolve the issue?

navdeeprana avatar Nov 10 '19 13:11 navdeeprana

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 )

davidcarlisle avatar Nov 10 '19 13:11 davidcarlisle

Oh, I always \texorpdfstring{}{}’ed those assuming math in PDF toc wasn’t supported. Now I’ll have to try psdextra. :)

ArchangeGabriel avatar Nov 11 '19 10:11 ArchangeGabriel