# mhchem for titles

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?

-
It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. –  Peter Grill Oct 11 '12 at 18:02

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}

-
Thank you for the hint. Finally, as the chemical formulas I am using as very simple, I've decided to use in line formulas, like IrO$_2$, for my titles. –  ziulfer Oct 12 '12 at 7:39