%display latex in Sage command line

167 views
Skip to first unread message

Antonio Rojas

unread,
May 24, 2023, 7:44:13 AM5/24/23
to sage-devel
Hi all,

 In older versions of sage/ipython, one could use '%display latex' or '%display typeset' to force all output to be formatted in latex. This is used by some third party GUIs (such as Cantor [1]) to typeset the output in their UI.

 In recent versions of Sage (at least since 9.5), this no longer works. It does work on Jupyter, which suggests there is some sort of autodetection going on for deciding whether to display latex output or not. I tried manually changing the display manager backend to IPythonNotebook with no success.

What would be the current way to force latex output in the Sage command line? 

 

Kwankyu Lee

unread,
May 24, 2023, 7:55:36 PM5/24/23
to sage-devel
I think there's no way to force latex output in the command line, as the command line is assumed to be incapable of rendering latex output.

Of course, you can get latex expression 

sage: f = sqrt(2)
sage: latex(f)
\sqrt{2}
sage: html(f)
<html>\(\displaystyle \sqrt{2}\)</html>

Perhaps you have to implement a display manager backend for Cantor. Currently "%display latex" is designed to work only with jupyter.
Reply all
Reply to author
Forward
0 new messages