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

Fix MathML spacing rules for mo elements. (mathjax/MathJax#2392) #656

Merged
merged 2 commits into from
Apr 8, 2021

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Mar 24, 2021

This PR modifies the MathML spacing rules for <mo> (and embellished <mo>) to correspond to Neil's explanation of the rules in mathjax/MathJax#2392. This means that space is only added when the (embellished) operator is inside an mrow (or inferred mrow) that has more than one element. This also makes the spacing between two successive <mo> elements be the maximum of the rspace of the first and the lspace of the second (as opposed to the sum of the two, as in the past).

This only affects when MathML spacing has been selected for the output jax, not the TeX spacing.

Finally, this also fixes the coreParent() function, which used to skip over <mstyle> elements, and so would incorrectly report the parent for <mstyle><mo>+</mo></mstyle> as the <mo> element rather than the <mstyle>. Similarly, the isTopEmbellished() function incorrectly reported the <mo> as the top embellished operator.

Resolve issue mathjax/MathJax#2392.

@dpvc dpvc added this to the 3.1.3 milestone Mar 24, 2021
@dpvc dpvc requested a review from zorkow March 24, 2021 14:21
… there if the mrow has other modes before or after it. (OOPS!)
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  • This only applies to mrow elements? Not any other "implied" mrow?
  • I have to admit I cannot really see the difference, but maybe I misunderstand what Neil's issue is.

Finally I think it is just wrong to ascribe meaning to a grouping element like mrow! But then again that is a major fault of MathML.

Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f2f: lgtm.

@dpvc
Copy link
Member Author

dpvc commented Apr 8, 2021

For the historical record:

This only applies to mrow elements? Not any other "implied" mrow?

The isKind('mrow') is actually an instanceof check under the hood, so it will be true for subclasses of mrow as well. The inferredMrow is a subclass of mrow, it will also make that test true. So the change applies to both explicit and implicit mrows.

I have to admit I cannot really see the difference, but maybe I misunderstand what Neil's issue is.

It only affects the output when mathmlSpacing: true is set in the output jax options, as it is about the MathML spacing rules, not the (default) TeX spacing rules.

@dpvc dpvc merged commit 2fe7c0c into develop Apr 8, 2021
@dpvc dpvc deleted the issue2392 branch April 8, 2021 16:01
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

Successfully merging this pull request may close these issues.

None yet

2 participants