On Wednesday, 1 April 2015 18:11:10 UTC-6, Volker Braun wrote: > > The IPython backend implementation is peculiar, you probably shouldn't > look at it for guidance. The reason is that IPython expects a callable that > returns a particular dictionary. In other words the displayhook doesn't > actually show anything, it only converts the output into IPython's format. > > If we were to use remote IPython kernels for the commandline or something > like that (which is currently discouraged afaik, but might work in the > future) then it should probably use BackendIPython.display_immediately and > not the override from the BackendIPythonCommandline subclass. At least that > was my thought in the code layout. > > Well, SageMathCell does use IPython for processing and I definitely want to be as close to other interfaces as possible. My understanding is that all interfaces but SageNB rely on IPython at the moment, so having some common base class is of interest.
3) html("string") should render "string" as a piece of HTML code rather > than just printing it if frontend supports it - I am not clear on how to > implement it in the current model, it seems to me that OutputHTML format > should be added and supported. > > > Agree, though I haven't gotten there yet. > > > >> 4) show(x^2) and view(x^2) should trigger display of OutputLatex, but it >> does not seem to be the case - it seems to me that SageNB still relies on >> old mess and IPython supports only global preferences for displaying >> formulas. >> > > > There is also pretty_print(x^2), which will become synonymous with show in > http://trac.sagemath.org/ticket/17821 > > I really dislike the "view" function, it really should be called > "pdflatex" because that is what it does and how it is documented. The > current name is very ambiguous, you basically have no chance to guess what > it does. > OK, to summarize, we want 3 different "print statements" that display results immediately: 1) print(s) that prints raw string and works fine at the moment 2) html(s) that interprets s as HTML code and requires new output type 3) something(s) that interprets s as LaTeX code for math mode, probably inserting HTML for MathJax and perhaps having versions for inline or display styles. The most messed up case for the moment. The natural choice for 3) seems to be "latex", except that it does a different thing. And not so natural names that work at the moment are show, pretty_print, and view. Is the plan to stick with pretty_print for formulas, use show for plots only, and deprecate view? We also can add a function mathjax(s) that will work like html(latex(s) + appropriate decoration), although that would be a hard-to-discover function, probably... Thank you! Andrey -- 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 http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.