[Tex/LaTex] Math in section headings

hyperrefsectioning

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!

Best Answer

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}