Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R knit2pdf():针织和乳胶通道_R_Latex_Knitr_Rstudio - Fatal编程技术网

R knit2pdf():针织和乳胶通道

R knit2pdf():针织和乳胶通道,r,latex,knitr,rstudio,R,Latex,Knitr,Rstudio,我正在使用knit2pdf(“book.Rnw”,quiet=TRUE)在 RStudio。编织步骤需要很长时间(我还没有使用缓存),何时开始 有新的参考文献、图表、交叉参考文献等。这需要几个步骤 即使.Rnw文件没有更改,也会传递以解析它们 我想要的是knit2pdf的等效版本或扩展版本,它允许 knit=FALSE禁止重新生成.tex文件,或 一个选项latex.passes=请求额外运行tools::texi2pdf 我已经看过knit2pdf中的代码,它有点太不透明,不允许使用 此功能的

我正在使用
knit2pdf(“book.Rnw”,quiet=TRUE)
在 RStudio。编织步骤需要很长时间(我还没有使用缓存),何时开始 有新的参考文献、图表、交叉参考文献等。这需要几个步骤 即使.Rnw文件没有更改,也会传递以解析它们

我想要的是knit2pdf的等效版本或扩展版本,它允许
knit=FALSE
禁止重新生成.tex文件,或 一个选项
latex.passes=
请求额外运行
tools::texi2pdf

我已经看过knit2pdf中的代码,它有点太不透明,不允许使用
此功能的一个简单补丁。

knit2pdf的全部功能是生成一个.tex文件,然后调用
工具:texi2pdf
。如果您正在寻找的
knit2pdf
版本不首先生成.tex文件,那么它正是
tools::texi2pdf

使用
stringr::str_replace
,我做了类似的事情,并发现这已经足够了:

knit2pdf_mod <- function(rnw_file) {
    knit2pdf(rnw_file, compiler = "xelatex")
    texi2pdf(file = str_replace(rnw_file, pattern = "Rnw", replacement = "tex"))
}

如何在不更改Rnw文件的情况下添加新引用?texi2pdf应根据需要自动运行多次,以整理所有引用。你能更详细地描述一下你的工作流程吗?这里发生了一些奇怪的事情。
knit2pdf_mod <- function(rnw_file, latex.passes = 1) {
    knit2pdf(rnw_file, compiler = "xelatex")
    for (i in 1:latex.passes) {
        texi2pdf(file = str_replace(rnw_file, pattern = "Rnw", replacement = "tex"))
    }
}