I finally got around to extracting the complex toolchain used to create our textbook into a separate project.
You can check it out on GitHub as armandofox/latex2ebook
It’s far from complete, has many restrictions on what you can and cannot do, has many quirks arising from both LaTeX weirdnesses and the limitations of current ebook formats, and is scantily documented (I’ll add more docs as time permits). Still, it should do what it advertises—allow you to create both a printable PDF and a .mobi format (Kindle, Sony and many other readers) ebook from the same set of LaTeX sources, if you follow some careful rules.
Next task is to add support for epub output. Anyone point me to succinct documentation for the epub format, and/or an open-source tool that takes the various epub assets and wraps them up into the .epub distribution file?
#1 by Brent J. Nordquist on May 12, 2012 - 8:40 am
Heh; the blog software wiped out the spaces too. So, all lines but the first must start with a tab character.
#2 by Brent J. Nordquist on May 12, 2012 - 8:39 am
An ePub is just a ZIP file with a few strictures. To make my .epub files, I use good ol’ make. Here’s a generic rule that will make foo.epub given a foo/ directory that contains the various elements. (As with all makefiles, all lines but the first must be an actual tab, not spaces.) The “-0″ flag on the first line is to make sure that those files are not compressed; I believe that’s a requirement for at least some of them.
%.epub: %/content.opf
@rm -f $@ 2>/dev/null
( cd ./$* && zip -r0 ../$@ mimetype META-INF content.opf )
( cd ./$* && zip -r ../$@ *.ncx *.css *.jpg *.html )