Trevor
I have been working on a document which has math in section titles. For example:

\section{$a + b = c$}

If I compile the document using the *hyperref* package, I get warnings that look like this:

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing math shift' on input line 1310.


I have learned from [this Stack Exchange answer](https://tex.stackexchange.com/a/53514/155760) that the way to get around these warnings is to use the \texorpdfstring{}{} command (which is part of the *hyperref* package):

\section{\texorpdfstring{$a + b = c$}{sometext}}

Although this command works, I am confused what the function of the second argument is. The [hyperref documentation](https://ctan.org/pkg/hyperref?lang=en) says it is a "PDFstring", but I still don't understand.

**What is the second argument to \texorpdfstring and how can I use it?**
Joseph Wright
The first argument is used by TeX for typesetting, the second is used in the PDF for e.g. TOC entries. In particular, the second argument needs to expand to 'text', which is normally handled by it simply _being_ text.

For example, with my siunitx package, one might want to pus some units into a heading and have them appear in the TOC

\documentclass{article}
\usepackage{siunitx}
\usepackage{hyperref}
\begin{document}

\section{Speed in \texorpdfstring{\unit{\metre\per\second}}{m/s}}

\end{document}

(siunitx` does that internally to avoid warnings, but done 'by hand' you get control of what the 'PDF String' version is.)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.