Last data update: 2014.03.03

R: Render an R Markdown file into a PDF
rmd2pdfR Documentation

Render an R Markdown file into a PDF

Description

Use knitr and pandoc to convert an R Markdown file into a TeX file, and run xelatex (and biber) on the converted file to produce a PDF.

Usage

rmd2pdf(file = "thesis.Rmd", template = "thesis_template.latex",
  biber = TRUE, saveTmpFiles = FALSE)

Arguments

file

the location and name of the R Markdown file to be rendered.

template

the location and name of the pandoc latex template to use during the conversion from R Markdown to TeX.

biber

logical flag indicating if biber (or biblatex) backend should be run after xelatex is called.

saveTmpFiles

logical flag indicating if intermediary files should be kept after PDF file is created. If FALSE the files are deleted.

Details

There's no markdown (yet) that allows for LaTeX preamble to be specified inside a .md file. To get around this, we have to redefine a Pandoc latex template using the preamble we'd normally use if we were using the LaTeX or knitr templates. The template, inst/rmarkdown/thesis_template.latex, is a modification of the default template found via pandoc -D latex. If you need to add more packages to your preamble, e.g. usepackage{amsmath}, modify thesis_template.latex accordingly.

Temporary files (e.g. .md's, .log's, .aux's, etc.) are stored in a temporary (sub)directory, tmp/.

Value

The name of the xelatex rendered PDF.

Examples

## Not run: 
setwd("inst/rmarkdown")
rmd2pdf()

## End(Not run)

Results