[Tex/LaTex] Not Obsolete LaTeX to HTML Converter

conversionhtmllatex2html

I am looking to convert LaTeX to HTML. A long time ago (during my thesis, in 2000!), I used Hacha and Hevea … but obviously, they are no longer maintained, especially the Windows version.
More recently Google sent me to tex4ht, but it seems that there too the project is at a standstill (the site indicates that there will soon be opportunities for image management, but that was in 2014, since then nothing more) and is poorly documented.

Hence my question: is there a recent solution for converting LaTeX to HTML compatible with Windows? The option that I need are:

  • using CSS
  • cutting the document into several file
  • allowing the use of picture for navigation (up, prev, next)
  • compatible with Windows

Best Answer

It is true that the main page of tex4ht and documentation seems obsolete, but the project itself is alive, as can be seen from the history of commits and the mailing list. We added MathJax output support recently, for example.

It is also true that the full distribution which is on CTAN haven't been updated since the original author passed away, but the updates go directly to TeX distributions, so it is not necessary to install the distribution by hand, it would be quite complicated process. Everything you need to run updated tex4ht is included in TeX Live.

At the moment, I am working on a new documentation, which should be big improvement over the current state.

Regarding your question, all of this should be possible with tex4ht. It produces basic CSS for your document, it also enables to include custom CSS in the generated HTML. It supports cutting of the document to separate files for chapters, sections etc. It works on Windows when you use TL, but Miktex works as well.

The following file, myconfig.cfg will split an article on sections:

\Preamble{xhtml,2}
\Configure{AddCss}{test.css}
\Css{body{background-color:green;}}
\Configure{crosslinks}{}{}{\includegraphics{next.png}}{\includegraphics{prev.png}}{}{}{}{\includegraphics{up.jpg}}
\begin{document}
\EndPreamble

The split is requested using 2 option used in the \Preamble command. The \Css command can be used for simple CSS instruction, while the \Configure{AddCss} requires inclusion of an external CSS file. The \Configure{crosslinks} requires pictures for links for previous, next and top pages.

Compilation of the document can be requested using the following command:

make4ht -uc myconfig.cfg filename.tex

make4ht is a build system for tex4ht, it should be used instead of the htlatex command.