Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 07-18-2024, 11:41 AM   #1
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,734
Karma: 26974049
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
MathML support in calibre editor/previewer

I have a math book that I'm going through and want to replace math expressions that are rendered in image or SVG files with MathML equivalents.

I found this:

https://manual.calibre-ebook.com/typesetting_math.html

However, while the ePub file downloaded from there previews and displays well in calibre viewer and editor preview, actual ePub software such as Apple Books or Thorium do not render it.

Conversely, when I create ePub with Sigil with a MathML example (attached) it does not render correctly in calibre viewer or editor previewer, but does so in Apple Books and Thorium reader.

So I do not understand the utility of using MathJax if only calibre reader / previewer handles it. It looks like I'll have to do this editing with Sigil and previewing there and with ePub apps like Thorium reader.

Am I missing something here?

I am guessing that adding the <script> stuff for MathJax would let me preview in calibre as well? and other reading apps would ignore it?
Attached Files
File Type: epub mathml.epub (2.0 KB, 38 views)

Last edited by tomsem; 07-18-2024 at 11:45 AM.
tomsem is offline   Reply With Quote
Old 07-18-2024, 11:50 AM   #2
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,734
Karma: 26974049
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Yes, looks like my guess was correct: I added the <script> reference to header and it previews now.

Perhaps the typesetting_math.html page could be updated to include a MathML example. It seems to me this is what most people will be doing as reading apps aren't going to support javascript solutions in general.
tomsem is offline   Reply With Quote
Advert
Old 07-18-2024, 12:02 PM   #3
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: 44,482
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Why? Pretty much any browser based reader can and should support javascript. These days most of them are browser based, apart from e-ink ones. MathML is a royal pain to author its not designed for authoring, its more of a machine interchange format. But, that said you can put MathML into typsetting_math.html if you like and MathJax will render it for you just like it does ascii math.
kovidgoyal is offline   Reply With Quote
Old 07-18-2024, 05:05 PM   #4
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,734
Karma: 26974049
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Quote:
Originally Posted by kovidgoyal View Post
Why? Pretty much any browser based reader can and should support javascript. These days most of them are browser based, apart from e-ink ones. MathML is a royal pain to author its not designed for authoring, its more of a machine interchange format. But, that said you can put MathML into typsetting_math.html if you like and MathJax will render it for you just like it does ascii math.
The two cases I cited (Apple Books and Thorium Reader) didn't render the ePub example downloaded from the calibre info page. And I want it to work on eInk.

I had been trying to do things with straight HTML with some success (okay for algebraic), but am running into expressions that are not amenable to that.

MathML may not be very user friendly, but given my self imposed requirements, I'd rather learn and work with that instead of TeX (if that's the only alternative). I need some auto-completion so I'll probably use VS Code w/MathML extension to compose things and then paste them where needed.

This 'project' started out as a Topaz-format book. You can imagine how awful conversion to ePub is and what there is to clean up. But it is a great learning exercise.

Last edited by tomsem; 07-18-2024 at 05:13 PM.
tomsem is offline   Reply With Quote
Old 07-18-2024, 05:20 PM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,155
Karma: 5450818
Join Date: Nov 2009
Device: many
FYI, Chromium version 109 finally supports Core MathML without any MathJax needed. Qt's WebEngine in Qt 6.7.2 (and maybe earlier) do support it.

We (Sigil) still internally use MathJax3.2.2 to render MathML because it supports the MML3 extensions (although that was recently broken by an Arch libxml2 new version bug).

Either way, a number of e-reading devices based on Chromium blink should soon have built in mathml core support without mathjax if they do not already.

Last edited by KevinH; 07-18-2024 at 05:23 PM.
KevinH is offline   Reply With Quote
Advert
Old 07-18-2024, 07:05 PM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,305
Karma: 136006010
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by tomsem View Post
I have a math book that I'm going through and want to replace math expressions that are rendered in image or SVG files with MathML equivalents.
Why switch SVG images to MathML? The SVG images will be easie to deal with a more compatible.

Back before ePub 3, I did see a sample ePub with math equations in SVG that worked very well. They even resized when the font size was changed. It looked very good.
JSWolf is online now   Reply With Quote
Old 07-18-2024, 10:01 PM   #7
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: 44,482
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@tomsem: You are welcome to submit an example using MathML for the docs. The docs are in typesetting_math.html. I have added a note saying that MathML works provided you add the MathJax canary script.

https://github.com/kovidgoyal/calibr...e551d77b9aa62c
kovidgoyal is offline   Reply With Quote
Old 07-19-2024, 11:04 PM   #8
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,734
Karma: 26974049
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Quote:
Originally Posted by JSWolf View Post
Why switch SVG images to MathML? The SVG images will be easie to deal with a more compatible.

Back before ePub 3, I did see a sample ePub with math equations in SVG that worked very well. They even resized when the font size was changed. It looked very good.
Because most of the SVGs in this case replace text paragraphs with a few math symbols sprinkled in, and hence don't respond to font changes and that sort of thing.
tomsem is offline   Reply With Quote
Old 07-20-2024, 02:30 AM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,305
Karma: 136006010
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by tomsem View Post
Because most of the SVGs in this case replace text paragraphs with a few math symbols sprinkled in, and hence don't respond to font changes and that sort of thing.
You could use a MathML to SVG converter and use SVG instead.
JSWolf is online now   Reply With Quote
Old 07-20-2024, 05:18 PM   #10
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,734
Karma: 26974049
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Quote:
Originally Posted by kovidgoyal View Post
@tomsem: You are welcome to submit an example using MathML for the docs. The docs are in typesetting_math.html. I have added a note saying that MathML works provided you add the MathJax canary script.

https://github.com/kovidgoyal/calibr...e551d77b9aa62c
Thanks.

As an exercise, I added MathML examples to the ePub file. Of course that at least quadruples the size of mathjax.html, so I don't know if you want all of that on the typesetting_math page. Probably one is enough to get the gist of things.

BTW this is by far the best reference I could find for MathML examples:

https://elsenaju.eu/mathml/MathML-Examples.htm

It does not cover all of the MathML tags, but that seems true of other cheat sheets and tutorials as well.

It is a lot of typing, but I'm happy with the results I'm getting, and it was pretty easy to pick up and use.
Attached Files
File Type: epub Math Test Page - Unknown.epub (204.2 KB, 30 views)

Last edited by tomsem; 07-20-2024 at 07:49 PM.
tomsem is offline   Reply With Quote
Old 07-20-2024, 11:47 PM   #11
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: 44,482
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yes, just one example, of MathML is sufficient. As I said, I doubt most people will want to author MathML directly.
kovidgoyal is offline   Reply With Quote
Old 07-21-2024, 12:51 PM   #12
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,734
Karma: 26974049
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Quote:
Originally Posted by kovidgoyal View Post
Yes, just one example, of MathML is sufficient. As I said, I doubt most people will want to author MathML directly.
Because they are starting with LaTeX documents and don't want to translate to MathML?

But it is easy with tools like this: https://temml.org
tomsem is offline   Reply With Quote
Old 07-21-2024, 01:02 PM   #13
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: 44,482
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Back when I was a physicist everyone ( at least serious physicists and mathematicians) wrote math in LaTeX, and you can use LaTeX directly in ebooks (at least with the calibre viewer). Far, far more convenient than typing mathml.
kovidgoyal is offline   Reply With Quote
Old 07-21-2024, 01:46 PM   #14
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,155
Karma: 5450818
Join Date: Nov 2009
Device: many
FYI, there is also a nice Math editor that is part of LibreOffice/OpenOffice that can easily use a WYSIWYG gui to create your formula, and then export it as MathML. It is a lot like the old Formula Editor that used to come with Office, and even standalone on MacOS.
KevinH is offline   Reply With Quote
Old 07-21-2024, 04:49 PM   #15
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 12,324
Karma: 90943357
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
LaTex is good. I think also can be used with LO Writer, maybe an extension. I forget.
Quoth is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindle Previewer doesn't support Calibre generated azw3/mobi xtraktor Calibre 3 02-12-2021 09:04 AM
CSS support in the editor vFbjgBDhV Editor 5 11-03-2020 09:25 AM
MathML not working (with Calibre@Archlinux?) nqk Server 4 07-16-2020 04:09 AM
Kindle Previewer 3 versus KDP Online Previewer Contre-jour Kindle Formats 3 05-29-2018 10:05 AM
MathML Support in the Browser? ManDay Onyx Boox 0 01-28-2013 05:21 AM


All times are GMT -4. The time now is 05:36 PM.


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