Debian Codegraph @

man/rnw2pdf.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/utils-conversion.R
3 \name{rnw2pdf}
4 \alias{rnw2pdf}
5 \title{Convert an \file{Rnw} document to PDF}
6 \usage{
7 rnw2pdf(
8 input,
9 output = with_ext(input, "pdf"),
10 compiler = "xelatex",
11 envir = parent.frame(),
12 quiet = FALSE,
13 clean = TRUE,
14 error = FALSE,
15 ...
16 )
17 }
18 \arguments{
19 \item{input}{Path to the input file.}
20
21 \item{output}{Path of the PDF output file. By default, it uses the same name
22 as the \code{input}, but changes the file extension to ".pdf".}
23
24 \item{compiler, ...}{The LaTeX engine and other arguments to be passed to
25 \code{tinytex::\link[tinytex]{latexmk}()}. The default compiler is
26 \code{xelatex}.}
27
28 \item{envir}{Environment in which code chunks are to be evaluated, for
29 example, \code{\link{parent.frame}()}, \code{\link{new.env}()}, or
30 \code{\link{globalenv}()}).}
31
32 \item{quiet}{Boolean; suppress the progress bar and messages?}
33
34 \item{clean}{If \code{TRUE}, the intermediate files will be removed.}
35
36 \item{error}{If \code{FALSE}, knitting stops when any error occurs.}
37 }
38 \value{
39 The \code{output} file path.
40 }
41 \description{
42 Call \code{\link{knit}()} to compile the \file{.Rnw} input to \file{.tex},
43 and then \code{tinytex::\link[tinytex]{latexmk}()} to convert \file{.tex} to
44 \file{.pdf}.
45 }
46 \details{
47 This function is similar to \code{\link{knit2pdf}()}, with the following differences:
48 \enumerate{
49 \item The default compiler is "xelatex" instead of "pdflatex".
50 \item \code{output} uses the file extension ".pdf" instead of ".tex".
51 \item Before knitting, it tries to remove the \code{output} file and will throw a clear error if the file cannot be removed.
52 \item \code{output} could be under any dir, not necessarily the same directory as \code{input}.
53 \item It cleans up intermediate files by default, including the ".tex" file.
54 \item It stops knitting when any error occurs (by setting the chunk option \code{error = FALSE}).
55 }
56 }