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.
\documentclass{article}
\newcommand \variable [1]
{%
\iftexfourht
\textit{#1}%
\else
$#1$%
\fi
}
\begin{document}
Let's talk about \variable{x}.
\end{document}
\@ifundefined{HCode}{NO HT}{YES HT}, but I wouldn't rely on it; anybody can define anything, so someone can define\HCodeeventex4htis not active. – yo' Sep 03 '16 at 15:15