The following example shows the effect of changing the math-depth
property on the font size of subformulas. The numbers in each subformula indicate the math-depth
and scale factor applied.
The first <mtext>
element is used as a reference to other subformulas and has no specific styles applied. The second and third subformulas have math-depth
set to auto-add
and show the effect of scaling depending on the math-style
.
The last two subformulas show the effect of setting math-depth
to a specific value.
HTML
<p style="font-size: 3rem; margin: 1rem 0">
<math>
<mtext>0</mtext>
<!-- auto-add value has no effect when math-style is normal -->
<mrow style="math-style: normal">
<mrow style="math-depth: auto-add">
<mtext>0</mtext>
</mrow>
</mrow>
<!-- the inherited math-style is compact, so math-depth is set to 1 -->
<mrow style="math-depth: auto-add">
<mtext>1</mtext>
</mrow>
<mrow style="math-depth: add(2)">
<mtext>2</mtext>
<mrow style="math-depth: add(-1)">
<mtext>1</mtext>
</mrow>
<mrow style="math-depth: 0">
<mtext>0</mtext>
</mrow>
</mrow>
</math>
</p>
Result