Open
Description
I'm working on an express.js app that wraps this library and returns a PNG image. Sometimes the equations will be less than stellar, possibly garbage. This example crashes my node app, leaves it in an usable state, I have to restart the server:
Equation:
\begin{equation*} A = \left[ \begin{array}{cccc} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \end{array} \right] \end{equation*}
Error:
Math Processing Error: Cannot read property 'toFixed' of undefined
Error: TypeError: Cannot read property 'setAttribute' of undefined
at GetSVG (C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\mathjax-node\lib\main.js:698:7)
at Function.execute (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:243:26)
at cb (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:225:59)
at Object.Process (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:495:38)
at Object.call (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:508:37)
at Function.WAITEXECUTE (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:348:50)
at cb (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:225:59)
at Object.Process (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:495:38)
at Object.call (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:508:37)
at Function.WAITEXECUTE (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:348:50)
Error: Uncaught [TypeError: Cannot read property 'setAttribute' of undefined]
at reportException (C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\jsdom\lib\jsdom\living\helpers\runtime-script-errors.js:66:24)
at processJavaScript (C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:192:7)
at HTMLScriptElementImpl._innerEval (C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:122:5)
at C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:31:22
at Object.check (C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:76:11)
at C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:95:12
at wrappedEnqueued (C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:253:16)
at ReadStream.readableStream.on (C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:74:7)
at ReadStream.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1129:12) TypeError: Cannot read property 'setAttribute' of undefined
at GetSVG (C:\Users\dac\Code\github\pressbooks\pb-mathjax\node_modules\mathjax-node\lib\main.js:698:7)
at Function.execute (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:243:26)
at cb (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:225:59)
at Object.Process (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:495:38)
at Object.call (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:508:37)
at Function.WAITEXECUTE (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:348:50)
at cb (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:225:59)
at Object.Process (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:495:38)
at Object.call (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:508:37)
at Function.WAITEXECUTE (file:///C:/Users/dac/Code/github/pressbooks/pb-mathjax/node_modules/mathjax/unpacked/MathJax.js:348:50)
Configs:
{
MathJax: {
extensions: ['Safe.js'],
displayMessages: false,
displayErrors: false,
AsciiMath: {
// @see http://docs.mathjax.org/en/latest/asciimath.html
},
SVG: {
blacker: 0,
},
},
}
{
math: myEquation,
format: 'AsciiMath',
svg: true,
speakText: true, // a11y
}
I've tried putting the code in a try/catch
block but it doesn't do anything.
Help?
Metadata
Metadata
Assignees
Labels
No labels