Rnw
document to PDFCall knit()
to compile the .Rnw
input to .tex
,
and then tinytex::latexmk()
to convert .tex
to
.pdf
.
rnw2pdf(
input,
output = with_ext(input, "pdf"),
compiler = "xelatex",
envir = parent.frame(),
quiet = FALSE,
clean = TRUE,
error = FALSE,
...
)
The output
file path.
Path to the input file.
Path of the PDF output file. By default, it uses the same name
as the input
, but changes the file extension to ".pdf".
The LaTeX engine and other arguments to be passed to
tinytex::latexmk()
. The default compiler is
xelatex
.
Environment in which code chunks are to be evaluated, for
example, parent.frame()
, new.env()
, or
globalenv()
).
Boolean; suppress the progress bar and messages?
If TRUE
, the intermediate files will be removed.
If FALSE
, knitting stops when any error occurs.
This function is similar to knit2pdf()
, with the following differences:
The default compiler is "xelatex" instead of "pdflatex".
output
uses the file extension ".pdf" instead of ".tex".
Before knitting, it tries to remove the output
file and will throw a clear error if the file cannot be removed.
output
could be under any dir, not necessarily the same directory as input
.
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
).