[XeTeX] xe(la)tex to epub?

Khaled Hosny khaledhosny at eglug.org
Tue Aug 17 22:58:57 CEST 2010

On Tue, Aug 17, 2010 at 01:16:02PM -0700, Michiel Kamermans wrote:
> Khaled,
> >AFAIK, epup is just a subset of xhtml with a subset of css2, so IMO not a kind of output format that is very well suited for TeX (well, I hardly consider html an output format at all, the output is what the browser renders out of it).
> True, but CSS uses a box model too, so it should be possible to
> create an "initial view" document that -- provided the render engine
> is properly compliant -- essentially looks the same as a generated
> pdf (barring special pdf commands, of course). Given the pretty
> rigid description of how CSS should be rendered by the w3c
> documentation for it, any x(ht)ml+css document is a proper format
> (be that for print or screen. note that there are a number of
> stand-alone css render engines which don't rely on browsers, but are
> meant for integration into reader applications devices, for
> instance). The difference between something like epub and pdf is
> that the layout in the first is mutable. For digital readers, with
> many different viewport sizes and aspects, that's highly desirable.
> For print media the epub format is, of course, nonsense. Hence the
> desire for parallel format generation.

I understand the benefits of EPUB, what I don't understand is the need
for TeX at all. (X)HTML is dynamic by nature, you should be able to
resize or change text size and the layout will re-flow, forcing a rigid,
box based layout that is a direct translation of TeX output just does
not make much sense to me. I've the feeling that you are looking for the
wrong solution to the problem. One of the strengths of TeX that I mis
in almost all HTML renderers is decent line breaking and hyphenation
algorithms. While I don't know any any HTML engines, especially
browsers, that have given much attention to this, there are JavaScript
implementations of TeX's line breaking and hyphenation algorithms,
assuming EPUB readers can execute JavaScript, I think this is a good
compromise. See [1] for example (some interesting links near the end,

[1] http://typophile.com/node/71247


 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer

More information about the XeTeX mailing list