character or bibentry object. If NULL the first BibTeX file in the current working directory is used. If a character is supplied it is read into a bibentry object using read.bib.
file
character for output BibTeX file name.
orig
character with file name for copy of the original BibTeX file (if any).
bibtool
logical. Should bibtool be run first (usually to remove bibentries that are not cited)?
doi
logical. Should DOIs be added using get_doi (based on cr_works)?
shortcites
logical. Should bibentries with a long author list be reported in a shortcites statement?
escape
logical or character. Should encoded text (non-ASCII, e.g., for accent and umlaut characters) be preserved in BibTeX output (FALSE) or escaped by their LaTeX representations (TRUE, default)? Instead of TRUE it is also possible to indicate the encoding of the text (e.g., escape = “UTF-8”) explicitly.
tex
character specifying the input LaTeX file.
maxlength
numeric. Maximum number of authors for a normal cite (that does not have to be shortened).
minscore
numeric. Minimum score that needs to be achieved when querying a DOI.
type
character. The reference type (e.g., “journal-article” or “book”) that needs to be matched.
…
further arguments passed to read.bib.
Details
The fix_bib function is a utility to automatically bring a .bib file almost into JSS style. By default, it proceeds by reading a .bib file using read.bib, omitting unused entries using bibtool, modifying author names, titles, journals, etc. if necessary, adding DOIs for articles and books using cr_works, and writing the result again to the same .bib file.
Some steps can be switched off by setting the corresponding arguments. Standalone functions for these steps are also provided.
Value
fix_bib and add_doi return an object of class “bibentry” (invisibly if an output file is specified).
bibtool returns a logical, only indicating whether the file renaming worked.
shortcites and get_doi return character vectors with BibTeX keys and DOIs, respectively.
@Article{Stefanski+Boos:2002,
author = {L.A. Stefanski and D.D. Boos},
title = {The calculus of {M}-estimation},
journal = {American Statistician},
volume = {56},
year = {2002},
pages = {29--38},
}
## fix BibTeX entry## - but do not overwrite file## - running bibtool is not necessary (and also not possible as there is no .tex file)## - query the DOI (which takes a couple of seconds)bde2<-fix_bib(bibfile, file =FALSE, bibtool =FALSE, doi =TRUE)print(bde2)
Stefanski LA, Boos DD (2002). "The Calculus of M-Estimation." _The
American Statistician_, *56*, 29-38. doi:10.1198/000313002753631330
<https://doi.org/10.1198/000313002753631330>.
@Article{Stefanski+Boos:2002,
author = {L. A. Stefanski and D. D. Boos},
title = {The Calculus of {M}-Estimation},
journal = {The American Statistician},
volume = {56},
year = {2002},
pages = {29--38},
doi = {10.1198/000313002753631330},
}
## - has a capitalized title,## - correctly spaces the middle initials,## - unifies the TAS journal name,## - added the DOI## cleanupfile.remove("_orig.bib")