[CommonHTML] Bad linebreaking when using mstyle scriptlevel
Created by: DorianLamaro
On our project we want the elements inside a fraction to be bigger, so we are wrapping fractions with <mstyle scriptlevel="-1">
which makes elements inside the fraction appear as if they are one level less nested (so normal for the first level). However, it causes some linebreaking issues(linebreaking is set to automatic:true). Some fractions wrapped this way go out of their elements so part of them is outside of their <div>
even though they can linebreak. I am assuming this is due the width being calculated before <mstyle>
is applied?
This only happens for CommonHTML. Other modes such as HTML-CSS or SVG perform satisfactory linebreaking in this case.
Here is the code. The issue is also reproducible on the mathjax demo on the official page if the below code is copied and pasted.
<math xmlns="http://www.w3.org/1998/Math/MathML">
<msub>
<mi>
t
</mi>
<mn>
1,2
</mn>
</msub>
<mo linebreak="goodbreak">
=
</mo>
<mstyle scriptlevel="-1">
<mfrac>
<mrow>
<mo linebreak="goodbreak" indentalign="left">
-
</mo>
<mn>
2
</mn>
<mo>
±
</mo>
<msqrt>
<mrow>
<msup>
<mn>
2
</mn>
<mn>
2
</mn>
</msup>
<mo linebreak="goodbreak">
-
</mo>
<mn>
4
</mn>
<mo>
·
</mo>
<mn>
1
</mn>
<mo>
·
</mo>
<mn>
1
</mn>
</mrow>
</msqrt>
</mrow>
<mrow>
<mn>
2
</mn>
<mo>
·
</mo>
<mn>
1
</mn>
</mrow>
</mfrac>
</mstyle>
<mo linebreak="goodbreak">
=
</mo>
<mstyle scriptlevel="-1">
<mfrac>
<mrow>
<mo linebreak="goodbreak">
-
</mo>
<mn>
2
</mn>
<mo>
±
</mo>
<mn>
0
</mn>
</mrow>
<mn>
2
</mn>
</mfrac>
</mstyle>
<mo linebreak="goodbreak">
=
</mo>
<mo linebreak="goodbreak">
-
</mo>
<mn>
1
</mn>
</math>
Is there a workaround for this?