latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
239 stars 28 forks source link

Error on using math in section name with hyperref #532

Open navdeeprana opened 4 years ago

navdeeprana commented 4 years ago

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:

530 says something similar, but there it's a warning.

navdeeprana commented 4 years ago

Some digging in stackoverflow yields the following solution

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

Is this the correct way to resolve the issue?

davidcarlisle commented 4 years ago

I would guess this is more of a hyperref issue unicode. actually two issues

and

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 )

ArchangeGabriel commented 4 years ago

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