![]() |
#1 |
Junior Member
![]() Posts: 9
Karma: 10
Join Date: Mar 2016
Device: iPad
|
Calibre mathjax
Hello,
this drives me crazy. I have an ePub with equations and I load mathjax in the <head> section of htmls like that: <script type="text/x-mathjax-config">MathJax.Hub.Config({jax: ["input/MathML","output/SVG"], extensions: ["mml2jax.js"], SVG: {linebreaks: {automatic: true, width:"container"}}});</script> <script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> When I edit the epub in calibre, equations show perfectly, with linebreaks and all! When I try to read the epub outside the editor in calibre viewer, the equations don't show! What am I doing wrong? I use calibre in mac. thx Elias. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,299
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The calibre viewer includes its own copy of matchjax. You should not be bundling mathjax with your epub. See the demo file http://manual.calibre-ebook.com/typesetting_math.html
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 9
Karma: 10
Join Date: Mar 2016
Device: iPad
|
Thank you for the quick answer. I found out that when I don't include mathjax it shows ok. But what if I need to include mathjax for other browsers/readers?
Also, can I use the configuration part of mathjax to activate line breaking? Thx |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,299
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I really would not recommend bundling mathjax with ebooks, that is going to be pretty fragile, not to mention greatly increasing the size of the book.
You use a script tag with type text/x-mathjax-config for doing MathJax config. In it you have access to the MathJax object. Look at the example on the page I linked to earlier. Last edited by kovidgoyal; 03-16-2016 at 01:36 AM. |
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() Posts: 9
Karma: 10
Join Date: Mar 2016
Device: iPad
|
I understand your opinion, but native mathml is also unstable and mathjax seems to show ok in ipad.
I am trying to find a way to conditionally load mathjax in the configuration file. I know one can have different configurations for different browsers. But could it be set to not load/ignored if the reader is calibre? After many hours of experimenting with many readers, I found out that readium is pretty good but has a problem of not breaking math lines (I would appreciate if someone knows how to achieve it) and other readers have their own problems. (yes, I have set breaking lines in mathjax config) Calibre seems to show everything perfectly to me... when mathjax is not trying to load... thx Elias |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,299
Karma: 27111240
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Conditionally loading is trivial. Simply run a script that inserts a new script tag into the DOM and set the src of the script tag to point to mathjax. Use the epubReadingSystem object to detect reading systems.
|
![]() |
![]() |
![]() |
#7 |
Member
![]() Posts: 16
Karma: 10
Join Date: Apr 2016
Device: kindle
|
I can't get maths equations to show correctly in the Editor Preview Panel but works fine in Calibre Viewer.
Is there a simple remedy? Thanks |
![]() |
![]() |
![]() |
#8 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,693
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Moderator Notice
Asking the same question again won't get you a different answer - Kovid Goyal already gave you the answer elsewhere, no one is likely to offer a different answer to one given by the creator of calibre. Please read the Mobileread Guidelines - item 3 in particular. BR |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
epub and mathjax | vri | Calibre | 24 | 03-31-2017 10:56 PM |
MathJax.epub | phossler | Editor | 8 | 08-23-2015 12:28 PM |
MathJax and SVG conversion problems to epub or MOBI | waiting90days | Conversion | 4 | 12-31-2013 10:15 PM |
Including MathJax | net-buoy | Sigil | 3 | 02-22-2013 04:44 PM |
HTML containing mathjax to MOBI? | kongzifan | Conversion | 2 | 12-10-2011 05:13 AM |