21

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
user227710
  • 3,164
  • 18
  • 35
Brian G. Peterson
  • 3,531
  • 2
  • 20
  • 21
  • 4
    You're right; there are no bibliography options for .Rpres files. However, .Rpres predates, and is in most cases superseded by, the presentation formats available on R Markdown. For this reason it isn't receiving a lot of attention and it's likely that the gap between its capabilities and those of .Rmd is going to widen over time. .Rpres files don't render with Pandoc; they are rendered by an engine baked into the main RStudio binary. – Jonathan Jul 06 '15 at 21:47

1 Answers1

6

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.

Heather Turner
  • 3,264
  • 23
  • 30