4

In my thesis, I have math/Greek expressions in some of my section headings. I am given the error message: Token not allowed in PDF string. I found \textorpdfstring{} from similar questions posted, and although it works in the final PDF, I would prefer to not have the error.

\subsection{\textorpdfstring{$E1$} transitions in and out of the   
    \textorpdfstring{$\kappa$} band}

Thanks!

3
  • 4
    Welcome to TeX.SX! \texorpdfstring takes two arguments, not just one. The command name stands for "TeX (commands) or PDF string". You should use, for example, \textorpdfstring{$\kappa$}{k}. Sep 28, 2018 at 0:51
  • @JohnKormylo You'll get warnings in the log when using hyperref. Sep 28, 2018 at 4:00
  • Interesting, my experiments indicate that it doesn't matter what the second argument is, so long as it contains no tokens. Sep 28, 2018 at 5:08

1 Answer 1

11

I think two separate issues need to be addressed:

  • The command in question is called \texorpdfstring, not \textorpdfstring.

  • The command takes two arguments -- the TeX string (which can contain math tokens) and the pdf string, which should not.

The following code runs fine. Incidentally, the \boldmath instruction at the start of the argument of \section is optional.

\documentclass{article}
\usepackage{hyperref} % for '\texorpdfstring' command
\begin{document}
\section{\boldmath\texorpdfstring{$E1$}{E1} transitions 
   in and out of the \texorpdfstring{$\kappa$}{k} band}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .