Le dimanche 19 mai 2019 10:48:23 UTC+2, Volker Braun a écrit :
>
>
> In general, I would lean more on the side of reasonable defaults (e.g. why 
> is %display typeset not the default in the notebook, its easier for power 
> users to turn it off than for novices to turn it on) than a proliferation 
> of more display-related methods.
>
>
A big +1 to this. 
LaTeX is arguably the best way to display mathematics and one may wonder 
why "%display latex" is not the default in the Jupyter notebook. If one 
would like the plain text view of an object X instead, one can use print(X).
So, in the Jupyter notebook, instead of having (as of today)

X.show() --> LaTeX typeset
X  --> plain text

we could have

X  --> LaTeX typeset
print(X)  --> plain text

By the way, a proper way to implement this could be to simply add the 
following method to SageObject:

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

Then the LaTeX display is taken in charge by the *native* Jupyter rich 
output mechanism (there is no need of "%display latex", which is a magic 
implemented at the Sage level) . Moreover, this would fix the long standing 
issue of pdf export reported in
https://trac.sagemath.org/ticket/23330
I've discussed this point with Fernando Perez at the CIRM meeting in 
February and he recommends that we use Jupyter's _repr_latex_.  See
https://github.com/ipython/ipython-in-depth/blob/master/examples/IPython%20Kernel/Custom%20Display%20Logic.ipynb
for more details on customizing Jupyter rich output.

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 post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/0ba751c9-0fb1-40bb-9752-afb9a440c989%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to