58

I am writing a paper, and I would like to be able to find out automatically how many times each reference is cited. This could either be appended to the references in a printed version, or outputted as a separate file.

I've seen Check if an entry is cited multiple times, but it focusses on checking each reference at the point of citation, while I want to do an overall count.

The reasons are twofold. Firstly, to see if any references are being 'overcited'. Secondly, if space becomes an issue, to be able to see easily which references are only being cited once and could potentially be removed with minimum fuss.

1
  • 1
    Only 2 answers!
    – Sigur
    Commented Jan 9, 2019 at 21:57

4 Answers 4

56

If you're willing to switch to biblatex, you may use the citecounter feature that was added in v1.3.

\documentclass{article}

\usepackage[citecounter=true]{biblatex}

\renewcommand{\finentrypunct}{%
  \addperiod\space
  (Cited \arabic{citecounter}~time\ifnumequal{\value{citecounter}}{1}{}{s})%
}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
@misc{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

Some text \autocite{A01}.

Some text \autocite{B02}.

Some text \autocite{A01}.

\printbibliography

\end{document}

enter image description here

1
  • Stangely, when I switch from style=authoryear to style=apa, most of the citation counts disappear. Any ideas on why this is happening? Perhaps I need to provide a minimal example.
    – PLG
    Commented Jun 26, 2015 at 11:26
14

You can use the backref or pagebackref options to hyperref to get links to section or page numbers after each reference in the bibliography if you don't want to switch to biblatex.

3
  • 1
    IIRC, the backref option doesn't tell you if a reference was cited multiple times on the same page.
    – lockstep
    Commented Mar 24, 2011 at 14:22
  • @lockstep: Yes, you're absolutely right. I should have pointed out that this just gives a rough indication of how often a reference is cited. (Also, I could have sworn I upvoted your answer...fixed.)
    – TH.
    Commented Mar 24, 2011 at 14:25
  • 8
    @lockstep: with version 1.21 or later of backref there is the \backrefalt formatting hook that gives access to the number of duplicate citations. Since version 1.33 the \backrefentrycount wrapper makes this more easily accessible.
    – Lev Bishop
    Commented Mar 24, 2011 at 15:19
2

The following worked for my natbib-powered document (it's the code OP used on How to show Not cited and Cited i times on pages ..., in the bibliography when using biblatex?). Just paste this somewhere in the preamble and you can easily see in the references which entries are the most and least cited.

\usepackage[pagebackref=true]{hyperref}
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4] {
    \ifcase #1
        No citation in the text.
    \or
        Cited on page #2.
    \else
        Cited #1 times on pages #2.
    \fi
}

P.S.: I remember using a simpler solution a couple of years ago, IIRC there is a package that automatically does something similar to the code above.

1

Here is a quick and dirty version of counting using Excel:

  1. Copy the content of the "main.aux" file into column A of an Excel spreadsheet.
  2. Click "Analyze Data" in Excel and you should get an overview of how often every entry appears.

If this didnt work, you'd have to create this overview manually by following the next steps:

  1. Insert the number 1 in column B for every entry of column A.
  2. Add a title for the two columns in line 1, e.g., "citation" and "counter".
  3. Highlight column A and B and insert a Pivot table.
  4. Set "citations" as the lines of the Pivot table and set the sum of "counter" as the value.
  5. Copy the Pivot table to another sheet (only values) and sort the column with the summed counter in descending order.

Note: In order to handle citations of multiple authors like \citation{Bob.2019,Alice.2025}, do some preparation:

  1. Open the "main.aux" file in an editor, preferable Notepad++.
  2. Search and replace "\citation{" with "" (leave the cell empty) to get rid of the string.
  3. Search and replace "}" with "" to get rid of it
  4. Search and replace "," with "\n" to create a line break between the two bibtex keys. Make sure that "Extended (\n, \r, \t, \0, \x...)" is activated in the search mode of Notepad++.

You must log in to answer this question.

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