使用render编译Rmarkdown文档
当我直接在RStudioIDE中编织Rmarkdown模板时,它会准确地创建所需的PDF。但是,当我尝试使用rmarkdown::render()编织文档时,我遇到了一个无法理解的错误。我已经安装了Rmarkdown和MikTex的最新版本。详情如下: 下面是我使用的Rmarkdown模板。谢谢你能给我的帮助使用render编译Rmarkdown文档,r,r-markdown,pdflatex,R,R Markdown,Pdflatex,当我直接在RStudioIDE中编织Rmarkdown模板时,它会准确地创建所需的PDF。但是,当我尝试使用rmarkdown::render()编织文档时,我遇到了一个无法理解的错误。我已经安装了Rmarkdown和MikTex的最新版本。详情如下: 下面是我使用的Rmarkdown模板。谢谢你能给我的帮助 --- title: "Test" output: pdf_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(
---
title: "Test"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
这是我的会话信息:
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.3 backports_1.1.2 magrittr_1.5 rprojroot_1.3-2 htmltools_0.3.6 tools_3.4.3 yaml_2.1.16 tinytex_0.3
[9] Rcpp_0.12.15 stringi_1.1.6 rmarkdown_1.8.10 knitr_1.19 stringr_1.2.0 digest_0.6.15 evaluate_0.10.1
windows上的“状态127”通常意味着在路径中找不到可执行文件。
Sys.which(“pdflatex”)
给你什么?(如果”
,那么问题是MiKTeX
或windows-TeXLive
不在路径中。RStudio在调用pandoc
和friends时可能会自行修复此问题。)rEvans-我得到的Sys.which(“pdflatex”)返回“”是正确的。但当我运行Sys.getenv(“PATH”)时,我会在正确的路径中看到MikTex(“C:\\Users\\sshewfelt.INGENUITY\\AppData\\Local\\Programs\\MikTex 2.9\\MikTex\\bin\\x64\”)。有什么建议吗?如果你不介意的话,卸载MiKTeX,然后测试TinyTeX:(你需要重新启动R/RStudio),这样做效果很好。非常感谢易慧!虽然我不知道为什么MiKTeX没有为你工作,但我很高兴TinyTeX还是工作了。
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.3 backports_1.1.2 magrittr_1.5 rprojroot_1.3-2 htmltools_0.3.6 tools_3.4.3 yaml_2.1.16 tinytex_0.3
[9] Rcpp_0.12.15 stringi_1.1.6 rmarkdown_1.8.10 knitr_1.19 stringr_1.2.0 digest_0.6.15 evaluate_0.10.1