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
G:\PhD\Thesis 3\Scratch>latex \makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode myhtml.a.b.c.\input .\scratch.tex
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.
htlatex .\scratch.tex? it tries to execute the\scratchcommand. You can either usehtlatex scratch.texorhtlatex ./scratch.tex– michal.h21 Sep 30 '18 at 22:40