cff_read_bib_text {cffr}R Documentation

Read BibTeX markup as a cff_ref_lst object

Description

Convert a character representing a BibTeX entry to a cff_ref_lst object.

Usage

cff_read_bib_text(x, encoding = "UTF-8", ...)

Arguments

x

A vector of character objects with the full BibTeX string.

encoding

Encoding to be assumed for x, see readLines().

...

Arguments passed on to cff_read_bib().

Details

This is a helper function that writes x to a ⁠*.bib⁠ file and reads it with cff_read_bib().

This function requires bibtex (>= 0.5.0) and uses bibtex::read.bib().

Value

An object of classes cff_ref_lst, cff according to the definitions.references specified in the Citation File Format schema. Each element of the cff_ref_lst object would have classes cff_ref, cff.

See Also

cff_read_bib() for reading ⁠*.bib⁠ files.

Other functions for working with BibTeX format: as_bibentry(), cff_read(), cff_write_bib(), encoded_utf_to_latex()

Other functions for reading external files: cff_read()

Examples

if (requireNamespace("bibtex", quietly = TRUE)) {
  x <- c(
    "@book{einstein1921,
      title        = {Relativity: The Special and the General Theory},
      author       = {Einstein, Albert},
      year         = 1920,
      publisher    = {Henry Holt and Company},
      address      = {London, United Kingdom},
      isbn         = 9781587340925
  }",
    "@misc{misc-full,
      title        = {Handing out random pamphlets in airports},
      author       = {Joe-Bob Missilany},
      year         = 1984,
      month        = oct,
      note         = {This is a full MISC entry},
      howpublished = {Handed out at O'Hare}
  }"
  )


  cff_read_bib_text(x)
}

[Package cffr version 1.0.1 Index]