# Standard for writing chemical formulae and chemical names

As we'll be seeing a lot of chemical formulae, and since mathjax is available, we should define a standard way of representing chemical formulae in our posts.

I propose something like \mathrm{formula} as in

$\mathrm{H_2O}$

which is neat. Anybody feel fancier?

We also need to figure out how to write chemical names. What do you think of something like \textbf{chemical} as in

$\textbf{diketone}$ ?

EDIT

After writing a question using \textbf{} to wrap chemical names, I think that using the standard markdown **text** while using \mathrm{} for formulae command looks better.

• I've filed a request for mhchem on the main meta…
– F'x
Apr 26 '12 at 16:26

Mathjax 2.0 supports the mhchem extension with stuff like \ce{H2O} etc. Either we bug the SE overlords to upgrade us, or we just copy the formatting of mhchem.

In the meantime, we can use the \require{} mathjax extension enabling switch. Eg:

 $\require{mhchem}$
$\ce{HCl}$ dissociates in water as follows:
$$\ce{H2O +HCl<=>H3O+ +Cl-}$$


Which yields:

• SE is already using MathJax 2.0 as far as I know, it's only a matter of enabling this specific module. Apr 26 '12 at 5:45

I agree with Nick T that particularly $\mathrm{}$ looks so different from the surrounding text that it becomes hard to read: the combination of the large size and roman font is ok for mathematics where most letters are lowercase and italicised, but not for bulky chemical formulas. That's why I'd prefer $\mathsf{}$ as I used here, but it still looks a bit out of place. It also needs $\small$ added, because the letters are to tall otherwise. At any rate, I think one should use a unified $\newcommand{}$ at the beginning for plain-MathJax solutions.

Directly using html tags yields of course the most native look, but is IMO unacceptable because it's really awkward to type. I'd rather use Unicode characters then, like

H₂SO₄ + H₂O  ⇌  HSO₄⁻ + H₃O⁺

Both have an improvised, unprofessional feel about them and lack proper environments for e.g. aligned equations.

mhchem with suitable settings would definitely be the best solution.

If I'm only throwing out a couple formulae, especially inline with text, I somewhat prefer using <sup> and <sub> as it just looks better and doesn't have some jarring transition.

e.g.

CO32− compounds or simply CO2 dissolved in water makes my enzyme work.

CO<sub>3</sub><sup>2&minus;</sup> compounds or simply CO<sub>2</sub> [...]

• Or using equivalent LaTex notation. Apr 26 '12 at 15:27
• @Khaloymes my point was that the LaTeX doesn't fit well with the rest of the text, and if using a couple formulae it sticks out like a sore thumb, (e.g. here) Apr 26 '12 at 17:47