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

MathJax extension that emulates the great LaTeX package `siunitx` by Joseph Wright

WARNING: This repository is unmaintained, and not up to date with recent MathJax or SIUnitX. If someone wants to step up to update and maintain this extension, I'd be happy to hand it over.

Extension: siunitx for the MathJax third party repository

An implementation of the siunitx package for LaTeX for MathJax.

#About siunitx

The siunitx package allows to typeset physical quantities consistently using the syntax \SI{299e6}{\metre\per\second}. This extension provides the same syntax in MathJax. Please see the documentation for siunitx on CTAN for details about siunitx.

References:

  • MathJax: http://www.mathjax.org/
  • siunitx on CTAN: http://www.ctan.org/pkg/siunitx
  • W3C note on Units in MathML: http://www.w3.org/TR/mathml-units/

Using this extension

Since the shutdown of the MathJax CDN, this extension is not currently hosted on any CDN. When using it in a production environment, please host it locally. To try it out, you may use rawgit. Then, add the extension to your configuration like any other third party extension. For example, your inline configuration might be

 <script type="text/x-mathjax-config">
 MathJax.Hub.Config({
   extensions: ["tex2jax.js","[siunitx]/siunitx.js"],
   jax: ["input/TeX","output/HTML-CSS"],
   tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
   TeX: {extensions: ["AMSmath.js","AMSsymbols.js", "sinuitx.js"]}
 });
 MathJax.Ajax.config.path['siunitx']  = 'http://rawgit.com/burnpanck/MathJax-siunitx/master/';
 </script>

Example

We have a listing of extracted code samples from the siunitx documentation (see it live) that highlight a number of uses of this extension and provides static images rendered with pdflatex and the siunitx package for comparison. For debugging purposes, you may append ?unpacked or ?modular to the URL, making the page use the combined but not minified, or even the modular original sources instead of the production level minified version of the extension.