I'm writing a thesis on clay materials which have rather unusual chemical formulas with commas in the subscript. For intance I try to write the following chemical formula in LaTeX:


The chemical formula of beidelite is: \ce{Na0,5Al2(Si3,5Al0,5)O10(OH)2.n(H2O)}


It ignores the commas and gives the following output:

chemical formula of beidelite

To be clear, I want the subscript after Na to say 0,5, the subscript after Si say 3,5 and the subscript after Al say 0,5.

How do i fix this?


Place the non-integers inside curly bracket groups:


The chemical formula of beidelite is: \ce{Na_{0,5}Al2(Si_{3,5}Al_{0,5})O10(OH)2.$n$(H2O)}


Output with <code>version=3</code>

| improve this answer | |
  • You should always specify the version when loading mhchem. in this case, using the original code when specifying version=4 the commas appear in the text but as normal text not subscripts. – ArTourter Feb 6 '16 at 13:46
  • I am using mhchem version 3. Should I add it to the code of my question? – Emily Feb 6 '16 at 14:07
  • @Emily In general such information is useful, as answers may depend on the version of packages used. – sodd Feb 6 '16 at 14:09
  • @ArTourter I'm aware, but in this case I decided to leave it out, since the version was not specified by the OP. Also, the solution is version-independent – the only difference is some different spacing in the output. But I agree that one should include the version option in general. – sodd Feb 6 '16 at 14:18
  • 1
    @hooy You should replace n with $n$ as this is a variable standing for a number – and therefore should be italic. – mhchem Feb 6 '16 at 16:53

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.