Package pdftex.def Error: File not found: using draft setting

Package pdftex.def Error: File not found: using draft setting

尽管使用 html 可以正常渲染,但 Rmd 未渲染!有一个similar question,但是没有回答。 jpg 也位于本地目录中,因为乳胶无法处理 http// 路径

这里有一个可重现的例子(图片存在,在html模式下渲染正常):

---
title: 'Title'
author: "SQC"
date: "30 march 2019"
output:
  pdf_document:
    toc: yes
    toc_depth: '2'
  html_document:
    keep_md: yes
    number_sections: yes
    toc: yes
    toc_depth: 2
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

Some text.

![text](C:/path2/file.jpg){width=500px}

more text...

评论:按照链接答案中的建议,我添加了

```{r}
getwd()
list.files("C:/path2/", full.names=TRUE)
```

那么错误就是

"C:/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.tex --table-of-contents --toc-depth 2 --template "C:\R\R-3.5.1\library\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --variable "compact-title:yes" output file: test.knit.md

! LaTeX Error: File `fancyvrb.sty' not found.

! Emergency stop.

Fehler: Failed to compile test.tex. See test.log for more info. Ausführung angehalten

同样,我从重新编辑 html 得知一切正常:路径存在,文件存在并已列出。

最后,"solution" 很简单:我只需要按照建议更改包的路径,例如here.

=> 运行 "miktex-console_admin.exe" => 转到 Packages => Install from... 我也改为 Uni-Hagen。

PS:我不知道在 windows 机器上工作是否必不可少。