引用rmd文件中的引用& pandoc-citeproc.exe

时间:2017-06-13 11:23:10

标签: r build package knitr bibliography

这是我第一次在我的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: >
>       %\VignetteIndexEntry{Context}
>       %\VignetteEngine{knitr::rmarkdown}
>       %\VignetteEncoding{UTF-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 个答案:

答案 0 :(得分:2)

也许您需要将bibliography.bib文件放入工作目录或将参考书目列入头部,例如:参考书目:

在编辑器中或使用JabRef等程序手动编写bibliography.bib文件。还有一些方法可以用例如自动生成。 Zotero

% Encoding: UTF-8
    @article{csardi2006,
      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