milewski-ctfp-pdf icon indicating copy to clipboard operation
milewski-ctfp-pdf copied to clipboard

epub/mobi/html5 version

Open hmemcpy opened this issue 7 years ago • 6 comments

Tried to do this myself. Failed miserably :) Could not get pandoc to work - it did not include any of the subfiles, although according to this issue, they should be supported. Perhaps the problem is with the directory layout?

hmemcpy avatar Sep 30 '17 19:09 hmemcpy

Yes please - I'd love an epub/mobi version too.

adishavit avatar Oct 01 '17 08:10 adishavit

I'll have a go at this. I'm not sure I can fix it, but it's worth trying.

barisere avatar Oct 01 '17 19:10 barisere

I'll share how far I've come in my attempt. TL;DR: ePub successfully generated, but still a few issues.

Install pandoc > 2.1, then cd milewski-ctfp-pdf/src and:

pandoc ctfp.tex -o category-theory-for-programmers.epub --webtex -M author="Bartosz Milewski" -M title="Category Theory for Programmers" --resource-path=.:content/0.0:content/1.1:content/1.10:content/1.2:content/1.3:content/1.4:content/1.5:content/1.6:content/1.7:content/1.8:content/1.9:content/2.1:content/2.2:content/2.3:content/2.4:content/2.5:content/2.6:content/3.1:content/3.10:content/3.11:content/3.12:content/3.13:content/3.14:content/3.15:content/3.2:content/3.3:content/3.4:content/3.5:content/3.6:content/3.7:content/3.8:content/3.9

See https://github.com/jgm/pandoc/issues/3983 for a discussion about how pandoc handles this LaTeX project, but basically:

  • use --resource-path with all image directories because of the \renewcommand*{\subfile} in this LaTeX project.
  • use --webtex to convert MathML to SVG because most eReaders don't support MathML, see https://pandoc.org/epub.html#math

TODO:

  • rename Monads, Monoids, and Categories file to not use commas.
  • ...?

Pandoc does handle \renewcommand to some extent, but obviously it cannot reimplement all of TeX macro behaviours. I guess it's debatable what should be fixed in pandoc and what things are just too non-standard in this LaTeX source for pandoc to re-implement...

Here my generated epub: category-theory-for-programmers.zip (rename .zip to .epub after download)

mb21 avatar Oct 21 '17 13:10 mb21

Wow, this looks fantastic! I've removed a bunch of unneeded macros already, but it seems there's more work to be done. Thank you so much for the effort! I'll see if I can help in any way by simplifying things further...

hmemcpy avatar Oct 21 '17 14:10 hmemcpy

I'm currently working on the ePub version, and after being finished, i will also target mobi(using KindleGen) and HTML(I can export, but I need a better styling for the HTML version).

The project is here if you guys are interested, and I'm following this guide mostly.

onlurking avatar Oct 30 '17 22:10 onlurking

Has there been any more progress on this, and are there any specific issues that need handling?

I'm especially interested in seeing the scala version in eBook form

kevinwright avatar Nov 25 '18 21:11 kevinwright