Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add citations and a bibliography to "Rpres" rmarkdown presentations?

This page:

http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html

describes adding citations and a generated bibliography to regular rmarkdown documents. When authoring presentations using rmarkdown, this method works for ioslides, slidify, and beamer presentations.

The approach of adding a bibliography: line to the front matter of the presentation does not work for the newer "Rpres" presentations.

How can you add a bibliography to an Rpres rmarkdown presentation file?

I suspect that the answer is that this is not supported by the templates or build options for Rpres files. If that is the case, then pointers on where to patch to add the --bibliography= option to the call to pandoc would be appreciated.

My environment includes

  • RStudio preview 0.9.451
  • knitr 1.1.12
  • rmarkdown 0.7
like image 798
Brian G. Peterson Avatar asked Jul 04 '15 14:07

Brian G. Peterson


People also ask

How do you add a citation in R markdown?

Inserting Citations. You insert citations by either using the Insert -> Citation command or by using markdown syntax directly (e.g. [@cite] or @cite ) . Citations go inside square brackets and are separated by semicolons.

How do I add a citation in R studio?

Use the toolbar button or the keyboard shortcut to show the Insert Citation dialog: Note that you can insert multiple citations by using the add button on the right side of the item display. If you insert citations from Zotero, DOI look-up, or a search then they are automatically added to your document bibliography.

How do I link zotero to Rmarkdown?

In Zotero follow this path: Tools>Add-Ons>Gear Icon>Install Add-On From File…. Then go to the folder you installed the Better Bibtex file in. Select the Better Bibtex . xpi file, click “Install Now” in the Zotero pop-up, and follow the system setup.

How do you present an R presentation?

To create a new R Presentation you execute the New File -> R Presentation command: After specifying the location to save the presentation, a new presentation will be created and a preview will show within the Presentation tab in the upper right corner of the IDE.


1 Answers

The knitcitations package can be used to add citations and a bibliography using R commands. The following chunk gives a minimal .Rpres:

Using knitcitations
=======================================================

Example Citation
=======================================================

```{r, echo = FALSE}
library(knitcitations)
```

See the `knitcitations` vignette for details on how to add citations, such as
`r citep("10.1890/11-0011.1")`

Bibliography
========================================================

Use the `bibliography` function to add the bibliography.

```{r, echo=FALSE, results="asis"}
bibliography()
```

Here the bibliography is created on-the-fly and includes a LaTeX command that isn't parsed correctly. For more control you can use your own bibliography, e.g.

bib <- read.bibtex("references.bib")
citet(bib["bloggs2002"])

Note that we could have saved the bibliography created in the .Rpres example using write.bibtex, then edited to create the final references.bib.

like image 194
Heather Turner Avatar answered Sep 21 '22 17:09

Heather Turner