Last active
April 4, 2017 16:14
-
-
Save sean-duffy/a76d74c6132ae8adfd6253debde384ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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