I try to convert the following LaTeX code to HTML using htlatex




\chapter{Regular expressions}


This works fine, when using the TeX Live from Debian stable; when using Debian unstable I get an error:

Appendix A.
! Undefined control sequence.
\@currentlabel ->\p@appendix
l.15 \label{sec:regexp}

! Emergency stop.
\@currentlabel ->\p@appendix
l.15 \label{sec:regexp}

As the code can be processed using LaTeX I'd assume it to be valid LaTeX code. I'm aware that there are a lot of changes in tex4ht in latest time. Is this a known issue and has been solved in the meantime? Thanks!

Update 20220724:

Here is a new minimal example. It fails to compile even after updating to latest version of htlatex.


-- section \ref{sec.portable_configuration} (on page \pageref{sec.portable_configuration}).
and follow the instructions suitable for your Linux distributions. Also see section \ref{sec.compiling}.


Processing the document using htlatex generates an error:

! Missing \endcsname inserted.
<to be read again>
l.9 ...Linux distributions. Also see section \ref{

When removing either the call to babel or the \ref commands the processing works fine. Processing the document using (Lua)LaTeX works fine, the warnings for undefined reference remain of course.

Can you help me? Thanks!

  • I think this was solved in the meantime, your example works fine with up-to-date TeX Live.
    – michal.h21
    Jul 22, 2022 at 7:18
  • Many thanks! So I'll package that version and give it another try. Jul 22, 2022 at 9:52
  • The document above is just a minimal example. The original document fails later on. ! Missing \endcsname inserted. <to be read again> \BooleanFalse l.25 ...hanging the Configuration -- section \ref{ sec.portable_configuration... ? ! Emergency stop. <to be read again> \BooleanFalse l.25 ...hanging the Configuration -- section \ref{ sec.portable_configuration... I'll try to build another example. Jul 23, 2022 at 22:48
  • OK, it seems like a package clash, I can look into that
    – michal.h21
    Jul 24, 2022 at 9:22
  • I updated my question w/ a new example, which does not work w/ latest htlatex. Please be so kind to have a look into this. Thanks! Jul 24, 2022 at 16:15

1 Answer 1


This issue seems to be caused by the TeX4ht configuration file for the babel package. It redefines the \ref command in the way which is incompatible with the current LaTeX. Try this updated file, babel.4ht, which omits this problematic redefinition.

% babel.4ht (2022-07-24-19:00), generated from tex4ht-4ht.tex
% Copyright 1999-2009 Eitan M. Gurari
% Copyright 2009-2022 TeX Users Group
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
% This work has the LPPL maintenance status "maintained".
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2022-07-24-19:00}

  \expandafter\let\csname org@\bbl@tempa\endcsname#1

\def\@newl@bel#1#2{{\:SUBOff\:SUPOff \@safe@activestrue
   \xdef\:temp{\noexpand\n:wlbl{#1}{#2}}}\:temp }

\def\:temp#1{{\leavevmode #1}}


\def\:tempc#1{\leavevmode \a:ddj}
\def\:tempc#1{\leavevmode \a:DDJ}


It should compile without errors now. This is the result, showing just ?? as the references are undefined:

enter image description here

  • The sample document compiles fine and the full document can be built too! Many thanks for help! Jul 24, 2022 at 22:28
  • 1
    @HilmarPreuße that's great to hear! I've updated TeX4ht sources, so the fix should be included in TeX Live soon.
    – michal.h21
    Jul 25, 2022 at 7:12
  • I've seen your commit (Revision 1178). It is basically a one-line commit, hence I'm not 100% sure if it identical to the proposed change above. Please be so kind to cofirm. Many thanks! Jul 25, 2022 at 10:51
  • @HilmarPreuße yes, there is just one line change. It suffices, because it prevents the code for \ref to be included in babel.4ht
    – michal.h21
    Jul 25, 2022 at 11:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .