Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

jupyter (ipython notebook) kernel math display

I'm trying to set up sage as a jupyter (ipython notebook 4.0+) kernel on my local machine.

To do this, I have installed sage in /usr/local/sage, and set up a kernel using the SageKernelSpec tool (following instructions here).

My sage kernel.json looks like this:

{"display_name": "Sage 6.9", "argv": ["/usr/local/sage/sage", "-python", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"]}

The kernel starts from within jupyter, and I am able to run sage. However, math text is not rendered. As an example:

x, y = var('x y')
show(x/y)

> \newcommand{\Bold}[1]{\mathbf{#1}}\frac{x}{y}

The problem seems to be that the notebook is not recognising and formatting mathjax input properly. I have tried manually linking the sage mathjax library to ipython using:

use_local_mathjax()

But it still does not work.

I can get a properly functioning sage notebook by entering:

sage -n ipython

in terminal, but when starting the notebook from my standard jupyter environment (i.e. choosing the kernel from the dropdown list), the mathtype is not rendered.

I can't work out what's going on... any pointers appreciated.

Thanks!