show and view

3 views
Skip to first unread message

Andrey Novoseltsev

unread,
Feb 8, 2010, 11:21:17 PM2/8/10
to sage-devel
Hello,

As of now show and view seem to do the same thing, yet show used to
produce displayed equations and I liked it mainly for bigger size of
fractions, but also for centering the output. Is there still a
possibility to get the old-style behaviour? There was some discussion
that show does not work in general as good as view, but at least for
matrices/rational functions it was just fine.

Also, if it is written somewhere in help how to do it, it is not easy
to find. Perhaps such functions deserve a mention on the notebook help
page? (It does have a note about typesetting everything via the
checkbox, it could also say something about other methods of output.)

Thank you!
Andrey

William Stein

unread,
Feb 8, 2010, 11:52:20 PM2/8/10
to sage-...@googlegroups.com, John Palmieri

Huge +1. I just tried "show(...)" in the notebook, and looked at
the generated HTML. Indeed it is

<span class="math">

when it should be

<div class="math">

which means "display math".

Here's the relevant code in sage/misc/functional.py that now gets
called by show:

def _do_show(x):
if sage.plot.plot.DOCTEST_MODE:
return sage.misc.latex.latex(x)
from latex import view
view(x)
#raise AttributeError, "object %s does not support show."%(x, )

Note the call to view :-(

Here is the guilty patch:

wstein@ubuntu:~/sage/devel/sage/sage/misc$ hg export 13803|more
# HG changeset patch
# User J. H. Palmieri <palm...@math.washington.edu>
# Date 1264540865 28800
# Node ID a597eec982bcd7dfc7252355bb7a526819564006
# Parent 6b139f7a44512b9f7e0883c45d229d337b086649
#8084: fix show for strings, etc.

diff -r 6b139f7a4451 -r a597eec982bc sage/misc/functional.py
--- a/sage/misc/functional.py Tue Jan 26 22:25:59 2010 +0100
+++ b/sage/misc/functional.py Tue Jan 26 13:21:05 2010 -0800
@@ -1361,9 +1361,6 @@
_do_show(x)

def _do_show(x):
- if sage.server.support.EMBEDDED_MODE:
- print '<html><div
class="math">%s</div></html>'%sage.misc.latex.latex(x)
- return sage.misc.latex.LatexExpr('') # so no visible output
if sage.plot.plot.DOCTEST_MODE:
return sage.misc.latex.latex(x)


So this looks like an accidental regression that was introduced in the course of
fixing another bug. This is now trac 8219:

http://trac.sagemath.org/sage_trac/ticket/8219

I've posted a patch there. Somebody please review it.

-- William

Andrey Novoseltsev

unread,
Feb 9, 2010, 1:08:19 AM2/9/10
to sage-devel
Positive review, thank you!

Andrey


On Feb 8, 9:52 pm, William Stein <wst...@gmail.com> wrote:

> # User J. H. Palmieri <palmi...@math.washington.edu>

Reply all
Reply to author
Forward
0 new messages