MathJax-siunitx icon indicating copy to clipboard operation
MathJax-siunitx copied to clipboard

Typesetting uncertainties in scientific notation

Open padawanphysicist opened this issue 7 years ago • 1 comments

Redirected from https://github.com/mathjax/MathJax-third-party-extensions/issues/41

The following works just fine in LaTeX:

\SI{1}{\electronvolt} = \SI{1.602176621(98)e-19}{\joule}

However, when rendered using MathJax I have

1 eV = 1.602176621(98)e - 19 J

Where e - 19 shows up instead of the \times usual scientific notation. The package works fine when using regular decimals though.

To render properly I had to use the following workaround:

\SI{1}{\electronvolt} = \num{1.602176621(98)}\times 10^{-19}\,\si{\joule}

Is there a way to typeset this properly? I couldn't find anything similar in the package reference.

I can try to do this as soon as I get familiar with the code (since my JavaScript is quite basic), but I would appreciate if someone can give me some advice =)

padawanphysicist avatar Aug 28 '17 00:08 padawanphysicist

@padawanphysicist: The typesetting with \times notation is already implemented and should be working. Therefore, I suspect the problem is with the parser not properly picking up the combination of bracketed uncertainties and e notation. The initial parser I wrote was hand-written and pretty basic. Then, I set out to re-do the parser using PEG.js. I think the current implementation is already switched to PEG.js, but I'm not 100% sure (since I ran out of time for this project already some time ago). If it is, you can probably start by copy-pasting the PEG.js parser definition into the online exploration tool of PEG.js to identify why the parser does not catch your input properly.

burnpanck avatar Aug 28 '17 11:08 burnpanck