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?