编译后 RStudio 中是否可以加快 Sumatra 中的 PDF 预览速度?

Is it possible in RStudio to speed up the PDF preview in Sumatra after compiling?

我不得不重新安装计算机上的所有内容。 重新安装 R、Rstudio、Pandoc 和 MikTex 后,使用 RStudio 和 Sumatra 预览编织 PDF 需要很长时间。在重新安装之前,整个过程只用了几秒钟。现在我必须等待三十多秒才能完成 Sumatra 预览。该过程在

之间以某种方式停止了一段时间
output file: MyFile.knit.md

Output created: volatility2.pdf

在 R Markdown 控制台中打印的部分输出。

我在 RStudio 中使用 Knit to PDF 选项,我在 windows 7 64 位系统上。我希望你们中的一些人能提出一些建议,因为这个小问题确实扰乱了我的工作流程。我测试过的所有 .Rmd 文件都会出现同样的问题。

如果您 knit 在处理文档以预览最终输出时,可能有一个解决方法:

RStudio 将很快发布一种名为 html_notebook 的新文档类型,它已在 preview release 中可用。与标准 .rmd 文件不同,笔记本不是 knit 而是 previewed:

Ordinary R Markdown documents are “knit”, but notebooks are “previewed”. While the notebook preview looks similar to a rendered R Markdown document, the notebook preview does not execute any of your R code chunks; it simply shows you a rendered copy of the markdown in your document along with the most recent chunk output. This preview is generated automatically whenever you save the notebook ... [source].

这意味着您可以立即看到输出,因为笔记本会更新您的 .rmd 文件,而不是编织整个文档。

Jonathan McPherson points out in the comments section of this manual 一样,笔记本的设计让您可以简单地将 html_notebook 替换为 pdf_document 等,以实现文件格式之间的无缝转换。

换句话说,您可以在处理文件时使用笔记本格式,并且在将 html_notebook 更改为 pdf_document 后只编织一次文档以获得您的最终版本(对于自动转换,请参见例如, this answer).