LaTeX and Chemistry

LaTeX is very useful for typesetting Chemistry.

A few examples are below

Normally we would the chemical formula for Methane as


How do we achieve this in LaTeX? We to use maths mode.


So the underscore gives us the required Subscript 4. The $ tells latex to use maths mode.

If we want to include both the Atomic number and Mass of an element. For example Hydrogen.



Or Carbon (illustrating how to type 2 numbers)



Puts one number above the other. So in the case the ^ gives us our superscript.

If we wanted to write Sodium as an ion we would put

$Na^{1+}$ Note that the 1+ has been put inside curly braces {1+}


So far this is pretty straightforward

You can also type chemical equations, which is a little more involved:

$H_2O(l) \hspace{0.5cm} \xrightarrow[\text{}]{\text{heat}}\hspace{0.5cm} = \hspace{0.5cm} H_2O (g)$

The first \text{} would put any text under the arrow, while clearly the second puts the text on top.

As per instructions you need to tell LaTeX to use the package mathtools


I have also added some horizontal spacing so the equation is not squashed together.

however writefreely does not seem to render this fully. You can view this equation in Overleaf here

#LaTeX, #Learn, #typesetting, #chemistry, #basics

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)