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

> Le mardi 23 mars 2021 à 19:37:33 UTC+1, Thierry (sage-googlesucks@xxx) a 
> écrit :
>
>> Hi, 
>>
>> On Tue, Mar 23, 2021 at 11:20:05AM -0700, Eric Gourgoulhon wrote: 
>> > PS: IMHO, things like %display latex or %display html are hindrances 
>> for 
>> > newcomers. 
>>
>> I understand that this is not the point, but for what it worth, i prefer 
>> the default to remain the current plain text, as it provides more 
>> explicit information, which are good to newcomers. 
>>
>> Example: 
>>
>> Univariate Polynomial Ring in X over Rational Field 
>>
>> vs 
>>
>> Q[X] 
>>
>
> Well, at least on this example, there is as much information in "Q[X]" 
> than in "Univariate Polynomial Ring in X over Rational Field" and the 
> former should be as explicit as the latter to any newcomer who manipulates 
> such an object, since Q[X] is precisely the standard notation for the 
> polynomial ring in X over Q. But I agree than on other examples, the latex 
> output may be not as explicit (sometimes, this is the other way round). 
> Anyway, in case of doubt about an object A, print(A) will always return the 
> plain text description of A. So, I would advocate to reverse the logic 
> here: instead of
> %display latex or show(A) or whatever to get the latex output, have
> A  --> latex output (or any other rich display of A, like svg via the 
> standard Jupyter way, namely _repr_svg_)
> print(A) --> plain text.
>
>
 Note that if for some reason, you have a class for which you would like 
the default display to be plain text, this is very easy to enforce via the 
_repr_latex_ mechanism: it suffices to implement _repr_latex_ in that class 
so that it returns None. Then the latex display will be performed only when 
explicitly asked for with show(...). For instance, assuming that 
_repr_latex_ is implemented in SageObject as indicated above, such a 
"return None" _repr_latex_ is necessary for the Graphics class, since 
Graphics is endowed with a _latex_ method, which returns PGF code --- not 
what you want to display the Graphics object in the browser. 

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/312f2cbf-bd02-469c-ad65-8c0a0d6026adn%40googlegroups.com.

Reply via email to