I think it is a good idea consolidate the capabilities of all these functions in show(). However, is there a way to deprecate a function but still make old code evaluate correctly if it calls this function? Perhaps it would just be a matter of changing the docstring to 'deprecated, see show()' or something similar, but not actually removing the function. I guess it's a trade-off between namespace pollution and backwards compatibility.
Stan On Dec 4, 7:33 pm, Jason Grout <[EMAIL PROTECTED]> wrote: > William Stein wrote: > > On Thu, Dec 4, 2008 at 1:45 AM, Wilfried_Huss > > <[EMAIL PROTECTED]> wrote: > >> From the discussion of trac #4575: > > >> There are already at least five functions that produce jsmath output > >> in the notebook, which all behave differently: > > >> show(): > > >> Produces latex in display mode. And works with graphic objects of > >> course. > > >> view(): > > >> Produces latex in inline mode (which is hard to read in the > >> notebook). This has many options that only work > >> on the commandline and with xdvi. For graphic objects it returns a > >> string representation. > > >> typeset(): > > >> Same behaviour as view() but has no options. > > >> pretty_print(): > > >> produces latex in inline mode. > > >> If used on the graphics objects, it shows it like show(). But it > >> doesn't accept any options, as show() does. > > >> jsmath(): > > >> produces latex in display mode. For graphic objects it returns a > >> string representation, but inside latex > >> math-mode. > > >> The docstring says that there is a option mode which changes > >> between display and inline mode. > > >> Unfortunately this only works in doctest mode. In the notebook I > >> get: > > >> sage: jsmath(x^2, 'inline') > >> Traceback (click to the left for traceback) > >> ... > >> TypeError: __call__() takes exactly 2 arguments (3 given) > > >> Is there a deeper reason why Sage has all these functions? Or have > >> they just accumulated over the years? > >> A few of these should probably be deprecated. > > >> In my opinion show() is the best of these, because also x.show() > >> works, so it is consistent. It's short and easy > >> to remember. It just needs better documentation. > > >> Would a mode flag for show() like the one for jsmath() be okay? Then > >> it could be extended in the future without adding additional keywords. > > >> What should be the user interface for latex output in the notebook? > > >> Greetings, > >> Wilfried > > > I think these "accumulated over the years", and there is no deep > > reason to have so many. Here's how I see them, which should > > mean something since I wrote the first versions of most of them: > > > show -- a useful command that I use all the time; shows an object > > nicely. > > > view -- pointless and should be removed. This behavior could > > maybe be an option to show. It was useful back before jsmath or > > the notebook existed when I used a "log to dvi file" mode. > > > typeset -- I have no clue where this comes from or what it does, though > > evidently I wrote it on July 4, 2006. > > > pretty_print -- Jason Grout wrote this somewhat recently. I'm not > > sure why, but I think there was a sage-devel discussion. > > I think there was a reason; the sage-devel discussion would probably > show it. > > > > > jsmath -- This is mainly so one can use %jsmath cells in a notebook > > to render formulas. I'm not sure how useful this is, but I have used > > it many times. It is also very nice in that you can do jsmath('x^n + > > y^n = z^n'), say and get typeset math out. There is no "natural" way > > to do that using any of the above commands right now. > > What is the difference between jsmath("x^n+y^n=z^n") and > html("$x^n+y^n=z^n$")? It seems like the jsmath function could be > removed, since a %jsmath cell would just be a %html cell with the math > enclosed in dollar signs. > > Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---