# Undefined control sequence with mhchem package

I am using chemical reactions and formula in my document. However, I am getting a compiler error " undefined control sequence when using \usepackage{mhchem}. If remove \usepackage{mhchem}, my document compiles with errors due to using commands related to the mhchem package. For example, writing \ce{H2O}. This is the heading of the document.

\documentclass[10pt]{iopart}
\usepackage{graphicx}
\usepackage{mhchem}
\newcommand{\gguide}{{\it Preparing graphics for IOP journals}}
\begin{document}
Water vapor(\ce{H2O}


Any suggestions for me?

• Welcome to TeX.SE! When trying to run your code, the log message reveals that mhchem loads amsmath, but iopart does not seem to like amsmath. It is really irritating that iopart has this "feature" and a bit surprising that mhchem loads amsmath. (And you might want to add an \end{document} to your code and replace \it by \itshape.) My conclusion is that you cannot have iopart and mchem at the same time. – marmot Feb 3 at 2:41
• I did not know that mhchem loads amsmath. There is an incompatibility between amsmath and iopart.cls. iopart is the class on the journal template. I will consult the journal service team about using a different class. Thank you! that was helpful. – Smily Feb 3 at 6:11
• Better yet, \newcommand{\gguide}{\textit{Preparing graphics for IOP journals}} – egreg Feb 3 at 9:20
• you are right. I commented this line and the codes compile well. Thanks for your help and the fast response!! – Smily Feb 5 at 17:42