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 06-14-2021, 09:49 AM   #1
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,527
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Question Bug in Preview with epubs that contain MathML equations?

I know that, in Sigil 1.6, Preview is now totally asynchronousis but even so, when someone does click with the mouse somewhere in CodeView, Preview scrolls to show the same text clicked in the source code. Well, nothing of that happens with the epub I attach; no matter the place where I do click in Codeview that Preview remains always in the same place (at the beggining of the file). It seems that something is broken when the epub has MathML equations.

By the way, I don't know why Bibi Reader can't open this epub.

Regards
Rubén

EDIT: The attached epub passes Epubcheck.
Attached Files
File Type: epub MathML Case.epub (4.0 KB, 116 views)
RbnJrg is offline   Reply With Quote
Old 06-14-2021, 10:32 AM   #2
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,469
Karma: 5432724
Join Date: Nov 2009
Device: many
I just tested it and had no trouble at all but you have to understand one thing:

Clicking inside a mathml equation in CV or clicking inside an equation in Preview can *never* work.

Neither actually exists in the other.

Inside Preview MathJax replaces the mathml with inline svg of the image.

So when you click in CV inside a mathml tags there is no equivalent node in the DOM inside of Preview.

When in Preview and you click inside an mathml equation, you are clicking in an svg image that has no correspondence in CV.

To use Sigil to navigate by clicking in CV and PV, simply click on any non-mathml element that will exist in both and they will sync.

That is just a limitation of how MathJax works.

As for BibiReader and MathJax, you probably have to load it in the extensions folder inside bibi since bibi itself does not come with or support mathjax.

This is why I really wanted true mathml support in browsers but when Chrome decided to drop it, and replace it with a polyfill kludge (ie. MathJax) it really hurts. As few browsers support true mathml and even fewer support the mml3 extensions (which is what that test case is testing).

If you check it out in calibre which uses Mathjax 3 + you will see much of that testcase is broken because even MathJax in its 3.X versions dropped mml3 support which will hopefully be soon added back.

Last edited by KevinH; 06-14-2021 at 10:37 AM.
KevinH is offline   Reply With Quote
Advert
Old 06-14-2021, 10:50 AM   #3
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,442
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I'm having trouble on Windows getting it to sync properly (either direction) even when clicking only the html elements. Clicking in the h tags in Code View does not take me to that section in Preview.
DiapDealer is online now   Reply With Quote
Old 06-14-2021, 10:56 AM   #4
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,527
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post

To use Sigil to navigate by clicking in CV and PV, simply click on any non-mathml element that will exist in both and they will sync.

That is just a limitation of how MathJax works.
Thanks for your answer Kevin. I did what you say, but even so CV and PV don't sync. Do the following:

1. Open in Sigil MathML Case.
2. In CV, go at the end of the sheet, where you read:

Code:
<h2>Multiscripts, Under-over, Greek and Gothic alphabets</h2>
and do click here; you'll see that nothing happens in PV, it remains at the start of the view. At least, that is what happens in my Windows system.

Quote:
As for BibiReader and MathJax, you probably have to load it in the extensions folder inside bibi since bibi itself does not come with or support mathjax.
Ok; understood

Last edited by RbnJrg; 06-14-2021 at 10:59 AM.
RbnJrg is offline   Reply With Quote
Old 06-14-2021, 10:58 AM   #5
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,527
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by DiapDealer View Post
I'm having trouble on Windows getting it to sync properly (either direction) even when clicking only the html elements. Clicking in the h tags in Code View does not take me to that section in Preview.
I agree with what you are experimenting. That is exactyly what happens in my Windows PC.
RbnJrg is offline   Reply With Quote
Advert
Old 06-14-2021, 11:15 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,469
Karma: 5432724
Join Date: Nov 2009
Device: many
It seems from looking at the Inspector in Preview, that MathJax is now injecting lots more crap into the DOM tree than they used to.

The problem is that extra nodes throws off the webpaths (think element counts from the body tag level by level much like an epubcfi) so much they no longer function as they are invalid.

This confuses the go to location very badly. Sometimes it works but other times it does not depending on how many element node counts are off.

Not sure exactly how we can deal with this.
KevinH is offline   Reply With Quote
Old 06-14-2021, 04:45 PM   #7
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,469
Karma: 5432724
Join Date: Nov 2009
Device: many
I spent most of today looking at this. It is going to be a bear to fix.

MathJax just inserts so much crap that any type of cfi or element path will be wrong. Very wrong. And it gets worse the more equations are in the file.

If I turn off just about all the crap as I can, it still wraps each math node in a script tag of type math/mml and it adds 2 divs at the top as the first two children of the body. One div is required as it has the svg paths and glyphs needed. The other is just a stupid message field that can not be deleted even if your set showMessages to false and to not display. Even worse the Mathjax java script code will constantly recreate it even if has been deleted and set not to be used.

So the only approach that might work is to register a start-up hook for when mathjax ends and then create some javascript to remove all of the extra script tags added to wrap the math ml tags from the dom, then remember if using mathml and if so compensating for the two extra first children of the body when passing a location into Preview and do the reverse when passing a location out of Preview to CV.

What a mess! All because Chrome decided to kill all support for true native mathml in the browser.

Last edited by KevinH; 06-14-2021 at 04:47 PM.
KevinH is offline   Reply With Quote
Old 06-14-2021, 04:49 PM   #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,442
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I wouldn't expect anyone to go down that rabbit hole.
DiapDealer is online now   Reply With Quote
Old 06-14-2021, 05:00 PM   #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,469
Karma: 5432724
Join Date: Nov 2009
Device: many
Well call me Alice!

I will try to do this tomorrow just to see how doable and robust this approach would be. If I can get it working reasonably well without the changes being too invasive we can consider it.

If not, we should just leave it as a bug and wait for MathJax 3.x with mml3 support and see if it deals with things any better.
KevinH is offline   Reply With Quote
Old 06-14-2021, 06:46 PM   #10
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,442
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Far be it for me to discourage a man with a plan.

I was just thinking that Preview/Codeview sync is probably able to be broken at any time by scripts included with epubs.
DiapDealer is online now   Reply With Quote
Old 06-14-2021, 06:50 PM   #11
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,469
Karma: 5432724
Join Date: Nov 2009
Device: many
Yes, any scripts that add dom nodes that are first level children of the body tag are going to be an issue. But that would be because of their own javascript and not our internal stuff.

I would like our internal stuff to not impact the sync if at all possible.
KevinH is offline   Reply With Quote
Old 06-15-2021, 06:17 AM   #12
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
You guys are heroes!
Notjohn is offline   Reply With Quote
Old 06-15-2021, 10:09 AM   #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,469
Karma: 5432724
Join Date: Nov 2009
Device: many
Okay, I tried this approach and it seems to work. The changes included modifying the SIGIL_EBOOK_MML_SVG.js file to strip out and turn off a bunch of junk (had to modify the version inside ML.zip as well), plus some special post mathjax run javascript cleanup code, and some routines to compensate for the added 2 divs as the first children of the body when getting and setting location.

I have pushed all of this to master.

If anyone gets a chance, I would love to see if and how this works on Windows (it should) but most importantly if it works with a system level MathJax 2.X on Linux.

If it seems to work on all platforms, we will leave it as is, otherwise if it can not be easily fixed, we can revert it and worry about it again when the mathjax conversion to Mathjax 3.X includes the mml3 extension.

Hope this works!
KevinH is offline   Reply With Quote
Old 06-15-2021, 10:17 AM   #14
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: 643
Karma: 2180076
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
I confirm in Windows 10.
Of course, jumps to preview only on click h1, h2 and p in the sample file.
BeckyEbook is online now   Reply With Quote
Old 06-15-2021, 10:38 AM   #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,469
Karma: 5432724
Join Date: Nov 2009
Device: many
Wonderful! Thanks.

I can confirm it works in macOS, so that just leaves Linux.

I will try to fire up my Linux box later tonight and give it a try there, unless someone beats me to it.


Quote:
Originally Posted by BeckyEbook View Post
I confirm in Windows 10.
Of course, jumps to preview only on click h1, h2 and p in the sample file.

Last edited by KevinH; 06-15-2021 at 12:06 PM.
KevinH is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Bug] HTML Comments in Preview Tex2002ans Sigil 4 08-22-2018 04:48 PM
dynamically scale MathML equations user2178319 Workshop 1 07-01-2015 08:04 AM
Mathematical Equations in epubs verydeepwater ePub 9 08-30-2013 06:49 AM
Syncing bug in preview window sellew Sigil 13 02-26-2013 01:10 PM
A bug with images in epubs? Cyclops ePub 2 09-13-2010 10:57 AM


All times are GMT -4. The time now is 06:52 AM.


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