title: mathjax commas in digits
body: <p>This is a TeX legacy issue---it would have made more sense to require a whitespace when a whitespace is desired:  <code>12,123</code> is probably a number, while <code>12, 123</code> is probably a list.  Alas, it is what it is.</p>
  
  <p>Related to <a href="https://stackoverflow.com/questions/33004337/mathjax-rendering-of-commas-in-numbers">MathJax rendering of commas in numbers</a>, where the solution is suppression of spaces via <code>{,}</code>.  Works, but inconvenient.  Is there a way to make this automatic?</p>
  
  <p>The hack in <a href="https://github.com/mathjax/MathJax/issues/169#issuecomment-2040235" rel="nofollow noreferrer">https://github.com/mathjax/MathJax/issues/169#issuecomment-2040235</a> is concerned with European vs Anglo.  The equivalent hack,</p>
  
  <pre><code>&lt;script type="text/x-mathjax-config"&gt;
    MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
      MathJax.InputJax.TeX.Definitions.number =
        /^(?:[0-9]+(?:\,[0-9]{3})*(?:\{\.\}[0-9]*)*|\{\.\}[0-9]+)/
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>solves the comma problem in <code>1,234.56</code> but now there is a space after the period (i.e., before 5).  I am not sure how the regex above works.  can someone help?</p>