Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MathJax testing for TeX and rendering errors. Create HTML page (with math) to include the MathJax library and then include this file. When the page is loaded, the js console will show when errors are encountered and the data about the error will be POSTed via ajax to a rest-type service named here as 'service/mathmltest'. That service should acc…
function ajaxRequest(){
return new XMLHttpRequest(async=false);
function mltest (){
var filename = window.location.href.substr(window.location.href.lastIndexOf("/")+1);
MathJax.Hub.Config({TeX: {noUndefined: {disabled: true}}});
MathJax.Hub.Queue(function() {console.log('finished rendering');});
MathJax.Hub.Register.MessageHook("TeX Jax - parse error",function (message) {
console.log('error encountered');
var mydata = {};
var myrequest = new ajaxRequest();
mydata['message'] = message[1];
mydata['source'] = message[2];
mydata['mode'] = message[3] ? "display mode" : "inline";
mydata['filename'] = filename;'POST', 'service/mathmltest');
myrequest.setRequestHeader("Content-type", "application/text");

This comment has been minimized.

Copy link
Owner Author

@tiarno tiarno commented Jul 30, 2013

This code was first written and posted on the MathJax google group by Davide P. Cervone. I added a few things and created this gist. See!topic/mathjax-users/cx9qx5Yhae8 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.