On Wednesday, March 24, 2021 at 5:49:41 AM UTC+9 Eric Gourgoulhon wrote:

> Le mardi 23 mars 2021 à 20:28:45 UTC+1, wst...@gmail.com 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...
>

Let me summarize the present situation, which should be the starting point.

Presently,

def _latex_(self):
       ....

defines the latex representation of the object, which you can get by 

latex(obj)

This latex representation is oriented for latex typesetting, originally for 
printing on paper. You can view it by 

view(obj)

on the screen instead. On the other hand, 

show(obj)

shows the html+mathjax representation (the rich output) of the object, 
which you can get by

html(obj)

Presently this html+mathjax representation is also defined by the above 
latex(obj)! This makes it difficult to provide  a proper html+mathjax 
representation of the object, when necessary. Hence the ticket lets you 
provide it by

def _html_(self):
      ...

if you do not like the default html+mathjax representation computed from 
the latex representation.

By the way, you can always override the rich output of an object by 
defining 

def _rich_repr_(self):
       ...

which may provide any representation (svg, png, ...) supported by the 
frontend(=backend).

I think we should distinguish the html+mathjax representation clearly from 
the latex representation. This is the aim of the ticket.

Logically then %display latex should be renamed to %display html. Hence the 
title of this thread.






-- 
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/1de88b36-4fa7-4e7b-91a5-43bd4b89d3abn%40googlegroups.com.

Reply via email to