Bug in AsciiMathML.js -- cannot render `x^and`

35 views
Skip to first unread message

lwz

unread,
Aug 16, 2014, 2:23:10 AM8/16/14
to asci...@googlegroups.com
Hi all,

I've found that `x^and` generates a uncaught exception in the original ASCIIMathML.js at AMremoveBrackets(node).

The error happens quite often for me because I am displaying the result dynamically, and I type something like "y=x^2 and ..." and when I remove the 2 (or sometimes halfway typing in the expression) it keeps failing.

Before I try to figure it out myself, I would like to know what I can do to fix it from someone more familiar, because I've already heavily modified the file (e.g. to allow row vectors and all sorts of other things)... Thanks!

Regards,
lwz.

lwz

unread,
Aug 16, 2014, 2:29:32 AM8/16/14
to asci...@googlegroups.com
I've got a temporary solution which works for me:

function AMremoveBrackets(node) {
  var st;
  if( node.childNodes.length==0 ) return;
  if (node.nodeName=="mrow") {
    st = node.firstChild.textContent;
    if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);
    st = node.lastChild.textContent;
    if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);
  }
}

lwz

unread,
Aug 16, 2014, 2:35:48 AM8/16/14
to asci...@googlegroups.com
Sorry, I have no idea how Google Groups thinks that my message was in Urdu, but to see it just click the arrow button on "Reply/ more options", and click "Show original".

lwz

unread,
Aug 16, 2014, 5:57:15 AM8/16/14
to asci...@googlegroups.com
Just to add, my workaround corrects the error in the case `x^{::}` too.

David Lippman

unread,
Aug 17, 2014, 2:01:09 AM8/17/14
to asci...@googlegroups.com
Reported on the github issue tracker, at https://github.com/mathjax/asciimathml/issues/24

David Lippman

unread,
Aug 17, 2014, 2:05:17 AM8/17/14
to asci...@googlegroups.com
And fixed in github now.  Thanks!
Reply all
Reply to author
Forward
0 new messages