michal-h21 / tex4ebook

Converter from LaTeX to ebook formats (epub, mobi). Using tex4ht and texlua scripts.
312 stars 33 forks source link

MathML / MathJax in Readium #23

Open danielweck opened 8 years ago

danielweck commented 8 years ago

Hello, I tested the following EPUB (hsmmt10t.epub): https://github.com/michal-h21/epub3sample

I am impressed by the quality of the generated EPUB, and how visually-seamless the MathML is in Readium (rendered by MathJax, SVG output).

Direct Readium link: https://readium.firebaseapp.com/?epub=https%3A%2F%2Fcdn.rawgit.com%2Fmichal-h21%2Fepub3sample%2Fmaster%2Fhsmmt10t.epub&goto=%7B%22idref%22%3A%22file12%22%2C%22elementCfi%22%3A%22%2F4%2F6%2F2%2C%2F1%3A0%2C%2F1%3A1%22%7D

However I am not a Math expert, so I just wanted to check with you guys whether the ebook renders fine in Readium. Let us know if you see any problems.

CC @pkra (MathJax) CC @rkwright (Readium Foundation)

pkra commented 8 years ago

@danielweck I currently see the SVG path problem on Chrome 49 (which is weird). But Firefox looks nice.

danielweck commented 8 years ago

Thanks @pkra What's the problem exactly? I mean, do you see an erroneous visual artifact, or are you referring to the fact that the font cache (SVG paths) is used / not-used? Firefox and Chrome look identical in Windows 10, on my machine. Edge seems to crash (!), Internet Explorer renders weird outlines / underlines in regular text paragraphs (not sure if this is related to MathJax).

Note that the above link (in my previous comment) points to the Readium "cloud reader", which is a pure-browser implementation that needs to populate the DOM in such a way that SVG paths references do not work. Conversely, the Readium Chrome extension does not need this "hack" as it makes use of the HTML5 Filesystem to unpack and preprocess the EPUB: https://chrome.google.com/webstore/detail/readium/fepbnnnkkadjhjahcafoaglimekefifl (I haven't tested hsmmt10t.epub with it yet)

pkra commented 8 years ago

What's the problem exactly? I mean, do you see an erroneous visual artifact, or are you referring to the fact that the font cache (SVG paths) is used / not-used?

The paths are not showing (just like they used to not show in Firefox). I'm on Chrom 49, Linux. (Maybe we should move this to a Readium tracker?)

pkra commented 8 years ago

With "paths" I mean the use elements. I'll take a closer look when I get the chance.

danielweck commented 8 years ago

@pkra NO! Regression bug with Chrome 49!! It was working fine with v48 :( Moving this issue to Readium's GitHub (sorry for the traffic).

danielweck commented 8 years ago

FYI, Chrome v49+ regression bug workaround for MathML / MathJax / SVG now implemented in Readium (develop branch). See live app URL with text4ebook EPUB (hsmmt10t.epub): https://readium.firebaseapp.com/?epub=https%3A%2F%2Fcdn.rawgit.com%2Fmichal-h21%2Fepub3sample%2Fmaster%2Fhsmmt10t.epub&goto=%7B%22idref%22%3A%22file12%22%2C%22elementCfi%22%3A%22%2F4%2F6%2F2%2C%2F1%3A0%2C%2F1%3A1%22%7D

pkra commented 8 years ago

Looking good. (And sorry for causing all this noise on your tracker @michal-h21!)

michal-h21 commented 8 years ago

@danielweck I am glad you like it :). files from PG are generally pretty hard for the conversion, because they use lot of custom commands defined in the document preamble and some of them are wrong (I've seen use of sectioning commands with direct formatting used for captions in some book, for example). My focus was on the document structure, not visual appearance, the document would look much better with some responsive CSS and custom fonts.

Regarding rendering in Readium, does it handle footnotes? They are rendered below paragraphs where they were used, I think iBooks can display them as popups, for example. But it is possible that actual coding in the sample is wrong and tex4ebok used wrong elements or epub:type attributes.

@pkra noise doesn't matter, there were too much silence recently :)

danielweck commented 8 years ago

@michal-h21 there's an experimental build of ReadiumJS (i.e. online cloud reader app, and offline Chrome extension) with support for EPUB3 "popup footnotes". Try this link and let me know what you think, please:

http://readium-footnotes.surge.sh/?epub=https%3A%2F%2Fcdn.rawgit.com%2Fmichal-h21%2Fepub3sample%2Fmaster%2Fhsmmt10t.epub&goto=%7B%22idref%22%3A%22file12%22%2C%22elementCfi%22%3A%22%2F4%2F6%2F2%2C%2F1%3A0%2C%2F1%3A1%22%7D

(I'm updating the build now to include the MathJax / SVG workaround for Chrome v49+)

danielweck commented 8 years ago

Another directly link to a page that contains both MathML and footnotes:

http://readium-footnotes.surge.sh/?epub=https%3A%2F%2Fcdn.rawgit.com%2Fmichal-h21%2Fepub3sample%2Fmaster%2Fhsmmt10t.epub&goto=%7B%22idref%22%3A%22file11%22%2C%22elementCfi%22%3A%22%2F4%2F6%2F2%2C%2F1%3A0%2C%2F1%3A1%22%7D

You can turn off the popup footnotes feature by changing your preference in the options dialog (layout tab, bottom radio box "original links")

michal-h21 commented 8 years ago

@danielweck ah, that's nice :) only thing that I'm missing is that it seems to be inaccessible from keyboard (I use Vimperator so I rarely use mouse or touchpad)

danielweck commented 8 years ago

The Readium UI is keyboard-accessible. However EPUB content can have its own keyboard tab-index, event handlers, etc., so there can be conflicts. There is a known bug in Readium's paginator for reflowable documents (which is implemented using CSS columns): keyboard-tabbing into EPUB HTML documents may shift the viewport and corrupt the visual page progression. We advice keyboard-power-users to switch the scroll view mode in Readium (per-document, or continuous), to mimic a regular web page vertical scrolling. This way, the browser's own "bring into view" behaviour does not mess-up the reading experience.