Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-31-2021, 08:12 AM   #1
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: 426
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
Question How to use MathML/MathJax

Hi folks,

How do I get Sigil to render MathML/MathJax the the preview window? I've only just discovered MathML and wanted to have a bit of a tinker.

I've got two sample epubs, one from the Calibre documentation and a linear algebra epub from this EPUB 3 samples page, neither of which render anything math like in the preview window.

I've also tried creating a new epub3 and putting this following snippet in the body (this from Accessible Publishing Knowledge Base MathML page):
Code:
<math xmlns="http://www.w3.org/1998/Math/MathML"
      alttext="Frac Root a EndRoot Over b EndFrac">
   <mfrac>
      <msqrt>
         <mtext>a</mtext>
      </msqrt>
      <mi>b</mi>
   </mfrac>
</math>
Both epubs and the above snippet in a new epub work with the calibre epub editor.

I've tried ticking the two boxes ("epubs may access remote resources" and "epubs may use javascript") in the General Settings / Security prefs but no change to preview rendering. I've seen references to MathML in the Sigil forums (eg here and here and this thread), so I figure I must be missing something simple. There's no mention of "math" in the Sigil User's Guide.

This is with Sigil 1.5.1 on Windows 10.

Last edited by snarkophilus; 03-31-2021 at 08:16 AM.
snarkophilus is offline   Reply With Quote
Old 03-31-2021, 09:01 AM   #2
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,697
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Looks like we broke something. It's not working like it should with 1.4.3, either. At least on Windows. Looks like the url for the mathjax javscript file is being blocked. Shoot. Sorry about that. I'll see if I can figure out what version of Sigil it last worked with. We'll get it fixed for the next release, but that may be a bit.
DiapDealer is offline   Reply With Quote
Advert
Old 03-31-2021, 09:22 AM   #3
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: 426
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
Good to know I'm not going (totally) crazy! I upgraded from 1.4.3 to 1.5.1 before posting too because I couldn't get it working there either.

If you can post in this thread when it's fixed, I'll pick up one of the CI builds (if I can recall where they live ).
snarkophilus is offline   Reply With Quote
Old 03-31-2021, 10:30 AM   #4
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,878
Karma: 5449552
Join Date: Nov 2009
Device: many
FWIW, this must be a Windows issue.

It works just fine on macOS with 1.3.0, 1.4.3, and 1.5.1.

Has anyone tried Linux?

See my screenshot.
Attached Thumbnails
Click image for larger version

Name:	mathml_screenshot.png
Views:	235
Size:	77.4 KB
ID:	186270  
KevinH is offline   Reply With Quote
Old 03-31-2021, 10:41 AM   #5
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,697
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Yeah... it's broken on Linux in 1.5.x, too.

Last edited by DiapDealer; 03-31-2021 at 10:43 AM.
DiapDealer is offline   Reply With Quote
Advert
Old 03-31-2021, 10:53 AM   #6
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,878
Karma: 5449552
Join Date: Nov 2009
Device: many
The exact same approach is used to inject user css into preview? Is that broken on Windows and Linux too?

Try his simple example, and the fire up Preview's Inspector and check to make sure the injected mathjax javascript file url is correct in head.

If it is, then the issue must be in URLInterceptor as it explicitly allows file calls inside of the mathjax folder. The MainWindow determines both the maxjaxurl which it passes to Preview and the enclosing mathjax folder which URLInterceptor takes from the MainWindow via a GetMathjaxFolder call defined in MainWindow.h.

Something there must be broken.
KevinH is offline   Reply With Quote
Old 03-31-2021, 11:03 AM   #7
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,697
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The injected url is correct. It's percent-encoded, but it always has been, and a quick browser test ensures that the percent-encoded file url can be located/loaded.

I'll do some more testing.
DiapDealer is offline   Reply With Quote
Old 03-31-2021, 11:39 AM   #8
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,697
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I've got to go back to Sigil 1.2.0 for it to work on Windows!?

The issue on Linux is completely different. The MathJax failure is directly tied to me defining a custom temp folder for Sigil. Once I change that back to the automatic default location, MathJax works again in Sigil 1.5.1 on Linux. I'm hoping that can be corrected some time, but it's not a big deal.

From what I can see, the url is fine on Windows, too. It's the exact same url as the one used in Sigil 1.2.0 when MathJax was working on Windows. GetMathJaxFolder is identifying the correct folder as well.
DiapDealer is offline   Reply With Quote
Old 03-31-2021, 11:43 AM   #9
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,878
Karma: 5449552
Join Date: Nov 2009
Device: many
Hmm, perhaps enable debug in URLInterceptor so we can see what is going on. I am betting some strange drive letter or initial path / nonsense.
KevinH is offline   Reply With Quote
Old 03-31-2021, 11:46 AM   #10
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,878
Karma: 5449552
Join Date: Nov 2009
Device: many
If it is not being blocked, then the issue might be in the URLSchemeHandler loading the resource from the file url. Again perhaps there is an error in converting that file url back to a functioning local file path that can be opened and read from.
KevinH is offline   Reply With Quote
Old 03-31-2021, 11:48 AM   #11
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,697
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Well the drive letter after the colon is being percent-encoded (file:///C:/) when viewed in inspector, but it always was, even back when mathjax was working.
DiapDealer is offline   Reply With Quote
Old 03-31-2021, 11:50 AM   #12
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,697
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
It's definitely being blocked on Windows.

Code:
Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
For MathJax.js
DiapDealer is offline   Reply With Quote
Old 03-31-2021, 12:00 PM   #13
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,878
Karma: 5449552
Join Date: Nov 2009
Device: many
Have you by any chance disabled client javascripts in Sigil's Preferences?

Under Sigil Preferences -> General Settings - > Security:

Control Use of Javascript by Epubs

check Epubs may use javascript.

Then restart Sigil so the new MainWindow will get that new setting. The current one has already opened and its setting is the old one.

If I uncheck that and open a new Window (macOS allows that without restarting), then try the example, all I get is "a b". If I enable it (and mathjax is javascript) and then open a new window and try the example it works.

Last edited by KevinH; 03-31-2021 at 12:07 PM.
KevinH is offline   Reply With Quote
Old 03-31-2021, 12:10 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: 7,878
Karma: 5449552
Join Date: Nov 2009
Device: many
If it was being blocked by our URLInterceptor you would see the following in qDebug:

Code:
        // otherwise block it to prevent access to any outside Sigil user file path
        info.block(true);
        qDebug() << "Warning: URLInterceptor blocking access to url " << destination;
        qDebug() << "    from " << info.firstPartyUrl();
        return;
So if you are not seeing that Warning then QtWebEngine itself is blocking that url not anything we are doing. My guess is missing a restart after changing that setting is the issue.
KevinH is offline   Reply With Quote
Old 03-31-2021, 12:11 PM   #15
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,878
Karma: 5449552
Join Date: Nov 2009
Device: many
If that turns out to be the case, we should make Sigil restart after playing with the "may use javascripts" setting at least on Windows and Linux. On macOS, no restart is needed because we can just open a new Window and it will have javascript enabled.
KevinH is offline   Reply With Quote
Reply

Tags
mathml


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 08:32 AM.


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