Skip to content

Kerning is off in MathJax4 + Asana + \mathit + "f" #3475

@blerner

Description

@blerner

Steps to Reproduce:

I have the following expression in an inline math expression:

\mathit{leftChild}

Technical details:

  • MathJax Version: 4.0
  • Client OS: Windows 11
  • Browser: Firefox 145 and Edge 142

I am using the following MathJax configuration:

MathJax = {
  tex: { inlineMath: [ ["$","$"], ["\\(","\\)"] ] },
  output: {
    font: 'mathjax-asana',
    scale: 1, // also tried this at > 1 scales
  },
  loader: { load: ['[tex]/noerrors'] }
};

and loading MathJax via

<script defer src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js"></script>

Supporting information:

  • A complete sample file is
<!doctype HTML>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <script>
      window.MathJax = {
        tex: { inlineMath: [ ["$","$"], ["\\(","\\)"] ] },
        output: { font: 'mathjax-asana' },
        loader: { load: ['[tex]/noerrors'] }
      };
    </script>
    <script defer src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js"></script>
    <style>
      body { font-size: 1.18rem; }
    </style>
  </head>
  <body>
    <p>
      <ul>
        <li><p>\(leftChild(idx) = \mathit{leftChild}(idx) = 2 * idx + 1\)</p></li>
        <li><p>\(rightChild(idx) = \mathit{rightChild}(idx) = 2 * idx + 2\)</p></li>
        <li><p>\(parent(idx) = \mathit{parent}(idx) = \mathit{floor}((idx - 1) / 2)\)</p></li>
      </ul>
    </p>
  </body>
</html>
  • I rendered this four times:
Using \mathit{...} Omitting \mathit{...}
Asana Image Image
NewCM Image Image

Things I noticed:

  • The two Asana renderings are basically identical, but the two NewCM renderings clearly show the difference that mathit makes
  • If you look at the full example above, the other words look much more consistent in their kerning; only the f is really wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Code ExampleContains an illustrative code example, solution, or work-aroundExpected BehaviorThis is how MathJax worksv4

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions