MathJax
MathJax copied to clipboard
Semantic enrichment adds unwanted `none` elements to `mmultiscript` containing `mtext`
The expression
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mmultiscripts>
<mi>Cu</mi>
<none></none>
<mo>*</mo>
<mprescripts></mprescripts>
<none></none>
<mrow>
<mn>58</mn>
<mtext>–</mtext>
<mn>61</mn>
</mrow>
</mmultiscripts>
</math>
gets turned into
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mmultiscripts>
<mi>Cu</mi>
<none></none>
<mo>*</mo>
<mprescripts></mprescripts>
<none></none>
<none></none>
<none></none>
<none></none>
<mrow>
<mn>58</mn>
<mtext>–</mtext>
<mn>61</mn>
</mrow>
<none></none>
</mmultiscripts>
</math>
(with the addition of four unneeded none elements, three before the mrow and one after it), turning the superscript into a subscript.
If the mtext element is changed to an mo, the problem doesn't occur.
This was reported in the MathJax User's Forum.
The reason for the issue the treatment of multi-index elements with sequences of indices, e.g.,
<math>
<mmultiscripts><mi>A</mi><mn>11</mn><mn>2</mn><mn>3</mn><mn>44</mn><mprescripts/><mn>5</mn><mn>4</mn><mn>6</mn></mmultiscripts>
</math>
(note that github can't render that...)
In that case SRE works with an invisible separator element to separate indices. It also uses this separator to separate multiple text elements, that is where it got confused and started padding with none.
There is a two step solution to this:
- The initial solution is to disambiguate the separator element for multi-index structures to avoid confusion. That solves the bug.
- There is really no need to treat the dash here as
textinstead ofpunctuation. The complication is that punctuation is treated before text, relations and operators. But I am testing a possible solution.