brucemiller / LaTeXML

LaTeXML: a TeX and LaTeX to XML/HTML/ePub/MathML translator.
http://dlmf.nist.gov/LaTeXML/
Other
961 stars 101 forks source link

Header levels off in appendix #2167

Closed rzach closed 1 year ago

rzach commented 1 year ago

After an \appendix the resulting header levels are off: both chapters and sections are turned into <h1>s. E.g.,

\documentclass{book}
\usepackage{latexml}

\begin{document}
\appendix
\chapter{Chapter}
\section{Section}
\paragraph{Paragraph}
\end{document}

results in

<section class="ltx_appendix">
<h1 class="ltx_title ltx_title_appendix">
<span class="ltx_tag ltx_tag_appendix">Appendix A </span>Chapter</h1>

<section id="S1" class="ltx_section">
<h1 class="ltx_title ltx_title_section">
<span class="ltx_tag ltx_tag_section">A.1 </span>Section</h1>

<section id="S1.SS0.SSS0.Px1" class="ltx_paragraph">
<h2 class="ltx_title ltx_title_paragraph">Paragraph</h2>
dginev commented 1 year ago

Nice catch, thanks @rzach . The main XML is even more telling in this case, it looks like the chapter was mistakenly merged with the appendix early on (judging by its title):

  <appendix inlist="toc" xml:id="A1">
    <tags>
      <tag>Appendix A</tag>
      <tag role="refnum">A</tag>
      <tag role="typerefnum">Appendix A</tag>
    </tags>
    <title><tag close=" ">Appendix A</tag>Chapter</title>
    <toctitle><tag close=" ">A</tag>Chapter</toctitle>
brucemiller commented 1 year ago

No, that's intentional; in book.cls after \appendix, \chapter generates an ltx:appendix instead of ltx:chapter. It's the header numbering "math" that's off in the xslt, I think.