To typeset chemical formulas in LaTeX, load mhchem and write \ce{H2O} or \ce{2H2 + O2 -> 2H2O}. It handles subscripts, charges, and reaction arrows.