Skip to content

Conversation

@dpvc
Copy link
Member

@dpvc dpvc commented Oct 29, 2025

This PR arranges for the various xarrow macros to produce a result that won't be stretched again later (e.g., when it is the sole child of an mtd element). The original MathML for something like \xrightarrow was an embellished operator, so if it was in a setting where the embellished operator should stretch, the arrow could be stretched further than it should. E.g.,

\begin{array}{c}
A+B+C\\
\xrightarrow{D}
\end{array}

would produce an arrow the full width of the column rather than jus the width of the "D" (plus a little extra).

Since the arrow has to be stretchy to accommodate the over-script, and since mover doesn't have an attribute to prevent stretching, the only way to fix this is to make the result of \xrightarrow and similar macros be to produce something that isn't an embellished operator. This PR does that by preceding the mover by an empty element and enclosing it all in a larger container element. The arrow is marked as an ORD so no additional space will be placed around it, and the outer container as a REL so that it gets the spacing that the arrow should produce.

Since this changes the MathML output, I updated the tests that are affected by that.

Resolves part of mathjax/MathJax#3457.

[I gave the wrong description to the other PR for mathjax/MathJax#3457, which was supposed to be for this PR.]

@dpvc dpvc requested a review from zorkow October 29, 2025 17:48
@dpvc dpvc added this to the v4.1.0 milestone Oct 29, 2025
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.66%. Comparing base (27c47f3) to head (bce7b4b).

Additional details and impacted files
@@            Coverage Diff             @@
##           develop    #1382     +/-   ##
==========================================
  Coverage    86.66%   86.66%             
==========================================
  Files          338      338             
  Lines        84384    84400     +16     
  Branches      4779     3149   -1630     
==========================================
+ Hits         73131    73147     +16     
  Misses       11253    11253             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants