Question

For very large equations generated by sympy, mathjax in the ipython notebook sometimes fails to render the equation. Instead, it shows the latex source of the equation in a box (which stretches far off the page). I can copy and paste that source into a real latex document, and it renders just fine (though I might have to use the geometry package to make the output PDF extraordinarily wide).

I've actually successfully rendered longer equations, but these particular ones I found were long and also had very large numbers of \left \right pairs in them. I'm not sure if that has anything to do with the failure, but it seems relevant.

What is going on? How can I debug mathjax? And how can I get it to render those equations?

Was it helpful?

Solution

Using the debugging tip found in this question, I found that the buffer was too small, which led me to this mathjax page, where I found the solution. After I increase mathjax's MAXBUFFER value, the equations render just fine. To do this (and turn debugging on), I just put the following in my ~/.ipython/profile_default/static/custom/custom.js.

MathJax.Hub.Config({
  TeX: {
    noErrors: {disabled: true}, // Show error messages
    MAXBUFFER: 25*1024, // Set size of buffer in bytes
  },
});

[Note: Your profile may be elsewhere. To find it, run ipython profile locate. If you don't have the custom.js file or its directories, you may need to create them.]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top