Radical is not stretched to its radicand when \dfrac restores display style inside a scaled context
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
When a \sqrt / \sqrt[n] sits in a script-level (scaled) context and its radicand
contains a \dfrac (or \displaystyle), the radical sign is stretched for the scaled
height, but the radicand is rendered back at full size. The radical then overlaps its own
content.
The nesting that triggers it is \dfrac → \frac → \dfrac, i.e. the radical has to end up
two levels down so that it is laid out at script level, while the \dfrac inside it restores
display style.
Reproduced on Windows 11 with Chromium 149 and with Node 22 (liteAdaptor), in both SVG and
CHTML output.
Steps to Reproduce:
-
Typeset the following expression in display mode:
\dfrac{a}{\frac{\sqrt{\dfrac{1}{2}}}{3}} -
Look at the radical sign and the fraction inside it.
-
The radical is roughly 30 % too short — its top bar cuts through the numerator of the
inner\dfracinstead of sitting above it.
Expected: the radical is stretched to cover its radicand, as it is at top level.
Actual: the radical is stretched to the height the radicand would have at the
surrounding script level. Because \dfrac restores display style, the radicand is drawn
about 1.414× taller than that, so the two overlap.
Why I consider this a bug: the same radicand renders correctly when the radical is not in
a scaled context, so the radical's stretch target is evidently computed before the inner
mstyle script-level reset is taken into account.
Cases that do reproduce (radical scale vs. radicand scale, from the generated SVG):
| TeX | radical | radicand |
|---|---|---|
\dfrac{a}{\frac{\sqrt{\dfrac{1}{2}}}{3}} |
0.707 | 1.000 |
\dfrac{a}{\frac{\sqrt[3]{\dfrac{233}{33}}}{323}} |
0.707 | 1.000 |
Both msqrt and mroot are affected.
Cases that do not reproduce (one nesting level is not enough):
| TeX | radical | radicand |
|---|---|---|
\sqrt{\dfrac{1}{2}} |
1.000 | 1.000 |
\frac{\sqrt{\dfrac{1}{2}}}{3} |
1.000 | 1.000 |
\dfrac{\sqrt{\dfrac{1}{2}}}{3} |
1.000 | 1.000 |
Technical details:
- MathJax Version: 4.1.3 (
@mathjax/src4.1.3,@mathjax/mathjax-newcm-font4.1.3) - Client OS: Windows 11 (also reproduced headless on Node 22)
- Browser: Chromium 149.0.7827.55
I am using the following MathJax configuration:
MathJax = {
loader: { load: ['[tex]/ams'] },
tex: { packages: { '[+]': ['ams'] } },
svg: { fontCache: 'local' },
startup: { typeset: false },
};
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
Start by reproducing the nested expression with Node 22 and the liteAdaptor, checking both SVG and CHTML output. Trace the msqrt and mroot layout paths through the nested script-style and display-style changes; done means the radical covers its radicand in both outputs while the listed non-reproducing cases remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, latex
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100