[OS X TeX] LaTeX conversion to eBook?

Nitecki, Zbigniew H. Zbigniew.Nitecki at tufts.edu
Wed Apr 25 21:15:56 CEST 2012

I don't have any personal experience with it, but the AMS has been involved in developing MathJax, which is an app devoted to creating good math text in HTML.  The AMS Notices for this past February has an article on it.

Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

my office     (617) 627-3843
dept. off.    (617) 627-3234
dept. fax    (617) 627-3966


On Apr 25, 2012, at 2:01 PM, Michael Sharpe wrote:

On Apr 25, 2012, at 8:48 AM, David Derbes wrote:

Some years ago a friend and I retyped, edited and otherwise modernized an old book in LaTeX (to PDF) for its subsequent reissue (The Einstein Theory of Relativity by Lillian and Hugh Lieber). The firm that reissued it, Paul Dry Books of Philadelphia, is thinking about doing it as an eBook. They have a firm that converts their books to ePub format and has done their non-technical stuff for a fee. The firm wants three times their usual fee for this one. I am hoping to find a much cheaper (or even free, with my sweat equity) solution.

I suspect that someone (or several someones) on this list have a very simple solution. Is there a package for turning a LaTeX'd book into ePub format?

The free program Calibre can do PDF to ePub, but they say that PDF's are just terrible for conversion. My hope is that there is a better approach than LaTeX->PDF->ePub via Calibre.

Summarizing some items from the list this February:

Claus Gerhardt wrote (2/4/12):

Attached are a shell script and an Applescript using htlatex with the option xhtml; they will convert almost any mathematical tex source file into an html file which will look beautiful in Safari and probably in any other browser.

I tested it with an arbitrary paper of mine and the result pleasantly  surprised me. The equations will be scalable.


Michael Sharpe wrote (2/15/12):

I've been playing with this script, and am also delighted by the quality of the html output. My comments below reflect my previous inexperience with tex4ht.

(1) You have to use fonts supported by tex4ht---ie, having a .htf file provided, unless you are willing to make them for your own preferred fonts. Computer Modern is supported though doesn't render as well as heavier font collections such as mathpazo.

(2) Display math is always converted to a png but with inline math, it depends on whether you use $..$ as delimiters, in which case the letters are text italic and there can be serious spacing flaws (though they are arbitrarily scalable), and if you use delimiters \(..\), you get png which looks very good at normal resolutions but which looks worse as you scale up. Generally, I prefer the latter.

(3) In view of (2), it would seem useful to have a means of translating a tex file written with $ delimiters to one without. Does anyone know of such a program? I wrote a python script to do this in limited cases meeting my needs, but there must be better options out there. In any case, the python script and an associated applescript for the Macros menu is available for those wishing to try it:

Claus Gerhardt wrote (2/18/12):

A simpler way to change the display of inline math is to redefine the default: Place the attached configuration file myhtlatex.cfg in the same folder as your document and change the command in the xhmlatex shell script to

htlatex  "$1" "myhtlatex,html,xhtml"

then inline math will be displayed by pictures.


The step from xhtml (with all math as png insertions) to epub is supposedly something that Calibre can handle, as epub uses a subset of xhtml for its internal processing. Does anyone have experience with this route?


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
List Archive: http://tug.org/pipermail/macostex-archives/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex

More information about the macostex-archives mailing list