[tex4ht] issue with raw html output with httex

Michal Hoftich michal.h21 at gmail.com
Sun Oct 25 12:27:08 CET 2020

Hello Pat,

>but I get ! Undefined control sequence. for \Hnewline, and when I
>remove \Hnewline another error for _ not in mathmode, and when I replace
>_ with - what is in \HCode{} is processed as TeX and not output as is as
>html.
>
>If I test with some equivalent latex code and htlatex everything is
>as expected, <!-- tex4ht_begin tex_tex4ht_tex tex 1 --> appears as
>is in the output html file. Equivalent LaTeX code is:

There are several problems. First is that TeX4ht now depends on eTeX,
but httex uses tex command that doesn't uses eTeX extensions. So first
of all, try to make a local copy of the httex using

cp which httex .

and replace calls to tex by etex.

Another issue is that TeX4ht needs \document and \enddocument
commands to appear in the compilation, because all HTML configurations
happen at this moment, and also HTML header is written. You don't need
to change your TeX file, just make another file with the necessary
structure and include your original file here. You can then compile this
file and instead of the original one.

The container file can look like this:

%%%%%%
\input plain-4ht.tex
\document
\input bug_httex.tex
\enddocument
%%%%%%

It depends on plain-4ht.tex:

%%%%%%
\def\documentstyle#1{}
\documentstyle{tex4ht}
\csname tex4ht\endcsname
\def\document{}
\def\enddocument{\csname bye\endcsname}
%%%%%%

>As a side note, it may be related or not, but for the math the output of
>httex (and httexi) is subpar corresponding to the same math code but
>with LaTeX beginning and end processed with htlatex.  In the past I
>think that it was not the case, the httex and httexi output were better.
>It maybe another symptom of an underlying issue also causing the issue
>reported above.

Your HTML file doesn't contain any HTML tags without the trick with
\document.

Best regards,
Michal