2

I am using BasicTeX on macOS Catalina. Here are my LaTeX version details.

$ tex --version
TeX 3.14159265 (TeX Live 2020)
kpathsea version 6.3.2
Copyright 2020 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.

$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020)
kpathsea version 6.3.2
Copyright 2020 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.02

$ make4ht --version
make4ht version v0.3f

I had installed TeX Live and make4ht like this:

brew install --cask basictex
sudo tlmgr update --self
sudo tlmgr install make4ht luaxml tex4ht environ trimspaces

Here is my input file foo.tex:

\documentclass{article}
\begin{document}
hello, world
\end{document}

Here is how make4ht fails:

$ make4ht foo.tex
[STATUS]  make4ht: Conversion started
[STATUS]  make4ht: Input file: foo.tex
[ERROR]   htlatex: Compilation errors in the htlatex run
[ERROR]   htlatex: Filename     Line    Message
[ERROR]   htlatex: ./foo.tex    2        Undefined control sequence.
[ERROR]   htlatex: ./foo.tex    2        LaTeX Error: Missing \begin{document} in `'.
[ERROR]   htlatex: ./foo.tex    2        Undefined control sequence.
[ERROR]   htlatex: ./foo.tex    4        Undefined control sequence.
[ERROR]   htlatex: /usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/article.4ht       140      Undefined control sequence.
[ERROR]   htlatex: /usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/article.4ht       140      LaTeX Error: Missing \begin{document} in `'.
[ERROR]   htlatex: Compilation errors in the htlatex run
[ERROR]   htlatex: Filename     Line    Message
[ERROR]   htlatex: ./foo.tex    2        Undefined control sequence.
[ERROR]   htlatex: ./foo.tex    2        LaTeX Error: Missing \begin{document} in `'.
[ERROR]   htlatex: ./foo.tex    2        Undefined control sequence.
[ERROR]   htlatex: ./foo.tex    4        Undefined control sequence.
[ERROR]   htlatex: /usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/article.4ht       140      Undefined control sequence.
[ERROR]   htlatex: /usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/article.4ht       140      LaTeX Error: Missing \begin{document} in `'.
[ERROR]   htlatex: Compilation errors in the htlatex run
[ERROR]   htlatex: Filename     Line    Message
[ERROR]   htlatex: ./foo.tex    2        Undefined control sequence.
[ERROR]   htlatex: ./foo.tex    2        LaTeX Error: Missing \begin{document} in `'.
[ERROR]   htlatex: ./foo.tex    2        Undefined control sequence.
[ERROR]   htlatex: ./foo.tex    4        Undefined control sequence.
[ERROR]   htlatex: /usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/article.4ht       140      Undefined control sequence.
[ERROR]   htlatex: /usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/article.4ht       140      LaTeX Error: Missing \begin{document} in `'.
[STATUS]  make4ht: Conversion finished

Here is the debug output:

$ make4ht -m draft -a debug foo.tex
[INFO]    mkparams: Output dir: 
[INFO]    mkparams: Compiler: latex
[INFO]    mkparams: Latex options: -jobname=foo  
[INFO]    mkparams: tex4ht.sty: xhtml,,charset=utf-8
[INFO]    mkparams: tex4ht:  -cmozhtf -utf8
[INFO]    mkparams: build_file: foo.mk4
[INFO]    mkparams: Output format: html5
[STATUS]  make4ht: Conversion started
[STATUS]  make4ht: Input file: foo.tex
[INFO]    mkutils: Load extension   common_domfilters
[INFO]    mkutils: Cannot open config file  foo.mk4
[INFO]    make4ht-lib: setting param correct_exit
[INFO]    make4ht-lib: setting param ext
[INFO]    make4ht-lib: Adding:  ext dvi
[INFO]    htlatex: LaTeX call: latex --interaction=errorstopmode -jobname=foo   '\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 xhtml,,charset=utf-8,html5.a.b.c.\input "\detokenize{foo.tex}"'
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06> (./foo.tex
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/tex4ht.sty)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/tex4ht.4ht
::::::::::::::::::::::::::::::::::::::::::
 TeX4ht info is available in the log file 
::::::::::::::::::::::::::::::::::::::::::
) (/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/tex4ht.sty
--- needs --- tex4ht foo ---
(./foo.tmp) (./foo.xref)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/unicode.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4-math.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html5.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/unicode.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4-math.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html5.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/unicode.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4-math.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html5.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/latex.4ht
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/unicode.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4-math.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html5.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/unicode.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4-math.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html5.4ht))
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/fontmath.4ht
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/unicode.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html4-math.4ht)
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/html5.4ht))
(/usr/local/texlive/2020basic/texmf-dist/tex/generic/tex4ht/article.4ht
! Undefined control sequence.
l.140 \AtBeginEnvironment
                         [tex4ht]{abstract}{\ConfigureEnv{center}{\a:abstrac...

?
7
  • 1
    I think there is some issue with your installation, namely that LaTeX core and TeX4ht don't match. Which distribution do you use? Can you update it?
    – michal.h21
    Mar 14 at 11:06
  • could you also post result of make4ht -m draft -a debug foo.tex?
    – michal.h21
    Mar 14 at 11:07
  • @michal.h21 Thank you for your comments. I have added the distribution details at the top of the question. I have added debug output at the bottom of the question. Mar 14 at 12:03
  • @cmhughes I already have etoolbox. The command sudo tlmgr install etoolbox said tlmgr install: package already present: etoolbox. I also manually confirmed that it is present at /usr/local/texlive/2020basic/texmf-dist/tex/latex/etoolbox/etoolbox.sty. Mar 14 at 12:52
  • 1
    the issue is with \AtBeginEnvironment command, which is defined by recent LaTeX core. It seems that BasicTeX uses updated TeX4ht, but older version of LaTeX core.
    – michal.h21
    Mar 14 at 12:54
1

Comments by @michal.h21 were very helpful in resolving the issue. Here is the minimal step that resolved the issue:

sudo tlmgr update latex-bin

But if you are going to use tlmgr to update LaTeX, you might as well update the entire TeX Live distribution like this which also resolves the issue:

sudo tlmgr update --all

I prefer the second solution because it updates the entire distribution, so there will be no incompatible versions of packages lying around on the system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.