mathml

Square root of fraction causes root symbol to extend excessively


Usually, MathML displays roots with the tail aligned with the bottom of the root content:

enter image description here

When taking the square root of a fraction though, the tail extends well past the the denominator:

enter image description here

Here's the code:

<svg height="160" width="160" viewBox="0 0 160 160" xmlns="http://www.w3.org/2000/svg">
  <foreignObject height="120" width="120" x="20" y="20">
    <math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
      <msqrt>
        <mfrac>
          <mrow>
            <mi>P</mi>
          </mrow>
          <mrow>
            <mi>R</mi>
          </mrow>
        </mfrac>
      </msqrt>
    </math>
  </foreignObject>
</svg>

Removing display="block" causes the font size of the numerator/denominator to decrease, which I don't want.

Does anyone know how to adjust this? Trying to make a diagram with a small handful of formulas and this is really throwing it off - I need to either make this one a smaller font size than the others, or make all the others weirdly small to make the font size match.

The documentation at https://w3c.github.io/mathml-core/#dfn-radical-gap has unfortunately not provided clarity.


Solution

  • It turns out that the font used is responsible for setting this kind of thing. The images I posted were rendered with Cambra Math, the default math font on windows. I believe this is a bug (or a very poor stylistic choice) with Cambria Math.