mathjax / mathjax/MathJax

[CHTML/Fira] Extra spacing after \underbrace group and subsequent characters

Open
#3,564 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Expected Behavior
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:
  1. Configure MathJax v4 with mathjax-fira font and CHTML output

  2. 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$$

  3. 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:
Image
  • 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.