# htlatex Defines a Command Then Chokes on it

I'm trying to compile a LaTeX document into a HTML document but I keep hitting the same problem. When I compile (using the command htlatex .\scratch.tex myhtml), I get the following output:

G:\PhD\Thesis 3\Scratch> htlatex .\scratch.tex myhtml

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6800 64-bit)
entering extended mode
LaTeX2e <2018-04-01> patch level 5
! Undefined control sequence.
<*> ...tother\HCode myhtml.a.b.c.\input  .\scratch
.tex

From this output the problem doesn't seam to be anything to do with the document (and the error is the same whatever the document is), rather it's a bug in tex4ht, but for reference scratch.tex is this:

\documentclass{article}

\begin{document}
Text text.
\end{document}

It seams that tex4ht is trying to define a command (\HCode) then run it before running the actual document, but for some reason the definition fails to take hold.

Updating MikTeX didn't change anything. From this question, a similar problem with tex4ht was solved by altering one of the .def files that tex4ht uses. But I don't know which file is causing this error or how to fix it.

So, my two questions are: 1) what causes this error, and 2) which file would I need to change to fix it. I'm using MiKTeX 2.9 on Windows 10 64-bit, if that helps.

• why do you use htlatex .\scratch.tex? it tries to execute the \scratch command. You can either use htlatex scratch.tex or htlatex ./scratch.tex – michal.h21 Sep 30 '18 at 22:40