mathjax / mathjax/MathJax

`\blacksquare` (and other AMS geometric symbols) with the Gyre Pagella CHTML font they get inline `font-style: italic` and are slanted by the browser

Open
#3,601 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

\blacksquare (U+25FC), \square/\Box (U+25FB), \lozenge/\Diamond (U+25CA), \blacklozenge, \blacktriangle, \bigstar, \checkmark, \maltese, and ~25 more AMS "miscellaneous symbol" macros are registered in the TeX input's AMSsymbols-mathchar0mi character map. mathchar0mi creates an <mi> token whose default mathvariant is italic. The CHTML (and SVG) output therefore renders these geometric symbols with italic styling:

  • with the Gyre-Pagella dynamic CHTML font, the glyph node carries the inline style font-family: MJX-GP-ZERO, serif; font-style: italic;, and the browser synthesizes an oblique slant for U+25FC — the black square is visibly tilted;
  • the serialized MathML is semantically wrong too: <mi>◼</mi> (italic identifier) instead of an upright ordinary symbol.

In LaTeX (amssymb), \blacksquare is \DeclareMathSymbol{\blacksquare}{\mathord}{AMSa}{"04} — a mathord, upright.

Environment

  • MathJax 4.1.3
  • TeX input (input/tex), ams package enabled
  • CHTML output, Gyre-Pagella font (@mathjax/mathjax-pagella-font), dynamic font mode

Minimal reproduction

browser-repro.html

Observed

CHTML wraps the glyph in an italic identifier element:

<mjx-container ...><mjx-math ...><mjx-mi data-latex="\blacksquare"><mjx-c class="mjx-c25FC">◼</mjx-c></mjx-mi></mjx-math></mjx-container>

MathML:

<mi data-latex="\blacksquare">&#x25FC;</mi>

With the Gyre-Pagella font (dynamic CHTML mode), the glyph node's inline style is:

font-family: MJX-GP-ZERO, serif; font-style: italic;

and the rendered \blacksquare is visibly slanted (browser-synthesized oblique), exactly like an italic math identifier. Compare with the base-package symbol \triangle, which renders <mi mathvariant="normal">&#x25B3;</mi> (upright).

Expected
  • \blacksquare renders upright — no font-style: italic, no synthetic slant.
  • The serialized MathML should be an upright ordinary symbol (e.g. <mi mathvariant="normal"> or an mo with no operator spacing), matching LaTeX's \mathord class.

Coverage

Scanned eleven v4 font packages (@mathjax/mathjax-*-font@4.1.3), every variant file. "✓" = the codepoint exists in at least one variant (usually the normal variant, from which italic inherits via the prototype chain — the glyph then comes from the math font and is upright); "✗" = absent from the entire package → CHTML falls back to font-style: italic; font-family: <prefix>-ZERO, serif → browser-synthesized slant.

The eleven fonts collapse into four identical-coverage groups:

  • A — TeX / new-cm (default) / modern / STIX2: best coverage, only the universal 4 missing.
  • B — Asana: adds \diagup, \diagdown.
  • C — Fira: misses the geometric set plus \checkmark, \maltese.
  • D — Pagella / Bonum / DejaVu / Schola / Termes (Gyre family + DejaVu): misses the geometric set plus \blacktriangle, \blacktriangledown.
command U+ A: TeX / new-cm / modern / STIX2 B: Asana C: Fira D: Pagella / Bonum / DejaVu / Schola / Termes
\blacksquare 25FC
\square/\Box 25FB
\lozenge/\Diamond 25CA
\blacklozenge 29EB
\blacktriangle 25B4
\blacktriangledown 25BE
\bigstar 2605
\checkmark 2713
\maltese 2720
\hslash 210F
\sphericalangle 2222
\measuredangle 2221
\nexists 2204
\complement 2201
\mho 2127
\Finv 2132
\Game 2141
\diagup 2571
\diagdown 2572
\yen 00A5
\circledR 00AE
\beth/\gimel/\daleth (letter-like) 2136–38
\digamma, \varkappa (letter-like) 03DD/03F0

Missing counts per group (of the 26 affected entries): A = 4 (\yen, \circledR, \digamma, \varkappa) · B = 6 · C = 14 · D = 14.

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 TeX input's AMSsymbols-mathchar0mi character map and compare the affected macros with the base-package \triangle registration. Use browser-repro.html to inspect the generated CHTML and serialized MathML for the affected symbols across the listed font packages. Done means the symbols are registered as upright ordinary symbols and no longer receive synthetic italic styling.

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
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.