citr (version 0.3.0)

insert_citation: Invoke RStudio add-in to insert Markdown citations

Description

Invoke RStudio add-in to insert Markdown citations

Usage

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

Charcter. Bibliography format to export from Zotero/Juris-M. Can be either "bibtex" or "biblatex". Ignored if use_betterbiblatex = FALSE. Requires that the Better Bib(La)TeX is installed and Zotero/Juris-M is running.

encoding

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

Value

Inserts selected Markdown citation(s) at currenct location.

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.

Examples

Run this code
# NOT RUN {
 insert_citation()
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace