mathjax / mathjax/MathJax

mathvariant=Monospace produces bold letters

Open
#3,567 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Expected Behavior v4
Dominant language
JavaScript
Stars
10.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Issue Summary

The mathvariant="monospace" mtext renders the letters in a bolder fashion, making them stand out and prone to be misinterpreted as intentionally bold letters, e.g. vector notations.

Steps to Reproduce:

Add the following mathML inside math> mrow > mtable > mtr > mtd > mstyle
<msub> <mrow> <mtext mathvariant="monospace">SN</mtext> </mrow> </msub>

Technical details:
  • MathJax Version: 4.1.2
  • Client OS: Mac OS 26.3.1
  • Browser: Chrome, Build 147.0.7727.138

I am using the following MathJax configuration:

         ...  
        displayOverflow: 'linebreak',
        font: 'mathjax-tex',
        mathmlSpacing: true,
        linebreaks: {
          inline: true,
          width: /Firefox/.test(navigator.userAgent) ? '40%' : '90%',
          lineleading: 0.2,
          LinebreakVisitor: null,
        },
      }

and loading MathJax via

<script src="'https://cdn.jsdelivr.net/npm/mathjax@4.1.2/mml-chtml.js"></script>
Supporting information:

In the following equation the letters SN, TN and Lick are all monospace.

Image

Link to live article: https://elifesciences.org/articles/95802

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 with the supplied MathML reproduction and the mml-chtml.js entry point used in MathJax 4.1.2, then trace how mathvariant="monospace" selects and renders the CHTML font. Confirm the result against the reported SN, TN, and Lick examples; done means monospace letters no longer appear unintentionally bold while remaining monospace.

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
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.