Is there a way to programatically test whether the current document is being compiled by tex4ht?

What I am looking for is something like \iftexfourht, or perhaps some \@ifundefined{...}, in order to make \variable expand either to $#1$ or to \textit{#1} conditionally upon whether or not tex4ht is in charge.


\newcommand \variable [1]

Let's talk about \variable{x}.
  • \@ifundefined{HCode}{NO HT}{YES HT}, but I wouldn't rely on it; anybody can define anything, so someone can define \HCode even tex4ht is not active. – yo' Sep 3 '16 at 15:15

Browse other questions tagged or ask your own question.