A small update: using the method _latex_ pointed out by Kwankyu, the 
implementation of _repr_latex_ in the class SageObject could become:

    def _repr_latex_(self):
        try:
            return '$' + str(self._latex_()) + '$'
        except AttributeError:  
            return None  # if None is returned, plain text is used


Le mardi 23 mars 2021 à 21:49:41 UTC+1, Eric Gourgoulhon a écrit :

> Le mardi 23 mars 2021 à 20:28:45 UTC+1, [email protected] a écrit :
>
>> Because I created this years before Jupyter started... 
>>
>
> Ah yes!
>
>  it would be great to redo it. 
>>
>
> As a starting point, it would suffice to endow the class SageObject with a 
> method  _repr_latex_ defined as something like
>
>     def _repr_latex_(self):
>         try:
>             return '$' + str(latex(self)) + '$'
>         except ...:
>             return None  # if None is returned, the plain text is used
>
> Certainly, this would require some fine tuning and the treatment of 
> specific cases.
>
> Similar things could be done with _repr_svg_, _repr_png_, etc...
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/325a903c-85bc-4327-9bf2-8b20347d90e9n%40googlegroups.com.

Reply via email to