hendricius / the-sourdough-framework

Open source book dedicated to helping you to make the best possible sourdough bread at home.
https://breadco.de/book
Creative Commons Attribution Share Alike 4.0 International
2.57k stars 128 forks source link

ebook does not work on Kobo #306

Closed cedounet closed 6 months ago

cedounet commented 6 months ago

As reported on discord: Kobo Libra H2O and original Kobo H2O from 2014 do not display the ebook correctly.

cedounet commented 6 months ago

Hello @sha1sum and others with a Kobo reader.

AS discussed if you could test each commit on https://github.com/hendricius/the-sourdough-framework/tree/kobo and let me know if that breaks and which one breaks it?

The makefile has been modified so simply running make will build an epub for you.

There is nothing funky in it right now... but still gettihg errors from epubcheck

Thanks in advance,

C

Apostolique commented 6 months ago

I just gave a test to commit 6620ccc3ff3327af24b40718fd649abda98ae3af the book already can't be opened in my Kobo ereader. The only text in the epub is (verified with SumatraPDF / Calibre):

If you’re a hobby brewer, you’ll know that it’s important to keep your beer at certain temperatures to allow the different amylases to convert the contained starches into sugar. This test, called the Iodine Starch Test, involves mixing iodine into a sample of your brew and checking the color.

cedounet commented 6 months ago

Thanks very much @Apostolique . That is super useful... this is a tool problem, we need to start with.

cedounet commented 6 months ago

5f22332542800fb605340d3ebd974ed9c350f7a5 really has the minimum... if that one fails then we need to report a bug to tex4ht folks.

Apostolique commented 6 months ago

This one worked!

Apostolique commented 6 months ago

It looks like there's an issue in \usepackage{sourdough}

Adding that line back by itself prevents kobo from reading the book.

I was also able open in kobo with this tex4ebook.cfg:

\Preamble{xhtml}
\ConfigureToc{loc}{\HCode{<span class="lofToc">}}{\ }{}{\HCode{</span><br />}}
\begin{document}
\Configure{DocumentLanguage}{en}
\Configure{OpfScheme}{URI}
\Configure{UniqueIdentifier}{https://the-bread-code.io}
\Configure{AddCss}{book-ebook.css}
\Configure{CoverMimeType}{image/jpeg}
\CoverMetadata{cover/cover-page.jpg}
\EndPreamble

I don't actually see the cover in kobo though. Not sure if that's intended.

Note that I didn't include:

\renewcommand\listofflowcharts{%
\chapter*{\listoflocname}%
\TableOfContents[loc]%
}

I guess that depends on the sourdough package? It refused to compile with it.

cedounet commented 6 months ago

On Fri, Dec 15, 2023 at 02:21:35PM -0800, Jean-David Moisan wrote:

It looks like there's an issue in \usepackage{sourdough}

Adding that line back by itself prevents kobo from reading the book.

OK we can start dichotomize this one now... we cannot get rid of it ofc as well this is the main style file for the book.

I was also able open in kobo with this tex4ebook.cfg:

\Preamble{xhtml}
\ConfigureToc{loc}{\HCode{<span class="lofToc">}}{\ }{}{\HCode{</span><br />}}
\begin{document}
\Configure{DocumentLanguage}{en}
\Configure{OpfScheme}{URI}
\Configure{UniqueIdentifier}{https://the-bread-code.io}
\Configure{AddCss}{book-ebook.css}
\Configure{CoverMimeType}{image/jpeg}
\CoverMetadata{cover/cover-page.jpg}
\EndPreamble

Good to know!

I don't actually see the cover in kobo though. Not sure if that's intended.

Cover has issues overall... not too worried about it.

Note that I didn't include:

\renewcommand\listofflowcharts{%
\chapter*{\listoflocname}%
\TableOfContents[loc]%
}

I guess that depends on the sourdough package? It refused to compile with it.

It does indeed.

Thanks again,

C/

cedounet commented 6 months ago

Ok added some more... none of my code in sourdough.sty just packages right now. Let me know if that works, if not we need to find the culprit.

Latest 07c8ec9 shows no error/warning with epubcheck... I take it as a sign. :smile_cat:

Apostolique commented 6 months ago

Ok, I was able to figure it out. Turns out the issue was with \usepackage{enumitem} (btw this line was there twice for some reason). I removed both lines that had that package.

I compiled the book from the main branch with no other changes and my kobo was able to read it.

cedounet commented 6 months ago

It was here for a reason though, (at least the first time) the interesting bit is that I explicitly escaped a command for tex4ht. I will make a new branch which would be nice if you could test it.

PS: stating the obvious but breaking the pdf is not an option.

cedounet commented 6 months ago

@Apostolique tentative work-around at https://github.com/hendricius/the-sourdough-framework/tree/fix-kobo let me know if that works.

Also if you can get an MWE that generates an epub working but does not on Kobo, I am sure @michal-h21 would appreciate it.

michal-h21 commented 6 months ago

@cedounet yes, it would be nice. We have some basic support for enumitem, but it is of course possible that you use some options that break TeX4ht somehow.

sha1sum commented 6 months ago

I am making the book from the fix-kobo branch now. Will let you know.

sha1sum commented 6 months ago

@cedounet @Apostolique the fix-kobo branch's epub worked great on my Kobo! Some of the pages take a while to change depending on what's on the page, but I haven't had a true freeze and the content looks reasonably good!

image

image

cedounet commented 6 months ago

Awesome! Thanks very much. Did you test both colour and black&white ?

sha1sum commented 6 months ago

I just used the build_ebook target, so whichever that uses. Let me see if I can bake everything.

cedounet commented 6 months ago

That would be the colour version you can do build_bw_ebook now or simply bake if you also want the pdfs.

c

sha1sum commented 6 months ago

I'm still getting an error when attempting to make bake:

Output written on book_sans_serif.pdf (167 pages, 61206628 bytes).
SyncTeX written on book_sans_serif.synctex.gz.
Transcript written on book_sans_serif.log.
Latexmk: Getting log file 'book_sans_serif/book_sans_serif.log'
Latexmk: Examining 'book_sans_serif/book_sans_serif.fls'
Latexmk: Examining 'book_sans_serif/book_sans_serif.log'
Latexmk: Found input bbl file 'book_sans_serif/book_sans_serif.bbl'
Latexmk: Log file says output to 'book_sans_serif.pdf'
Latexmk: Bibliography file(s) form .bcf file:
  ./references.bib
Latexmk: All targets () are up-to-date
Latexmk: Undoing directory change

make: *** [bake] Error 2
sha1sum commented 6 months ago

That would be the colour version you can do build_bw_ebook now or simply bake if you also want the pdfs.

c

There seems to be no build_bw_ebook target.

sha1sum commented 6 months ago

Oh I see it's just not exposed to the outer makefile

sha1sum commented 6 months ago

@cedounet yeah it's way, way faster than the color on the Kobo!

cedounet commented 6 months ago

Oh I see it's just not exposed to the outer makefile

Yeah sorry, so used to native builds myself.

on the error messages, looks like the build went fine but make isn’t happy about something else.

Apostolique commented 6 months ago

There are graphics / images that are unreadable. Flowcharts overflow the bounds of my device, for example, for flowchart 4 and 5 I can only see something like this: image image

Figure 5.1 is unreadable on my Kobo. The image is too blurry.

cedounet commented 6 months ago

https://github.com/hendricius/the-sourdough-framework/pull/312