Warnings from JsMath

13 views
Skip to first unread message

bill.p

unread,
Jan 24, 2008, 4:56:01 PM1/24/08
to sage-support
I find the warning messages that appear at the top of the notebook
saying
that JsMath isn't available annoying. There's an awful lot of disk
space full
of the JsMath stuff so it's definitely there. I find it especially
annoying when I
try to print something - I get a big red box at the top of my output
saying:

To print higher resolution math symbols, click the
Hi_Res Fonts for Printing button on the jsMath control panel.

What control panel?
If you have to issue a warning, it should be on the 'print' window,
before you
commit to paper. Having seen the message, if you go ahead, it should
not
appear on the paper!

Bill

BFJ

unread,
Jan 24, 2008, 7:50:03 PM1/24/08
to sage-support
The control panel is the little tab at the bottom of the browser
output which reads "jsMath". Just click there and follow the links.

I agree about the warning. It might be better as a browser alert, or
maybe an embedded popup. On the other hand, this may be part of jsMath
and not something which can be addressed in Sage without modifying
jsMath, I don't know.

-BFJ

Timothy Clemans

unread,
Jan 24, 2008, 11:52:14 PM1/24/08
to sage-support
In the first versions of the Sage Notebook that message was actually
hidden.

William Stein

unread,
Jan 25, 2008, 1:17:37 AM1/25/08
to sage-s...@googlegroups.com
On Jan 24, 2008 8:52 PM, Timothy Clemans <timothy...@gmail.com> wrote:
>
> In the first versions of the Sage Notebook that message was actually
> hidden.

(1) If one wants to disable the font message, comment out (with /* */) line 253
of SAGE_ROOT/devel/sage/sage/server/notebook/js.py and do "sage -br":

/* jsMath = {Font: {Message: function () {}}} */

I do not think this should be the default in Sage. However, a nicer error
message would be good, which provides a link to a _local_ download page
for the jsmath fonts, which is much easier to understand and follow than
the official jsmath page.

(2) Any typesetting in the notebook basically looks like crap without the jsmath
fonts, so it would be bad to encourage people to completely remove the warning
message.

(3) The fonts are tiny (120KB) and fairly easy to install:

http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html

-- William

bill purvis

unread,
Jan 25, 2008, 2:45:43 AM1/25/08
to sage-s...@googlegroups.com
The fonts I downloaded are 80Mb!

And where should they be installed? I can't work out where the
notebook server expects to find them.

I thought they were included as part of the Sage distribution, anyway?

Bill
--
+---------------------------------------+
| Bill Purvis, Amateur Mathematician |
| email: b...@beeb.net |
| http://bil.members.beeb.net |
+---------------------------------------+

Timothy Clemans

unread,
Jan 25, 2008, 3:10:58 AM1/25/08
to sage-support
See http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html.
There are install instructions for PC, Mac OS X, and Unix users.

On Jan 24, 11:45 pm, bill purvis <b...@beeb.net> wrote:
> On Friday 25 January 2008, William Stein wrote:
>

bill purvis

unread,
Jan 25, 2008, 7:49:50 AM1/25/08
to sage-s...@googlegroups.com
On Friday 25 January 2008, Timothy Clemans wrote:
> See http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html.
> There are install instructions for PC, Mac OS X, and Unix users.
>
> On Jan 24, 11:45 pm, bill purvis <b...@beeb.net> wrote:
Yes, but what about Sage users?

They say unpack them in the server tree. I know where my Apache server
keeps things, and I've installed them in there.

Where is the server tree for the notebook server?

William Stein

unread,
Jan 25, 2008, 7:55:32 AM1/25/08
to sage-s...@googlegroups.com
On Jan 25, 2008 4:49 AM, bill purvis <b...@beeb.net> wrote:
>
> On Friday 25 January 2008, Timothy Clemans wrote:
> > See http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html.
> > There are install instructions for PC, Mac OS X, and Unix users.
> >
> > On Jan 24, 11:45 pm, bill purvis <b...@beeb.net> wrote:
> Yes, but what about Sage users?
>
> They say unpack them in the server tree. I know where my Apache server
> keeps things, and I've installed them in there.

??! There is nothing about "server trees" here:
http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html

You just download a 120KB zipped font file, extract it and install it
as explained there.
It has nothing whatever to do with servers.

Ted Kosan

unread,
Jan 25, 2008, 2:15:06 PM1/25/08
to sage-s...@googlegroups.com
Bill wrote:

> Where is the server tree for the notebook server?

The fonts are installed in the computer that is running the browser,
not the one that is running the Sage server :-) The idea is that the
browser loads the fonts from the hard drive that it was launched from
when it visits a web page that uses jsMath. For example, here is a
web page that uses jsMath and it will also show the warning message if
your system does not have the fonts installed:

http://www.math.union.edu/~dpvc/jsmath/examples/TeXbook16.html

Ted

dpvc

unread,
Jan 26, 2008, 6:18:50 AM1/26/08
to sage-support
> I find the warning messages that appear at the top of the notebook saying
> that JsMath isn't available annoying.

If you look carefully, it says the jsMath TeX fonts aren't found, not
that jsMath isn't found (in fact, it is jsMath that issuing the
message, so clearly that was found).

> I find it especially annoying when I try to print something - I get a big red box at the top of my output saying:
>
> To print higher resolution math symbols, click the
> Hi_Res Fonts for Printing button on thejsMathcontrol panel.

If you would install the jsMath TeX fonts, that would go away.

> What control panel?

The small jsMath button at the bottom right of the screen links to the
control panel. Also, the initial jsMath font warning page that you
get when you first view the notebook has two buttons on it: one to
hide the message and one to open the jsMath control panel. If you
don't like to see the message, you can push the hide button and it
will go away (no more work than if you were receive an alert
message). If you don't know how to get the jsMath control panel, you
can get it from that message. You can also get it by ALT-clicking on
any typeset mathematics.

> If you have to issue a warning, it should be on the 'print' window, before you
> commit to paper. Having seen the message, if you go ahead, it should not
> appear on the paper!

If sage constructs a special version of the page for printing purposes
(I don't use sage myself, so I'm unfamiliar with its workings), then
it would be possible for that page to load the higher-resolution fonts
automatically (via the insertion of a line similar to the one William
listed for turning off the main font warning). Otherwise, if you are
just printing the page out of the browser, there is no way to jsMath
to know if you are planning to print such a page, and so it puts it
in the only place that makes sense, the printed version, which will be
showing the poor quality output and where it is likely to do you some
good. Putting it on every page you view would be considered by some
users as "annoying".

The jsMath panel allows you to control the printing of these messages,
so the user has the option of turning them off himself. You can also
configure jsMath not to display the print warnings in a similar
fashion to William's message about the main font warnings. You can
also change the CSS styles for the message to make them less
obtrusive, or replace the content of the message by your own wording.
Finally, you can override jsMath's function for issuing the message
and so make it appear anywhere or in any form you want. These
possibilities are documented at

http://www.math.union.edu/locate/jsMath/authors/warnings.html

so the sage project could set up the messages in a different way if it
wants to.

Davide

dpvc

unread,
Jan 26, 2008, 6:28:55 AM1/26/08
to sage-support
> I agree about the warning. It might be better as a browser alert, or
> maybe an embedded popup.

The "hide" button already makes the message essentially a popup, but
one that you can ignore if you want. Making it an alert or real popup
would REQUIRE user interaction (whereas you can simply ignore the
message as it currently stands), and I assure you that having to
respond to an alert would certainly fall into the "annoying" category.

> On the other hand, this may be part of jsMath
> and not something which can be addressed in Sage without modifying jsMath, I don't know.

I have mentioned the page where the methods for changing this are
documented. The Sage folks are welcome to use any of them to alter
the way the message is handled.

Normally, jsMath uses a browser cookie to determine if you have seen
the font warning message before and doesn't issue it a second time for
you. Unfortunately, files loaded from the local disk (as opposed to a
remote server) do not support cookies (which are tied to server
domains, and local files don't really have any), so you will see the
message every time you view the notebook. Since sage lets you save
changes to the notebook (I assume), there may be a way for it to save
the fact that you have already seen the message as well (e.g., like
including the font-warning-disabling code in the saved version, but
not an original blank notebook or something, at least when saving to a
local file). That might help some users.

Davide

dpvc

unread,
Jan 26, 2008, 6:33:16 AM1/26/08
to sage-support
> (2) Any typesetting in the notebook basically looks like crap without the jsmath
> fonts, so it would be bad to encourage people to completely remove the warning
> message.

I agree completely. That is why the message is there in the first
place. Removing it removes any chance of the user finding out that
they could improve their results significantly. It is designed to be
a little unsettling so that you will go out and get the fonts. (It is
also really designed for a server, not local files, where the user can
use the control panel to control whether the message is shown or not
and save that data in a cookie.)

Davide

dpvc

unread,
Jan 26, 2008, 6:49:09 AM1/26/08
to sage-support
> The fonts I downloaded are 80Mb!

You downloaded the wrong thing. There are two kinds of fonts used by
jsMath: one is standard TTF fonts that the browser can use like any
other font. These are called the "jsMath TeX fonts", and are what the
warning message is complaining about. The link on the jsMath control
panel to "Missing Fonts" takes you to a page that explains this and
links to the download page for the missing fonts. That is the page
William and others have pointed you to in other messages. These fonts
are small and are installed on the machine that is running the browser
that is viewing pages that contain jsMath.

The other type of font is called the "jsMath Image Fonts" and is the
80 MB download you talk about. These are not really fonts, they are
collections of images of the characters in the fonts (an image for
each character in each font in each size that jsMath uses, and so
there are tens of thousands of them). These go on the SERVER, as part
of the jsMath folder. Individual users don't usually install these on
their machines, but since sage is running locally on your machine, it
has a full installation of the jsMath server files, and so these image
fonts must be there as well. These are what get used if the browser
doesn't have access to the jsMath TeX fonts described above; that is,
when you see the font warning message, it is these image fonts that
jsMath falls back on.

A normal user doesn't have to worry about the jsMath image fonts, only
the jsMath TeX fonts, but since you are really running a jsMath server
locally, sage users do have to have (and understand) both.

> And where should they be installed? I can't work out where the
> notebook server expects to find them.

The jsMath TeX fonts are installed in the place that all other fonts
go on your system (e.g., in the Fonts control panel under Windows, or
~/Library/Fonts on Mac OS X, or ~/.fonts on linux).

The jsMath image fonts are unpacked into the jsMath source directory
(somewhere inside the sage directories, I assume), and that is
documented on the author's download page of the jsMath website. But
you should not be having to deal with that, as I suspect the sage
distribution already includes these image font files in the correct
place.

Davide

William Stein

unread,
Jan 27, 2008, 8:38:40 AM1/27/08
to sage-s...@googlegroups.com
On Jan 26, 2008 3:49 AM, dpvc <dp...@union.edu> wrote:
>
> > The fonts I downloaded are 80Mb!
>
> You downloaded the wrong thing. There are two kinds of fonts used by
> jsMath: one is standard TTF fonts that the browser can use like any
> other font. These are called the "jsMath TeX fonts", and are what the
> warning message is complaining about. The link on the jsMath control
> panel to "Missing Fonts" takes you to a page that explains this and
> links to the download page for the missing fonts. That is the page
> William and others have pointed you to in other messages. These fonts
> are small and are installed on the machine that is running the browser
> that is viewing pages that contain jsMath.
>
> The other type of font is called the "jsMath Image Fonts" and is the
> 80 MB download you talk about. These are not really fonts, they are
> collections of images of the characters in the fonts (an image for
> each character in each font in each size that jsMath uses, and so
> there are tens of thousands of them). These go on the SERVER, as part
> of the jsMath folder. Individual users don't usually install these on
> their machines, but since sage is running locally on your machine, it
> has a full installation of the jsMath server files, and so these image
> fonts must be there as well.
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sage (the SERVER) actually does *not* include the 80MB jsMath Image Fonts.
I made the decision not to include them a long time ago, mostly because of disk
space and configuration issues, and it hasn't been revisited yet.

> These are what get used if the browser
> doesn't have access to the jsMath TeX fonts described above; that is,
> when you see the font warning message, it is these image fonts that
> jsMath falls back on.

Actually since Sage does not include those fonts, the fallback math
typesetting is currently using unicode.

> A normal user doesn't have to worry about the jsMath image fonts, only
> the jsMath TeX fonts, but since you are really running a jsMath server
> locally, sage users do have to have (and understand) both.

I don't think we have to have both, since in fact we don't have both.

> > And where should they be installed? I can't work out where the
> > notebook server expects to find them.
>
> The jsMath TeX fonts are installed in the place that all other fonts
> go on your system (e.g., in the Fonts control panel under Windows, or
> ~/Library/Fonts on Mac OS X, or ~/.fonts on linux).
>
> The jsMath image fonts are unpacked into the jsMath source directory
> (somewhere inside the sage directories, I assume), and that is

Presumably here:

SAGE_ROOT/data/extcode/javascript/jsmath/

> documented on the author's download page of the jsMath website. But
> you should not be having to deal with that, as I suspect the sage
> distribution already includes these image font files in the correct
> place.

We don't due to size issues, as mentioned above.

William

bill purvis

unread,
Jan 27, 2008, 3:03:10 PM1/27/08
to sage-s...@googlegroups.com
That is just talking about installing TeX fonts which are installed on
my system anyway. I've been using TeX/LaTeX for years...

I guess we have been somehow talking at cross purposes here.

I'll check further to see if there's something gone adrift.

William Stein

unread,
Jan 27, 2008, 3:09:03 PM1/27/08
to sage-s...@googlegroups.com
On Jan 27, 2008 12:03 PM, bill purvis <b...@beeb.net> wrote:
>
>
> On Friday 25 January 2008, William Stein wrote:
> > On Jan 25, 2008 4:49 AM, bill purvis <b...@beeb.net> wrote:
> > > On Friday 25 January 2008, Timothy Clemans wrote:
> > > > See http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html.
> > > > There are install instructions for PC, Mac OS X, and Unix users.
> > > >
> > > > On Jan 24, 11:45 pm, bill purvis <b...@beeb.net> wrote:
> > >
> > > Yes, but what about Sage users?
> > >
> > > They say unpack them in the server tree. I know where my Apache server
> > > keeps things, and I've installed them in there.
> >
> > ??! There is nothing about "server trees" here:
> > http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html
> >
> > You just download a 120KB zipped font file, extract it and install it
> > as explained there.
> > It has nothing whatever to do with servers.
> >
> > > Where is the server tree for the notebook server?
> >
> That is just talking about installing TeX fonts which are installed on
> my system anyway. I've been using TeX/LaTeX for years...

This is not about installing TeX fonts which are on your system anyways.
Jsmath is a javascript implementation of TeX that runs in a web browser.
It requires its own version of the tex fonts, which are that 120KB zipped
file mentioned above. It certainly does not make use of fonts that come
with, e.g., the teTex tex install.

> I guess we have been somehow talking at cross purposes here.
>
> I'll check further to see if there's something gone adrift.
>
>
> Bill
> --
> +---------------------------------------+
> | Bill Purvis, Amateur Mathematician |
> | email: b...@beeb.net |
> | http://bil.members.beeb.net |
> +---------------------------------------+
>
> >
>

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

bill purvis

unread,
Jan 27, 2008, 3:19:48 PM1/27/08
to sage-s...@googlegroups.com
OK, I apologise!
I downloaded them and followed the instructions. They say I have to reload
X11 server which I've not done, though I had to restart Firefox then the
popups went away.
Checked out the printouts too, though my comment that the warning about
printing should be on the screen rather than the paper still holds.
On the other hand, that's probably not in your court :-)

William Stein

unread,
Jan 27, 2008, 3:25:30 PM1/27/08
to sage-s...@googlegroups.com
On Jan 27, 2008 12:19 PM, bill purvis <b...@beeb.net> wrote:
>
>
> On Friday 25 January 2008, William Stein wrote:
> > On Jan 25, 2008 4:49 AM, bill purvis <b...@beeb.net> wrote:
> > > On Friday 25 January 2008, Timothy Clemans wrote:
> > > > See http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html.
> > > > There are install instructions for PC, Mac OS X, and Unix users.
> > > >
> > > > On Jan 24, 11:45 pm, bill purvis <b...@beeb.net> wrote:
> > >
> > > Yes, but what about Sage users?
> > >
> > > They say unpack them in the server tree. I know where my Apache server
> > > keeps things, and I've installed them in there.
> >
> > ??! There is nothing about "server trees" here:
> > http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html
> >
> > You just download a 120KB zipped font file, extract it and install it
> > as explained there.
> > It has nothing whatever to do with servers.
> OK, I apologise!
> I downloaded them and followed the instructions. They say I have to reload
> X11 server which I've not done, though I had to restart Firefox then the
> popups went away.
> Checked out the printouts too, though my comment that the warning about
> printing should be on the screen rather than the paper still holds.

I agree with that. When one clicks the print button in the notebook it should
render the html with jsmath but with no warning at all. I've made this
trac #1950:

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

William

bill purvis

unread,
Jan 27, 2008, 3:28:49 PM1/27/08
to sage-s...@googlegroups.com
Davide, see my earlier message to William.
Apologies for my confusion. There's a lot of stuff for my poor aged
brain to absorb and I hadn't read your web pages properly... :-)

dpvc

unread,
Jan 28, 2008, 6:24:38 AM1/28/08
to sage-support

> Davide, see my earlier message to William.
> Apologies for my confusion. There's a lot of stuff for my poor aged
> brain to absorb and I hadn't read your web pages properly...  :-)

No problem. A lot of people have made the same mistakes. It can be
confusing when there are several different things all called "fonts".
It was probably a bad idea to call the jsMath TeX fonts "TeX fonts" as
that is a source of trouble for many, but it is too late now. It is
also true that the SourceForge download sight doesn't include much
information about that the image fonts are (it is documented at the
jsMath site, but not at SourceForge). That should be changed. Also,
since I don't have a linux installation to test with, the font
instructions there are more confusing. I understand that there are
now RPM packages for jsMath for some linux installations, but I
haven't tracked that.

I'm glad you have things working now.

Davide

dpvc

unread,
Jan 28, 2008, 6:33:55 AM1/28/08
to sage-support

> > my comment that the warning about
> > printing should be on the screen rather than the paper still holds.
>
> I agree with that.  When one clicks the print button in the notebook it should
> render the html withjsmathbut with no warning at all.  I've made this
> trac #1950:
>
>    http://trac.sagemath.org/sage_trac/ticket/1950

Since you are not using the image fonts, the print message should not
be showing up. The message only applies to when image fonts are used,
so in unicode mode the message should not be printed. That sounds
like a bug in jsMath, then, and I'll look into it. I assume you have
used the noImageFonts plugin to disable the image fonts options? (and
also the noGlobal plugin to disable global mode?) Do any of your users
actually install the image fonts?

Personally, I find the unicode mode the least effective of all the
modes. I now understand your complaints that the mathematics doesn't
look very good without the jsMath TeX fonts. The image mode, while
not so nice as the TeX font mode, works pretty well and gives very
acceptable results, but the unicode mode is pretty lame.

I had originally thought I'd be able to do jsMath with just the
unicode mode, but that turned out to be pretty unreliable. I haven't
put much work into keeping unicode mode working well, and I think some
things may no longer work properly in Firefox in unicode mode. I
suspect there are a number of missing characters, but that is
dependent on the fonts you have installed, which differ from platform
to platform, and I can only check on the Mac and PC at the moment.

Davide

Davide

Jason Grout

unread,
Jan 28, 2008, 8:49:11 AM1/28/08
to sage-s...@googlegroups.com

Davide,

What is the current status of your sprite fonts plugin? That seems like
that would address the size issues. Also, what is the possibility that
we could automagically extract the character images on the server side
and send those, so that from the client, it would appear as if the
original image fonts plugin was loaded.

Thanks,

Jason

dpvc

unread,
Jan 29, 2008, 7:11:15 AM1/29/08
to sage-support
> What is the current status of your sprite fonts plugin?  That seems like
> that would address the size issues.

It was a nice idea, but turned out to have some serious drawbacks. It
really slowed down IE (it appears that IE renders the entire image
behind the scenes even though only a tiny portion is showing), and
since it was already too slow to begin with, it made it unbearably
so. Firefox works unexpectedly slowly on the hi-res fonts for
printing. Also, Opera (at the time) had a bug that prevented the
clipped images from being positioned properly, and so I had to use
background images, and that meant they didn't print unless the user
turned on printing of backgrounds. I haven't checked recently to see
if Opera has fixed that bug or not. Firefox on the PC did not show
print previewing correctly, but did print correctly. On the other
hand, Opera on the PC previews correctly, but prints incorrectly. (It
seems that print previewing on the PC is not very closely tied to the
actual print results.) There were also other printing issues, and
since every character has to be put into separate clipping boxes and
aligned properly by hand, there are noticeable baseline alignment
issues at times, and the resulting HTML is considerably more complex.

In the end, it seems that the sprite-based image fonts were just too
fragile and browser dependent, so I have not continued development on
that front. Indeed, I'm not sure they still work with the current
version of jsMath (I haven't tested them in a while). On the other
hand, there are new versions of Opera and IE since I worked on the
sprite fonts, so perhaps the situation has improved.

> what is the possibility that
> we could automagically extract the character images on the server side
> and send those, so that from the client, it would appear as if the
> original image fonts plugin was loaded.

Well, it probably could be done through some sort of CGI interface,
but it seems to me that it would be likely slow jsMath down even
further. It also violates one of the important design decisions for
jsMath, which is not to reply on programs running on the server. And
if you are going to start running things on the server, why not just
process the complete formula on the server with one of the many
possible choices of tex->image rendering (mimeTeX, BlahTeX, dvipng,
etc)? It seems pretty inefficient to process individual characters
one at a time. Maybe it would help to have the results cached, but
they isn't that really just the same as having the individual images
all there initially?

It may be possible to reduce the number of sizes used by perhaps not
use the very largest and smallest sizes, but the large ones are there
for the hi-res printing, so you might have to lose that. It might
also be possible to leave out every other size, but that would mean
the math might not match the text size quite so well. You could
probably cut the image font size in half or more that way. But is it
really worth it? in these days 100 of 200 GB hard drives, is 80 MB
all that much? That's about 50 images from my digital camera, or just
about two rolls of traditional film. I have single sound files that
are larger than that.

The real solution is, of course, to install the jsMath TeX fonts and
avoid the whole issue. For a private installation (like I expect most
sage installations are), where you are the only person looking at the
web pages that use jsMath, it is reasonable not to install the image
fonts because once you have the jsMath TeX fonts, there is no need for
anything else. On the other hand, if you are hosting a public site,
where you don't know whether your reader has installed the fonts or
not, then you have to decide whether it is worth the space in order to
give those users a better view of the mathematics on your site. My
own feeling is that the image fonts are so much superior to the
unicode results that it is worth it to me (because I know that most
people won't install the TeX fonts, so image-font mode turns out to be
the primary mode used by most viewers). While I would like a method
with a smaller footprint on the server, I haven't found one that is as
reliable and maintainable as the image fonts.

Davide

William Stein

unread,
Jan 29, 2008, 7:19:37 AM1/29/08
to sage-s...@googlegroups.com

You've convinced me. We'll make an optional spkg that people can
install on servers to enable this functionality:

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

William

dpvc

unread,
Jan 29, 2008, 3:15:03 PM1/29/08
to sage-support
> You've convinced me.  We'll make an optional spkg that people can
> install on servers to enable this functionality:
>
>    http://trac.sagemath.org/sage_trac/ticket/1971

OK, great. I think that will be useful.

In another thread someone mentioned the STIX fonts, and I said I hoped
to support those in jsMath. That may be another route, as they will
not be separate jsMath fonts and so users are more likely to have them
installed for other reasons. So the image fonts may become less
important as the STIX fonts become more widely used. I still have to
do some work to have jsMath handle them, however, and that probably
won't happen for a while.

Davide
Reply all
Reply to author
Forward
0 new messages