| rnw2pdf {knitr} | R Documentation |
Convert an ‘Rnw’ document to PDF
Description
Call knit() to compile the ‘.Rnw’ input to ‘.tex’,
and then tinytex::latexmk() to convert ‘.tex’ to
‘.pdf’.
Usage
rnw2pdf(
input,
output = with_ext(input, "pdf"),
compiler = "xelatex",
envir = parent.frame(),
quiet = FALSE,
clean = TRUE,
error = FALSE,
...
)
Arguments
input |
Path to the input file. |
output |
Path of the PDF output file. By default, it uses the same name
as the |
compiler, ... |
The LaTeX engine and other arguments to be passed to
|
envir |
Environment in which code chunks are to be evaluated, for
example, |
quiet |
Boolean; suppress the progress bar and messages? |
clean |
If |
error |
If |
Details
This function is similar to knit2pdf(), with the following differences:
The default compiler is "xelatex" instead of "pdflatex".
-
outputuses the file extension ".pdf" instead of ".tex". Before knitting, it tries to remove the
outputfile and will throw a clear error if the file cannot be removed.-
outputcould be under any dir, not necessarily the same directory asinput. It cleans up intermediate files by default, including the ".tex" file.
It stops knitting when any error occurs (by setting the chunk option
error = FALSE).
Value
The output file path.