梅威瑟:
\documentclass{amsart}
\usepackage{hyperref}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}\label{thm}
This is a theorem.
\end{theorem}
\begin{proof}[Proof of Theorem~\ref{thm}]
This is a proof.
\end{proof}
\end{document}
编译后make4ht
,得到
[ERROR] htlatex: ./test.tex 11 Extra \else.
如果不包含包则不会出错hyperref
。另外值得一提的是,如果我们用 替换,也会出现此\begin{proof}[Proof of Theorem~\ref{thm}]
问题\begin{proof}[Proof of Theorem~\hyperref[thm]{some theorem}]
。
我想知道原因和解决方法。谢谢。
答案1
此问题是由于删除了 TeX4ht 中 Hyperref 的一些补充代码而导致的。这样做的原因是与 BibLaTeX 冲突。由于我发现此更改还导致其他问题,我已将原始代码重新引入 TeX4ht 源。与此同时,您可以使用该hyperref-hooks.4ht
文件的本地副本:
% hyperref-hooks.4ht (2021-12-08-12:41), generated from tex4ht-4ht.tex
% Copyright 2021 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 2021-12-08-12:41}
% we don't have any code here for now
\:AtEndOfPackage{%
\@ifpackageloaded{nameref}{}
{%
\let\sv:label\label
\RequirePackage{nameref}%
\let\label\sv:label
%\input nameref.4ht
}}
您的示例现在可以编译,没有错误: