Skip to content

Instantly share code, notes, and snippets.

@sean-duffy
Last active April 4, 2017 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sean-duffy/a76d74c6132ae8adfd6253debde384ad to your computer and use it in GitHub Desktop.
Save sean-duffy/a76d74c6132ae8adfd6253debde384ad to your computer and use it in GitHub Desktop.
import re
references = []
with open('references.bib', 'r') as references_file:
references = re.findall('@\w*{(.*),', references_file.read())
dupes = [x for x in references if references.count(x) > 1]
not_cited = []
with open('project.tex', 'r') as project_file:
project_string = project_file.read()
for reference in references:
if not reference in project_string:
not_cited.append(reference)
if len(not_cited) > 0:
print 'The following {} references are not cited in your report:'.format(len(not_cited))
for reference in not_cited:
print reference
if len(dupes) > 0:
print 'The following {} references are duplicated in your bibtex file:'.format(len(dupes))
for dupe in dupes:
print dupe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment