toBiblatex: Convert BibEntry objects to BibTeX or BibLaTeX

View source: R/toBiblatex.R

toBiblatexR Documentation

Convert BibEntry objects to BibTeX or BibLaTeX

Description

toBiblatex converts a BibEntry object to character vectors with BibLaTeX markup. toBibtex will convert a BibEntry object to character vectors with BibTeX markup, converting some BibLaTeX fields and all entry types that are not supported by BibTeX to ones that are supported.

Usage

toBiblatex(object, ...)

## S3 method for class 'BibEntry'
toBibtex(
  object,
  note.replace.field = c("urldate", "pubsate", "addendum"),
  extra.fields = NULL,
  ...
)

Arguments

object

an object of class BibEntry to be converted

...

ignored

note.replace.field

a character vector of BibLaTeX fields. When converting an entry to BibTeX, the first field in the entry that matches one specified in this vector will be added to the note field, if the note field is not already present

extra.fields

character vector; fields that are not supported in standard BibTeX styles are by default dropped in the result return by the toBibtex function. Any fields specified in extra.fields will not be dropped if present in an entry.

Details

toBiblatex converts the BibEntry object to a vector containing the corresponding BibLaTeX file, it ensures the name list fields (e.g. author and editor) are formatted properly to be read by bibtex and biber and otherwise prints all fields as is, thus it is similar to toBibtex.

toBibtex will attempt to convert BibLaTeX entries to a format that can be read by bibtex. Any fields not supported by bibtex are dropped unless they are specified in extra.fields. The fields below, if they are present, are converted as described and added to a bibtex supported field, unless that field is already present.

  • date - The date field, if present will be truncated to a year and added to the year field, if it is not already present. If a month is specified with the date, it will be added to the month field.

  • journaltitle - Will be changed to journal, if it is not already present

  • location - Will be changed to address

  • institution - Converted to school for thesis entries

  • sortkey - Converted to key

  • maintitle - Converted to series

  • issuetitle - Converted to booktitle

  • eventtitle - Converted to booktitle

  • eprinttype - Converted to archiveprefix (for arXiv references)

  • eprintclass - Converted to primaryclass (for arXiv references)

If no note field is present, the note.replace.field can be used to specified BibLaTeX fields that can be looked for and added to the note field if they are present.

BibLaTeX entry types that are not supported by bibtex are converted by toBibtex as follows "mvbook" = "Book", "bookinbook" = "InBook", "suppbook" = "InBook",

  • MvBook,Collection,MvCollection,Reference,MvReference,Proceedings,MvProceedings,Periodical - to Book

  • BookInBook,SuppBook,InReference,SuppPeriodical - to InBook

  • report,patent - to TechReport

  • SuppCollection - to InCollection

  • thesis - to MastersThesis if type = mathesis, else to PhdThesis

  • rest - to Misc

Value

an object of class “Bibtex” - character vectors where each element holds one line of a BibTeX or BibLaTeX file

Author(s)

McLean, M. W. mathew.w.mclean@gmail.com

See Also

toBibtex, BibEntry, print.BibEntry

Examples

if (requireNamespace("bibtex")) {
    file.name <- system.file("Bib", "biblatexExamples.bib", package="RefManageR")
    bib <- suppressMessages(ReadBib(file.name))
    toBiblatex(bib[70:72])
    toBibtex(bib[70:72])
}

RefManageR documentation built on Oct. 1, 2022, 1:08 a.m.