Hi,

Le mardi 23 mars 2021 à 16:49:07 UTC+1, Kwankyu Lee a écrit :

> Hi all, 
>
> Changes by ticket #31536 may cause unexpected regressions in Sage in 
> jupyter notebook.  Please test and leave comments. 
>
> Here is the address: https://trac.sagemath.org/ticket/31536
>

May I take the opportunity of this thread and ticket to ask why the LaTeX 
display of Sage objects in the Jupyter notebook is not performed via the 
standard Jupyter/IPython way for LaTeX rich output? This standard way 
amounts to simply  implementing a method _repr_latex_ , cf. 
https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html
https://ipython.readthedocs.io/en/stable/api/generated/IPython.core.formatters.html?highlight=_repr_latex_#IPython.core.formatters.LatexFormatter

For instance,  in a Sage Jupyter notebook, if one does

class A(SageObject):

    def __init__(self, data):
        self._data = data

    def _repr_latex_(self):
        return '$' + str(latex(self._data)) + '$'

s = A(sin(x^2))
s

s is then automatically latex-rendered via MathJax without the need to type 
%display latex. The current treatment of LaTeX rich output in Sage looks 
much more complicated than that and apparently, no use of _repr_latex_ is 
done. 

Eric.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/97b23154-e2c0-445b-a02b-6d41b5524707n%40googlegroups.com.

Reply via email to