htlatex 无法转换文件

htlatex 无法转换文件

我尝试使用 htlatex 将以下 LaTeX 代码转换为 HTML

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

\begin{document}

\appendix

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

\end{document}

当使用 Debian 稳定版的 TeX Live 时,这可以正常工作;当使用 Debian 不稳定版时,我收到一个错误:

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}

由于代码可以使用 LaTeX 处理,因此我认为它是有效的 LaTeX 代码。我知道最近 tex4ht 发生了很多变化。这是一个已知问题吗?目前已经解决了吗?谢谢!

更新 20220724:

这是一个新的最小示例。即使更新到最新版本的 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}

使用 htlatex 处理文档会产生错误:

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

当删除对 babel 或 \ref 命令的调用时,处理工作正常。使用 (Lua)LaTeX 处理文档工作正常,当然未定义引用的警告仍然存在。

你能帮助我吗?谢谢!

答案1

此问题似乎是由软件包的 TeX4ht 配置文件引起的babel。它\ref以与当前 LaTeX 不兼容的方式重新定义了命令。请尝试此更新的文件,babel.4ht它省略了这个有问题的重新定义。

% 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

现在应该可以编译了,不会出现错误。结果如下,显示??引用未定义:

在此处输入图片描述

相关内容