Mathjax: \overbrace and \underbrace cause nodejs conversion errors in both tex input and mml input

Created on 24 Aug 2020  ยท  3Comments  ยท  Source: mathjax/MathJax

Issue Summary

When using \overbrace or \underbrace in displaymath, the node demos tex2svg and mml2svg do not work. The following error is thrown:

TypeError: Cannot read property 'chars' of undefined                                                                                                                                                       
    at SVGmo.CommonWrapper.unicodeChars (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/common/Wrapper.js:433:48)                                                   
    at SVGmo.SVGWrapper.placeChar (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrapper.js:206:45)                                                            
    at SVGmo.addGlyph (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrappers/mo.js:109:21)                                                                    
    at SVGmo.addMidH (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrappers/mo.js:194:14)                                                                     
    at SVGmo.stretchHorizontal (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrappers/mo.js:94:34)                                                            
    at SVGmo.stretchSVG (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrappers/mo.js:73:18)                                                                   
    at SVGmo.toSVG (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrappers/mo.js:52:18)                                                                        
    at SVGmover.toSVG (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrappers/munderover.js:77:16)                                                             
    at SVGmrow.SVGWrapper.addChildren (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrapper.js:61:23)                                                         
    at SVGmrow.toSVG (/home/shiblon/chris/jstext/tmp/MathJax-demos-node/node_modules/mathjax-full/js/output/svg/Wrappers/mrow.js:27:14)  

Occurring when using any mml2svg or tex2svg node binary.

Steps to Reproduce:

Example input causing failure:

<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mtable><mtr><mtd columnalign="right"><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo></mtd><mtd columnalign="left"><mo>=</mo><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mn>2</mn><mi>x</mi><mo>+</mo><mn>3</mn></mtd></mtr><mtr><mtd columnalign="right"><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mn>10</mn><mo stretchy="false" form="postfix">)</mo></mtd><mtd columnalign="left"><mo>=</mo><munder><msup><mn>10</mn><mn>2</mn></msup><mo accent="true">โŸ</mo></munder><mo>+</mo><mn>2</mn><mo stretchy="false" form="prefix">(</mo><mn>10</mn><mo stretchy="false" form="postfix">)</mo><mo>+</mo><mn>3</mn></mtd></mtr><mtr><mtd columnalign="right"></mtd><mtd columnalign="left"><mo>=</mo><mover><mn>100</mn><mo accent="true">โž</mo></mover><mo>+</mo><munder><mrow><mn>2</mn><mo stretchy="false" form="prefix">(</mo><mn>10</mn><mo stretchy="false" form="postfix">)</mo></mrow><mo accent="true">โŸ</mo></munder><mo>+</mo><mn>3</mn></mtd></mtr><mtr><mtd columnalign="right"></mtd><mtd columnalign="left"><mo>=</mo><munder><mrow><mn>100</mn><mo>+</mo><mover><mn>20</mn><mo accent="true">โž</mo></mover></mrow><mo accent="true">โŸ</mo></munder><mo>+</mo><mn>3</mn></mtd></mtr><mtr><mtd columnalign="right"></mtd><mtd columnalign="left"><mo>=</mo><munder><mrow><mover><mn>120</mn><mo accent="true">โž</mo></mover><mo>+</mo><mn>3</mn></mrow><mo accent="true">โŸ</mo></munder></mtd></mtr><mtr><mtd columnalign="right"></mtd><mtd columnalign="left"><mo>=</mo><mover><mn>123</mn><mo accent="true">โž</mo></mover></mtd></mtr></mtable></semantics></math>

Attempting to convert that mml expression using mml2svg causes the exception mentioned above.

The same input, but with over/under braces converted to over/under parens follows, and this does not cause the error, but converts properly:

<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mtable><mtr><mtd columnalign="right"><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mi>x</mi><mo stretchy="false" form="postfix">)</mo></mtd><mtd columnalign="left"><mo>=</mo><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mn>2</mn><mi>x</mi><mo>+</mo><mn>3</mn></mtd></mtr><mtr><mtd columnalign="right"><mi>f</mi><mo stretchy="false" form="prefix">(</mo><mn>10</mn><mo stretchy="false" form="postfix">)</mo></mtd><mtd columnalign="left"><mo>=</mo><munder><msup><mn>10</mn><mn>2</mn></msup><mo accent="true">โ</mo></munder><mo>+</mo><mn>2</mn><mo stretchy="false" form="prefix">(</mo><mn>10</mn><mo stretchy="false" form="postfix">)</mo><mo>+</mo><mn>3</mn></mtd></mtr><mtr><mtd columnalign="right"></mtd><mtd columnalign="left"><mo>=</mo><mover><mn>100</mn><mo accent="true">โœ</mo></mover><mo>+</mo><munder><mrow><mn>2</mn><mo stretchy="false" form="prefix">(</mo><mn>10</mn><mo stretchy="false" form="postfix">)</mo></mrow><mo accent="true">โ</mo></munder><mo>+</mo><mn>3</mn></mtd></mtr><mtr><mtd columnalign="right"></mtd><mtd columnalign="left"><mo>=</mo><munder><mrow><mn>100</mn><mo>+</mo><mover><mn>20</mn><mo accent="true">โœ</mo></mover></mrow><mo accent="true">โ</mo></munder><mo>+</mo><mn>3</mn></mtd></mtr><mtr><mtd columnalign="right"></mtd><mtd columnalign="left"><mo>=</mo><munder><mrow><mover><mn>120</mn><mo accent="true">โœ</mo></mover><mo>+</mo><mn>3</mn></mrow><mo accent="true">โ</mo></munder></mtd></mtr><mtr><mtd columnalign="right"></mtd><mtd columnalign="left"><mo>=</mo><mover><mn>123</mn><mo accent="true">โœ</mo></mover></mtd></mtr></mtable></semantics></math>

Technical details:

  • MathJax mml2svg reports version 3.0.5
  • git log shows commit 967c7f6460ff6cb25c7fe7b7626a0ef02a66f64c at the top
  • Client OS: Ubuntu, same on latest Mac OS
  • using NodeJS v10.21.0, npm version 6.14.6
Duplicate v3

Most helpful comment

Fixed in v3.1 released today.

All 3 comments

This is the same issue as #2402, and the work-around listed there should resolve the problem. It will be fixed in v3.1, which will be related this week.

Okay, thanks! Looked different based on error messages, so your additional
insight is very appreciated.

Fixed in v3.1 released today.

Was this page helpful?
0 / 5 - 0 ratings