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


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}$ ?


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.

  • 1
    $\begingroup$ I've filed a request for mhchem on the main meta… $\endgroup$
    – F'x
    Apr 26, 2012 at 16:26

3 Answers 3


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:

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

Which yields:

formula rendering

  • $\begingroup$ SE is already using MathJax 2.0 as far as I know, it's only a matter of enabling this specific module. $\endgroup$ Apr 26, 2012 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.


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> [...]
  • $\begingroup$ Or using equivalent LaTex notation. $\endgroup$
    – Khaloymes
    Apr 26, 2012 at 15:27
  • 2
    $\begingroup$ @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) $\endgroup$
    – Nick T
    Apr 26, 2012 at 17:47

You must log in to answer this question.

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