引用 rmd 文件中的引用和 pandoc-citeproc.exe 中的错误
Posted
技术标签:
【中文标题】引用 rmd 文件中的引用和 pandoc-citeproc.exe 中的错误【英文标题】:citing references in a rmd file & error in pandoc-citeproc.exe 【发布时间】:2017-11-15 03:38:32 【问题描述】:这是我第一次想在我的 rmd 文件中使用引用,但我不知道该怎么做。我将 rmd 文件转换为 pdf 文档,但在生成参考和参考书目时遇到问题。编织时出现此错误:
pandoc-citeproc.exe: 找不到 bibliography.bib pandoc.exe: 错误 运行过滤器 pandoc-citeproc 过滤器返回错误状态 1 错误: pandoc 文档转换失败,错误 83
这是我的 yaml 上下文:
> title: "Context" > author: "Minoo" > date: "2017/06/06" > output: > pdf_document: > toc: true > toc_depth: 3 > bibliography: bibliography.bib > vignette: > > %\VignetteIndexEntryContext > %\VignetteEngineknitr::rmarkdown > %\VignetteEncodingUTF-8
我已经在我的 rmd 文件的最后部分列出了这样的引用:
@article@Csardi2006, Csardi G, Nepusz T: The igraph software package for complex network research, InterJournal, Complex Systems 1695. 2006. http://igraph.org
@article@Butts2015, Butts C (2015). network: Classes for Relational Data. The Statnet Project (http://statnet.org). R package version 1.13.0, http://CRAN.R-project.org/package=network.
@article@Butts2008, Butts C (2008). “network: a Package for Managing Relational Data in R.” Journal of Statistical Software, 24(2). http://www.jstatsoft.org/v24/i02/paper.
我要么在我的上下文中引用它们为 [@Csardi2006]。 有什么想法可以解决这个问题吗? 更具体地说,如何在 rmd 文件中引用?
【问题讨论】:
【参考方案1】:也许您需要将 bibliography.bib 文件放入您的工作目录或将您的参考书目列出到头部,例如参考书目:
在编辑器中或使用JabRef 之类的程序手动编写 bibliography.bib 文件。还有一些方法可以自动生成,例如Zotero:
% Encoding: UTF-8
@articlecsardi2006,
author = G, Csardi and T, Nepusz,
title = The igraph software package for complex network research,
journal = InterJournal, Complex Systems,
year = 2006,
url = http://igraph.org,
@article...
@article...
将其作为“bibliography.bib”保存到您的工作目录中。
带有参考书目的 YAML 元数据:
---
title: "Context"
author: "Minoo"
date: "June 13, 2017"
output:
pdf_document: default
html_document: default
bibliography: bibliography.bib
---
或包含引用的 YAML 元数据,例如快速论文:
---
title: "Context"
author: "Minoo"
date: "June 13, 2017"
output:
pdf_document: default
html_document: default
references:
- id: csardi2006
author:
- family: Csardi
given: G.
- family: Nepusz
given: T.
publisher: InterJournal, Complex Systems
title: The igraph software package for complex network research
type: article-journal
issued:
year: 2006
---
RMD 的文本部分:
```r setup, include=FALSE
knitr::opts_chunk$set(echo = TRUE)
```
## Text
Lorem ipsum dolor sit amet [@csardi2006], consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
## Biblio
【讨论】:
感谢您的回复,但是bibliography.bib文件的格式应该怎么写,怎么写呢?是否应该写在脚本中 @minoo 我已经扩展了我的答案。我认为您的引用可能采用不同的格式,您可以在编辑器中进行比较。 我正在尝试按照您的指示进行操作,还有一个问题是:您已经在 yaml 中编写了参考文献之一,对于更多参考文献,我是否也写了 min the yaml?如果是怎么办? 在参考书目方法中,您只需指向放置所有引用的 YAML 中的 *.bib 文件(我现在已经在上面更正了......)。 感谢您的完整回答。我可以生成参考。以上是关于引用 rmd 文件中的引用和 pandoc-citeproc.exe 中的错误的主要内容,如果未能解决你的问题,请参考以下文章
终于解决了Rstudio中Rmarkdown的.rmd文件knit为PDF
RMarkdown 中对 reference_docx 的绝对引用