Display of matrix in notebook

180 views
Skip to first unread message

Mike Witt

unread,
Aug 2, 2010, 10:21:46 AM8/2/10
to sage-n...@googlegroups.com
Sage Version 4.5.1

When I do this sequence of code in a worksheet:

M1=matrix([[1,2],[3,4]])
print(latex(M1))
html('$%s$' %latex(M1))
M2=matrix([[1,2,3],[1,2,3],[1,2,3]])
print(latex(M2))
html('$%s$' %latex(M2))

... M1 displays correctly, but M2 looks weird. I don't see any
difference in the way the html is constructed. Does anybody else
get a funny result on this? Or have I possibly screwed up
something in my worksheet environment?

-Mike

Tim Joseph Dumol

unread,
Aug 2, 2010, 12:19:30 PM8/2/10
to sage-n...@googlegroups.com
Hi,

Are you sure you have jsmath fonts installed? Similar complaints were
made before by people without jsmath fonts.

--
Tim Joseph Dumol <tim (at) timdumol (dot) com>
http://timdumol.com

Mike Witt

unread,
Aug 2, 2010, 2:22:20 PM8/2/10
to sage-n...@googlegroups.com
On 08/02/2010 09:19:30 AM, Tim Joseph Dumol wrote:
> Hi,
>
> Are you sure you have jsmath fonts installed? Similar complaints were
> made before by people without jsmath fonts.

I don't know. I don't remember doing anything explicitly to
install them. I don't have any other latex related problems
in the notebook (that I've found out about yet :-)

Is there some command that can tell me if they're installed?
Or can you give me a pointer to the documentation I might read
to find out more about that?

-Mike

Mike Witt

unread,
Aug 2, 2010, 2:48:53 PM8/2/10
to sage-n...@googlegroups.com

Follow up question: I'm not actually going to use this notebook
myself. I generally just output latex and build a PDF file.

I'm making the notebook for others to use. Are they going to
have to have jsmath fonts installed? My whole intent in using
the notebook interface is that (hopefully) someone can just
point their browser at it, and not have to know about the
underlying issues. Is this realistic?

-Mike

Harald Schilly

unread,
Aug 2, 2010, 2:53:28 PM8/2/10
to sage-n...@googlegroups.com
On Mon, Aug 2, 2010 at 20:48, Mike Witt <msg...@gmail.com> wrote:
> someone can just
> point their browser at it, and not have to know about the
> underlying issues. Is this realistic?


There is an optional spkg for sage, jsmath_image_fonts-1.4.p3.spkg
description: The jsMath image fonts provide a fall-back for rendering
TeX characters in browsers on computers that do not have the TeX fonts
installed.

This is not included by default because it is huge (many images
[although i heard it is indirectly in the mercurial repo of sagenb]),
but afaik would render installing fonts on all clients unnecessary.

H

Mike Witt

unread,
Aug 2, 2010, 3:15:25 PM8/2/10
to sage-n...@googlegroups.com

Well, I *thought* that that was equivalent to what I do have:
html('<script src="http://localhost/jsMath/easy/load.js"></script>')

Although, now that I try it, everything other than the 3d matrix
seems to work with or without that line. I'm a bit confused about
what jsmath capabilities are needed and when. Is there something else,
other than displaying matrices that should fail if jsmath isn't
properly set up?

Mike Witt

unread,
Aug 2, 2010, 5:20:00 PM8/2/10
to sage-n...@googlegroups.com
On 08/02/2010 11:53:28 AM, Harald Schilly wrote:

So, I tried this:

/usr/local/sage-4.5.1/sage -i jsmath_image_fonts-1.4.p3.spkg

It downloaded the package and appeared to install it without
any problem. I stopped the sage server, exited out of sage,
quit netscape, then started everything up again. Nothing changed.

(I did eliminate all the includes for my local jsmath stuff too.)

-Mike

Mike Witt

unread,
Aug 2, 2010, 6:10:44 PM8/2/10
to sage-n...@googlegroups.com
Here's something. When I log on to sagenb.org and try to edit
a worksheet, I get this:

It looks like jsMath failed to set up properly (error code -7). I will
try to keep going, but it could get ugly.

I don't remember ever seeing this before. I haven't updated
firefox lately. Anyone know if this indicates that my browser
has some particular problem? I imagine whatever this is may
be the root of my other issues.

-Mike

William Stein

unread,
Aug 2, 2010, 7:05:19 PM8/2/10
to sage-n...@googlegroups.com
I upgraded the sagenb.org server -- maybe this broke the image fonts.
I've just done

sage -i jsmath_image_fonts-1.4.p3

which might help.

William

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Mike Witt

unread,
Aug 2, 2010, 7:14:12 PM8/2/10
to sage-n...@googlegroups.com
I'm still getting the same error. Maybe it's me?

Mike Witt

unread,
Aug 2, 2010, 9:52:16 PM8/2/10
to sage-notebook
OK, so I tried this from another computer, and not only
do I not get any errors from sagenb, but the original
worksheet on which I had the problem works fine. So,
it appears that somehow the firefox running on my
system has simply gotten .... messed up. Any the only
symptom (that I can find) is not being able to display
a matrix in jsmath. So, I'm at a loss to know what to
do about this. And I can't duplicate the problem using
jsmath outside of a sage notebook. Bummer.

Harald Schilly

unread,
Aug 3, 2010, 4:24:05 AM8/3/10
to sage-n...@googlegroups.com
On Tue, Aug 3, 2010 at 03:52, Mike Witt <msg...@gmail.com> wrote:
> So,
> it appears that somehow the firefox running on my
> system has simply gotten ....

you can setup several profiles with firefox, it's worth checking this
out by creating a new one. Also, disable all
adblock/scriptblocking/content modification plugins.

$ firefox -P "sage" -safe-mode

-P for profile, -safe-mode disables plugins and loads the default theme.

H

Mike Witt

unread,
Aug 3, 2010, 11:12:28 AM8/3/10
to sage-n...@googlegroups.com

I did this. I checked all the "disable" boxes while creating the
new profile. When I go to sagenb.org, I still get the "jsMath failed
to setup" error. And I still have the same matrix display problem
locally. By the way, this is firefox 3.5.6 on Fedora 11.

In the meantime I've found by trying a couple of other computers,
that there are *some* other browsers on *some* other system do get the
same error, and some don't.

For example, my girlfriends laptop with Fedora 12 and Firefox 3.5.9
does NOT get the "fail to setup" error on sagenb.org.

But I tried in on another Fedora 12 system with Firefox 3.5.11,
and that one DOES get the error. Google Chrome 5.0.375.125 beta
on this same fc12 system does NOT get the error.

BTW, I don't see the jsmath failed to setup error when I use
my own server, even for the browsers that "fail" with sagenb.
But the same browsers that get the error on sagenb are the
ones that have the problem displaying the matrix. So, I
assume it's the same problem.

So, after these test, I can only assume that I'm not the only
one who ever gets this "failed to setup" with sagenb(?)

For the record, I just did these, around 8:00am (PST) Tuesday.

-Mike

Harald Schilly

unread,
Aug 3, 2010, 11:47:37 AM8/3/10
to sage-n...@googlegroups.com
On Tue, Aug 3, 2010 at 17:12, Mike Witt <msg...@gmail.com> wrote:
> So, after these test, I can only assume that I'm not the only
> one who ever gets this "failed to setup" with sagenb(?)

Could you please also check how the examples on the official jsmath
page look? Maybe it's time to update jsmath?
(clicking on the jsmath icon at the bottom right reveals the version number)

here are matrices:
http://www.math.union.edu/~dpvc/jsMath/examples/TeXbook18b.html

H

Jason Grout

unread,
Aug 3, 2010, 11:49:33 AM8/3/10
to sage-n...@googlegroups.com
On 8/3/10 8:47 AM, Harald Schilly wrote:
> On Tue, Aug 3, 2010 at 17:12, Mike Witt<msg...@gmail.com> wrote:
>> So, after these test, I can only assume that I'm not the only
>> one who ever gets this "failed to setup" with sagenb(?)
>
> Could you please also check how the examples on the official jsmath
> page look? Maybe it's time to update jsmath?

I think we'd probably move to MathJax, the successor to jsmath. I think
all development has moved from jsmath to MathJax.

Thanks,

Jason

Mike Witt

unread,
Aug 3, 2010, 12:11:41 PM8/3/10
to sage-n...@googlegroups.com

Yes, those look fine. And I followed the links to a bunch of other
examples, which all worked. BTW, I really did try to duplicate this
problem outside of the sage notebook environment and I couldn't
do it.

It appears that I'm using jsMath v3.6e on the system that
has the problem. On the other system, google-chrome which does
not have the problem, and firefox which does have the problem
both report: jsMath v3.6e also.

Mike Witt

unread,
Aug 4, 2010, 4:20:53 PM8/4/10
to sage-notebook
Here's another bit of information. The matrix display problem only
happens with '()' or '[]' -- A matrix surrounded by '<>' or a
determinant '||' work fine.

Also, it appears to be related to the 'size' of the image, not the
fact that it's a matrix. In other words:

html('$\\left(\\frac{1}{1+\\frac{1}{1+\\frac{1}{2}}} \\right)$')

... gets the crazy display

html('$\\left<\\frac{1}{1+\\frac{1}{1+\\frac{1}{2}}} \\right>$')

... looks as expected.

Is there anything "special" about '(' or '[' in the notebook
environment? Or, is there any way to directly examine the image
that would be used in these instances?

Again, when I do this code on a page outside of the notebook
environment (with the same browser) I can't duplicate the
problem.

-mike

Mike Witt

unread,
Aug 5, 2010, 12:48:34 AM8/5/10
to sage-notebook
I don't know if people are tired of this thread by now,
but I've managed to fix this problem on my local
server by doing the following. Around line 169 in

/usr/local/sage-4.5.1/local/lib/python2.6/site-packages/
sagenb-0.8.1-py2.6.egg/sagenb/data/sage/js/
jsmath.js

I changed the "noImageFonts" lines so they
both say 0. After that the three people who had the
"bad" browsers can now load the image fonts.

I have no idea if this make sense or not. And,
it appears the equivalent javascript file from
sagenb.org ONLY has noImageFonts: 0,
so it doesn't explain my "error -7" there.

I won't keep posting about this unless there
actually appears to be any interest.

-Mike

Jason Grout

unread,
Aug 5, 2010, 1:25:41 AM8/5/10
to sage-n...@googlegroups.com

Wow, good job finding a fix! Can you summarize the issue and fix on a
trac ticket?

Thanks,

Jason

Mike Witt

unread,
Aug 5, 2010, 12:29:11 PM8/5/10
to sage-n...@googlegroups.com

Well, AFAIK this isn't really a fix. Since that line shouldn't be
executed (as far as I can see) and it doesn't appear to be related
to the error on sagenb.org. It just makes things work on my local
server, for reasons that I don't understand. I'm way out of my
depth here, and I was hoping that what I found would serve as a
"hint" to someone who knows how the notebook really works.

Also, I'm a little confused about the fact that no one else has
reported this "-7" error with sagenb.org. This seems to call
into question whether there is, in general, a problem or not.

So I'm afraid I'd just create more confusion by starting to
create trac tickets, without really knowing what I'm doing.

I guess my best "summary" of the "suspected" error would be
to phrase it in terms of sagenb, rather than a server running
on my system (since that brings in all sorts of other
complications) and that summary is:

It looks like jsMath failed to set up properly (error code -7). I will
try to keep going, but it could get ugly.

Happens when I try to use sagenb.org on some systems with
some browsers, but not with any pattern that I've been able
to detect.

Sorry I can't do better than that. I've never really
used the notebook interface much. I normally output stuff
using latex and view it in PDF. I just happened to try to
create some worksheets so that they could be viewed by
a study group I'm in. Maybe I should have had more experience
with notebooks before trying that :-)

-Mike


Rob Beezer

unread,
Aug 6, 2010, 2:32:47 AM8/6/10
to sage-notebook
Hi Mike,

I'm not tired of this yet. I always get bad looking matrices, but I
am always messing around with the notebook and fonts, so I just
figured I busted something. The other thing that is weird for me is
the delimiters for the floor function, they are always shifted
downward. Do you want to try:

html('$\\Bigl\\lfloor x \\Bigr\\rfloor$')

and see what you get.

Rob

Mike Witt

unread,
Aug 6, 2010, 11:29:27 AM8/6/10
to sage-n...@googlegroups.com

When I don't load the image fonts properly I see something crazy.

When they do load properly, I see the same symbol in the sage
notebook that I see with jsMath on a regular html page. So I
assume it's the right symbol.

If I do

QL('This is the $\Bigl\\lfloor x \\Bigr\\rfloor$ function')

Then the x is lined up with the rest of the text, but the
"bars" surrounding the x extend for quite a ways
above and below the x and the rest of the text. But the amount
of extension appears roughly equal. When I look closely,
perhaps those line in the notebook extend *slightly* further
down than they do on a regular html page.

-Mike


Mike Witt

unread,
Aug 6, 2010, 11:31:43 AM8/6/10
to sage-notebook


On Aug 6, 8:29 am, Mike Witt <msg...@gmail.com> wrote:
> On 08/05/2010 11:32:47 PM, Rob Beezer wrote:
>
> > Hi Mike,
>
> > I'm not tired of this yet.  I always get bad looking matrices, but I
> > am always messing around with the notebook and fonts, so I just
> > figured I busted something.  The other thing that is weird for me is
> > the delimiters for the floor function, they are always shifted
> > downward.  Do you want to try:
>
> > html('$\\Bigl\\lfloor x \\Bigr\\rfloor$')
>
> > and see what you get.
>
> > Rob
>
> When I don't load the image fonts properly I see something crazy.
>
> When they do load properly, I see the same symbol in the sage
> notebook that I see with jsMath on a regular html page. So I
> assume it's the right symbol.
>
> If I do
>
> QL('This is the $\Bigl\\lfloor x \\Bigr\\rfloor$ function')

Sorry, make that:

html('This is the $\\Bigl\\lfloor x \\Bigr\\rfloor$ function')
Reply all
Reply to author
Forward
0 new messages