Another way is to use the refcheck
package and add \nocite{*}
in your document. This package will warn you (amongst other things) about unused references. My MWE:
\begin{filecontents}{\jobname.bib}
@BOOK{foo:2012a,
title = {My Title One},
publisher = {My Publisher One},
year = {2012},
editor = {My Editor One},
author = {Author One}
}
@BOOK{foo:2012b,
title = {My Title Two},
publisher = {My Publisher Two},
year = {2012},
editor = {My Editor Two},
author = {Author Two}
}
@BOOK{foo:2012c,
title = {My Title Three},
publisher = {My Publisher Three},
year = {2012},
editor = {My Editor Three},
author = {Author Three}
}
\end{filecontents}
\documentclass{article}
\usepackage{refcheck}
\begin{document}
Hello world \cite{foo:2012a,foo:2012b}.
\nocite{*}
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}
The output:

The reference keys not cited in your document will be displayed between ?...?
. Besides, refcheck
adds the following line to your .log
file:
<Info by RefCheck> Unused bibitem `foo:2012c' on page 1.
Hope it helps. :)
Update: Based on this question, egreg and I came up with a Lua script called checkcites
. The idea of this script is to detect unused or undefined references from LaTeX auxiliary (.aux
) or bibliography (.bib
) files.
Consider the following example: document.tex
\begin{filecontents}{\jobname.bib}
@BOOK{foo:2012a,
title = {My Title One},
publisher = {My Publisher One},
year = {2012},
editor = {My Editor One},
author = {Author One}
}
@BOOK{foo:2012b,
title = {My Title Two},
publisher = {My Publisher Two},
year = {2012},
editor = {My Editor Two},
author = {Author Two}
}
@BOOK{foo:2012c,
title = {My Title Three},
publisher = {My Publisher Three},
year = {2012},
editor = {My Editor Three},
author = {Author Three}
}
@BOOK{foo:2012d,
title = {My Title Four},
publisher = {My Publisher Four},
year = {2012},
editor = {My Editor Four},
author = {Author Four}
}
\end{filecontents}
\documentclass{article}
\begin{document}
Hello world \cite{foo:2012a,foo:2012c},
how are you \cite{foo:2012e}, and
goodbye \cite{foo:2012d,foo:2012a}.
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}
After compiling it, an auxiliary file document.aux
will be generated. Now we will use texlua
(which is available in both MiKTeX and TeX Live distros) to run checkcites
on the .aux
file:
$ texlua checkcites.lua document.aux
The script will look for all unused and undefined references. The output will be:

If you want to look only for unused references in your .bib
file, you can add the --unused
flag:
$ texlua checkcites.lua --unused document.aux
The argument order doesn't matter, so you can also call:
$ texlua checkcites.lua document.aux --unused
Similarly, using
$ texlua checkcites.lua --undefined foo.aux
will make the script only look for undefined references in your .tex
file.
To look for both unused and undefined references, you can also use the --all
flag. If no flag is provided, checkcites
will behave as if --all
was provided.
The script is now available on CTAN and tlmgr
will install it on TeX Live 2011 (or later). Hope you guys like our humble script. :)
Update: As checkcites
is now available on CTAN and TeX Live, there's no need of explicitly calling texlua
nor the original checkcites.lua
file; a simple call to
$ checkcites --unused document.aux
will suffice, since the script is properly wrapped. :)
\cite
d will appear in the bibliography. If you want to make a.bib
file that consists of only those entries cited, then see this: tex.stackexchange.com/questions/32032/….aux
file in the form\citation{ref-label}
..bib
file usingbibexport
to a new file and thendiff
both to see the differences.