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

Typeset size changed for mathjax-tex between alpha.1 and beta.4 #3199

Open
AlexEdgcomb opened this issue Feb 29, 2024 · 1 comment
Open

Typeset size changed for mathjax-tex between alpha.1 and beta.4 #3199

AlexEdgcomb opened this issue Feb 29, 2024 · 1 comment
Labels
Expected Behavior This is how MathJax works v4

Comments

@AlexEdgcomb
Copy link

Issue Summary

The resulting SVG from tex2svgPromise() has a slightly different height and vertical-align style for mathjax-tex between alpha.1 and beta.4

Steps to Reproduce:

  1. Go to alpha.1
    Observed: SVG has height="2.26ex" and vertical-align: -0.563ex;
  2. Go to beta.4
    Observed: SVG has height="2.034ex" and vertical-align: -0.464ex;

Technical details:

  • MathJax Version: 4.0.0-beta.4
  • Client OS: MacOS 13.4
  • Browser: Firefox 123 and Chrome 122

I am using the following MathJax configuration:

MathJax = {output:{font:'mathjax-tex'}};

and loading MathJax via

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

Supporting information:

  • If the alpha.1's SVG's height and vertical-align values are replaced in the beta.4 SVG, the beta.4 SVG looks identical to alpha.1's SVG. So, I wasn't sure if this was an expected change.
  • One of our use cases for tex2svgPromise() is to add the resulting SVG to a canvas, wherein the canvas shows an animation with other images, text, and so on. Not exactly pixel perfect, but pretty close.
@dpvc
Copy link
Member

dpvc commented Mar 1, 2024

The height and depth of the equal sign was incorrectly set in the alpha.1 font data. Glyphs that are used as parts of multi-character assemblies for horizontal characters have their height and depth set to the largest height and depth of any of the characters in the assembly, so that they will align properly. Because the equal sign is used for the stretchy \Longrightarrow (and other double arrows), it was getting the extra height and depth of the arrow heads. That has been fixed in beta.4.

That makes the height and depth of the expression smaller in beta.4 than in alpha.1. But note that the viewBox is also different between the two, with beta.4 being smaller than alpha.1. For me, when I view your two example codepens in Firefox, the output is identical (the smaller viewBox and the smaller height and depth compensate for each other, and the visual output is the same.

@dpvc dpvc added Expected Behavior This is how MathJax works v4 labels Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expected Behavior This is how MathJax works v4
Projects
None yet
Development

No branches or pull requests

2 participants