Page MenuHomePhabricator

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

Description

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.

Details

Related Changes in Gerrit:

Event Timeline

The following MathML is produced:

<mrow data-mjx-texclass="ORD"><mstyle displaystyle="true" scriptlevel="0"><mrow data-mjx-texclass="ORD"><mn>1</mn></mrow><mrow data-mjx-texclass="ORD"><mn>2</mn></mrow></mstyle></mrow>

No browser warnings, see https://en.wikipedia.beta.wmflabs.org/wiki/T387952

Temml produces

<msubsup><mrow></mrow><mn>1</mn><mn>2</mn></msubsup>

Mathoid produces

<mrow class="MJX-TeXAtom-ORD">
          <msubsup>
            <mi></mi>
            <mrow class="MJX-TeXAtom-ORD">
              <mn>1</mn>
            </mrow>
            <mrow class="MJX-TeXAtom-ORD">
              <mn>2</mn>
            </mrow>
          </msubsup>
        </mrow>

The parser extracts the following tree structure

Screenshot 2025-05-04 at 10.59.56.png (984×1 px, 182 KB)

in the code there is a comment that this special rendering was introduced

			// this happens when FQ is located in Sideset (is this a common parsing way?)

we need to check what is meant by that before merging this to avoid regressions.

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

[mediawiki/extensions/Math@master] Render {}_a^b like _a^b

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

This is related to testcase 123:

Screenshot 2025-05-04 at 11.14.11.png (338×372 px, 23 KB)

Change #1141449 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Render {}_a^b like _a^b

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