2

Here is an error from latexml (installed with brew install latexml on 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].

Here is the latex:

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

\begin{document}

\appendix \appendixpage \addappheadtotoc

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

Here's a chapter.

\end{document}

dfrankow
  • 233
  • Sure, that's just a cut and paste error. I changed the "include" to an "input" above (and in the original file). This is not the same question. This question is about appendixpage. – dfrankow Aug 29 '21 at 15:23
  • I am not using \include. That was a cut-and-paste error. – dfrankow Aug 29 '21 at 15:24
  • I made a single reproducible test case, and pasted the actual error messages. – dfrankow Aug 29 '21 at 15:32
  • Thanks I get same error:-) you could ask on latexml github for the appendix package support to be extended, or use \part*{Appendix} which seems to be more or less the same – David Carlisle Aug 29 '21 at 15:39
  • The original appendix package from CTAN defines the \appendixpage macro. I have no ide what might be on latexml github or why it should differ from the CTAN version. – Peter Wilson Aug 29 '21 at 17:26
  • @PeterWilson LaTeXML uses Perl to convert tex to xml. Sometimes they use the CTAN version of a style file, and sometimes they write their own conversion. It appears they wrote their own conversion for the appendix package, but missed this command. – Teepeemm Aug 30 '21 at 00:39

1 Answers1

3

The ("incompletely implemented") code for that package is at https://github.com/brucemiller/LaTeXML/blob/master/lib/LaTeXML/Package/appendix.sty.ltxml, and does not include the \appendixpage command (it's commented out at line 28). That explains why you get the error. To fix the error, you could approximate it as David Carlisle suggested: \providecommand{\appendixpage}{\part*{\appendixname}}. You could also try copying definitions from the package, but there are several definitions that you'd need to trace through.

Teepeemm
  • 6,708
  • Thanks for the code ref. That code seems to define \appendices. I wonder if that is a command I could use (that would also work outside of latexml). – dfrankow Aug 29 '21 at 15:58
  • You can also \usepackage{latexml} to access the conditional \iflatexml...\else...\fi. – Teepeemm Aug 29 '21 at 16:06