MathJax Debugging tips

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

Using unpacked resources

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

For example, using the MathJax CDN just add unpacked/ before MathJax.js, e.g., from

<script type="text/javascript" async


<script type="text/javascript" async

Getting traceback information


MathJax stores the error object from the last Math Processing Error in MathJax.Hub.lastError. This allow 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.


For more information, see The MathJax API.