[CHTML/Fira] Extra spacing after \underbrace group and subsequent characters
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 using mathjax-fira font with CHTML output, there is unwanted extra spacing between an \underbrace group and the
character that immediately follows it. This gap does not exist in MathJax v3.2.2 (default font)
The issue is most visible when a digit follows a closing \underbrace, e.g., \underbrace{0000\cdots0}3 — the "3" appears visually detached from the underbrace group.
Steps to Reproduce:
-
Configure MathJax v4 with
mathjax-firafont and CHTML output -
Render the following LaTeX:
$$A = 0.\underset{80\text{ 个 }0}{\underbrace{0000\cdots0}}3,\quad B = 0.\underset{120\text{ 个 }0}{\underbrace{00\cdots0}}2$$ -
Observe the gap between the underbrace group and the trailing digits "3" and "2"
Expected behavior:
The trailing digits should appear immediately adjacent to the underbrace group with no extra spacing, consistent with MathJax v3.2.2 rendering.
Comparison screenshot:
- Left (v3.2.2): No extra spacing — digits "3" and "2" are tight against the underbrace content
- Right (v4.1.2 + Fira): Visible gap before "3" and "2"
Technical details:
-
MathJax Version: 4.1.2
-
Client OS: macOS
-
Browser: Chrome (also reproducible in Safari/Firefox)
-
Font:
mathjax-fira -
Browser: Chrome (also reproducible in Safari/Firefox)
-
Font:
mathjax-fira
I am using the following MathJax configuration:
MathJax = {
output: {
font: 'mathjax-fira',
},
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$'], ['\\[', '\\]']],
}
};
and loading MathJax via
<script src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-chtml.js"></script>
Supporting information:
- The issue does NOT occur in MathJax v3.2.2 with its default font
- No console errors are produced
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 reported expression in MathJax v4 with CHTML output and the mathjax-fira font, then compare it with MathJax v3.2.2 using the same expression. Focus on the spacing between the closing underbrace group and trailing digits; done means the digits render immediately adjacent without the extra gap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100