% Generated by roxygen2: do not edit by hand % Please edit documentation in R/pdf_document.R \name{pdf_document} \alias{pdf_document} \alias{latex_document} \alias{latex_fragment} \title{Convert to a PDF/LaTeX document} \usage{ pdf_document( toc = FALSE, toc_depth = 2, number_sections = FALSE, fig_width = 6.5, fig_height = 4.5, fig_crop = "auto", fig_caption = TRUE, dev = "pdf", df_print = "default", highlight = "default", template = "default", keep_tex = FALSE, keep_md = FALSE, latex_engine = "pdflatex", citation_package = c("default", "natbib", "biblatex"), includes = NULL, md_extensions = NULL, output_extensions = NULL, pandoc_args = NULL, extra_dependencies = NULL ) latex_document(...) latex_fragment(...) } \arguments{ \item{toc}{\code{TRUE} to include a table of contents in the output} \item{toc_depth}{Depth of headers to include in table of contents} \item{number_sections}{\code{TRUE} to number section headings} \item{fig_width}{Default width (in inches) for figures} \item{fig_height}{Default height (in inches) for figures} \item{fig_crop}{Whether to crop PDF figures with the command \command{pdfcrop}. This requires the tools \command{pdfcrop} and \command{ghostscript} to be installed. By default, \code{fig_crop = TRUE} if these two tools are available.} \item{fig_caption}{\code{TRUE} to render figures with captions} \item{dev}{Graphics device to use for figure output (defaults to pdf)} \item{df_print}{Method to be used for printing data frames. Valid values include "default", "kable", "tibble", and "paged". The "default" method uses a corresponding S3 method of \code{print}, typically \code{print.data.frame}. The "kable" method uses the \code{\link[knitr:kable]{knitr::kable}} function. The "tibble" method uses the \pkg{tibble} package to print a summary of the data frame. The "paged" method creates a paginated HTML table (note that this method is only valid for formats that produce HTML). In addition to the named methods you can also pass an arbitrary function to be used for printing data frames. You can disable the \code{df_print} behavior entirely by setting the option \code{rmarkdown.df_print} to \code{FALSE}. See \href{https://yihui.org/rmarkdown/html-document.html#data-frame-printing}{Data frame printing section} in bookdown book for examples.} \item{highlight}{Syntax highlighting style passed to Pandoc. Supported built-in styles include "default", "tango", "pygments", "kate", "monochrome", "espresso", "zenburn", "haddock", and "breezedark". Two custom styles are also included, "arrow", an accessible color scheme, and "rstudio", which mimics the default IDE theme. Alternatively, supply a path to a \samp{.theme} file to use \href{https://pandoc.org/MANUAL.html#syntax-highlighting}{a custom Pandoc style}. Note that custom theme requires Pandoc 2.0+. Pass \code{NULL} to prevent syntax highlighting.} \item{template}{Pandoc template to use for rendering. Pass "default" to use the rmarkdown package default template; pass \code{NULL} to use pandoc's built-in template; pass a path to use a custom template that you've created. See the documentation on \href{https://pandoc.org/MANUAL.html}{pandoc online documentation} for details on creating custom templates.} \item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF. Note that this argument does not control whether to keep the auxiliary files (e.g., \file{.aux}) generated by LaTeX when compiling \file{.tex} to \file{.pdf}. To keep these files, you may set \code{options(tinytex.clean = FALSE)}.} \item{keep_md}{Keep the markdown file generated by knitting.} \item{latex_engine}{LaTeX engine for producing PDF output. Options are "pdflatex", "lualatex", "xelatex" and "tectonic".} \item{citation_package}{The LaTeX package to process citations, \code{natbib} or \code{biblatex}. Use \code{default} if neither package is to be used, which means citations will be processed via the command \command{pandoc-citeproc}.} \item{includes}{Named list of additional content to include within the document (typically created using the \code{\link{includes}} function).} \item{md_extensions}{Markdown extensions to be added or removed from the default definition of R Markdown. See the \code{\link{rmarkdown_format}} for additional details.} \item{output_extensions}{Pandoc extensions to be added or removed from the output format, e.g., \code{"-smart"} means the output format will be \code{latex-smart}.} \item{pandoc_args}{Additional command line options to pass to pandoc} \item{extra_dependencies}{A LaTeX dependency \code{latex_dependency()}, a list of LaTeX dependencies, a character vector of LaTeX package names (e.g. \code{c("framed", "hyperref")}), or a named list of LaTeX package options with the names being package names (e.g. \code{list(hyperef = c("unicode=true", "breaklinks=true"), lmodern = NULL)}). It can be used to add custom LaTeX packages to the .tex header.} \item{...}{Arguments passed to \code{pdf_document()}.} } \value{ R Markdown output format to pass to \code{\link{render}} } \description{ Formats for converting from R Markdown to a PDF or LaTeX document. } \details{ See the \href{https://yihui.org/rmarkdown/pdf-document.html}{online documentation} for additional details on using the \code{pdf_document} format. 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. For more details see the documentation on R Markdown \link[=rmd_metadata]{metadata}. R Markdown documents also support citations. You can find more information on the markdown syntax for citations in the \href{https://pandoc.org/MANUAL.html#citations}{Bibliographies and Citations} article in the online documentation. Many aspects of the LaTeX template used to create PDF documents can be customized using metadata. For example: \tabular{l}{ \code{---} \cr \code{title: "Crop Analysis Q3 2013"} \cr \code{fontsize: 11pt} \cr \code{geometry: margin=1in} \cr \code{---} } Available metadata variables include: \describe{ \item{\code{lang}}{Document language code (e.g. "es", "fr", "pt-BR")} \item{\code{fontsize}}{Font size (e.g. 10pt, 11pt, 12pt)} \item{\code{documentclass}}{LaTeX document class (e.g. article)} \item{\code{classoption}}{Option for \code{documentclass} (e.g. oneside); may be repeated} \item{\code{geometry}}{Options for geometry class (e.g. margin=1in); may be repeated} \item{\code{mainfont, sansfont, monofont, mathfont}}{Document fonts (works only with xelatex and lualatex, see the \code{latex_engine} option)} \item{\code{linkcolor, urlcolor, citecolor}}{Color for internal, external, and citation links (red, green, magenta, cyan, blue, black)} \item{\code{linestretch}}{Options for line spacing (e.g. 1, 1.5, 3)} } } \examples{ \dontrun{ 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")) } }