Forum Bugs

MathML underbrace not stretching

arthurattwell
Using MathML from MathJax, the underbrace is not stretching, which it is supposed to do. I've attached sample HTML and PDF files, and a PNG showing what I should get. (Note that your machine needs a font that includes an underbrace. On Windows, Cambria Math works.)

I'm getting this in Prince 11.4 and in Prince for Books.

If I edit the underbrace rule in Prince's math/operators.xml file (i.e. the MathML DTD), replacing `\underbrace` with the unicode character or HTML entity for an underbrace, the rendered underbrace stretches, but is distorted.

If I configure MathJax to generate SVG rather than MathML, the underbrace renders correctly. However, our workflow uses MathJax 3 which only supports the TeX font in SVG output (as far as I can tell), which looks poor compared to the body-text font we get using MathML. So I really want to get this working with MathML.

Does anyone have any ideas about what is causing the underbrace to not stretch with MathML? Or have any other suggestions?
  1. correct-rendering-in-browser.png10.1 kB
  2. index.html2.1 kB
  3. index.pdf16.0 kB
mikeday
Unfortunately stretchy operators are a problem we have not fully solved! Our current implementation simply scales them as necessary, but that introduces distortion as you noted.

A better way of doing this is to support the OpenType `math` table, for describing stretchy operators that can be assembled by repeating subcomponent glyphs, although this is quite complex to implement and requires a font that includes it.

Another option I've experimented with in the past is to define stretchy operators in SVG with extensions to indicate where they can be extended, which I think is nicer than repeating subcomponent glyphs but is of course not supported by anyone anywhere!

In the meantime, perhaps there is a way to convince MathJax to use a different font?