LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

Spurious bibitem in {thebibliography} with custom macros

Open dginev opened this issue 1 year ago • 0 comments
trafficstars

This is a subtle issue that arises in .bbl files which also contain some custom bookkeeping macros - things like conditionals and assignments to registers - just before some or all concnrete \bibitem cases.

A distilled minimal example is:

\documentclass{article}
\begin{document}
\begin{thebibliography}{1}

\relax\bibitem[Author et~al.(2019)Author, Other]{Author2019}
  Some content.

\end{thebibliography}
\end{document}

which produces the bibliography:

  <bibliography xml:id="bib">
    <title>References</title>
    <biblist>
      <bibitem xml:id="bib.bib1">
        <tags>
          <tag>[1]</tag>
          <tag role="refnum">1</tag>
        </tags>
        <bibblock/>
      </bibitem>
      <bibitem key="Author2019" xml:id="bib.bibx1">
        <tags>
          <tag>[Author et al.(2019)Author, Other]</tag>
          <tag role="refnum">Author et al.(2019)Author, Other</tag>
        </tags>
        <bibblock>
Some content.
</bibblock>
      </bibitem>
    </biblist>
  </bibliography>

It should be possible to avoid creating the leading empty [1] bibitem.

dginev avatar Aug 19 '24 21:08 dginev