TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

class="cmr-10">01 12</span>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  

This example illustrates the problem:


    AUTHOR = {Smith}, 
    TITLE = {Some Title}, 
    JOURNAL = {Some Journal},
    YEAR = {1942},
    AUTHOR = {Aronson}, 
    TITLE = {Some Title}, 
    JOURNAL = {Some Journal},
    YEAR = {1912},

% The following instead of the previous line works with tex4ht, but the numbering is not as desired.




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?

share|improve this question

I'm not sure if this will help exactly with the problem above - but I'll try to jot down my debugging steps. I was using a customized bibliography sorting in biblatex, which then requires biber - and, all being good in the PDF - as soon as I wanted to build this using htlatex, biber, htlatex - I got the above error (only when the .aux file is present)..

So first I get something like:

! LaTeX Error: Missing \begin{document} in `'.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.29 ...backref{1}{myfirstcite}{0}{4}{4}

I search with grep through files to find this ...backref{1}{myfirstcite} - and it turns out it is in the .aux file; contents around that line look like this:

\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\select@language{american}}
\@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\select@language{american}}
\@writefile{lot}{\defcounter {refsection}{0}\relax }\@writefile{lot}{\select@language{american}}

So I go back, run htlatex again - and now when it stops at error, I press 'I' in the shell to insert, and then just type \show and ENTER (ENTER maybe twice) - this spits an additional error message:

! Extra }, or forgotten \endgroup.
\abx@aux@backref ...{#2}}{#4}}\blx@addpagesum {#1}
l.29 ...backref{1}{myfirstcite}{0}{4}{4}

Ok, so by now, I'm pretty sure tex4ht doesn't like \abx@aux@backref.

So, I search first for the macro \abx@aux@page - and it turns out it is present in biblatex.4ht file (from tex4ht); a snippet looks like:

% ...
% ...

... but it also appears in biblatex.sty (from biblatex).

Then I search for \abx@aux@backref - and, as suspected - this one is defined in biblatex.sty, but not in biblatex.4ht; which is probably the reason why it crashes.

Now, \abx@aux@backref contains an @, meaning I'd have to define it in between \makeatletter/\makeatother - somewhere in the preamble after both biblatex and tex4ht are loaded. However, often times in similar cases I just do \let\abx@aux@backref\relax - but, that will not work here, because the original command always has five arguments.

So, after another search through biblatex.sty, I find: "\protected\def\blx@aux@backref#1#2#3#4#5{..." - and while that is not the same command, it is certainly to related to something @aux@backref ... So, in the end I put this in my preamble:


... and now the htlatex, biber, htlatex combo seems to pass for me?!


Well, not sure how right I am about all this - but certainly hope it helps,

share|improve this answer
This is perfect! Everything works now that I have that mysterious blx@aux@backref stuff in my preamble. Surely the biblatex people or the tex4ht people can do something about this, since it is fixable. – Andrew Aug 29 '12 at 19:55
In my example the htlatex run fails with l.9 \abx@aux@number{0}{Smith42}{0}{1} (at least for me). If I just blank out \abx@aux@number like you did with \abx@aux@backref, then htlatex indeed passes. However, the html output does not reflect the option defernumbers=true (i.e., the numbering is the standard one). – Manfred Sauter Nov 23 '12 at 6:00

The biblatex.4ht which you use is incompatible with biblatex 1.7. You can use http://von-wachter.de/dateien/for-biblatex-1-6/biblatex.4ht with http://sourceforge.net/projects/biblatex/files/biblatex-1.6/.

share|improve this answer
Well, I think that I had tried this already before I posted my question here. Anyhow, I gave your suggestion a try and downgraded to biblatex-1.6 using the above biblatex.4ht. For my MWE it behaves exactly the same, i.e., it gives the same error and the same defective html output. – Manfred Sauter Nov 23 '12 at 6:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.