# [Tex/LaTex] mhchem for titles

mhchem

I'm using mhchem for chemical formulas. In the body of the text it is fine, but it is given me nasty outputs for the titles on the index of my pdf reader. I have tried different ones and the result comes to be the same. Instead of \ce{IrO2} it appears 3222378.

Has someone encountered a similar problem?

The problem is that bookmarks can't handle things like math, colors, or font changes. You can use \texorpdfstring; the first argument will be used in the document and the second one will be used in the bookmarks:

\documentclass{article}
\usepackage{mhchem}
\usepackage{hyperref}

\begin{document}

\section{\texorpdfstring{\ce{IrO2}}{Ir02}}

\end{document}