[IPython-dev] Supporting the qtconsole and notebook display system simultaneously

Jason Moore moorepants at gmail.com
Wed Jan 6 00:13:52 EST 2016


SymPy has a comprehensive printing system and we leverage IPython's
qtconsole and notebook display abilities to show mathematics in unicode,
mathjax, and png outputs. Typically all three of these are generated and
the IPython frontend can choose what to display.

We've hit a bug that we can't figure out how to fix though. Matplotlib has
a minimal LaTeX implementation and can output PNGs. If a user doesn't have
a full LaTeX suit installed we fall back to that. But since matplotlib
doesn't handle LaTeX environments, it can't render things like matrices.

Now if a qtconsole user tries to display a matrix, this fails if matplotlib
is the only available renderer. But if the user is using the notebook then
the matplotlib renderer will fail but mathjax will print properly. We'd
like to fall back to unicode printing if matplotlib fails to print **only
in the qtconsole**, but render with mathjax in the notebook.

So, as far as we can tell, we need to know which frontend is trying to
display our object so that we can handle errors properly. We haven't been
able to think of a workaround that is agnostic of the frontend.

There is some discussion in this PR:
https://github.com/sympy/sympy/pull/9976 (among others).

Any suggestions?

Jason
moorepants.info
+01 530-601-9791
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20160105/7518a8f6/attachment.html>


More information about the IPython-dev mailing list