Skip to content

Instantly share code, notes, and snippets.

@jrsmith3
Created May 5, 2013 04:13
Show Gist options
  • Save jrsmith3/5519665 to your computer and use it in GitHub Desktop.
Save jrsmith3/5519665 to your computer and use it in GitHub Desktop.
Get a list of bibTeX keys from a LaTeX document using plasTeX.
from plasTeX.TeX import TeX
# The following can be a problem if you are using revtex.
doc = TeX(file="filename.tex").parse()
refs = doc.getElementByTagName("cite")
cites = []
for ref in refs:
cites += ref.attributes["bibkey"]
# Remove duplicate entries.
cites = list(set(cites))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment