Format for converting from R Markdown to a PDF document.
pdf_document(toc = FALSE, toc_depth = 2, number_sections = FALSE,
fig_width = 6, fig_height = 4.5, fig_crop = TRUE, fig_caption = TRUE,
highlight = "default", template = "default", latex_engine = "pdflatex",
natbib = FALSE, biblatex = FALSE, includes = NULL, data_dir = NULL,
pandoc_args = NULL)TRUE to number section
headings
TRUE to automatically apply the
pdfcrop utility (if available) to pdf figures
Syntax highlighting style. Supported
styles include "default", "tango", "pygments", "kate",
"monochrome", "espresso", "zenburn", and "haddock". Pass
NULL to prevent syntax highlighting.
LaTeX engine for producing PDF output. Options are "pdflatex", "lualatex", and "xelatex".
Use natbib for citations in LaTeX output
Use biblatex for citations in LaTeX output
Pandoc template to use for rendering.
Pass "default" to use the rmarkdown package default
template; pass NULL to use pandoc's built-in
template; pass a path to use a custom template that
you've created. See the documentation on
pandoc
templates for more details.
TRUE to include a table of contents in
the output
Depth of headers to include in table of contents
Default width (in inches) for figures
Default width (in inches) for figures
TRUE to render figures with
captions
Named list of additional content to
include within the document (typically created using the
includes function).
Additional directory to resolve relatives paths of templates and included content against (the directory of the input file is used by default).
Additional command line options to pass to pandoc
R Markdown output format to pass to render
Creating PDF output from R Markdown requires that LaTeX be installed.
R Markdown documents can have optional metadata that is used to generate a document header that includes the title, author, and date. Metadata can also be provided to enable the use of footnotes and bibliographies. For more details see the documentation on R Markdown metadata and citations.
Many aspects of the LaTeX template used to create PDF documents can be customized using metadata. For example:
--- |
title: "Crop Analysis Q3
2013" |
fontsize: 11pt |
geometry:
margin=1in |
Available metadata variables include:
langDocument language code
fontsizeFont size (e.g. 10pt, 11pt, 12pt)
documentclassLaTeX document class (e.g. article)
classoptionOption for
documentclass (e.g. oneside); may be repeated
geometryOptions for geometry class (e.g. margin=1in); may be repeated
mainfont,
sansfont, monofont, mathfontDocument fonts (works only
with xelatex and lualatex, see the latex_engine
option)
linkcolor, urlcolor, citecolorColor for internal, external, and citation links (red, green, magenta, cyan, blue, black)
biblio-styleLaTeX bibliography style (used
with natbib option)
biblio-filesBibliography files to use in
LaTeX (used with natbib or biblatex options)
# NOT RUN {
library(rmarkdown)
# simple invocation
render("input.Rmd", pdf_document())
# specify an option for latex engine
render("input.Rmd", pdf_document(latex_engine = "lualatex"))
# add a table of contents and pass an option to pandoc
render("input.Rmd", pdf_document(toc = TRUE, "--listings"))
# }
Run the code above in your browser using DataLab