TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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

Hard to tell without seeing the actual code you are using; anyways, I'd suggest you the mhchem package:





enter image description here

Another option would be to use the chemmacros package:





However, for just one or two formulae, using a package might be overkill, and you could simply say something like





Or using a command, as cgnieder suggested,




share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.