Skip to content

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Sep 15, 2025

This PR fixes a problem where the column width for a column with stretchy characters isn't adjusted if the stretched version of the character is wider than the expected stretch width. This can happen if a fixed-size character is used that is slightly larger than needed (which is allowed), or if the stretchy has a minsize attribute that makes it larger than expected. The latter is true in the case cited in mathjax/MathJax#3423.

We fix the problem by making sure we always stretch characters, even if there is only one stretchy (so as to handle midsize even on a single row), and testing if the new width is wider than the column width, and adjusting that width if so. We also remove a variable that is no longer needed.

A test case is

\begin{CD}
A @= B
\end{CD}

Without this patch the equal sign overlaps the A and B.

Resolves issue mathjax/MathJax#3423.

@dpvc dpvc requested a review from zorkow September 15, 2025 10:47
@dpvc dpvc added this to the v4.0.1 milestone Sep 15, 2025
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 37.50000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.67%. Comparing base (afaf1ea) to head (2624516).
⚠️ Report is 47 commits behind head on develop.

Files with missing lines Patch % Lines
ts/output/common/Wrappers/mtable.ts 37.50% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1353      +/-   ##
===========================================
- Coverage    86.72%   86.67%   -0.05%     
===========================================
  Files          337      338       +1     
  Lines        84145    84270     +125     
  Branches      3140     4783    +1643     
===========================================
+ Hits         72971    73038      +67     
- Misses       11174    11209      +35     
- Partials         0       23      +23     

☔ 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.

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.

One change.

.getStretchedVariant([
Math.max(W, child.getBBox().w) / child.coreRScale(),
]);
const w = child.getBBox().w;
Copy link
Member

Choose a reason for hiding this comment

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

This could be moved before line 731 and used in the max computation in line 734.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, and good catch. I didn't see that. I've made the change.

@dpvc dpvc requested a review from zorkow October 10, 2025 19:16
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.

lgtm.

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