为什么 latexml 不能识别“appendix”包中的“\appendixpage”?

为什么 latexml 不能识别“appendix”包中的“\appendixpage”?

brew install latexml这是 latexml (安装在 OS X 上)的一个错误:

$ latexml foo.tex
latexml (LaTeXML version 0.8.5)
processing started Sun Aug 29 10:28:25 2021

(Digesting TeX foo...
(Loading /usr/local/Cellar/latexml/0.8.5/libexec/lib/perl5/LaTeXML/Package/TeX.pool.ltxml...
(Loading /usr/local/Cellar/latexml/0.8.5/libexec/lib/perl5/LaTeXML/Package/eTeX.pool.ltxml... 0.00 sec)
(Loading /usr/local/Cellar/latexml/0.8.5/libexec/lib/perl5/LaTeXML/Package/pdfTeX.pool.ltxml... 0.00 sec) 0.14 sec)
(Processing content a_dir/foo.tex...
(Loading /usr/local/Cellar/latexml/0.8.5/libexec/lib/perl5/LaTeXML/Package/LaTeX.pool.ltxml...
(Loading /usr/local/Cellar/latexml/0.8.5/libexec/lib/perl5/LaTeXML/Package/textcomp.sty.ltxml... 0.01 sec) 0.18 sec)
(Loading /usr/local/Cellar/latexml/0.8.5/libexec/lib/perl5/LaTeXML/Package/book.cls.ltxml... 0.01 sec)
(Loading /usr/local/Cellar/latexml/0.8.5/libexec/lib/perl5/LaTeXML/Package/appendix.sty.ltxml... 0.00 sec)
Error:undefined:\appendixpage The token T_CS[\appendixpage] is not defined.
    at foo.tex; line 9 col 0 - line 9 col 13
    Defining it now as <ltx:ERROR/>
    Next token is T_CS[\addappheadtotoc]
    In Core::Gullet[@0x7ffe5bbebc30] a_dir/foo.tex; from line 10 col 0 to line 10 col 16
     <= Core::Stomach[@0x7ffe5c0d9028] <= ...

Error:undefined:\addappheadtotoc The token T_CS[\addappheadtotoc] is not defined.
    at foo.tex; line 10 col 0 - line 10 col 16
    Defining it now as <ltx:ERROR/>
    Next token is T_CS[\par]
    In Core::Gullet[@0x7ffe5bbebc30] a_dir/foo.tex; from line 11 col 0 to line 11 col 1
     <= Core::Stomach[@0x7ffe5c0d9028] <= ...
 0.24 sec) 0.38 sec)
(Building...
(Loading compiled schema /usr/local/Cellar/latexml/0.8.5/libexec/lib/perl5/LaTeXML/resources/RelaxNG/LaTeXML.model... 0.01 sec). 0.05 sec)
(Rewriting... 0.00 sec)
(Finalizing... 0.00 sec)
Conversion complete: 2 errors; 2 undefined macros[\appendixpage, \addappheadtotoc].

这是乳胶:

\documentclass[10pt]{book}
\usepackage{appendix}

\begin{document}

\appendix
\appendixpage
\addappheadtotoc

\appendix
\chapter[Chapter]{Chapter}
\chaptermark{Chaptermark}

Here's a chapter.

\end{document}

答案1

该软件包的(“未完全实现的”)代码位于https://github.com/brucemiller/LaTeXML/blob/master/lib/LaTeXML/Package/appendix.sty.ltxml,并且不包含\appendixpage命令(它在第 28 行被注释掉了)。这解释了为什么会出现错误。要修复错误,您可以按照 David Carlisle 的建议进行近似处理:\providecommand{\appendixpage}{\part*{\appendixname}}。您也可以尝试从包中复制定义,但有几个定义需要您进行跟踪。

相关内容