11

I have a section heading which includes an epsilon. Furthermore I am using the "hyperref" package to create links in my PDF document.

When compiling I get a strange warning that a math symbol is not allowed in a PDF string, e.g. Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing \varepsilon on input line 6.

However, if I open the compiled PDF there are no obvious errors and all links are clickable. Am I missing something, or can I just ignore this warning? Are there any alternatives to achieve the same result?

\documentclass{article}
\usepackage{hyperref}

\begin{document}
\tableofcontents
\section{$\varepsilon$SOA}

Text about $\varepsilon$SOA.

\end{document}

Screenshot of the compiled example

Thanks in advance!

  • In the pdf, the link itself (such as the one you see under Bookmarks in Adobe Reader) will not be able to display special characters. Check \texorpdfstring{}{} in hyperref manual. – Fato39 Jun 22 '15 at 9:28
  • Hi, \section{\texorpdfstring{$\varepsilon$}{e}SOA} is what you are looking for. It has been discussed here before, I'll try to find it. – yo' Jun 22 '15 at 9:29
  • 2
    Related / possible duplicate: 1 2 – yo' Jun 22 '15 at 9:33
15
  • Option pdfencoding=auto or unicode enables bookmarks in Unicode with more symbols.

  • Option psdextra defines lots of math symbols, however it misses \varepsilon.

  • Then \pdfstringdefDisableCommands can be used to define a bookmark replacement string for commands.

Full example:

\documentclass{article}
\usepackage[pdfencoding=auto, psdextra]{hyperref}
\pdfstringdefDisableCommands{\def\varepsilon{\textepsilon}}
\usepackage{bookmark}% faster updated bookmarks

\begin{document}
\tableofcontents
\section{$\varepsilon$SOA}

Text about $\varepsilon$SOA.

\end{document}

If the warnings about math shift should also be removed, then \texorpdfstring helps:

\section{\texorpdfstring{$\varepsilon$}{\textepsilon}SOA}
  • 1
    WHAT? I've been using \texorpdfstring{} this whole time when I could have used pdfencoding=auto? Dammit. – Canageek Jul 30 '15 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.