cff_read_bib_text: Read BibTeX markup as a 'cff_ref_lst' object

View source: R/cff-read-bib-text.R

cff_read_bib_textR Documentation

Read BibTeX markup as a cff_ref_lst object

Description

Convert one or more complete BibTeX entries supplied as a character vector into a cff_ref_lst object.

Usage

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

Arguments

x

A character vector with one or more complete BibTeX entries.

encoding

Encoding to be assumed for x. See base::readLines().

...

Arguments passed to cff_read_bib().

Details

This function writes x to a temporary ⁠*.bib⁠ file and reads it using cff_read_bib().

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

Value

An object of classes cff_ref_lst, cff as defined by the definitions.reference specified in the following guide: Citation File Format schema guide. Each element of the cff_ref_lst object has classes cff_ref, cff.

See Also

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

Work with BibTeX metadata: as_bibentry(), cff_read(), cff_write_bib(), encoded_utf_to_latex()

Read external citation metadata: 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)
}

cffr documentation built on Aug. 24, 2026, 5:11 p.m.