Suppose, that we write a survey. Somehow we need to count a number of reviewed papers. The simplest way is to create a counter, say, refsRev and add 1 at each \cite.

I created newcommand \rcite, which wrap \cite and adds 1 to refsRevS counter. However, it would be great to have more general decision.

One possible way of problem-solving is to create a special field in bib-entries (a field note is used for another purposes). Then if this field exists for a bib-entry (or we can check a value inside an entry), count the reference, say within citenum.

I've tried to implement another possible way of problem-solving: to create a special environment. However

  1. citenum, which works fine with biblatex is broken for biber
  2. I do not know how to save a number of current citings (without duplicates) at the beginning of environment and at the end of environment

As a MWE we can use a MWE given here with some modifications. Perhaps, it is possible to use somehow assoccnt package as it is done by egreg for counting chapters here

Here is my MWE:



        author = {Author, A.},
        year = {2001},
        title = {Alpha}
        author = {Buthor, B.},
        year = {2002},
        title = {Betta}
        author = {Cuthor, C.},
        year = {2003},
        title = {Charlie}
    author = {Duthor, D.},
    year = {2004},
    title = {Delta}
        author = {Euthor, D.},
        year = {2005},
        title = {Eelta}

 % http://texblog.org/2012/04/16/counting-the-total-number-of/  
\newtotcounter{citenum} %total counter for references %broken

% attempt to create an environment
\newcounter{refsRev} %counter for total citings in environment countRefs
\newcounter{atBeginOfCountRefs} % save a current number of citings at the begining of env
\newcounter{atEndOfCountRefs} % save a current number of citings at the end of env
    % 1) save number of references at the begining and at the end of environment
    % 2) calculate the differense between them
    % 3) add to refsRev the current values of counters 

% new cite-like command, seems to be safe, i.e. with the same properities as \cite[]{} 

Here we need to mention that there are \therefsRev $\:$  references in some parts of text, which are wrapped by our environment countRefs.

This document contains \total{citenum} references (possibly with multiple citations). %broken
Some text \autocite{A01}.
Here we begin review papers.
Some text \autocite{B02} = \rcite{B02}
Some text \autocite{B02}. % this value should be deleted
Some text \autocite{C03}.
Some text \autocite{D04}.
Here we temporary stop review papers.
Some text \autocite{A01}.
The current number of refsRev papers is ... % 3 papers
Continuation of papers review.  
Some text \cite[p.2~]{E05} = \rcite[p.2~]{E05}
Some text \autocite{D04}.
End of papers review.   
The current number of refsRev papers is ... % 4 papers
The current number of refsRevS papers is \therefsRevS.

The question is how to get one of two mentioned decisions to count survey papers?

UPT: It would be great to have an opportunity to add by \rcite a citing into a counter, which is used for the environment, i.e. to mix these two approaches.

Counters on references

  • 1
    This seems very complicated. Biber already counts the citations. Why not \immediate\write18{grep citekeys \jobname.blg | cut -d' ' -f6 > citekeys.txt} then \newread\citecnt \openin\citecnt=citekeys.txt \read\citecnt to \printcitecnt. Usage: The total number of citations is \printcitecnt. (Compile with option -shell-escape.)
    – jon
    Dec 11, 2016 at 18:12
  • 1
    There is a successor to assoccnt, named xassoccnt, but as its author, I doubt that it is useful at all for your purpose
    – user31729
    Dec 27, 2016 at 11:05
  • 1
    Dear @ChristianHupfer, thank you for the comment. The task is really hard, perhaps it is better just to use \rcite command. Dec 28, 2016 at 21:17
  • @VladimirParkhomenko: I am no biblatex expert, so no advice from me here. I can't say whether it is possible to implement something in xassoccnt what you request
    – user31729
    Jan 2, 2017 at 0:47


You must log in to answer this question.