Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integral sign and centering #13

Closed
norbusan opened this issue Dec 4, 2024 · 8 comments
Closed

Integral sign and centering #13

norbusan opened this issue Dec 4, 2024 · 8 comments

Comments

@norbusan
Copy link

norbusan commented Dec 4, 2024

It seems that the axis of the integral sign is broken, see https://www.preining.info/MathFonts/ and select the Lete font in the drop down, screenshot attached.
Screenshot_20241204_205732

@dflipo
Copy link
Collaborator

dflipo commented Dec 4, 2024

Sorry, I can't reproduce the misalignment with LuaLaTeX and amsmath align* environment. I have no idea of which settings lead to wrong conversion into MathML, hints welcome!

@abccsss
Copy link
Owner

abccsss commented Dec 4, 2024

I tested the website on Firefox on Windows and Android, and the integral is correctly displayed, so this seems to be specific to Chromium-based browsers.

@norbusan
Copy link
Author

norbusan commented Dec 5, 2024

That is indeed puzzling that Integral signs and Sums are incorrectly rendered.
I checked with NewComputerModern otf math font, and it renders correctly in both Chrome and Firefox.
Then I have looked into the fonts with fontforge and looked into the math tables.
It was interesting that in the "Vert. Variants" for NewCMModern, the different sized integrals are shown centered, while in the Lete the different sized integrals share the lower baseline, not the middle axis.

NewCM:
Screenshot_20241205_142826

Lete Math:
Screenshot_20241205_142849

Not sure this is related, but at least it is a difference.

@abccsss
Copy link
Owner

abccsss commented Dec 5, 2024

Okay, I think I have a good guess of what's going on.

The probable cause is that the baseline in the font is not set to the expected position. Moving the glyph vertically should fix the problem.

My guess is that in Lua/XeLaTeX or Firefox, the operator is automatically vertically centred, so the actual vertical position of the glyph does not matter. But in Chrome this is not done.

This problem not only occurs with Lete, but also with XITS and Fira Math. I suspect it is the same problem, and the same fix should work.

I'll do more tests, and upload a fixed version later.

That aside, having looked more closely at https://www.preining.info/MathFonts/, I started to have more concerns:

  • The \hat, as in $\hat{\mathbf{k}}$, is not rendered with the correct accent from the font, but with the ASCII ^ symbol, which is not designed to be used like this.

  • The spacing of $z &lt; -d/2$ is incorrect. It should look like z < −d/2 rather than the ugly z < − d / 2 (note the double space in the middle!), which seems to be what was rendered in both Chrome and Firefox. This should be able to be fixed by replacing <mo>−</mo> with <mo lspace="0em" rspace="0em">−</mo> in the MathML, and similarly for the slash.

I'm not an expert in how MathML works in browsers, but I would guess that using a better LaTeX-to-MathML converter should solve these.

@abccsss abccsss closed this as completed in 1283192 Dec 5, 2024
@norbusan
Copy link
Author

norbusan commented Dec 6, 2024

Hi @abccsss
big thanks (with both my arXiv and TeX Live maintainer hats on), greatly appreciated!!!

Concerning the code on the page - that was not a latex2ml converter, but hand written as far as I know. The page is developed by Frédéric Wang https://github.com/fred-wang/MathFonts who is working on mathml support in browsers, so all credit goes to him. I just add some fonts to the list, and test-deploy it to my server before sending PRs.

@norbusan
Copy link
Author

Hi @abccsss
Short followup: The MathML spec seems to be a bit unclear about how to deal with these operators, and there is some move to clarify the spec: w3c/mathml-core#250
That would also fix the issue in Chrome(ium based) browsers: https://issues.chromium.org/issues/40889877

But a short-term fix to the Lete fonts would be greatly appreciated since the update for the MathML spec and the Chromium update will take a long time I fear.

Thanks for all your work!

@dflipo
Copy link
Collaborator

dflipo commented Dec 14, 2024

Issue fixed in version 0.45 which is on the way to CTAN.

@norbusan
Copy link
Author

Thanks a lot @dflipo , confirmed!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants