04-02-2021, 02:17 AM | #31 |
Wannabe Connoisseur
Posts: 425
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
|
Thanks Diap!
That works for the linear equation epub and the snippet of mathml code, but it doesn't render the example epub from the Calibre documentation. Both the code snippet and the linear algrabra book in my first post in this thread use "inline" <math xmlns="http://www.w3.org/1998/Math/MathML"> XML for each math equation but the Calibre doco example uses a <script type="text/x-mathjax-config"> phrase in the <head> section to declare it's mathml and then just a bare \[,\] or \(,\) pair in the text to bracket a maths expression. I added the following line (from a random mathml sample I found on the web) to the <head> section and then it did render: Code:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> One minor nit: In the "about" popup, it still says Build time: 2021.03.25 14:50:59 UTC. I assume a resource wasn't updated when you uploaded the replacement 1.5.1 build? No biggie, but it was harder to make sure I'd installed the updated 1.5.1 even after I'd verified the new checksum . |
04-02-2021, 05:26 AM | #32 |
Grand Sorcerer
Posts: 27,545
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Yeah, you're probably not going to be able to include your own MathJax script (local or remote) with its own config. Sigil's Preview automatically injects the script tags with its own version of MathJax (and its own local config) behind the scenes whenever MathMl tags are encountered.
The build-time is definitely my fault. Since only two lines of one file were changed, I didn't do a full compile from scratch. It probably should have occurred to me that that might happen, but it didn't. |
04-02-2021, 05:45 AM | #33 | |
Guru
Posts: 687
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
|
Quote:
Tip: I like to see the correct compilation date, so in the build batch, I added an extra line, which by removing the compiled file from "About" forces inserting the current date and time. Code:
if exist W:\Develop\Sigil\Sigil-master\src\CMakeFiles\Sigil.dir\Dialogs\About.cpp.obj del /Q W:\Develop\Sigil\Sigil-master\src\CMakeFiles\Sigil.dir\Dialogs\About.cpp.obj |
|
04-02-2021, 06:05 AM | #34 | |
Grand Sorcerer
Posts: 27,545
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
This is never a problem under "normal" circumstances. Sigil releases are done with a full, fresh compile of all files starting with an empty build directory. As are all CI builds. This was just a one-off mistake I made looking to save some time. Last edited by DiapDealer; 04-02-2021 at 06:14 AM. |
|
04-02-2021, 06:17 AM | #35 |
Guru
Posts: 687
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
|
I thought you did the build on the local computer for some batch to do it faster, I use one myself (cmake with parameters + ninja -j4).
|
04-02-2021, 06:52 AM | #36 |
Grand Sorcerer
Posts: 27,545
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No. Locally I do it manually. Well, as "manually" as a 3 command process can be, anyway
Too much automation gets me in just as much trouble as not enough. Makes me forget how to fix things when inevitable changes and other disruptions out of my control breaks something. The build environment is automated (paths, qt, python, visual studio, etc), but that's about it. I've got 50 or so different cmake configurations I experiment with locally. But building Sigil still boils down to 3 commands for me: cmake (the correct config string pasted in from the file of 50 or so) ninja ninja makeinstaller That's as automated as I'm willing to get and still stay on my toes. I've got the CI deployment if I need fully automated builds for quick testing (and they're always from scratch). But I don't use those builds for official releases. I can't trust that something hasn't crept into their build environments while I wasn't looking. |
04-02-2021, 07:27 AM | #37 | |
Wannabe Connoisseur
Posts: 425
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
|
Quote:
Is there a way we can key off 'text/x-mathjax-config' as well as the existance of a <math> tag to enable MathML? This seems to be the difference in what Sigil does compared with what Calibre editor does to detect math. Surely this isn't as simple as adding something like '<script\\s+type="text/x-mathjax-config"' to the regex that's looking for the math tags? |
|
04-02-2021, 08:04 AM | #38 |
Wannabe Connoisseur
Posts: 425
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
|
A bit of a play around (whilst admitting I don't really know what I'm doing) seems to indicate something more is needed than just detecting 'script type="text/x-mathjax-config"'.
Inspecting the preview window with a <math ...> line and grabbed the inserted MathJax script and added that to a "simple" file, but it doesn't render: Spoiler:
Using the random google-found script line I mentioned earlier does render: Spoiler:
I'm hoping(!) that I can get this simple sample to render: Spoiler:
Last edited by snarkophilus; 04-02-2021 at 08:14 AM. Reason: Add spoiler tags around XML |
04-02-2021, 09:06 AM | #39 |
Grand Sorcerer
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Since JavaScript isn't supported in epub2 books, I converted it to an epub3 book and I also embedded the MathJax JavaScript library.
It displays more or less fine in Sigil, Azardi and Apple Books, but not in Adobe Digital Editions 4.5.x. OTOH, ADE displays the old IDPF test file fine. (So does Sigil 1.5.1.) |
04-02-2021, 09:35 AM | #40 |
Grand Sorcerer
Posts: 27,545
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Yes. The basic inline <math></math> stuff is the only thing that's going to stand a chance of working in an epub2 in Sigil. And it's probably not even technically spec. Epub3 is necessary for your sample epub (to comply with spec and work with Sigil).
The MathML section of the IDPF EPUB3 test epub is what we used when implementing the support in Sigil. The only places Sigil falls down in their tests (at least on Windows) is the optional "CSS Styling test (mathml-021)" and the required "BiDi, RTL and Arabic alphabets test (mathml-070)". I think at least one of those was a Windows-only failure. Last edited by DiapDealer; 04-02-2021 at 09:48 AM. |
04-02-2021, 09:38 AM | #41 |
Sigil Developer
Posts: 7,629
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Unlike calibre, Sigil does not support tex math or ascii math as that is not what the epub spec calls for. Only mathml notation (the spec) is supported.
So no, your simple example is not part of the epub3 spec so Sigil does not support it. Last edited by KevinH; 04-02-2021 at 09:41 AM. |
04-03-2021, 12:25 AM | #42 | ||
Wannabe Connoisseur
Posts: 425
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
|
Thanks Daip and Kevin for those explanations.
Quote:
Quote:
|
||
04-03-2021, 01:40 AM | #43 | ||
Grand Sorcerer
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Quote:
(Sigil supports MathML out of the box.) |
||
04-03-2021, 09:10 PM | #44 | ||
Wannabe Connoisseur
Posts: 425
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
|
Quote:
Quote:
Well off topic for Sigil now, I'll stop here! Thanks again all for getting MathML working on Sigil again, and for helping me understand a little bit more about MathML in general. |
||
Tags |
mathml |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convert Mathjax to AZW3 | mathbooks | Conversion | 1 | 01-16-2019 10:24 PM |
Calibre mathjax | ELITSIO | Calibre | 7 | 04-01-2017 04:27 AM |
epub and mathjax | vri | Calibre | 24 | 03-31-2017 10:56 PM |
MathJax.epub | phossler | Editor | 8 | 08-23-2015 12:28 PM |
Including MathJax | net-buoy | Sigil | 3 | 02-22-2013 04:44 PM |