[tex4ht] Detecting TeX4ht

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


Hello,

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

  https://groups.google.com/d/topic/comp.text.tex/ByoF82q20sI/discussion

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

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:

  \ifHtml
  \else
  \usepackage{floatrow}
  \fi

or, better:

  \ifnotHtml
  \usepackage{floatrow}
  \fi

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

  \usepackage{ifpdf}
  \ifpdf
  \usepackage{floatrow}
  \fi

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:

  \usepackage{ifxetex}
  \ifxetex
  \usepackage{floatrow}
  \fi

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.
-- 
Denis


More information about the tex4ht mailing list