7

Is there a way of knowing if I left out any bibliography entry in a specific tex file from an specific bib file?

I am doing a kind of a literature review and every day I write a bit I find several papers to add. I generally add them and write about them in the moment, but it would be nice to make sure I haven't left any of them out.

  • 3
    use grep or some other search tool, or use a number in order of reference bibligraphy style and put \nocite{*} at the end of the document then any "unused" references will appear at the end of your reference list with the highest numbers, coming after any real references – David Carlisle Jan 22 '15 at 14:29
  • if you include a bibliography, and use either \cite or \nocite for each of the items you're writing about, after processing the review with bibliography, your log will tell you what's missing. if you've used \cite, there will be ?? in your output instead of the cited item, but only the log will say what the reference label is. – barbara beeton Jan 22 '15 at 14:30
  • @DavidCarlisle Definetly the answer I was looking for. I didn't thought it ws going to be as easy. I believe you should answer the question, for the shake of knowledge base philosophy! – Ander Biguri Jan 22 '15 at 14:33
6

Use grep or some other search tool, or use a number in order of reference bibliography style and put \nocite{*} at the end of the document then any "unused" references will appear at the end of your reference list with the highest numbers, coming after any real reference

3

You can use the checkcites script, which is available in every recent TeX distribution.

Here's an example file, save it as checktest.tex; usage of \jobname and filecontents* is just for making the example selfcontained, you'll use your own .bib file, of course.

\begin{filecontents*}{\jobname.bib}
@article{used,
  author={A. Uthor},
  title={Title},
  journal={Journal},
  year={2015},
}
@article{unused,
  author={W. Riter},
  title={Title},
  journal={Journal},
  year={2015},
}
\end{filecontents*}

\documentclass{article}
\begin{document}

\cite{used}

\cite{undefined}

\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

If you compile it and run

checkcites checktest

The terminal will output

checkcites.lua -- a reference checker script (v1.0i)
Copyright (c) 2012 Enrico Gregorio, Paulo Roberto Massa Cereda

I found 2 citation(s).
Great, there's only one 'bib' file. Let me check it.
I found 2 reference(s).

Unused reference(s) in your bibliography file(s): 1
- unused

Undefined reference(s) in your TeX file: 1
- undefined

So the unused entry has no corresponding \cite command in the file, while undefined has a \cite, but has no entry in the .bib file.

  • This answer is awesome – Ander Biguri Jan 22 '15 at 15:59

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.