LaTeX → HTML (tex4ht/make4ht/lwarp/LaTeXML)

Sometimes you want your LaTeX as a web page, not a PDF — for accessibility, the web, or e-books. Four tools convert LaTeX → HTML, each with different strengths: tex4ht (via the friendly front-end make4ht), lwarp, and LaTeXML. This page maps them.

tex4ht and make4ht

tex4ht is the classic LaTeX→HTML/XML converter, invoked like htlatex file.tex "html5,mathml,…". It is powerful but fiddly to drive directly. make4ht (by Michal Hoftich) gives it a friendly build front-endmake4ht file.tex — with HTML5 by default and Lua build files to customize (run bibtex, post-process, handle images). Prefer make4ht over raw htlatex.

terminal
make4ht file.tex     # tex4ht の手軽な front-end(HTML5 既定)/ friendly front-end
# 生の tex4ht なら / raw tex4ht:
htlatex file.tex "html5,mathml,charset=utf-8"

lwarp

lwarp (by Brian Dunn) takes a different tack — it runs real LaTeX to emit HTML5 directly, so it supports 500+ packages and classes with high fidelity. Math becomes SVG images or MathJax. Add \usepackage{lwarp}, compile with pdflatex, then run lwarpmk html (a texlua script automates the multi-step build). Good for documents that use many packages.

terminal
% プリアンブルに / in the preamble:  \usepackage{lwarp}
lwarpmk html         # 多段処理を自動化 / automates the build

LaTeXML

LaTeXML (Bruce Miller, NIST) parses LaTeX into semantic XML, then to HTML5 + MathML (and ePub, JATS). Two steps: latexml then latexmlpost. Its math → MathML is the most robust, and arXiv uses it to offer HTML papers. The strongest choice for math-heavy, semantic, accessible output.

terminal
latexml --dest=file.xml file.tex
latexmlpost --dest=file.html file.xml   # → HTML5 + MathML

Which to choose

  • Quick HTMLmake4ht (tex4ht).
  • Many packages, high fidelitylwarp.
  • Math-heavy, MathML, semantic XML (the arXiv route)LaTeXML.