Learn R Programming

knitr (version 1.28)

knit2pdf: Convert Rnw or Rrst files to PDF

Description

Knit the input Rnw or Rrst document, and compile to PDF using tinytex::latexmk() or rst2pdf().

Usage

knit2pdf(
  input,
  output = NULL,
  compiler = NULL,
  envir = parent.frame(),
  quiet = FALSE,
  ...
)

Arguments

input

Path to the input file.

output

Path to the output file for knit(). If NULL, this function will try to guess a default, which will be under the current working directory.

compiler

A character string giving the LaTeX engine used to compile the tex document to PDF. For an Rrst file, setting compiler to 'rst2pdf' will use rst2pdf to compile the rst file to PDF using the ReportLab open-source library.

envir

Environment in which code chunks are to be evaluated, for example, parent.frame(), new.env(), or globalenv()).

quiet

Boolean; suppress the progress bar and messages?

...

Options to be passed to tinytex::latexmk or rst2pdf.

Value

The filename of the PDF file.

Examples

Run this code
# NOT RUN {
#' compile with xelatex
## knit2pdf(..., compiler = 'xelatex')

#' compile a reST file with rst2pdf
## knit2pdf(..., compiler = 'rst2pdf')
# }

Run the code above in your browser using DataLab