Pretty print in IPython

57 views
Skip to first unread message

Tobia...@gmx.de

unread,
Feb 2, 2021, 8:27:34 AM2/2/21
to sage-devel

Hello,

I'm using sage in an existing Jupyter notebook (that is using a 'normal' Python backend, and *not* sage). This works great except that all the output is plain text instead of a nice latex or image presentation (symbolic expressions, plots, ...).

I was able to activate pretty printing with the following code:
from sage.repl.rich_output.backend_ipython import BackendIPythonNotebook
backend = BackendIPythonNotebook()
backend.get_display_manager().switch_backend(backend, shell=get_ipython())

I feel like this a bit hacky. Is there a cleaner solution? Perhaps I'm looking for something like sympy's init_printing() method (https://docs.sympy.org/latest/tutorial/printing.html).

Thanks!
Tobias
Reply all
Reply to author
Forward
0 new messages