fix_bib | R Documentation |
Utilities for processing BibTeX files, adding DOIs etc., especially for publications in the Journal of Statistical Software.
fix_bib(x = NULL, file = x, orig = "_orig.bib", bibtool = TRUE, doi = TRUE, shortcites = TRUE) bibtool(tex = NULL, orig = "_orig.bib") shortcites(x, maxlength = 6) get_doi(x, minscore = 1.5, type = NULL) add_doi(x, file = "out.bib", minscore = 1.5)
x |
character or bibentry object. If |
file |
character for output BibTeX file name. |
orig |
character with file name for copy of the original BibTeX file (if any). |
bibtool |
logical. Should |
doi |
logical. Should DOIs be added using |
shortcites |
logical. Should bibentries with a long author list be reported in a shortcites statement? |
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., |
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.
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.
jss
bibfile <- system.file("bib", "example.bib", package = "jss") if(require("bibtex")) { ## read BibTeX entry as currently stored bde1 <- read.bib(bibfile) print(bde1) toBibtex(bde1) ## fix BibTeX entry ## - but do not overwrite file ## - running bibtool is not necessary (and also not possible as there is no .tex file) ## - querying the DOI is switched off (just to save processing time in this example) bde2 <- fix_bib(bibfile, file = FALSE, bibtool = FALSE, doi = FALSE) print(bde2) toBibtex(bde2) ## This has ## - a capitalized title, ## - correctly spaces the middle initials, ## - unifies the TAS journal name, ## - and the DOI could be added by setting doi = TRUE or manually queried via ## get_doi(bde2) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.