I have recently switched from BibTeX to the biblatex package (using the Biber back-end) and I can only subscribe what others have already said about its many virtues. This question is not so much about biblatex itself as about its interaction with the TeXcount scripting facilities for word counting in TeX-based documents. How can the settings of the latter script be tuned in order for it to work with biblatex (meaning, for TeXcount to be able to proceed as it does with BibTeX)?

  • 4
    I am planning on adding a biber feature to add a word count directly to the .bbl as it's much easier and more reliable for biber to calculate this from internal data than to guess it from the .bbl. It will either be in a comment or a macro like \wordcount{num}
    – PLK
    Apr 26, 2013 at 9:15

2 Answers 2


This is a tricky topic because with pure bibtex, the .bbl you see is what is included in the document. With biblatex, the .bbl is essentially a database and not necessarily everything in there appears in the document. It depends on the biblatex style and which fields it chooses to use. In general, a wordcount of a biblatex .bbl will overestimate the number you want for the document. Even if biber makes this easier by calculating the .bbl wordcount for you (which it doesn't yet), it will nearly always be an overestimate as there is no way of knowing from the .bbl what happens to the fields in the style.

Having thought about this some more, I think it's not really possible to wordcount biblatex bibliographies in any decent way. The problem is that there are many biblatex options like minnames, uniquename, uniquelist, useprefix etc. which reduce/increase the number of "words" used from the .bbl at compile time. This means that you are never really going to have an accurate word count of the bibliography or citations by looking at the .bbl. You'd have to take account of the style, the biblatex options, any user-code which copies/removes/changes .bbl data. Plus it's very hard even for biber to "count" things like related entries (which may or may not have data used in the output), data based in inheritance rules (CROSSREF and XDATA), XREF (completely impossible as it's all done in arbitrary biblatex code at compile time), "data-only" entries for sets etc. Basically, you'll get an approximation at best.

It is probably more reliable to count the finished PDF using pdftotext | wc or whatever. This can have problems with maths but it'll probably be better than trying to count biblatex .bbls, especially if you are using any of the biber features like related entries, XDATA etc.

  • And with a verbose style it may underestimate, perhaps, instead, since the same citation data may get typeset several times. Apr 26, 2013 at 22:03
  • Yes, good point. In general, word counting the pre-compiled source doesn't work conceptually with biblatex at all I'm afraid.
    – PLK
    Apr 27, 2013 at 8:15
  • Thanks for the detailed explanation on the issues. Although it doesn't provide a solution, I am awarding you the bounty. I guess the discussion should probably go into a package that would calculate the word count at compile time, since as you mention it, counting at the pre-compiled source level is not accurate (this is also the case I think with bibtex depending on the bibliography style (numbered or author-year). The problem I can foresee with the package solution is that it would be very easy to run out of memory with large document.
    – ArTourter
    Apr 29, 2013 at 11:08
  • 1
    It's a bit easier with bibtex because the .bbl is essentially the final form which is spliced in at the \bibliography command position. The whole point of biblatex is precisely that this has a lot of limitations which is why it treats the .bbl more like a TeX database of sorts ...
    – PLK
    Apr 29, 2013 at 11:24
  • What I meant was that the appearance in the text of the reference changes with the style, which I think is not in the bbl or the source and only generated at compile time. I am not sure how texcount takes that into account if at all, but would assume it does not.
    – ArTourter
    Apr 29, 2013 at 15:51

Digging in the documentation of TeXcount, I can propose the following workaround. Please note that it is far from perfect:

  • it will throw out a lot of (non critical) errors due to the way TeXcount parses \verb
  • it will be imprecise (count some things which aren't words, not count others... I deem it as acceptable because there is the same problem with bibtex)

So, you need to add rules for TeXcount. In the following, the rules are in the "document" format, as you would include them in the document you want to parse, but you can easily transform them into global TeXcount rules.

The first thing is to get it to parse the filename.bbl file with -incbib. We are quite lucky that biber uses the same .bbl extension as bibtex, so all we have to do is convince TeXcount that we are using a bibliography:

%TC:subst \printbibliography \bibliography

Now, for the counting, we have to add rules for biblatex's macros. They are more or less approximate, especially the \name one, which will count one word for an internal hash, but I don't see any easy workaround. Anyway, as previously stated, given the unaccuracy of the overall count in the bibliography, I consider this one more mistake as acceptable.

%TC:macro \field [0,1]
%TC:macro \name [0,0,0,1]
%TC:macro \list [0,0,1]

This may miss some macros, but adding some more isn't really difficult: just look at the .bbl file to see what is expected to be in the macro arguments, and select the arguments in which you want to count the words (0: don't count, 1: do count).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .