This post tries to be a guide to new members of the (chemical) scientific community for instructions on how to apply the right formatting when writing chemical and mathematical equations.

  • 7
    $\begingroup$ As a heavy editor myself, I am absolutely pro nice typeset. So while I see a post that needs redo, I try to go the whole ten yards, i.e. also changing all \times to \cdot. Whenever I review an edit that contains these faulty typesets I will improve it. When I see some faulty typeset in a post, but it is still very much understandable, I usually leave it that way (some people just refuse to use mhchem and then roll back). I think a good typeset is important for future references, so it should be done. $\endgroup$ – Martin - マーチン Jul 29 '14 at 16:32
  • 3
    $\begingroup$ @Martin-マーチン In many cases, changing \times to \cdot may be acceptable, preferable, or even absolutely necessary; however “if the point is used as the decimal sign, the cross and not the half-high dot should be used as the multiplication sign between numbers expressed with digits.” $4\,711.32 \times 0.351\,2$ $\endgroup$ – Loong Jul 18 '15 at 8:10

This answer tries to be a guide to new members of the (chemical) scientific community for instructions on how to apply the right formatting when writing chemical and mathematical equations.

The main problem most members struggle with is: Which symbols are written in roman (upright) font?

The Solution

As a rule of thumb: Symbols representing physical quantities or mathematical variables are the only things written in italic type.


Everything of the following is not written in italics:

  • Unit symbols, e.g. $\mathrm{kg}$, $\mathrm{kJ}$, $\mathrm{mol}$, $\mathrm{K}$
  • Chemical formulae. These are written in roman font automatically when using the mhchem commands, i.e. $\ce{...}$.
  • Function names such as $\sin$, $\cos$, $\log$, i.e. \sin, \cos, \log. (MathJax recognizes standard mathematical function names and automatically applies the correct style to them.)
  • Mathematical constants, the values of which never change, e.g. $\mathrm{e} = 2.718\,218\,8\ldots$, $\mathrm {i}^2 = -1$
    (Note that this convention for $\mathrm e$ and $\mathrm i$ is recommended by ISO 80000, IUPAC, NIST, and ACS, but italicizing these expressions is also very common.)
  • Descriptive indices such as $_\text{ox}$, $_\text{red}$ or $_\text{tot}$
  • Descriptive text
  • Symbols for mathematical operators, e.g. $\Delta$ in $\Delta x=x_2-x_1$ and each $\mathrm d$ in $\mathrm df/\mathrm dx$ (derivative of $f$ with respect to $x$). Note that $x$ and $y$ are variables in this context.
    (Note that this convention for differentials and derivatives is recommended by ISO 80000, IUPAC, NIST, and ACS; it is also used in the rules and style conventions presented in The International System of Units (SI). Nevertheless, italicizing these expressions is also very common.)
  • Electronic configurations $\mathrm{(1s)^2 (2s)^2 (2p)^4}$

Everything of the following is written in italics:

  • Symbols representing physical quantities, e.g. $m$ for mass or $V$ for volume,
    including fundamental physical constants (quantities that are considered to be constant under all circumstances), e.g. Planck constant $h$, Faraday constant $F$
  • Mathematical variables, e.g. $x$ and $y$, including expressions such as “the $x$ axis”
  • Iterative variables such as $i$ in a sum
  • Parameters, such as $a$, $b$, etc., which may be considered as constant in a particular context
  • Locants in chemical-compound names indicating attachments to heteroatoms, e.g. N,N-dimethylaniline
  • Stereochemical descriptors as (E) or (Z)


When, in a given context, different quantities have the same letter symbol or when, for one quantity, different applications or different values are of interest, a distinction can be made by use of subscripts. The following principles for the printing of subscripts apply (see also specific heat capacity $c_p$ in "Examples" below).

  • A subscript that represents a physical quantity or a mathematical variable, such as a running number, is printed in italic type, e.g. equilibrium constant on a pressure basis $K_p$ and equilibrium constant on a concentration basis $K_c$.
  • Other subscripts, such as those representing words or fixed numbers, are printed in upright type, e.g. Avogadro constant $N_\mathrm A$.

There are of course some mixed notations possible:

  • Chemical formulae which contain variables, such as the $n$ in the general formula for alkanes ($\ce{C_{$n$}H_{$2n+2$}}$) or $x$ in this molecular formula for a superconductor: $\ce{LaO_{$1−x$}F_{$x$}FeAs}$
  • Point groups, for example $C_n$, $S_{2n}$, $D_n$, $D_{n\mathrm{h}}$, $D_{n\mathrm{d}}$, $C_{n\mathrm{v}}$, $C_{n\mathrm{h}}$, $T$, $T_\mathrm{h}$, $T_\mathrm{d}$, $O$, $O_\mathrm{h}$, $I_\mathrm{h}$, $C_{\infty\mathrm{v}}$, $D_{\infty\mathrm{h}}$. More detail can be found in the question on the main site: How are point group character tables typeset correctly?
  • The symbol $\mathrm pK_\mathrm a$ for the logarithmic acid dissociation constant (read details under "Examples")

How do I do this?

There are two generic commands that produce roman output, \text{} and \mathrm{}. The main difference between the two commands is the way how math command characters such as the caret ^ or the underline _ are interpreted. In \text{} these get rendered out literally and in \mathrm{} they get interpreted as usual. The use of \mathrm{} is therefore recommended. (The command \rm should be avoided since it is deprecated and only maintained for backwards compatibility.)

The mhchem extension offers two shortcuts, \ce and \pu.

Display Math and inline Math

There are several possibilities to typeset mathematical formulae.
The inline math mode is invoked by bracing the statement with dollar signs, i.e. $...$.
A displayed mathematical equation, it is centered and typeset a little bigger, can be invoked using double dollar signs as braces, i.e. $$...$$. Here it is also possible to force a line break with \\.
When dealing with more than one equation, an aligning environment should be used instead, i.e. \begin{align}...\end{align}. The alignment character is the &. This can also be used in conjunction with the \ce{...} statements.


  • Chemical formulae and equations: $$\ce{H2O + HCl <--> H3O+ + Cl-}$$ becomes $$\ce{H2O + HCl <--> H3O+ + Cl-}$$
  • Units: $$E = 33.4~\mathrm{kJ\, mol^{-1}}$$ becomes $$E = 33.4~\mathrm{kJ\, mol^{-1}}$$ Note that there is a tilde character between the numbers and the \mathrm{} command, which produces a fixed, non-linebreaking space.
    Or: $$E = \pu{123E6 kJ mol-1}$$ becomes $$E = \pu{123E6 kJ mol-1}$$
  • Sums and descriptive text: $$m_\text{tot} = \sum_i^N m_i ~\text{for}~N~\text{substances}$$ becomes $$m_\text{tot} = \sum_i^N m_i ~\text{for}~N~\text{substances}$$
  • Specific heat capacity $c_p$: Here the subscript denotes the constant pressure $p$ and is as such written in italics; whereas in the molar heat capacity at constant pressure $C_{\mathrm m,p}$, the subscript $\mathrm m$ does not represent a quantity but the adjective “molar” and is printed in roman (upright) type.
  • In the symbol $\mathrm pK_\mathrm a$ for the logarithmic acid dissociation constant, the roman symbol $\mathrm p$ is interpreted as an operator ($\mathrm px=-\lg x$), the italic symbol $K$ represents a quantity (the dissociation constant), and the roman subscript $\mathrm a$ represents the word “acid”.
  • Locants: O-ethyl hexanethioate; N-methylbenzamide
  • Electronic configurations can easily be written using the mathrm command. The MathJaX command \mathrm{(1s)^2 (2s)^2 (2p)^6 (3s)^1} renders as $$\mathrm{(1s)^2 (2s)^2 (2p)^6 (3s)^1}\,.$$ Alternatively you can use \mathrm{[Ne] (3s)^1} to get $$\mathrm{[Ne] (3s)^1}\,.$$
  • Stereochemical descriptors are preferably italicized through markdown (*E*) or (*Z*), and not mathjax

Sources / Further reading:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .