I'm not entirely sure if this is still the correct platform for mhchem issues, but I've noticed a mildly annoying extra space that occurs just before mhchem commands if they are started by a superscript.

To illustrate:

  • blah blah $\ce{^{1}H}$ $\ce{^{1}H}$
  • blah blah $^{1}\ce{H}$ $^{1}\ce{H}$

and it can occur anywhere in a MathJax block, not just at the start:

  • blah blah $x + \ce{^{1}H}$ $x + \ce{^{1}H}$
  • blah blah $x + {}^{1}\ce{H}$ $x + {}^{1}\ce{H}$

This is almost imperceptible on Chemistry.SE (you can see it if you zoom in), but I ran into it separately while working on a GitHub Pages blog, where the spacing is more obvious and starts to actually look ugly while reading.

enter image description here

I can 'fix' this by putting the superscript outside of \ce{...}, or on my other website I can actually manually compensate for it by inserting negative spaces \!, but neither of these solutions are ideal, IMO.

Is this intended behaviour or a bug? What to do about it (if anything)?

  • $\begingroup$ I think this is an issue with mhchem (and I guess the answer shows that, too); I'm not sure how appropriate the bug tag is. $\endgroup$ Jul 3, 2021 at 16:17

1 Answer 1


This doesn't look right. $\mathrm{|{}^1H|}$ $\mathrm{|{}^1H|}$ and $\mathrm{|\ce{^1H}|}$ $\mathrm{|\ce{^1H}|}$ should give the same result. They don't.


I'll debug this further. Please don't use workarounds like \! because things will look weird after an update. (Hmm, StackExchange hasn't updated MathJax for 3 years.)

Update 2020-07-06: I improved the rendering of nuclides with version 4.1.1 of mhchemParser. It will be included with the next update of MathJax 3. (StackExchange is still on MathJax 2.7.5 which is of 2020-07-20, though.)

enter image description here

  • $\begingroup$ Thanks for your (very) quick response! For now, I'm sticking to \mathrm{}. $\endgroup$ Jul 3, 2021 at 16:16
  • 2
    $\begingroup$ @orthocresol, I published an update for mhchemParser. See above. $\endgroup$
    – mhchem
    Jul 7, 2021 at 6:06

You must log in to answer this question.

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