The following bug report has been fixed, here is screenshot of the question in its original state.

Explicit error values are usually given as an interval with $\pm$. When I try to typeset this with mhchem's \pu{...} command, it sneaks some undefined markers in there and raises numbers in a funny fashion:

  • $\pu{8.001 \pm 0.005 nm}$
    \pu{8.001 \pm 0.005 nm}
  • $\pu{8.001 +/- 0.005 nm}$
    \pu{8.001 +/- 0.005 nm} (alternative input possibility)
    \pu{8.001 +- 0.005 nm} (even easier)
    \pu{8.001+-0.005 nm} (thinkable, lesser code readability)

I believe it should rather look like

  • $8.001 \pm 0.005~\mathrm{nm}$
    8.001 \pm 0.005~\mathrm{nm}

Current workaround would be only typesetting the unit in the command, which kind of defeats the automatic spacing feature:

  • $8.001 \pm 0.005~\pu{nm}$
    8.001 \pm 0.005~\pu{nm}

Similarly exponents break:

  • $\pu{10^-10 m}$ \pu{10^-10 m}
  • or worse: $\pu{7.8\times10^-10 m}$ \pu{7.8\times10^-10 m}
  • still: $\pu{7.8\times10^{-10} m}$ \pu{7.8\times10^{-10} m}
  • Scientific notation works though: $\pu{7.8E-10 m}$ \pu{7.8E-10 m}

I don't know to whether there would be other formats like this, that potentially also break. (Please leave a comment.)


MathJax/mhchem 3.0.6 should fix the issues. It supports all standard uncertaincy notations as listed at https://chemistry.stackexchange.com/a/58667/24052. It will take a week or so to make its way to here.

You can test this not-yet-released version at the bottom of https://mhchem.github.io/MathJax-mhchem/


Thanks! Some of the things are already fixed on my harddrive (the "undefined" error), but not published yet. The others, I take as valid input for my todo list.

For now, 10^-10 can be written as e-10, but I'll support explicit exponents.

What does $8.001 \pm 0.005~\mathrm{nm}$ mean? Shouldn't it rather read $(8.001 \pm 0.005)~\mathrm{nm}$? I am not sure if I should support \pu{7.8\times10^-10 m}. Basically, you are asking for a <any mathematical expression><unit> syntax? Up to now I only had <number><unit> in mind. I am not sure how I could reliably differentiate between mathematical expression and unit ('$5n~\mathrm{g}$' vs. '$5~\mathrm{ng}$').

  • $\begingroup$ Please have a look at Loong's answer. It seems like the \pm variations are not a good choice. However, we'll find them still quite frequently in (especially older) publications, therefore I'd think we might want to support it just for quoting purposes. Anyway, the recommended $\pu{8.001(5) nm}$ \pu{8.001(5) nm} is also broken. $\endgroup$ Mar 2 '17 at 8:45
  • $\begingroup$ ?? 10^-10 renders as $\ce{10^-10}$ with \ce and $10^-10$ with mathjax $\endgroup$
    – MaxW
    Mar 2 '17 at 17:55

You must log in to answer this question.

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