Skip to content

MathJax installation

Kyle Rawlins edited this page Feb 12, 2016 · 7 revisions

MathJax installation

For using the lambda notebook, I strongly recommend locally installing a full version of MathJax; Jupyter notebook ships only with the HTML renderer, which doesn't always work so well for the lambda notebook's use cases. (Especially in tree representations.) In addition, at the time of writing Jupyter ships with an older version of MathJax that has bugs which significantly degrade the appearance of composition trees in the lambda notebook; this is fixed in current MathJax 2.6. (Jupyter 4.2 will also have the updated MathJax.)

The recommended renderers for Firefox are SVG, and common HTML (new with MathJax 2.6). You can switch renderers by right-clicking on a formula, and selecting Math Settings -> Math Renderer.

Currently, installing a full mathjax version is slightly technical.

  1. Download and unzip the latest MathJax; at the time of writing this is version 2.6.
  2. Move the resulting folder into your nbextensions folder, and rename it MathJax. Your nbextensions folder can be found in the Jupyter data directory, whose location varies per OS. You can find it by typing at the command line, jupyter --data-dir. On OS X this will be ~/Library/Jupyter. If the directory nbextensions doesn't exist, just create it at that location.
  3. Edit your Jupyter notebook configuration. You may need to create this by running jupyter notebook --generate-config -- it will tell you where it put it. On OS X/linux this should be ~/.jupyter/jupyter_notebook_config.py.
  4. To this file, add the line: c.NotebookApp.mathjax_url = 'nbextensions/MathJax/MathJax.js'.
  5. (re-)start the notebook server.

###Alternate MathJax installation instructions

If you should have bower, you can install MathJax more simply, replacing steps 1-2 with the following commands (h/t Min RK):

  cd $(jupyter --data-dir) 
  bower install --config.directory=nbextensions components/mathjax

###A note on switching renderers

If the instructions go wrong and you attempt to switch renderers with the current Jupyter install, you will be left in a situation where no math renders at all, because the renderers are missing. This is fixed in trunk for Jupyter, so these instructions will go away at some point, but if this happens to you in the meantime, you can reset MathJax by finding and deleting a browser cookie beginning with mjx.

Clone this wiki locally