Page MenuHomePhabricator

<math>_1</math> not rendered as subscript
Closed, ResolvedPublicBUG REPORT

Description

Enable "MathML (experimental; no images)" in Special:Preferences → Apperance → Math. Then preview a page with the contents <math>_12</math>.
This should render as "₁2" (with subscript 1) but it is rendered as "12" because the generated MathML is invalid ("Incorrect number of children for <msub/> tag" is printed to the Firefox console). The same problem occurs with <math>{_{1}^2}</math> but in that case no <msub> element is generated.

This subscript notation is used in over 50 articles in dewiki (particularly noticeable here) and over 100 articles in enwiki.

Event Timeline

A possibly related bug is that the "2" in <math>\sin \cos^2</math> or <math>\deg \cos^2</math> is not rendered as a superscript (i.e. I would expect to see "sin⁡ cos²" but it actually renders as "sin⁡ cos⁡2"). Again, "Invalid markup: Incorrect number of children for <msup/> tag" is printed to the Firefox console. Interestingly, <math>\sin^2 \cos^2</math> is rendered correctly as "sin⁡² cos²".

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

[mediawiki/extensions/Math@master] Add changes test

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

Another related bug: The "i=0" in <math>\min\limits_{i=0}</math> should be rendered below "min" but it's not.

Physikerwelt triaged this task as High priority.
Physikerwelt subscribed.

It seems this has never worked with native MathML rendering. This makes it easier to fix, as I don't remember something that I changed recently that could have broken this feature

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

[mediawiki/extensions/Math@master] Fix: rendering of _1

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

Another related bug: The "i=0" in <math>\min\limits_{i=0}</math> should be rendered below "min" but it's not.

Change #1118986 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Add changes test

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

Change #1119368 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Fix: rendering of _1

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

The first one is fixed

<math>_1</math> not rendered as subscript

However,

<math>{_{1}^2}</math> not rendered as subscript

is still rendered as 12.

I'm closing this task and tracking the remaining work in T387952.

Screenshot 2025-03-05 at 07.42.49.png (512×1 px, 146 KB)

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

[mediawiki/extensions/Math@REL1_43] Add changes test

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

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

[mediawiki/extensions/Math@REL1_43] Fix: rendering of _1

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

Change #1130274 merged by jenkins-bot:

[mediawiki/extensions/Math@REL1_43] Add changes test

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

Change #1130279 merged by jenkins-bot:

[mediawiki/extensions/Math@REL1_43] Fix: rendering of _1

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