1

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

\listfiles
\documentclass[a4paper,12pt,oneside,openany]{book}

\begin{document}

\appendix

\chapter{Regular expressions}
\label{sec:regexp}

\end{document}

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
                             \theappendix
l.15 \label{sec:regexp}

?
! Emergency stop.
\@currentlabel ->\p@appendix
                             \theappendix
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.

\documentclass[a4paper,12pt]{minimal}
\usepackage[french,english]{babel}
\begin{document}

-- 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}.

\end{document}

Processing the document using htlatex generates an error:

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

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!

6
  • 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

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}


\def\:tempc#1{%
  \edef\bbl@tempa{\expandafter\@gobble\string#1}%
  \expandafter\let\csname org@\bbl@tempa\endcsname#1
  \expandafter\def\csname\bbl@tempa\endcsname}
\let\@c:tex\@citex
\:tempc\@c:tex[#1]#2{%
  \@safe@activestrue\org@@c:tex[#1]{#2}\@safe@activesfalse}
\let\@citex\@c:tex


\def\@newl@bel#1#2{{\:SUBOff\:SUPOff \@safe@activestrue
   \xdef\:temp{\noexpand\n:wlbl{#1}{#2}}}\:temp }
\pend:defI\l:bel{\Protect\@safe@activestrue}
\append:defI\l:bel{\Protect\@safe@activesfalse}
\let\@b:bitem=\@bibitem
\def\@bibitem#1{\@safe@activestrue
  \edef\:temp{\noexpand\@b:bitem{#1}}\@safe@activesfalse\:temp}

\def\:temp#1{{\leavevmode #1}}
\HLet\save@sf@q\:temp
\def\:tempc#1#2#3{\HCode{<sub>}{\let\/=\empty#1}\HCode{</sub>}}
\HLet\set@low@box\:tempc
\HLet\quotedblbase\empty
\HLet\quotesinglbase\empty
\NewConfigure{quotedblbase}[1]{\def\n:quotedblbase:{#1}}
\NewConfigure{quotesinglbase}[1]{\def\n:quotesinglbase:{#1}}
\Configure{quotedblbase}{\o:quotedblbase:}
\Configure{quotesinglbase}{\o:quotesinglbase:}

\def\arabic:loopoverdigits#1{\ifx\relax#1\else%
\ht:special{t4ht@+&{35}x066#1{59}}\a:HChar%
\expandafter\arabic:loopoverdigits\fi}
\def\arabicdigits#1{\arabic:loopoverdigits#1\relax}

\def\active:prefix#1{\protect#1}
\def\:temp#1{%
  \ifx\protect\@typeset@protect
  \else
    \bbl@afterfi\active:prefix#1\@gobble
  \fi}
\HLet\active@prefix\:temp
\def\:tempc#1{\leavevmode \a:ddj}
\HLet\ddj@=\:tempc
\def\:tempc#1{\leavevmode \a:DDJ}
\HLet\DDJ@=\:tempc
\NewConfigure{ddj}{1}
\NewConfigure{DDJ}{1}
\Configure{DDJ}{\leavevmode\ht:special{t4ht@+{38}{35}x0110;}\a:HChar}
\Configure{ddj}{\leavevmode\ht:special{t4ht@+{38}{35}x0111;}\a:HChar}

\Hinput{babel}
\endinput

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

enter image description here

4
  • 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 .