Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use MathJax when creating epub versions #16

Closed
dietmarw opened this issue Dec 28, 2013 · 4 comments
Closed

Don't use MathJax when creating epub versions #16

dietmarw opened this issue Dec 28, 2013 · 4 comments

Comments

@dietmarw
Copy link
Collaborator

I got an eReader for Christmas and started playing with the epub format of the book. This is when I noticed that MathJax (despite being part of the epub 3 format) it will not work properly (tested both in the calibre viewer and my device).

So we need to look into this one if epub format is something that should be offered. As a work around we can simply change conf.py by removing the line:

 'sphinx.ext.mathjax',

which basically means we fall back to dvipng graphics for equations.
Simply taking the PDF and converting this to epub using calibre will not work.

@dietmarw
Copy link
Collaborator Author

Sorry I misread the information on MathJax and epub. The linked article above actually says that MathML is part of epub3 but not MathJax. MathJax could just be used to circumvent the lack of MathML in the readers per day. That is if the reader can load in and use MathJax.js

@dietmarw
Copy link
Collaborator Author

I might have found the solution. Including a local copy of MathJax under _static and linking that one instead of the CDN version will also include MathJax in the epub version. Mind MathJax is not really a small package. The size of the epub with static MathJax is about 17 MB vs. 1.5 MB with png images for math equations/symbols.

Anyway what's needed is to put the MathJax sources (174MB btw) under _static/MathJax and to add the following lines to conf.py:

 # Use local copy of MathJax (necessary for epub)
 mathjax_path = 'MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML'

Adding the sources should be done via git subtree.

Mind, I have not yet tested if the epub version with static MathJax actually work. This depends of course on the epub reader. I will test this tonight. The calbre viewer should also display MathJax (Plugin which now seems to be part of calibre). In the Plugin link there is also a link to a post on how to slim down mathjax for usage in epub.

The example epub containing MathJax from the calibre page works fine but our current version of ModelicaBook as epub does not. Need to investigate further.

@dietmarw
Copy link
Collaborator Author

Turns out that at least on my Kobo Touch ebook reader not even the example mathjax.epub from the calibre page is not rendered. So I guess we should stick to dvipng created images for equations.

@dietmarw
Copy link
Collaborator Author

I added a fix in 11e366 (part of #23)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant