mathml

How can I use angle brackets in MathML and ensure they are automatically sized? Using less-than/greater-than signs doesn’t work so well


MathML automatically adjusts the size of the symbols like parenthesis, e.g. "(" or "|", when they are entered as operators. For example here:

<html>
  <body>
    <math>
      <mrow>
    <mo>(</mo>
    <mfrac> <mrow> q + w + e </mrow>
      <mrow>
        a +
        <mfrac> <mrow> q + w </mrow> <mrow> a + s + f + g </mrow> </mfrac>
      </mrow>
    </mfrac>
    <mo>></mo>
      </mrow>
    </math>
  </body>
</html>

there is a large mathematical formula enclosed in a mrow block; the size of the symbol "(" in the same block is adjusted to match the size of the whole formula. Instead, the symbol ">" is rendered without resizing it.

The symbols "<" or ">" are often used as parenthesis (e.g. to represent an average), So I would like that they adapt their size.

I tried to add the attributes "stretchy" and "fence" but I do not get the desired result. I would like to adapt the size of the symbols "<" and ">" to the surrounding formulas.


Solution

  • You can use a Mathematical Right Angle Bracket character instead, which you get with &#10217; or &#x27E9;. So you don't have to use the "greater than" symbol, which is the wrong character anyway:

    <html>
      <body>
        <math>
          <mrow>
        <mo>(</mo>
        <mfrac> <mrow> q + w + e </mrow>
          <mrow>
            a +
            <mfrac> <mrow> q + w </mrow> <mrow> a + s + f + g </mrow> </mfrac>
          </mrow>
        </mfrac>
        <mo>&#x27E9;</mo>
          </mrow>
        </math>
      </body>
    </html>

    This will generate an output like this: