Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 04-02-2021, 02:17 AM   #31
snarkophilus
Wannabe Connoisseur
snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.
 
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>
Is that a problem with the sample EPUB or a Sigil problem?

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 .
snarkophilus is offline   Reply With Quote
Old 04-02-2021, 05:26 AM   #32
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 04-02-2021, 05:45 AM   #33
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 687
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
Quote:
Originally Posted by DiapDealer View Post
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.

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
BeckyEbook is online now   Reply With Quote
Old 04-02-2021, 06:05 AM   #34
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,545
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by BeckyEbook View Post
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
What build batch?

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.
DiapDealer is online now   Reply With Quote
Old 04-02-2021, 06:17 AM   #35
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
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).
BeckyEbook is online now   Reply With Quote
Old 04-02-2021, 06:52 AM   #36
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 04-02-2021, 07:27 AM   #37
snarkophilus
Wannabe Connoisseur
snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.
 
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:
Originally Posted by DiapDealer View Post
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.
I'm happy to include the builtin MathJax somehow!

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?
snarkophilus is offline   Reply With Quote
Old 04-02-2021, 08:04 AM   #38
snarkophilus
Wannabe Connoisseur
snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.
 
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:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <script type="text/x-mathjax-config"></script>
  <script type="text/javascript" async="async" src="file:///C:/Program Files/Sigil/polyfills/MJ/MathJax.js?config=local/SIGIL_EBOOK_MML_SVG"></script>
</head>
<body>
<p>
\(\frac{\sqrt{a}}{b}\)
</p>
</body>
</html>


Using the random google-found script line I mentioned earlier does render:

Spoiler:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <script type="text/x-mathjax-config"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</head>
<body>
<p>
\(\frac{\sqrt{a}}{b}\)
</p>
</body>
</html>


I'm hoping(!) that I can get this simple sample to render:
Spoiler:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <script type="text/x-mathjax-config"></script>
</head>
<body>
<p>
\(\frac{\sqrt{a}}{b}\)
</p>
</body>
</html>

Last edited by snarkophilus; 04-02-2021 at 08:14 AM. Reason: Add spoiler tags around XML
snarkophilus is offline   Reply With Quote
Old 04-02-2021, 09:06 AM   #39
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
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.)
Attached Files
File Type: epub mathjax_embedded_epub3.epub (168.5 KB, 198 views)
Doitsu is offline   Reply With Quote
Old 04-02-2021, 09:35 AM   #40
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 04-02-2021, 09:38 AM   #41
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: 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.
KevinH is offline   Reply With Quote
Old 04-03-2021, 12:25 AM   #42
snarkophilus
Wannabe Connoisseur
snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.
 
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:
Originally Posted by Doitsu View Post
Since JavaScript isn't supported in epub2 books, I converted it to an epub3 book and I also embedded the MathJax JavaScript library.
Thanks! It didn't even occur to me that you could embed the JavaScript, although it's perfectly obvious now that you've done ie.

Quote:
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.)
I haven't even got to what may or may not work on my Kobo Aura 2!
snarkophilus is offline   Reply With Quote
Old 04-03-2021, 01:40 AM   #43
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by snarkophilus View Post
I haven't even got to what may or may not work on my Kobo Aura 2!
AFAIK, Kobo devices support EPUB3 books, if you convert them to KEPUB files. According to the official KEPUB specs, MathML is supported.

Quote:
MathML Support

MathML is currently supported on Kobo's iOS, Android, Desktop and eInk platforms. It is not currently supported on the Windows app for Desktop and mobile. It is recommended that content creators test their content across Android, iOS and Desktop prior to distribution to ensure that equations are displaying as intended.
Try converting the old IDPF MATHML test file to a KEPUB file and side-load it to your Kobo.
(Sigil supports MathML out of the box.)
Doitsu is offline   Reply With Quote
Old 04-03-2021, 09:10 PM   #44
snarkophilus
Wannabe Connoisseur
snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.
 
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:
Originally Posted by Doitsu View Post
AFAIK, Kobo devices support EPUB3 books, if you convert them to KEPUB files. According to the official KEPUB specs, MathML is supported.
It looks like Kobo supports MathML only, and not the LaTex format that MathJax javascript also works with. The Calibre example with the embedded MathJax.js didn't render any math.

Quote:
Try converting the old IDPF MATHML test file to a KEPUB file and side-load it to your Kobo.
(Sigil supports MathML out of the box.)
That one works to some extent. The first half(ish) of the MathML tests render mostly pl on my Aura, but the remaining are a bit hit and miss. The integral symbol is a bit short, you can see the vertical stretch on parantheses are made up of vertical bars and not a continuous line, etc.

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.
snarkophilus is offline   Reply With Quote
Reply

Tags
mathml

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 03:09 PM.


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