[OS X TeX] xhmlatex

Michael Sharpe msharpe at ucsd.edu
Thu Feb 16 07:28:40 CET 2012

On Feb 4, 2012, at 1:07 PM, Claus Gerhardt wrote:

> 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

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:



More information about the macostex-archives mailing list