[Tex/LaTex] Use LaTeX to produce ePub


I'm asking here a question which was asked on the Italian TeX group forum.

Is there a way to produce ePub output automatically from a LaTeX source?

I should remark that ePub is just HTML + a subset of CSS + some XML for metadata, packed in a ZIP file. So one can settle with the existing tools for HTML conversion. Still something better could be done for ePub output.

In the first place, ePub accepts only a subset of CSS, then it would be nice to produce the file with the metadata from the LaTeX source too. Finally, I'm not sure how it works, but ePub files allow for automatic hyphenation of words. By this I mean that hyphenation can be specified in the ePub file itself, so that a reader will not need to know hyphenation rules. Note that since ePub files are resizable, all possible points of hyphenation must be specified.

Best Answer

Pandoc supports converting Latex to Epub. I don't think there's any "black box" solution producing high-quality output, but the HTML that Pandoc generates is easy to work with.


  1. John MacFarlane's Creating an ebook with pandoc

  2. My answer recommending Pandoc (now deleted, so included inline below) to SO question, User manual for Java software: In-application help + PDF, which also discusses some other useful technologies for dealing with Epub conversion.

    It's not clear what your problem with HTML is: I recommend looking at the HTML-based Epub format.

    There are Latex to Epub converters, such as Pandoc, which generate the separate TOC and metadata files, possibly making the representation more satisfactory from your point of view.

    Epublib has a bundled Java viewer (source) that you could tailor to your needs.

    Note that you can generate SVG from PDF, which may offer you some flexibility.