Bibliography Management in R Markdown with CiteDrive and RStudio

CiteDrive + RStudio

Guide: Project preparation and connecting both Apps

Please note that a small workaround is required if you use {rticles}. We will explain this at the end. Until then, you can follow along by reading this guide.

Step 1: Create a new Project at CiteDrive

First, let’s look at CiteDrive and create an R Markdown project. Click on the big R Markdown button + to create a new project. After that, enter the name of your choice.

Step 2: Adding a reference

With the help of the browser extension, we can easily add articles to our project from the browser window. For our project, we use Google Scholar (or a similar search engine) to search for articles, such as R Markdown.

Google Scholar with the search term R Markdown.
Google Scholar with the first result under the search term R Markdown.
Adding References from Google Scholar with CiteDrive — via YouTube
CiteDrive project view

Step 3: Create a new R Markdown template at RStudio

To create a new R Markdown template in RStudio, do the following:

File >New File > R Markdown.

Creating a new R Markdown project in RStudio
R Markdown settings for a new document

Step 4: Synchronize your references

Now that we have created the template in RStudio, we go back to CiteDrive, load the project and open our dynamic BiBTeX file. We click on .bib and see that the file opens in a new window. We copy the URL from that window, and in YAML, after the bibliography, we specify our previously created file at RMarkdown. We demonstrate the whole process in this clip:

Export your references to RMarkdown from your CiteDrive project.

Workarorand when using {rticles}

As mentioned earlier, there is one to be aware of when using {rticles}, as specifying the URL in YAML is impossible when using this package.

Workarorand when using {rticles} with download.fil(“url”,file)

Additional Information

1. About R Markdown and the Citation engine

R Markdown is a great tool that embeds R code directly into Markdown-based documents to create dynamic papers, books, or reports. So you can make most of your research pipeline in RStudio, from data analysis to publication-ready PDFs or web pages.

2. Bibliography

With RMarkdown, you define your bibliography and style in the YAML front matter:

---bibliography: bibliography.bib
csl: american-chemical-society.csl
---

3. BibTeX and CitationKeys

In our example, your bibliography.bib will contain so-called BibTeX-entries. We can best explain the structure of a BibTeX entry with an example:

@book{REFERENZ_ID,
title = "Title of the book",
author = "Gareth Doe and Josh Doe",
year = "1988"
...
}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. [@CITATIONKEY]

To bundle references via in-text citations, simply separate them with a comma:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. [@CITATIONKEY1, @CITATIONKEY2]

Each citation key must be unique in the same database (.bib file). Often it consists of the first author’s last name, publication year, and the first non-stopper word. Here in this example, the citation key could be Doe1988Title. You can specify attributes with BibTeX fields, like title, year, or author. Additional authors are separated by and.

4. Changing styles

As noted above, you can choose one of the thousands of styles to suit your needs. Citation Style Language provides them in their official GitHub repository: https://github.com/citation-style-language/styles

---...
csl: american-chemical-society.csl
...
---
---...
csl: https://raw.githubusercontent.com/citation-style-language/styles/master/american-chemical-society.csl
...
---

5. Other CiteDriveIntegrations

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store