Page MenuHomePhabricator

Client-side MathJax rendering problems
Open, In Progress, MediumPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

The following latex expressions fail.

  • <math>\tilde{a}</math> gives "mover" red writing on yellow background
  • <math>^\wedge</math> gives " msup" red writing on yellow background
  • <math>f(n) =\begin{cases} n/2, & \text{if }n\text{ is even} \\3n+1, & \text{if }n\text{ is odd}\end{cases}</math> "math input error"
  • <math>\boldsymbol{\alpha \beta \gamma \delta \epsilon \zeta \eta \theta}</math> "math output error"
  • <math> \boldsymbol{\iota \kappa \lambda \mu \nu \xi \omicron \pi}</math> "math output error"
  • <math> \boldsymbol{\rho \sigma \tau \upsilon \phi \chi \psi \omega}</math> "math output error"
  • <math> \boldsymbol{\varepsilon\digamma\varkappa\varpi}</math> "math output error"
  • <math> \boldsymbol{\varrho\varsigma\vartheta\varphi}</math> "math output error"
  • <math> \text{if }n\text{ is even}</math> "Math input error"
  • <math> a \text{ } b</math> "Math input error"
  • <math>( \nabla \times \mathbf{F} ) \cdot {\mathrm d}\mathbf{S} = \oint_{\partial S} \mathbf{F} \cdot {\mathrm d}\boldsymbol{\ell}</math> "math output error"
  • <math>\oint_C \mathbf{B} \cdot {\mathrm d} \boldsymbol{\ell} = \mu_0 </math> "math output error"
  • <chem>\mu-Cl</chem> "Math output error"
  • <chem>[Fe(\eta^5-C5H5)2]</chem> "Math output error"
  • <math chem>\begin{align}\overbrace{\ce{2Fe3O4}}^{\text{magnetite}} + \ce{1/2 O2 ->}\ &{\color{Brown}\overbrace{\ce{3(\lambda{-}Fe2O3)}}^{\text{maghemite}}}\\ \underbrace{\ce{2Fe3O4}}_{\text{magnetite}} + \ce{1/2 O2 ->}\ {\color{Red}\underbrace{\ce{3(\alpha{-}Fe2O3)}}_{\text{hematite}}} \end{align}</math> Math output error

problems with old mhchem syntax (ignored)

  • <chem>{C_\mathit{x}H_\mathit{y}} + \mathit{z}O2 -> {\mathit{x}CO2} + \frac{\mathit{y}}{2}H2O</chem> Failed to parse (syntax error): {\displaystyle \ce{{C_\mathit{x}H_\mathit{y}} + \mathit{z}O2 -> {\mathit{x}CO2} + \frac{\mathit{y}}{2}H2O}}
  • <chem>A ->[{}\atop x] B</chem> Failed to parse (syntax error): {\displaystyle \ce{A ->[{}\atop x] B}}
  • <chem>A ->[{}\atop\ce{+H2O}] B</chem> Failed to parse (syntax error): {\displaystyle \ce{A ->[{}\atop\ce{+H2O}] B}}

Open sub-tasks

  • Review the entire page again
  • \grave{a} too big T409110
  • \hat and \widehat look the same
  • \vec is too large
  • \P is messed up
  • \sqrt[3]{x} 3 is too small
  • c in large dfrac example is wrong
  • \smallmatrix is wrong

What should have happened instead?:

All equations rendered correctly

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Google Chrome 128.0.6613.138 (Official Build) (64-bit) (cohort: Stable)

Related Objects

StatusSubtypeAssignedTask
In ProgressBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
DuplicateBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
DuplicateBUG REPORTNone
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedPhysikerwelt
ResolvedPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTJeanCASPAR
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
OpenBUG REPORTJeanCASPAR
DuplicateBUG REPORTNone
ResolvedBUG REPORTPhysikerwelt
ResolvedBUG REPORTPhysikerwelt
ResolvedPhysikerwelt
ResolvedPhysikerwelt
ResolvedPhysikerwelt
ResolvedPhysikerwelt
OpenPhysikerwelt
OpenPhysikerwelt

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Most of the problems here, are covered by two subtasks, \text tags that end with a space character, and \boldsymbols with a Greek letter.

Not investigated problems with chem tags yet.

Change #1104157 had a related patch set uploaded (by Physikerwelt; author: Physikerwelt):

[mediawiki/extensions/Math@master] Fix rendering of underOver

https://gerrit.wikimedia.org/r/1104157

Physikerwelt changed the task status from Open to In Progress.Thu, Oct 16, 7:51 PM
Physikerwelt claimed this task.
Physikerwelt triaged this task as Medium priority.
Physikerwelt moved this task from Inbox to Ready to implement on the Math board.

State of 25-10-16

image.png (2×1 px, 427 KB)

I think the remaining @mhchem problems are due to the use of an outdated mhchem syntax. I think it can be ignored for this ticket.

Mh, there are quite some differences (even though ChatGPT does not see them)

  • \grave{a} too big T409110
  • \hat and \widehat look the same
  • \vec is too large
  • \P is messed up
  • \sqrt[3]{x} 3 is too small
  • c in large dfrac example is wrong
  • \smallmatrix is wrong

Maybe it would be better to run automated visual regression tests, like we did for the last switch in 2016 https://ceur-ws.org/Vol-1785/W48.pdf

I looked at \grave{a} and was unable to identify the underlying problem. The generated MathML code is identical to the MathML code generated by mathoid. If I render the resulting MathML code with the interactive Mathjax demo from https://mathjax.github.io/MathJax-demos-web/input/tex2mml.html the result looks fine

Screenshot 2025-11-02 at 05.44.08.png (1×1 px, 298 KB)

I looked at \grave{a} and was unable to identify the underlying problem. The generated MathML code is identical to the MathML code generated by mathoid. If I render the resulting MathML code with the interactive Mathjax demo from https://mathjax.github.io/MathJax-demos-web/input/tex2mml.html the result looks fine

Screenshot 2025-11-02 at 05.44.08.png (1×1 px, 298 KB)

I just tested different versions of MathJax and the formula is fixed in version 4.0.0: https://github.com/mathjax/MathJax/releases/tag/4.0.0-alpha.1.

Screenshot From 2025-11-03 19-02-02.png (44×48 px, 579 B)