Skip to content

agdelma/cleanbib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cleanbib

Cleanup bibtex entries on the clipboard or grab them from a DOI.

Description

cleanbib is a python script built using the python-bibtexparser library which accomplishes two simple tasks:

  1. If you have copied a bibtex entry (it exists on the clipboard) apply some formatting that is standard for physics journals and return the new bibtex entry to the clipboard.
  2. If you have a DOI, get the bibtex from http://dx.doi.org and format it as above.

At present it uses a hard-coded dictionary for journal abbreviations. This needs to be expanded upon.

Requirements

Installation

Clone via clone https://github.com/agdelma/cleanbib.git cleanbib and copy cleanbib.py to somewhere on your $PATH.

Usage

Description:
  Clean up a latex .bib record on the clipboard or retrieved from the doi.

Usage:
  cleanbib   [--doi=<doi>] 
  cleanbib -h | --help

Options:
  -h --help                Show this screen.
  -d <doi> --doi=<doi>     A valid doi.

Suppose you had the following bibtex (generated by Papers3) on the clipboard:

@article{Herdman:2014jq,
    author = {Herdman, C M and Roy, P N and Melko, R G and Del Maestro, Adrian},
    title = {{Particle entanglement in continuum many-body systems via quantum Monte Carlo}},
    journal = {Physical Review B},
    year = {2014},
    volume = {89},
    number = {14},
    pages = {140501},
    month = apr,
    doi = {10.1103/PhysRevB.89.140501},
    language = {English},
    read = {Yes},
    rating = {0},
    date-added = {2014-04-09T12:59:48GMT},
    date-modified = {2017-04-25T00:15:16GMT},
    url = {http://link.aps.org/doi/10.1103/PhysRevB.89.140501},
    uri = {\url{papers3://publication/doi/10.1103/PhysRevB.89.140501}}
    }

running ./cleanbib from the command line would yield:

@article{Herdman:2014jq,
    author = {Herdman, C.~M. and Roy, P.~N. and Melko, R.~G. and Del Maestro, Adrian},
    doi = {10.1103/PhysRevB.89.140501},
    journal = {Phys. Rev. B},
    number = {14},
    pages = {140501},
    title = {{P}article entanglement in continuum many-body systems via quantum {M}onte {C}arlo},
    url = {http://link.aps.org/doi/10.1103/PhysRevB.89.140501},
    volume = {89},
    year = {2014}
}

which includes all the essential information that is needed.

If you don't have the record, but instead only the DOI, then you could type:

./cleanbib.py -d 10.1103/PhysRevB.89.140501

which would copy the following text to your clipboard

@article{Herdman:2014ye,
    author = {Herdman, C.~M. and Roy, P.-N. and Melko, R.~G. and Del Maestro, A.},
    doi = {10.1103/physrevb.89.140501},
    journal = {Phys. Rev. B},
    number = {14},
    publisher = {American Physical Society (APS)},
    title = {{P}article entanglement in continuum many-body systems via quantum {M}onte {C}arlo},
    url = {http://dx.doi.org/10.1103/PhysRevB.89.140501},
    volume = {89},
    year = {2014}
}

About

Cleanup bibtex entries or grab from DOI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages