【问题标题】:R Markdown Could not find .bib file in one project, whilst working fine in anotherR Markdown 在一个项目中找不到 .bib 文件,而在另一个项目中工作正常
【发布时间】:2016-02-06 13:07:23
【问题描述】:

文件x中的rmd引用正常,单击knit后将引用添加到我的引用列表中,但是在文件y中,还有一个rmd文件设置如下:

title: Swans
bibliography: library.bib
output: html_document


[@Ticehurst1957]
##bibloography 

编织后出现如下错误,无输出

输出文件:essay_swan_first.knit.md

pandoc-citeproc: 找不到 library.bib pandoc:运行过滤器时出错 /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc 错误:pandoc 文档转换失败,错误 83 执行停止

怎么了?

【问题讨论】:

  • 可能签出stackoverflow.com/questions/25191744/…?我刚刚google了一下错误码,感觉挺有道理的。
  • 你的 rmarkdown 和 bib 文件在哪里?可能你的 wd 不是你想象的那样,特别是如果你正在使用 Rstudio 项目和嵌套的子目录。您可以尝试设置 library.bib 相对于您的项目根目录的路径
  • @scoa 似乎成功了。移动了围兜。文件与我当前的项目相同。感谢您的帮助

标签: r markdown pandoc


【解决方案1】:

knitr 期望所有路径都是绝对的或相对于您的current R working directory。在 Rstudio 项目中,工作目录是创建项目的目录(您可以通过getwd() 进行检查)。

您需要将您的 YAML 标头调整为:

---
bibliography: /path/to/library.bib
---

或将 library.bib 复制到您当前 rstudio 项目的文件夹中

【讨论】:

    猜你喜欢
    • 2015-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-05
    • 2021-08-08
    • 1970-01-01
    相关资源
    最近更新 更多