md_cite: Insert citation in Markdown format

Description Usage Arguments Details Value See Also Examples

View source: R/md_cite.R

Description

Look up entries in bibliography and insert citation in Markdown format if exactly one match is returned.

Usage

1
2
3
4
md_cite(x, in_paren = TRUE,
  bib_file = getOption("citr.bibliography_path"), cache = TRUE,
  use_betterbiblatex = getOption("citr.use_betterbiblatex"),
  encoding = getOption("citr.encoding"))

Arguments

x

Character. Search terms used to filter bibliography (by author, year, title, and journal fields); Regex is supported.

in_paren

Logical. Determines if citation is in parentheses.

bib_file

Character. Path to Bib(La)TeX-file. See details.

cache

Logical. If cache = TRUE cached bibliography is used, if available. If cache = FALSE bibliography is re-imported on every function call.

use_betterbiblatex

Logical. If use_betterbiblatex = TRUE references are imported from Zotero/Juris-M.

encoding

Character. Encoding of the Bib(La)TeX-file.

Details

The path to the BibTeX-file can be set in the global options and is set to references.bib when the package is loaded. Once the path is changed in the RStudio addin, the global option is updated. If use_betterbiblatex = TRUE references are imported from Zotero/Juris-M rather than from the Bib(La)TeX-file. The Bib(La)TeX-file is then updated to include the inserted reference.

Value

If the bibliography contains exactly one match the formatted citation is returned, otherwise returns NULL. md_cite returns an in-text citation ("@foo2016"), md_cite returns an in-parenthesis citation ("[@foo2016]").

See Also

insert_citation

Examples

1
2
3
4
## Not run: 
  md_cite("foo 2016", bib_file = "references.bib")

## End(Not run)

citr documentation built on Aug. 19, 2019, 5:03 p.m.