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

Choose a decimal delimiter

Open SamThilmany opened this issue 5 years ago • 5 comments

I'm using mathjax with this siunitx extension on a german website and would like to change the decimal delimiter from a period to a comma. Hou can I do this?

SamThilmany avatar Aug 29 '18 13:08 SamThilmany

Please refer to the documentation of the original LaTeX siunitx package, as this project is supposed to be an exact mapping of that package to MathJax. According to that documentation, there is a output-decimal-marker marker option. While I haven't worked on this code for a long time, a comment in the source-code says it's actually implemented.

burnpanck avatar Sep 01 '18 00:09 burnpanck

Thanks for your comment.

As I now see, my question was not asked well. I know that the decimal marker output is implemented, but it is modified using \SI[output-decimal-marker={,}]{1.00}{kg}. This means that you have to modify each and every number to match the correct decimal delimiter, which makes the code very cluttered.

I'd like to know if there is any possibility to globally change this for the entire website. Maybe in the global mathjax settings.

In LaTeX you do this by typing

\sisetup{output-decimal-marker = {,}}

to the preamble or loading the siunitx package with a specific locale:

\sisetup{locale = DE}

SamThilmany avatar Sep 01 '18 07:09 SamThilmany

Ah, I see. Unfortunately, \sisetup isn't implemented yet. A basic implementation would probably be quite simple, as the optionparser is already there, one simply needs to update the global defaults. Supporting the locale option might be a little more involved though. However, this raises questions of scoping, which works differently in MathJax than in LaTeX. I never had the time to dive into MathJax's implementation of scopes, which I thought would be essential for a complete implementation of \sisetup. As of now, there is unfortunately also no global MathJax settings mechanism implemented.

burnpanck avatar Sep 01 '18 08:09 burnpanck

I think that the implementation of \sisetup would really be a great addon to your extension. The locale is great too, but I don't think that it's worth the complexity of implementation. A user knows which delimiter he wants to use, so he can easily select the correct one using the \sisetup command.

It would be great if you could implement this whenever you find the time. I'd really appreciate it as it would make the typesetting much easier and less cluttered.

SamThilmany avatar Sep 01 '18 16:09 SamThilmany

Unforutnately, that's unlikely going to happen anytime soon.

burnpanck avatar Sep 01 '18 18:09 burnpanck