1

I am having trouble with getting texcount count the words in the bibliography. I have tried two methods:

  1. The one described on Overleaf: I added %TC:incbib into the preamble and created a file without extension called latexmkrc that in my case includes this:

    END { system('cp', 'output.bbl', 'paper.bbl'); }

  2. From the official documentation of texcount, I included %TC:incbib in the preamble and also tried with calling on texcount by adding the -incbib option.

Unfortunately, none of this works. I don't get an error, but the wordcount of my bibliography does not appear in the texcount output.

My main document is called paper.tex. In the preamble I have:

\PassOptionsToPackage{natbib=true}{biblatex}
\RequirePackage[authordate,backend=biber]{biblatex-chicago}
\addbibresource{bibliography.bib}

All this comes from the official template of the journal I am using. In the reference section I just did:

\printbibliography

The entries in bibliography.bib look like this:

@book{barnes_kaase_1979,
    address = {Beverly Hills, CA},
    title = {Political action: mass participation in five {Western} democracies},
    isbn = {978-0-8039-0957-1},
    publisher = {Sage Publications},
    editor = {Barnes, Samuel Henry and Kaase, Max},
    year = {1979}}

@article{Borbath_Gessler_2020, 
 title={Different worlds of contention? {Protest in Northwestern, Southern and Eastern Europe}}, 
 volume={59}, 
 DOI={10.1111/1475-6765.12379}, 
 number={4}, 
 journal={European Journal of Political Research}, 
 author={Borbáth, Endre and Gessler, Theresa}, 
 year={2020}, 
 pages={910–935}}

Any help on how to get this to work is greatly appreciated!

4
  • The Overleaf pages mentions that the first workaround with the latexmkrc does not work for biblatex: "Note that this workaround is only applicable if you are using a manual thebibliography list or BibTeX. texcount does not currently support biblatex." Presumably that is because texcount counts words in the code and the .bbl files for BibTeX are typesettable text, whereas the ones for biblatex have a different format and just contain all the data. I think a source-based word counting system like texdoc simply won't work for biblatex bibliographies.
    – moewe
    Jun 22, 2021 at 6:08
  • 1
    Yeah, you are right... I was hoping maybe someone has a tip that is different than 'open it with MS Word'. I wonder how others do this, since it feels like nowadays journals are so strict on the word limit, that it is important to have a precise estimate... Can I maybe go from Biblatex to Bibtex? Jun 22, 2021 at 6:28
  • You can switch from biblatex to BibTeX. But if the journal template contains code for biblatex that means they probably want biblatex in which case choosing a different method with different workflow might not go down too well. If the journal do not have biblatex in their template and do not say that they want biblatex, then I'd recommend not to use biblatex anyway (since it may imply a different workflow for the publisher).
    – moewe
    Jun 22, 2021 at 6:31
  • BTW: I am still looking for an answer on this, if someone can help. I understand that the methods I listed are not compatible with biblatex, but maybe there are some alternatives? Jun 24, 2021 at 13:43

1 Answer 1

1

The handling of bibliographies is somewhat limited, and I don't quite recall how it all works, so I hope I'm not saying anything wrong. Beware that my suggested solution (towards the end of this answer) has not been tested.

The incbib setting does not actually force inclusion of the bbl-file. Instead it adds a macro rule for the \bibliography macro to include the bbl-file. As I recall, if the main file is paper.tex, the bbl-file will be paper.bbl, with no option to choose a different bbl-file.

This works well when the \bibliography macro is used. However, if another macro is used, the bibliography will not be included.

The fix should have been to add a similar rule for \printbibliography, but unfortunately the option to do that is lacking. It could easily be added to the TeXcount Perl code, but if you are running on Overleaf, I assume you cannot change the script.

The best fix I can come up with is to "replace" \printbibliography with \bibliography{} when running TeXcount, which can be done by adding the line

%TC:subst \printbibliography \bibliography{}

which will cause TeXcount to do a simple search and replace during its parsing. If you run \printbibliography with optional arguments, you might need to tweak it a little:

%TC:subst \printbibliography \bibliography
\printbibliography[...]{}

where the {} is added at the end since \bibliography requires an argument, resulting in \bibliography[...]{}.

Hopefully, this should trigger inclusion of the bibliography file, or an error message if it doesn't find it.

Note that if the bbl-file is located in another directory, eg in the tex-aux subdirectory, you need to specify this using the -auxdir=... option.

3
  • This works but it gives me a strangely inflated word count, about 17500 words for a bibliography of ten pages. Can I fix it?
    – NCH32
    Mar 5 at 12:58
  • 1
    @NCH32: As I recall, bibliography styles can cause the bbl file to be formatted very differently from regulart TeX text, and not something TeXcount is built to handle well. That's why the default is not to count the bibliography. You might try to look at the bbl file to see what it looks like, and perhaps try one of the simpler bibliography styles to see how that affects TeXcount's ability to count the bibliography text. However, I wouldn't rely on it for an accurate count. Mar 5 at 21:06
  • Normally I don't count bibliographies; this is for a journal that requires it. Unfortunately, neither authoryear nor numeric seems to work. For now I've counted one page by hand and made a rough guesstimate.
    – NCH32
    Mar 7 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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