[R Course] How to: Use Zotero with RStudio

R Courses

Make your reproducible research easier by learning to use Zotero with Nüance-R

Thierry Warin https://warin.ca/aboutme.html (HEC Montréal and CIRANO (Canada))https://www.hec.ca/en/profs/thierry.warin.html
03-25-2020


Nüance-R provides an Addin called citr (Aust et al. 2019) to insert citations from a Zotero with a bib file. citr provides functions and an addin to search a BibTeX-file to create and insert formatted Markdown citations into the current document. (Aust and Barth 2019)

Zotero

If you do not already have Zotero yet, download the last version now! Also, install the “Zotero Connector” avaible on the same link to save to Zotero from your browser directly.

Add Zotero Better Bib(La)TeX to Zotero

Better BibTeX (BBT) is an extension for Zotero and Juris-M that makes it easier to manage bibliographic data, especially for people authoring documents using text-based toolchains (e.g. based on LaTeX / Markdown).

First, you need to install BBT by downloading the latest release

Once it is done, open Zotero and do the following:

YAML

Before using the Addin citr, make sure that your YAML contain this 3 options:

---
title: "nameOfYourDocument"
author: "nameOfTheAuthor"
date: "12/07/2019"
bibliography: nameOfTheBibFile.bib
biblio-style: nameOfTheBiblioStyle
output:
  pdf_document:
    citation_package: biblatex
---

Citr

Now that your YAML is setup, you can click on the “Addins” button.

When you write “citation” in the search bar, you have an option labeled “Insert citations”.

Click on it! A window will open.

All your references will appear.

Citations

If it happens that you are not using the Nüance-R and instead a local Rstudio without the citr addin, here an option to make citations.

You still have to supply a .bib file to the bibliography parameter in the YAML (bibliography: nameOfTheBibFile.bib) for the R Markdown file knows where to look for reference.

Here some citation examples:

Citation type Syntax Rendered citation
Citation within parentheses [@james_1890] (James, 1890)
Multiple citations [@james_1890; @bem_2011] (Bem, 2011; James, 1890)
In-text citations @james_1890 James (1890)
Year only [-@bem_2011] (2011)

Additional information can be added to citations as pre- or postfixes. Pre- and postfixes can simply be added to each citation by writing inside the brackets ([e.g., @bem_2011]). Note that pre- and postfixes are bound to the enclosed citation, not to the set of all citations. Hence, a prefix will be reorder together with its citation, which may be undesirable. For example, [e.g., @james_1890; @bem_2011] yields (e.g., James, 1890; Bem, 2011). There is no way to prevent this behavior, so mind the alphabetical order of citations.



Aust, Frederik, and Marius Barth. 2019. Papaja: Reproducible APA Manuscripts with R Markdown. https://crsh.github.io/papaja_man/.

Aust, Frederik, Yihui Xie, Robin Lovelace, and Garrick Aden-Buie. 2019. “Citr: ’RStudio’ Add-in to Insert Markdown Citations.” https://CRAN.R-project.org/package=citr.

References

Citation

For attribution, please cite this work as

Warin (2020, March 25). Thierry Warin, PhD: [R Course] How to: Use Zotero with RStudio. Retrieved from https://warin.ca/posts/rcourse-howto-usezoterowithnuancer/

BibTeX citation

@misc{warin2020[r,
  author = {Warin, Thierry},
  title = {Thierry Warin, PhD: [R Course] How to: Use Zotero with RStudio},
  url = {https://warin.ca/posts/rcourse-howto-usezoterowithnuancer/},
  year = {2020}
}