Search code examples
htmllatexmathjax

How to resize (control) subscript sizes in MathJax


I have included the MathJax library in me HTML by including within the 'head' tag of my HTML.

<head>
  <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
  </script>
</head>

Then, I used the delimiter to signal the MathJax parsing...

 \[\sigma_{X}^{2} = VAR[X = E[(X-m_X)^2]\]

But note, the terrible sizing ratio between 'm' and its subscript 'X'.

enter image description here

I simply want to control this sizing. Or have MathJax configured to yield, what should be standard ratios between identifier and sub- or super-script.


Solution

  • You may control the size with LaTeX syntax (rather than MathJax configuration):

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>MathJax</title>
    <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
    <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
    </head>
    
    <body>
    \[\sigma_{\tiny X}^{2} = VAR[X = E[(X-m_X)^2]\]
    \[\sigma_{\scriptsize X}^{2} = VAR[X = E[(X-m_X)^2]\]
    \[\sigma_{\small X}^{2} = VAR[X = E[(X-m_X)^2]\]
    \[\sigma_{X}^{2} = VAR[X = E[(X-m_X)^2]\]
    \[\sigma_{\large X}^{2} = VAR[X = E[(X-m_X)^2]\]
    \[\sigma_{\Large X}^{2} = VAR[X = E[(X-m_X)^2]\]
    \[\sigma_{\LARGE X}^{2} = VAR[X = E[(X-m_X)^2]\]
    \[\sigma_{\huge X}^{2} = VAR[X = E[(X-m_X)^2]\]
    </body>
    </html>
    

    Actually, only footnotesize does not work for me (JSFiddle).