Attention

Version 3 is now the current version of MathJax. This document is for version 2.

MathJax Debugging tips

This page documents basic tips for debugging MathJax in your application.

Using unpacked resources

MathJax provides both packaged (minified) and unpacked versions of all its components. For debugging, it is useful to switch to an unpacked version.

For example, if your copy of MathJax lives at https://example.com/mathjax/MathJax.js just add unpacked/ before MathJax.js, e.g.,

<script type="text/javascript" async
  src="https://example.com/mathjax/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

to

<script type="text/javascript" async
  src="https://example.com/mathjax/unpacked/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

Getting traceback information

MathJax.Hub.lastError

MathJax stores the error object from the last Math Processing Error in MathJax.Hub.lastError. This allows developers to access the stack-trace information when needed.

Add listener for MathJax errors

MathJax provides a detailed signaling infrastructure which a developers can hook into.

The following example hooks into Math Processing Errors.

MathJax.Hub.Register.MessageHook("Math Processing Error",function (message) {
  //  do something with the error.  message[2] is the Error object that records the problem.
});

Another example hooks into TeX parsing errors.

MathJax.Hub.Register.MessageHook("TeX Jax - parse error",function (message) {
  // do something with the error.  message[1] will contain the data about the error.
});

Note

For more information, see The MathJax API.