knitcitations给出了pandoc-citeproc错误

 mobiledu2502917797 发布于 2022-12-29 12:12

我有以下文档,我试图用Rstudio编译:

---
output: 
  word_document: 
    pandoc_args: [
      "--biblio", "references.bib"
    ]
---
```{r}
library("knitcitations")
cleanbib()
```
This is a citation citet("10.1098/rspb.2013.1372"): 
```{r}
citet("10.1098/rspb.2013.1372")
```

```{r}
write.bibtex(file="references.bib")
```

```{r}
summary(cars)
```

当我运行knit时,它会编译.md文件,但是pandoc会出错:

processing file: toy.Rmd
  |......................                                           |  33%
  ordinary text without R code

  |.............................                                    |  44%
label: unnamed-chunk-2
  |....................................                             |  56%
  ordinary text without R code

  |...........................................                      |  67%
label: unnamed-chunk-3
  |...................................................              |  78%
  ordinary text without R code

  |..........................................................       |  89%
label: unnamed-chunk-4
  |.................................................................| 100%
  ordinary text without R code


/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc toy.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output toy.docx --highlight-style tango --biblio references.bib 
output file: toy.knit.md

pandoc: Error running filter pandoc-citeproc
pandoc-citeproc not found in path
Error: pandoc document conversion failed with error 83
Execution halted

生成的引用文件是references.bib:

@Article{Boettiger_2013,
  doi = {10.1098/rspb.2013.1372},
  url = {http://dx.doi.org/10.1098/rspb.2013.1372},
  year = {2013},
  month = {Jul},
  publisher = {The Royal Society},
  volume = {280},
  number = {1766},
  pages = {20131372-20131372},
  author = {C. Boettiger and A. Hastings},
  title = {No early warning signals for stochastic transitions: insights from large deviation theory},
  journal = {Proceedings of the Royal Society B: Biological Sciences},
}

Jim M... 7

错误消息表明在$ PATH中找不到pandoc-citeproc(即/ usr/bin /等).一种解决方法是从嵌入在Rstudio中的pandoc-citeproc创建一个链接并将其放在/ usr/local中/ bin目录.

在终端:

sudo ln /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc  /usr/local/bin/pandoc-citeproc
cd /usr/local/bin
chown root /usr/local/bin/pandoc-citeproc
chgrp wheel /usr/local/bin/pandoc-citeproc

pandoc结果:

knitr结果的屏幕截图

1 个回答
  • 错误消息表明在$ PATH中找不到pandoc-citeproc(即/ usr/bin /等).一种解决方法是从嵌入在Rstudio中的pandoc-citeproc创建一个链接并将其放在/ usr/local中/ bin目录.

    在终端:

    sudo ln /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc  /usr/local/bin/pandoc-citeproc
    cd /usr/local/bin
    chown root /usr/local/bin/pandoc-citeproc
    chgrp wheel /usr/local/bin/pandoc-citeproc
    

    pandoc结果:

    knitr结果的屏幕截图

    2022-12-29 12:14 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有