Bibliography Entries

Functionality for representing and manipulating bibliographic information in enhanced BibTeX style.

utilities, documentation
bibentry(bibtype, textVersion = NULL, header = NULL, footer = NULL,
         key = NULL, ..., other = list(),
         mheader = NULL, mfooter = NULL)
## S3 method for class 'bibentry':
print(x, style = "text", .bibstyle, ...)
a character string with a BibTeX entry type. See Entry Types for details.
a character string with a text representation of the reference to optionally be employed for printing.
a character string with optional header text.
a character string with optional footer text.
a character string giving the citation key for the entry.
for bibentry: arguments of the form tag=value giving the fields of the entry, with tag and value the name and value of the field, respectively. Arguments with empty values are dropped. See Entry Fields for details.

For the print method, extra parameters to pass to the renderer.

a list of arguments as in ... (useful in particular for fields named the same as formals of bibentry).
a character string with optional outer header text.
a character string with optional outer footer text.
an object inheriting from class "bibentry".
an optional character string specifying the print style. If present, must be a unique abbreviation (with case ignored) of the available styles, see Details.
a character string naming a bibliography style.

The bibentry objects created by bibentry can represent an arbitrary positive number of references. One can use c() to combine bibentry objects, and hence in particular build a multiple reference object from single reference ones. Alternatively, one can use bibentry to directly create a multiple reference object by vectorizing the given arguments, i.e., use character vectors instead of character strings.

The print method for bibentry objects provides a choice between seven different styles: plain text (style "text"), BibTeX ("Bibtex"), a mixture of plain text and BibTeX as traditionally used for citations ("citation"), HTML ("html"), LaTeX ("latex"), R code ("R"), and a simple copy of the textVersion elements (style "textVersion"). The "text", "html" and "latex" styles make use of the .bibstyle argument using the bibstyle function. When printing bibentry objects in citation style, a header/footer for each item can be displayed as well as a mheader/mfooter for the whole vector of references.

The print method is based on a format method which provides the same styles, and for formatting as R code a choice between giving a character vector with one bibentry() call for each bibentry (as commonly used in CITATION files), or a character string with one collapsed call, obtained by combining the individual calls with c() if there is more than one bibentry. This can be controlled by setting the option collapse to FALSE (default) or TRUE, respectively. (Printing in R style always collapses to a single call.) Further, for the "citation" style, format()'s optional argument citation.bibtex.max (with default getOption("citation.bibtex.max") which defaults to 1) determines for up to how many citation bibentries text style is shown together with with bibtex, automatically.

It is possible to subscript bibentry objects by their keys (which are used for character subscripts if the names are NULL).

There is also a toBibtex method for direct conversion to BibTeX.


  • bibentry produces an object of class "bibentry".

See Also


  • bibentry
  • print.bibentry
library(utils) ## R reference rref <- bibentry( bibtype = "Manual", title = "R: A Language and Environment for Statistical Computing", author = person("R Core Team"), organization = "R Foundation for Statistical Computing", address = "Vienna, Austria", year = 2014, url = "") ## Different printing styles print(rref) print(rref, style = "Bibtex") print(rref, style = "citation") print(rref, style = "html") print(rref, style = "latex") print(rref, style = "R") ## References for boot package and associated book bref <- c( bibentry( bibtype = "Manual", title = "boot: Bootstrap R (S-PLUS) Functions", author = c( person("Angelo", "Canty", role = "aut", comment = "S original"), person(c("Brian", "D."), "Ripley", role = c("aut", "trl", "cre"), comment = "R port, author of parallel support", email = "") ), year = "2012", note = "R package version 1.3-4", url = "", key = "boot-package" ), bibentry( bibtype = "Book", title = "Bootstrap Methods and Their Applications", author = as.person("Anthony C. Davison [aut], David V. Hinkley [aut]"), year = "1997", publisher = "Cambridge University Press", address = "Cambridge", isbn = "0-521-57391-2", url = "", key = "boot-book" ) ) ## Combining and subsetting c(rref, bref) bref[2] bref["boot-book"] ## Extracting fields bref$author bref[1]$author bref[1]$author[2]$email ## Convert to BibTeX toBibtex(bref) ## Format in R style ## One bibentry() call for each bibentry: writeLines(paste(format(bref, "R"), collapse = "")) ## One collapsed call: writeLines(format(bref, "R", collapse = TRUE))
Documentation reproduced from package utils, version 3.3, License: Part of R 3.3

Community examples

Looks like there are no examples yet.