There seems to be a known incompatibility between biblatex and tex4ht when using defernumbers=true.
I have one large .bib file. In the document I want to group the references into different categories. When using numerical labels, this requires defernumbers=true to obtain consecutive numbering.
Everything works fine, apart from that htlatex chokes on this option with the following error:
! LaTeX Error: Missing \begin{document} in `'.
Forcing the run to continue for the example below, I obtain a usable .html, but there is a erroneous span tag right at the beginning:
<span
class="cmr-10">01 12</span>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
This example illustrates the problem:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{sample.bib}
@article{Smith42,
AUTHOR = {Smith},
TITLE = {Some Title},
JOURNAL = {Some Journal},
YEAR = {1942},
}
@article{Aronson12,
AUTHOR = {Aronson},
TITLE = {Some Title},
JOURNAL = {Some Journal},
YEAR = {1912},
}
\end{filecontents}
\usepackage[style=numeric,defernumbers=true]{biblatex}
% The following instead of the previous line works with tex4ht, but the numbering is not as desired.
%\usepackage[style=numeric]{biblatex}
\bibliography{sample.bib}
\DeclareBibliographyCategory{group1}
\DeclareBibliographyCategory{group2}
\addtocategory{group1}{Smith42}
\addtocategory{group2}{Aronson12,Smith42}
\begin{document}
\nocite{*}
\printbibliography[category=group1]
\printbibliography[category=group2]
\end{document}
Note that the problem doesn't occur without the option defernumbers=true. I am using an up-to-date TL 2011 distribution, i.e., a biblatex.sty version 1.7 dated 2011/11/13 19:09:07 and biblatex.4ht dated 2011-09-18-16:07.
Is there a workaround for this that doesn't require editing the .bib file?
htlatexfromtexlive-coreversion2022.63035-1and the currentbiberfrom the community repo. However, the automatic generation ofsample.bibonly worked for me after removing\usepackage{filecontents}and changing\begin{filecontents}{sample.bib}into\begin{filecontents}[overwrite]{sample.bib}. – Manfred Sauter Jun 20 '22 at 23:33