# Why am I receiving this package hyperref error?

Error is:

Argument of \@secondoftwo has an extra }.
<inserted text>
\par
l.4 ...{$g(x)$} of the form \texorpdfstring{$ax$}}


MWE to get the error is:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\subsubsection{With \texorpdfstring{$g(x)$} of the form \texorpdfstring{$ax$}}
\end{document}


## Note:

I "solved" the error by placing a dot immediately after the \texorpdfstring command (why does it work?, I have no idea, I just was lucky), it's like if \texorpdfstring is waiting for an argument to end.

Solved error:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\subsubsection{With \texorpdfstring{$g(x)$} of the form \texorpdfstring{$ax$}.}
\end{document}


hyperref takes the text for bookmarks from the arguments of commands like \section, which can contain things like math, colors, or font changes, none of which will display in the pdf bookmarks as is.
Correct \texorpdfstring syntax is
\texorpdfstring{TEXstring}{PDFstring}

• You will also see that in your "working" example in the question, the o in of is missing from the PDF, as \texorpdfstring grabs that as it's second argument. – Torbjørn T. Jul 19 '15 at 7:07