[tex4ht] Detecting TeX4ht

Denis Bitouzé dbitouze at wanadoo.fr
Wed Oct 3 14:41:09 CEST 2012


I understand the answer of the late Eitan in the following thread:


where he said that it is a wrong approach to include
translator-dependent code within source files with the help of macros as

He advised the alternative route through local configuration files.
This is indeed enough for the "if" part of \ifHtml...\else...\fi but it
is not relevant for the "else" part: for instance, TeX4ht is currently
not compatible with floatrow package so it may be useful to have
something like:


or, better:


There is another route with ifpdf package that lets you write:


But, if later you decide to compile the file not with pdflatex, but
with xelatex? OK, in this case, you could use ifxetex package and write
something like:


That's not very nice because this needs adjustments (what about if you
want to compile now with lualatex: OK, there is a ifluatex package...
Not very nice). Furthermore, the ifxetex package's route doesn't work
if you decide to compile with htxelatex!

For the moment, I will use the Anthony Williams' approach:

  \newif\ifhttex \ifx\HCode\undefined \httexfalse \else \httextrue \fi

but, if you see a better approach, I'd be happy to know it :)

Thanks in anticipation.

More information about the tex4ht mailing list