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?
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?
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}
chemmacros (\ch{H2O}). The package is probably overkill, though, if one only needs one or two chemical formulas.
– cgnieder
Dec 16 '12 at 20:12
$_2$ please see my last example.
– Gonzalo Medina
Dec 16 '12 at 20:27
\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}} in the preamble and then use it like \chem{H_2O}?
– cgnieder
Dec 16 '12 at 20:32
\ensuremath can be really useful.
– egreg
Dec 16 '12 at 21:25
_needs to be in a math mode to be subscripted. So doH$_2$O. – nickpapior Dec 16 '12 at 20:09_is only valid in math-mode (and LaTeX probably used math-mode from_2on 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