# Cursive text after _

I would like to write H2O with a small 2 below the H.

H_2 O (water)


However, all text after _2 becomes cursive. It appear that something obvious is wrong but, I cant find what it is.

Anyone how have had the same problem?

-
it is hard to tell, however, the _ needs to be in a math mode to be subscripted. So do H$_2$O. – zeroth Dec 16 '12 at 20:09
Besides the fact that _ is only valid in math-mode (and LaTeX probably used math-mode from _2 on and didn’t know where to stop), \textsubscript{2} also works mostly. If you find yourself often using chemical formulae you might be interested in certain packages. – Qrrbrbirlbel Dec 16 '12 at 20:11
Thanks @zerot $did the trick! – RollerBoy Dec 16 '12 at 20:24 @RollerBoy, you probably (as Gonzalo also indicates) use the mhchem package. It is much inferior in use and can do a lot of stuff! :) – zeroth Dec 16 '12 at 20:57 ## 1 Answer Hard to tell without seeing the actual code you are using; anyways, I'd suggest you the mhchem package: \documentclass{article} \usepackage{mhchem} \begin{document} \ce{H2O} \end{document}  Another option would be to use the chemmacros package: \documentclass{article} \usepackage{chemmacros} \begin{document} \ch{H2O} \end{document}  However, for just one or two formulae, using a package might be overkill, and you could simply say something like \documentclass{article} \begin{document}$\mathrm{H}_2\mathrm{O}$\end{document}  Or using a command, as cgnieder suggested, \documentclass{article} \newcommand*\chem[1]{\ensuremath{\mathrm{#1}}} \begin{document} \chem{H_2O} \end{document}  - Similar with chemmacros (\ch{H2O}). The package is probably overkill, though, if one only needs one or two chemical formulas. – clemens Dec 16 '12 at 20:12 I not having too much chemical formulas to write so$_2$will do, but anyway Thanks – RollerBoy Dec 16 '12 at 20:26 @RollerBoy I added another options to my answer; I wouldn't use just $_2\$ please see my last example. – Gonzalo Medina Dec 16 '12 at 20:27
@RollerBoy how about saying \newcommand*\chem[1]{\ensuremath{\mathrm{#1}}} in the preamble and then use it like \chem{H_2O}? – clemens Dec 16 '12 at 20:32
@cgnieder I've added your two suggestions to my answer; thank you! – Gonzalo Medina Dec 16 '12 at 21:23