...
23 August 2023

Math in LaTeX headings

by markolenik

I often need math in my LaTeX headings. This is a problem because headings are used in the table of contents, where math can’t be properly rendered. chktex also complains about math in headings and throws the error:

Token not allowed in a PDF string (Unicode)

The fix is to provide a “plain text” version of the heading for the PDF table of contents as an option, for example:.

\section[The Logistic Map: x_{n+1} = r x_n (1 - x_n)]{The Logistic Map: $x_{n+1} = r x_n (1 - x_n)$}

Resources