I am using the \usepackage[version=3]{mhchem} package, and would like to write the formula for Dolomite in my report: (Ca,Mg)CO3

So far I haven't found a way to get that comma right in my formula using the mhchem package, and haven't found anyone having had troubles doing that so far. Anyone could help me doing so?


  • 3
    I am no chemist but are you sure that the comma is correct there? I know CaMg[CO3]2 – user31729 Jan 29 at 17:50
  • Welcome to TeX.Stackexchange! – user36296 Jan 29 at 17:50
  • 1
    @TheEpok: I totally agree with ChristianHupfer. However, if you definitely insist on using a comma to separate Ca and Mg, you could use \ce{Ca{,}Mg(CO3)2}. – leandriis Jan 29 at 18:26

First off, the OP's formula (Ca,Mg)CO3 is completely fine and meets IUPAC recommendations [1, p. 21], section IR-

(d) In solid-state chemistry, to enclose symbols of atoms occupying the same type of site in a random fashion. The symbols themselves are separated by a comma, with no space.


  1. K(Br,Cl)

To achieve this with mhchem, the sane way would be to use braces around the comma (as mentioned in the comments): {,}. Note that chemformula doesn't require the comma to be escaped and renders the formula correctly "as is":


        modules = all


\ce{(Ca{,}Mg)CO3} (\texttt{mhchem})

\ch{(Ca,Mg)CO3} (\texttt{chemformula})



  1. IUPAC “Red Book” Nomenclature of Inorganic Chemistry, 1st ed.; Connelly, N. G., Damhus, T., Hartshorn, R. M., Hutton, A. T., Eds.; IUPAC Recommendations; Royal Society of Chemistry: Cambridge, UK, 2005. ISBN 978-0-85404-438-2.
  • 1
    Thank you very much ! so easy, and yet haven't found any answer anywhere. Thanks again :) – TheEpok Jan 30 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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