How to typeset chemical formulas in roman?
The standard today is to use mhchem
(or similar packages), less typing
\documentclass{article}
\usepackage[version=4]{mhchem}
\begin{document}
\ce{CO2}
\end{document}
The the mhchem
documentation for details.
Another similar package is chemformula
(as suggested by @Dailef) to typeset chemical formulas and reactions. The link is taken from CTAN Comprehensive TEX Archive Network.
\documentclass{article}
\usepackage{chemformula}
\usepackage{lipsum}
\begin{document}
\ch{CO_2} \lipsum[1]
\ch{CO_2}
\end{document}
You should use $\mathrm{CO}_2$
, which provides exactly what you're looking for.