Compiling LaTeX to html with TeX4ht
TeX4ht was created by Eitan Gurari, who sadly died in 2009. It is still under active development, but upgrading is difficult.
Unlike lwarp, the idea is that you simply run somecommand
sourcefile.tex with a bunch of options without having to make
changes to your tex file. I tried this with the same tex file I used
for lwarp - no fancy packages, a couple of images - with these
results.
MathJax mode
There is some support for producing html files containing tex commands
that will be rendered with MathJax even in the version of TeX4ht in the
debian repos: htlatex sourcefile "html,mathjax" does it. You might
think this would be easier to implement (since there’s no need to
translate LaTeX to mathml) and it looks
good after one or two tweaks, but there’s a serious problem: label and
ref don’t work. I submitted a bug
report and Michal Hoftich replied
saying this is “not easily solvable” and linking to
this tex.se
question.
There were a few other issues: one of the tex macros (the only one with
two arguments) wouldn’t render, and double primes look pretty bad unless
replaced with ^{\prime\prime}. qedhere doesn’t work either. The
images were OK once I included the file extension to the
includegraphics command, and svg images worked fine. I gave up
on improving it because of the ref problem though.
MathML rendered by MathJax
In a 2012 tex.se
answer
Michal gives some instructions for using TeX4ht to convert to mathml and
then have that rendered by mathjax. He gives a sample cfg file, but for
modern browsers you’ll need to change the link to the mathjax script to
https if you want to put the output on an https webpage.
After saving the cfg file as michal.cfg you run
htlatex filename.tex "michal.cfg, charset=utf-8" " -cunihtf -utf8"
For some reason textrm causes a big problem (the output stops
after the first textrm) and rm doesn’t work. Apart from this the
output is good, even better than lwarp in some ways: no weird symbols
for --- or for double primes (even if they don’t look great), all the
macros work.
Conclusion
The second method worked pretty well and needed relatively few changes
to the source file. It is a shame not to have the tex commands embedded
in the output though - hopefully there will be a proper release in the
future with improvements to the mathjax mode. It’s certainly possible
to do references in mathjax, since \ref and \label work
automatically and automatic equation numbering now exists too (but isn’t
enabled by default).