text4ht and LuaTeX

There is a specific command to run tex4ht with XeTeX: htxelatex (which doesn't really work actually as far as I'm concerned).

What is the command to run text4ht with LuaTeX instead?

Edit Oct 2015:

Issues with babel are now fixed, the document can be compiled without errors.

make4ht, new build tool for tex4ht supports LuaLaTeX out of the box, you can just use

make4ht -l filename


The minimal sample file may look like this:

\documentclass{article}
\usepackage[czech]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{luainputenc}
\begin{document}
Příliš žluťoučký kůň úpěl ďábelské ódy. Nazd\~ar
\end{document}


There is also some experimental support for Fontspec, see my guide

Original post

You can try this shell script, windows version is there

#!/bin/sh
lualatex --output-format=dvi --jobname=$1$5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,xhtml]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input '$1
lualatex --output-format=dvi --jobname=$1$5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,xhtml]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input '$1
lualatex --output-format=dvi --jobname=$1$5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,xhtml]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input '$1
tex4ht -.dvi -f/$1 -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3
t4ht -.dvi -f/$1$4 ## -d~/WWW/temp/ -m644


save it as htlualatex and make executable.

This code sample

\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{luainputenc}
\begin{document}
\section{Does it make sense?}
Příliš žluťoučký kůň úpěl ďábelské ódy
\end{document}


gives some compilation errors about invalid utf-8 sequences, but the html output is correct. Without \usepackage[utf8]{luainputenc} the output file ended at the first accented character.

• That seems to work, but I get tons of LaTeX Error: Command \acute' already defined in '. errors like with XeTeX. – ℝaphink Sep 5 '11 at 10:24
• yes, I think there is no correct support for lualatex in tex4ht now, and this is the best what we could get. – michal.h21 Sep 5 '11 at 10:43
• @Raphink: You can't use fontspec + system fonts with tex4ht. tex4ht.exe will be looking for tfm files. You can find some discussion about the problems in the thread starting here: http://tug.org/mailman/htdig/tex4ht/2011q3/000326.html – Ulrike Fischer Sep 6 '11 at 17:24
• Which parameters does this shell script expect? from what i've seen 5 but I don't really know which one is which one.. Thanks for explaining! – Michael Weibel Mar 5 '13 at 8:44
• @MichaelWeibel see tug.org/applications/tex4ht/mn-commands.html#QQ1-9-33 – michal.h21 Mar 5 '13 at 9:05