mathjax and epub/pdf options

449 views
Skip to first unread message

Carl Boettiger

unread,
Sep 24, 2011, 4:47:31 PM9/24/11
to wordpress-fo...@googlegroups.com, knowledgeb...@knowledgeblog.org
Dear list,

I am using the mathjax-latex wp plugin for many of my posts, and am trying to figure out a solution to export them as pdf or epub document.  Unfortunately I am not getting the equations to display when using Martin's epub generator or various pdf generators (pdf24, kalin's).  This seems strange, as the other plugins such as kcite seem to be working in the exported forms.  An example post is here: http://www.carlboettiger.info/archives/2655

Any suggestions?

Thanks,
Carl

--
Carl Boettiger
UC Davis
http://www.carlboettiger.info/

Carl Boettiger

unread,
Sep 24, 2011, 4:58:27 PM9/24/11
to wordpress-fo...@googlegroups.com, knowledgeb...@knowledgeblog.org
whoops, try this example page instead:http://www.carlboettiger.info/archives/2652

Philli...@newcastle.ac.uk

unread,
Sep 25, 2011, 6:01:33 AM9/25/11
to wordpress-fo...@googlegroups.com, knowledgeb...@knowledgeblog.org

Mathjax uses javascript while (the current version of) kcite doesn't. I
haven't looked at either Martin's epub or the pdf generators to see how
they work, or handle this situation. The obvious solution is to fall back
to tex -> image. Personally, I'm not so interested in legacy formats like
PDF or epub, but I am happy to add support into mathjax-latex if someone
knows how.

Phil

Peter Krautzberger

unread,
Sep 25, 2011, 1:00:08 PM9/25/11
to Wordpress for Scientists
Carl,

In my experience, PDF and epub are two very different problems.

PDF

I haven't found a good plugin yet, but (in my experience) the best
"solution" for pdf export is simply "print-to-pdf". Wordpress has
excellent printing functionality, styling the content via css with
rendered mathjax.

I have nevertheless experienced some minor mathjax printing problems
using firefox (missing brackets especially) which can be avoided by
switching the rendering mechanism for mathjax (falling back to png
fonts).

EPUB
Epub is a very different problem. I have been in contact with the
MathJax developers recently who are aware of and interested in the
matter. The problems are due to multiple complications.

a) As Phil pointed out you need javascript for MathJax. The current
epub specs (epub 2) have a "should not" rule for javascript and have
no mathml requirement. This will change with the upcoming epub3
(thanks to the people behind MathJax).

b) Except for Calibre, I don't know any epub viewer that supports
either javascript or mathml well enough. I have hacked an epub to
simply call up the mathjax cdn. This works very well with Calibre, but
already iBooks (which supports some javascript) does not display much.
I have had unreliable results using simpler tools such as asciimathml
and I have not had success with building an epub with mathjax
included.

So right now, epub and mathjax is simply not working and cannot work
because of no reader supporting enough technology.

HOWEVER, you could follow http://www.neverendingbooks.org/index.php/wp-latex-sweet-revenge-wpmathjax-epub.html
and use png renderings.

I haven't had the time to look at Martin's epub export plugin to see
if that could be a temporary fix -- and I'm reluctant. With epub 3
already at draft status (and going the html5 route), I really expect
to see some epub3 readers soon. I would rather want to help Martin
cook up a stripped down mathjax copy that could just be included in an
epub3 file.

Anyway, I'm very interested to here about your experiences,

Peter.

PS: There's my own old posting on this mailing list, also available
http://boolesrings.org/krautzberger/2011/07/13/epub-and-mathematics/

Carl Boettiger

unread,
Sep 25, 2011, 8:11:57 PM9/25/11
to wordpress-fo...@googlegroups.com
Hi,

Peter, Phillip, Thanks for the excellent responses.  Following Peter's suggestion, I've decided my best solution is printing to pdf from the browser.  Firefox omits any non-trivial symbols in the equations, but google-chrome does a rather nice job of generating a pdf with properly displayed equations.  This prints the footer widgets as well, fortunately my theme will hide them so the resulting document looks okay.  (example).  

This does bring me closer to Phillip's persuasion -- that I should worry only about rendering for the browser, and hope an intelligent browser can do things a user might want even though it doesn't serve an obvious purpose (i.e. print the page as pdf). I'm generating pdfs of notes I took during a working group -- rather ironically, when I shared my notebook links, members of the groups said: these are great, can you stick them on the working group's wiki as pdfs? 

Carl

Fenner...@mh-hannover.de

unread,
Sep 26, 2011, 2:47:35 AM9/26/11
to wordpress-fo...@googlegroups.com
Carl,

To add to what Peter said: Javascript in ePub is possible but still experimental. My ePub Export plugin doesn't include Javascript yet, but I'm certainly interested in exploring this. The ePub 3 specification has been released a few months ago, so I expect that more ePub readers will support Javascript (and therefore Mathjax) over time.

Best,

Martin

-----Ursprüngliche Nachricht-----
Von: wordpress-fo...@googlegroups.com [mailto:wordpress-fo...@googlegroups.com] Im Auftrag von Peter Krautzberger
Gesendet: Sonntag, 25. September 2011 19:00
An: Wordpress for Scientists
Betreff: Re: mathjax and epub/pdf options

Phillip Lord

unread,
Sep 26, 2011, 5:42:19 AM9/26/11
to wordpress-fo...@googlegroups.com
Peter Krautzberger <p.kraut...@googlemail.com> writes:
> HOWEVER, you could follow
> http://www.neverendingbooks.org/index.php/wp-latex-sweet-revenge-wpmathjax-epub.html
> and use png renderings.
>
> I haven't had the time to look at Martin's epub export plugin to see
> if that could be a temporary fix -- and I'm reluctant. With epub 3
> already at draft status (and going the html5 route), I really expect
> to see some epub3 readers soon. I would rather want to help Martin
> cook up a stripped down mathjax copy that could just be included in an
> epub3 file.


So, wordpress supports image rendering with wp-latex. I've noticed,
though, that this plugin is now part of Jetpack, so if it goes the way
of WP-stats, you may be forced to install a load of other junk that you
have no interest in, if you want to get it.

Our own mathjax plugin, though, is essentially a fork of wp-latex; if
memory serves me well, it supports exactly the same syntax as wp-latex
(including all the $latex $ stuff).

It should be possible to add image rendering as a fall back option using
the Wordpress server. This should work as well (or as badly) as wp-latex
does.

A more generic solution would be nice; I have the same problem with
kcite, the development version of which renders with javascript. I still
have the server-side rendering code which generates HTML directly, which
I can use as a fall-back. But maintaining two rendering mechanisms is
not exactly high on my list.

Phil

Phillip Lord

unread,
Sep 26, 2011, 5:49:33 AM9/26/11
to wordpress-fo...@googlegroups.com

Well, I can only report my own experience. I currently know two people
who bought ebook readers. One of them bricked his within two months, and
the other also owns an animatronic, touch sensitive dinosaur. On the
other hand, at most meetings I go to, shiny fondle slabs are more
popular than deodorant. Can't say I understand why, a keyboard was the
reason I ditched pen and paper in the first place, but there you have
it.

So, my question would be, does any one really care about epub?

Phil

--
Phillip Lord, Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics, Email: philli...@newcastle.ac.uk
School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower, skype: russet_apples
Newcastle University, msn: m...@russet.org.uk
NE1 7RU twitter: phillord

Peter Krautzberger

unread,
Sep 26, 2011, 10:39:04 AM9/26/11
to Wordpress for Scientists
Phil,

I care for epub not because of ipads and kindles but because it is a
convenient html-based platform to produce self-contained copies --
what's the point of using creative commons if people have trouble to
copy and build on my work? Speaking as a mathematician, I really need
mathjax when it comes to epub. Decent mathml would be a good start,
but given the ability of html, I really expect more from epub. A lot
will hopefully be solved in epub3.

I have also heard from various sources that the publishing industry is
*very* interested in epub (for digital textbooks and simply as a
modern alternative to pdf). I think that's at least worth keeping in
mind.

Peter.
> >>http://www.neverendingbooks.org/index.php/wp-latex-sweet-revenge-wpma...
> >> and use png renderings.
>
> >> I haven't had the time to look at Martin's epub export plugin to see
> >> if that could be a temporary fix -- and I'm reluctant. With epub 3
> >> already at draft status (and going the html5 route), I really expect
> >> to see some epub3 readers soon. I would rather want to help Martin
> >> cook up a stripped down mathjax copy that could just be included in an
> >> epub3 file.
>
> >> Anyway, I'm very interested to here about your experiences,
>
> >> Peter.
>
> >> PS: There's my own old posting on this mailing list, also available
> >>http://boolesrings.org/krautzberger/2011/07/13/epub-and-mathematics/
>
> --
> Phillip Lord,                           Phone: +44 (0) 191 222 7827
> Lecturer in Bioinformatics,             Email: phillip.l...@newcastle.ac.uk

Phillip Lord

unread,
Sep 27, 2011, 8:12:02 AM9/27/11
to wordpress-fo...@googlegroups.com

Peter Krautzberger <p.kraut...@googlemail.com> writes:
> I care for epub not because of ipads and kindles but because it is a
> convenient html-based platform to produce self-contained copies --

But, then, everything that we are discovering is that it isn't
convenient, because lots of things don't work. In terms of being
self-contained, incidentally, using data URIs it's very possible to make
HTML self-contained.

> what's the point of using creative commons if people have trouble to
> copy and build on my work?

Good point. Although, do you actually write your work in epub in the
first place? Most people here are talking about generating it. So having
the epub (or even the HTML) is not going to let people build on your
work. For this, then need the source format, whatever this is.

> Speaking as a mathematician, I really need mathjax when it comes to
> epub. Decent mathml would be a good start, but given the ability of
> html, I really expect more from epub. A lot will hopefully be solved
> in epub3.

Okay. I understand why you need mathjax (or decent maths), just less
convinced about epub.


> I have also heard from various sources that the publishing industry is
> *very* interested in epub (for digital textbooks and simply as a
> modern alternative to pdf). I think that's at least worth keeping in
> mind.

True, but I don't think it makes it worth jumping through hoops to
support. If I can support epub cheaply, then fine.

Phil

Peter Krautzberger

unread,
Sep 27, 2011, 1:21:37 PM9/27/11
to Wordpress for Scientists

> True, but I don't think it makes it worth jumping through hoops to
> support. If I can support epub cheaply, then fine.
>
> Phil

Agreed.
Reply all
Reply to author
Forward
0 new messages