Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-15-2016, 03:28 PM   #1
ELITSIO
Junior Member
ELITSIO began at the beginning.
 
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.
ELITSIO is offline   Reply With Quote
Old 03-15-2016, 11:32 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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
kovidgoyal is offline   Reply With Quote
Advert
Old 03-16-2016, 01:19 AM   #3
ELITSIO
Junior Member
ELITSIO began at the beginning.
 
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
ELITSIO is offline   Reply With Quote
Old 03-16-2016, 01:32 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Old 03-16-2016, 08:18 AM   #5
ELITSIO
Junior Member
ELITSIO began at the beginning.
 
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
ELITSIO is offline   Reply With Quote
Advert
Old 03-16-2016, 08:53 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Old 04-01-2017, 01:35 AM   #7
knorris
Member
knorris began at the beginning.
 
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
knorris is offline   Reply With Quote
Old 04-01-2017, 04:27 AM   #8
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,693
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by knorris View Post
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
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
BetterRed is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 04:29 PM.


MobileRead.com is a privately owned, operated and funded community.