insert_citation: Invoke RStudio add-in to insert Markdown citations

Description Usage Arguments Details Value Examples

View source: R/insert_citation.R

Description

Invoke RStudio add-in to insert Markdown citations

Usage

1
2
3
4
insert_citation(bib_file = getOption("citr.bibliography_path"),
  use_betterbiblatex = getOption("citr.use_betterbiblatex"),
  betterbiblatex_format = getOption("citr.betterbiblatex_format"),
  encoding = getOption("citr.encoding"))

Arguments

bib_file

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

use_betterbiblatex

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

betterbiblatex_format

Character. Bibliography format to export from Zotero/Juris-M. Can be either "bibtex" or "biblatex". Ignored if use_betterbiblatex = FALSE. Requires that the Better BibTeX is installed and Zotero/Juris-M is running.

encoding

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

Details

The path to the Bib(La)TeX-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.

If insert_citation is called while the focus is on a R Markdown document, which includes a YAML front matter with paths to one or more bibliography files, bib_file is ignored. Instead the file(s) from the YAML front matter are used.

The addin caches bibliographies to avoid unnecessary hard drive access. If the specified bibliography path or the file paths in the YAML header change the files are reloaded. To manually reload a bibliography at an unchanged location click the action link.

Value

Inserts selected Markdown citation(s) at current location.

Examples

1
2
3
4
## Not run: 
 insert_citation()

## End(Not run)

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