MathJax equipped ePub readers

67 views
Skip to first unread message

Marc Grober

unread,
Nov 1, 2011, 1:30:03 AM11/1/11
to mathja...@googlegroups.com
Richard at IGP had the following to say about equipping Azardi with MathJax and would appreciate comments/responses:

"Adding in a JS library is not difficult. The current installation has JQuery (obviously), LABJS and a few othersOne of the main reasons we went with the Mozilla strategy this time was because of its excellent native support of MathML. Can you please let me know if MathJax adds features and support that are superior to, or different from the Firefox implementation? I had a quick Google on comparisons, but all the dialogues I could find were pretty old."

"MathJax appears to be an Apache license which certainly means we can use it. However it is also 16MB! This more than doubles the size of the installation. The advantage seems to be that MathJax supports LaTeX as well as MathML, and a lot of math material is typeset in LaTeX. Looking quickly into the package there appears to be a sub-set of components that would be suitable."

"We were considering incorporating the STIX fonts as a standard installed component on the next release and using them as the default system font. Our ePub packager IGP:Digital Publisher already works out which STIX fonts to include in a math ePub3 package, but that only applies to ePubs made by us. Within AZARDI we could specifically save a lot of space with MathML by directly applying STIX fonts but I would have to see if this can be configured to use them."

"We will have to do a few experiments with the FF Same origin security policy (which is being changed shortly I believe) and rendering modes. Within AZARDI all HTML, CSS, JS is turned into DataURIs for page presentation. We can look at this next week."

"While we know a bit about digital content in general, Maths is relatively opaque to us. However with AZARDI we are targeting the learning/teaching/training/academic user with AZARDI and staying away from the general trade book publisher noise."

"Your feedback on the value of MathJax over native FF MathML support would be appreciated. Specifically:
1. STIX font inclusion - is it a good idea?
2. Does MathJax give real benefits beyond native FF MathML?
3. Any recommendations on installation profiles within FF specifically.
And thanks for the input."

leathrum

unread,
Nov 2, 2011, 7:18:55 PM11/2/11
to MathJax Users
On Nov 1, 12:30 am, Marc Grober <m...@interak.com> wrote:
> 1. STIX font inclusion - is it a good idea?
> 2. Does MathJax give real benefits beyond native FF MathML?
> 3. Any recommendations on installation profiles within FF specifically.

1. Well, you need *something* -- you need a Unicode-based math
symbols font. STIX is certainly serviceable in that sense, and its
licensing makes it so that availability is not an issue. MathJax also
has its own set of web fonts, which are not STIX. In fact, a majority
of the 16Mb you are worried about is fonts and fallbacks for when
fonts aren't available.

2. For authors, yes. For readers, no. MathJax output, in an FF
environment, *is* Presentation MathML. FF's MathML rendering uses
STIX fonts if it can find them. So if you use FF with STIX, you don't
need the MathJax fonts. What MathJax buys you in that case is LaTeX
input, which authors of math content will find familiar and
comfortable, especially compared to the barely-human-readable
Presentation MathML tags.

3. I'm pretty sure that the latest versions of FF have been shipping
with STIX, but it is getting harder and harder to keep track of what
is going on with FF versions. At any rate, if you are using a local
install, I would recommend FF with STIX (which, like I said, I think
comes with FF these days) and the MathJax scripts but not the MathJax
web fonts. You would find a lot of very happy math content authors if
you went this direction.

Davide P. Cervone

unread,
Nov 6, 2011, 8:35:57 PM11/6/11
to mathja...@googlegroups.com
> "MathJax appears to be an Apache license which certainly means we
> can use it. However it is also 16MB! This more than doubles the size
> of the installation.

Most of at is the image fonts, which you would not be needing. By
removing the image fonts, and other unneeded components, you should be
able to bring that down to under 1.5MB (uncompressed).

> The advantage seems to be that MathJax supports LaTeX as well as
> MathML, and a lot of math material is typeset in LaTeX. Looking
> quickly into the package there appears to be a sub-set of components
> that would be suitable."

Yes, MathJax provides for both LaTeX and MathML as input languages.

> "We were considering incorporating the STIX fonts as a standard
> installed component on the next release and using them as the
> default system font. Our ePub packager IGP:Digital Publisher already
> works out which STIX fonts to include in a math ePub3 package, but
> that only applies to ePubs made by us. Within AZARDI we could
> specifically save a lot of space with MathML by directly applying
> STIX fonts but I would have to see if this can be configured to use
> them."

MathJax can also use the STIX fonts, if present. If not, it uses its
own web-based fonts, but these do not include all the glyphs that the
STIX fonts do. If you are already installing STIX, MathJax would be
able to take advantage of that.

> "We will have to do a few experiments with the FF Same origin
> security policy (which is being changed shortly I believe) and
> rendering modes. Within AZARDI all HTML, CSS, JS is turned into
> DataURIs for page presentation. We can look at this next week."

Yes, the same-origin policy has been a problem in the past. Up until
now, it has only affected MathJax in terms of its web-fonts, but the
solution to that is to install either the STIX fonts or the MathJax
fonts as system fonts. I have experimented with making the fonts into
dataURI fonts as well, but that is not currently in MathJax, though I
did have it mostly working at one point, and that could be revived if
needed.

> "Your feedback on the value of MathJax over native FF MathML support
> would be appreciated. Specifically:

> 1. STIX font inclusion - is it a good idea?

Yes, that is probably a good idea, as it would make the widest range
of math symbols available to your books. If you do use MathJax, that
would also avoid any same-origin policy problems (at least as the
policy currently stands).

> 2. Does MathJax give real benefits beyond native FF MathML?

I personally like MathJax's HTML-CSS output better than Firefox's
native MathML, but I'm biased. In terms of features, MathJax does
implement some parts of the MathML3 specification that are not yet in
Firefox (though they may come in future versions). One notable one is
the <mlabeledtr> that is used to add equation numbers (commonly used
in textbooks to make it possible to refer to specific equations
easily). MathJax also implements all the mathvariants, not just
italic and bold (though with the STIX fonts you can get the other
character sets in Firefox's native MathML via numeric character
entities). Version 2.0 (due for release at the end of the year)
implements automatic linebreaking of displayed equations (but not in-
line equations), which can be important if you are targeting mobile
devices, since they have smaller screens. On a technical side, I've
had problems with Firefox not getting the bounding box of the math
elements correct when they are in inline-block elements, and in some
cases, mtable elements that are dynamically created don't get the
proper alignment, but I don't fully understand the conditions that
cause these problems. It is likely that these will be resolved
eventually.

MathJax also adds some additional user-interface functionality (even
when it uses Firefox's native MathML rendering rather than its own).
This includes the ability to show the source of the math as either
MathML or TeX (if it was originally in TeX), the ability to zoom the
math to read an individual equation more easily (though your reader
may have its own way of doing that), and the ability to specify a
scaling factor for all the math in the document (this is useful if
there are lots of super- and subscripts, which can sometimes be hard
to read in small fonts). It also gives you the ability to select the
renderer to use (Native MathML or HTML-CSS, and in v2.0, SVG). You
may or may not consider those to be advantages, but the menu can be
turned off if you so desire.

> 3. Any recommendations on installation profiles within FF
> specifically.

Without knowing the specifics of the product, I couldn't say, but I
suspect the defaults would work pretty well for you. You might want
to disable the MathJax message are (which gives messages about the
percentage of the page that has been processed, and so on), and you
might disable the contextual menu as well. When you remove the image
fonts, there is a setting to indicate that as well. If you want to
talk in more detail about that privately, I would be happy to discuss
it with you.

Beset of luck with the project.

Davide

Reply all
Reply to author
Forward
0 new messages