I am creating an annotated bibliography. Is there a way of obtaining a count of the number of references in a bibliography meeting certain criteria and inserting that into a document?
For example using biblatex I create one section using:
\nocite{*} ;; include all references in .bib file
\printbibliography[keyword=MyProject,type=report,title=My project reports]
and another using:
\printbibliography[keyword=AnotherProject,type=report,title=Another project's reports]
Somewhere else in the document I would like to be able to put a table with counts of number of number of reports by project, or include these counts in text. So for example:
"This year, My Project produced XX reports, while Another Project produced YY reports."
Any ideas on how to get started on that?
Update:
Based on Maieul's excellent and quick answer, I have the following MWE:
\documentclass[oneside,oldfontcommands,9pt,a4paper]{memoir}
\usepackage{url}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,natbib=true,backend=biber,url=false,doi=false,eprint=false,isbn=false,maxbibnames=98]{biblatex}
\addbibresource{mybiblio.bib}
\begin{document}
\nocite{*}
\chapter{Introduction}
My project produced \thearticles peer-reviewed articles and Another Project produced \theotherarticles peer-reviewed articles. \par
Note - no numbers here.
\newcounter{articles}
\renewbibmacro*{finentry}{\stepcounter{articles}\finentry}
\printbibliography[keyword=MyProject,title=My project peer-reviewed articles,type=article]
\newcounter{otherarticles}
\renewbibmacro*{finentry}{\stepcounter{otherarticles}\finentry}
\printbibliography[keyword=AnotherProject,title=Another project peer-reviewed articles,type=article]
My project produced \thearticles peer-reviewed articles and Another Project produced \theotherarticles peer-reviewed articles. \par
This works
\end{document}
Where mybiblio.bib looks like:
@ARTICLE{Other2000,
author = { Other, A N},
title = { my article},
journal = { Some journal },
keywords = {MyProject},
year = {2000},
number={2},
volume = {343},
pages = {230-8}
}
@article{Author1993,
author = {Author, E and Author, M},
journal = {Some Journal},
keywords = {MyProject},
number = {4},
pages = {424--428},
title = {{Another article}},
volume = {6},
year = {1993}
}
@article{Author1997a,
author = {Author, F and Author, T },
journal = {Another journal},
keywords = {AnotherProject},
title = {{A third article}},
year = {1997}
}
However, as you will see I cannot refer to the counters earlier in the document than the \printbibliography commands. Is there any way to be able to refer to the counters early on?