\phantom seems to be under-calculating width
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Issue Summary
I've noticed that \phantom{} is producing content that seems to be too narrow.
Steps to Reproduce:
- At the demo site, try:
$$(1+2+3)$$
$$(\phantom{1}+\phantom{2}+\phantom{3})$$
I see a few things. Mainly, the space where phantom elements are is too narrow for what is phantomed out. There is also some asymmetry in the example above, where there is more space for the \phantom{1} than for the \phantom{3}. If anything, it should be the other way.
It does not seem to change anything if I wrap the \phantom instances in \mathord{}. In other words, it seems the missing space is due to something more than the spacing that surrounds the binary operators.
Technical details:
- MathJax Version: 4.1.3 (at the demo site)
- Client OS: (e.g., Mac OS Tahoe 26.5.2)
- Browser: (Firefox 152.0.6)
- I see this with both CHTML and SVG math rendering.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported expressions on the MathJax demo site in both CHTML and SVG output, comparing normal content with \phantom content. Trace the rendering entry point for \phantom and verify that the phantom widths match the hidden expressions and preserve the reported spacing symmetry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, latex
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100