我正在尝试在降价文件中使用自定义引文样式,但每次编织时引文都使用默认(芝加哥)样式。我尝试将输出格式从 JS 显示演示文稿更改为 HTML 文档到 PDF 文档,但它仍然不起作用。我正在使用 knitcitations 包来引用文档的 DOI,并使用 bibliography() 函数来编写参考书目。我也尝试过使用 Zotero 上的 apa.csl 样式,但引用仍以默认样式完成。apa.csl 文件与我尝试在其中使用引文的文件存储在同一文件夹中,newbiblio.bib 文件也是如此,我在其中存储了我要引用的项目的书目信息。
下面是我的降价代码:
---
title: "htmlcitetest"
citation_package: natbib
csl: "apa.csl"
output:
pdf_document:
pandoc_args: ["--natbib"]
biblio-style: unsrt
bibliography: newbiblio.bib
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(bibtex)
library(knitcitations)
options("citation_format" = "pandoc")
library(RefManageR)
cleanbib()
```
## R Markdown
- This is a citation [^1]
[^1]: `r citet("10.1098/rspb.2013.1372")`
```{r, message=FALSE}
bibliography()
```
此链接(http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html)说我应该能够像这样格式化我的 YAML 标头:
---
title: "Sample Document"
output: html_document
bibliography: newbiblio.bib
csl: apa.csl
---
但是,当我这样做时,文件会合并到一个降价(.md)文件,但它不会被处理到输出中。我收到此错误:
pandoc-citeproc: 23:3-23:10: Expected end element for: Name {nameLocalName = "category", nameNamespace = Just "http://purl.org/net/xbiblio/csl", namePrefix = Nothing}, but received: EventEndElement (Name {nameLocalName = "info", nameNamespace = Just "http://purl.org/net/xbiblio/csl", namePrefix = Nothing})
pandoc: Error running filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc
Filter returned error status 1
Error: pandoc document conversion failed with error 83
Execution halted
我的 .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},
}
我也不明白为什么 YAML 标头中的 biblio-style 选项没有做任何事情。从本质上讲,我所需要的只是一种使用我已经用 Markdown 文档制作的自定义引用样式的方法。任何帮助将不胜感激!