Is there any way to produce a table that can provide counts based on the @article, @proceedings and other categories in bibtex?

  • 1
    Welcome to TeX.SX! What do you mean by “produce”? Do you want to insert into a LaTeX document a typeset table showing those statistics? Or you just need to compile such statistics for your own use? Please clarify. – GuM Oct 6 '18 at 22:59
  • I want to create a macro that will print a table in the final pdf based on what is in my bib file – Michael Oct 6 '18 at 23:07

The number of entries per entry type can easily be counted in biblatex's \AtDataInput hook. The data is then available from the moment the .bbl file is read. If you want to count only one specific \printbibliography the approach could be similar with \AtEveryBibitem.

The code creates a counter for each refsection and type that counts the number of entries of that type in that refsection. A generic counter for each type is defined in terms of the refsection-specific counter for the current refsection.


\usepackage[style=authoryear, backend=biber]{biblatex}



% generic counters: typecounter@article, ...
% will throw an error if Biber hasn't been run yet, so I'd avoid them
    \csname typecounter@\the\c@refsection @#1\endcsname}%

% initialise refsection-specific counters

% count entries of each type for this refsection
% \AtDataInput is executed once for every refsection
  \stepcounter{typecounter@\the\c@refsection @\abx@field@entrytype}}

% produce a table
    \ifltxcounter{typecounter@\the\c@refsection @##1}
      {\ifnum\value{typecounter@\the\c@refsection @##1}>0
            & \arabic{typecounter@\the\c@refsection @##1}\\}
        Type & Count \\

% custom names for the table can be defined with
% typecounter@name@<entrytype>
\csdef{typecounter@name@article}{Journal articles}




The MWE shows a few citations together with the bibliography. At the end of the document there is a table listing all entry types with at least one entry and their respective entry counts.

  • Works perfectly and it was exactly what I wanted. One thing to note, I got an error related to the use of biber as a backend but that was quickly fixed using \usepackage[style=authoryear, backend=bibtex]{biblatex} – Michael Oct 10 '18 at 2:00
  • Subsequent question, how can I define custom names for the type @bibtypecounttable variable? For example, instead of article to manually say Journal article. – Michael Oct 10 '18 at 2:07
  • @Michael See the edit. The code show work for both Biber and BibTeX, but you have to run Biber if you have backend=biber in the code: tex.stackexchange.com/q/154751/35864 – moewe Oct 10 '18 at 5:48
  • does the change include how to change the names of the defaults (e.g., article -> journal article). – Michael Oct 11 '18 at 2:47
  • @Michael Yes, see \csdef{typecounter@name@article}{Journal articles}. You can define \csdef{typecounter@name@<entrytype>}{<output>} in the preamble and then <output> will be printed instead of the entry type. I could not be bothered to update the image, but the code as posted now should already produce 'journal article'. – moewe Oct 11 '18 at 5:05

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.