8

This question already has an answer here:

In order to produce the following output involving a chemical formula

enter image description here

I can attempt to write the chemical formula as a mathematical formula:

\documentclass{report}
\usepackage{amsmath}
\begin{document}
    As the scintillator $\text{PbWO}_{\text{4}}$ crystals are used.
\end{document}

However, this method is a brute force when approaching a chemical formula. How would a versed Latex expert solve this task?

marked as duplicate by clemens, Phelype Oleinik, flav, user36296, TeXnician Dec 21 '18 at 15:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    See the package mhchem for example, especially its \ce macro – user31729 Aug 3 '17 at 12:21
13

This might help you.

It boils down to using the package

\usepackage[version=4]{mhchem}

or

\usepackage{chemformula}

which then allows you to use, e.g.,

\ce{3H2O} \\
\ce{1/2H2O} \\
\ce{AgCl2-} \\
\ce{H2_{(aq)}}

or

\ch{3 H2O} \\
\ch{1/2 H2O} \\
\ch{AgCl2-} \\
\ch{H2_{(aq)}}

respectively.

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