[OS X TeX] LaTeX conversion to eBook?

Michael Sharpe msharpe at ucsd.edu
Wed Apr 25 14:01:27 EDT 2012


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. 

Claus


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?

Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20120425/399fa9dc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xhmlatex.scpt.zip
Type: application/zip
Size: 7358 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20120425/399fa9dc/attachment.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20120425/399fa9dc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xhmlatex.zip
Type: application/zip
Size: 650 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20120425/399fa9dc/attachment-0001.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20120425/399fa9dc/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myhtlatex.cfg.zip
Type: application/zip
Size: 637 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20120425/399fa9dc/attachment-0002.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20120425/399fa9dc/attachment-0003.html>


More information about the MacOSX-TeX mailing list