mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.2k stars 1.16k forks source link

MJ4 mathjax-tex: Overhead line too far left in MML for italicized ℓ #3102

Open AlexEdgcomb opened 1 year ago

AlexEdgcomb commented 1 year ago

Issue Summary

An overhead line above an italicized ℓ is too far left. Ex:

<math overflow="scroll">
  <mover accent="true">
    <mi>ℓ</mi>
    <mo>¯</mo>
  </mover>
</math>

Steps to Reproduce:

  1. Go to https://codepen.io/alexedgcomb/pen/mdaqwxJ

Observed: Overhead line is too far left

image

Expected: Overhead line to be centered, like in MJ2: https://codepen.io/alexedgcomb/pen/gOZXRzP

image

Technical details:

I am using the following MathJax configuration:

// Using CDN direct link b/c String 'mathjax-tex' yields the wrong URL, so falls back to mathjax-modern
MathJax = {output:{font:'https://cdn.jsdelivr.net/npm/mathjax-tex-font@1.0.0-alpha.1/es5/output/fonts/mathjax-tex'}};

and loading MathJax via

<script src="https://cdn.jsdelivr.net/npm/mathjax-full@4.0.0-alpha.1/es5/tex-mml-svg.min.js"></script>

Supporting information:

May be related to https://github.com/mathjax/MathJax/issues/3051, which was about LaTeX. This is about MML, so I made a new issue.

Issue present in 4.0.0-beta.3: https://codepen.io/alexedgcomb/pen/MWZOoVQ

image
dpvc commented 1 year ago

As you surmised, this is the same issue as #3051. If you add mathbackground="red" to the base <mi>, you will see that the accent actually is centered on the glyph:

ell

Because of the shape of the glyph, it doesn't appear to be. To fix that, the character needs a skew value, as described in #3051, as it is missing from the table there. You can add

0x2113: .111,

to that list, and it should take care of it. The older v2 fonts did include this skew value and a few others, which is why you like the v2 version. The skew values for v4 are obtained from the fonts' OpenType MATH tables, but these don't seem to have values for U+2113, so they didn't make it into the font.

AlexEdgcomb commented 1 year ago

@dpvc , thank you! Works as advertised :)