如何在R Markdown中的biblatex中更改引用样式?

Nam*_*los 5 latex r citations biblatex r-markdown

citation_package: biblatex.Rmd文件的YAML中包含时,可以指定引用样式吗?在各种R降价手册中找不到关于此的任何信息。

Mic*_*per 7

此问题已于20163 月解决。由于许多文档是在此之前编写的,因此它并不总是出现在指南中。但是,rmarkdown 上的NEWS文件始终是检查新功能的好地方。

您可以biblio-style在 YAML 中使用该参数。如果你熟悉乳胶,这基本上是在\usepackage[style= *SELECTED STYLE*]{biblatex}. 这是一个例子。它将.bib为您构建一个单独的文件:

---
output: 
  pdf_document:
    citation_package: biblatex
keep_tex: TRUE
bibliography: test.bib
---

```{r}
knitr::write_bib(x = c("knitr", "rmarkdown") , file = "test.bib")
```

Some ref [@R-knitr]

Another ref [@R-rmarkdown]

# References
Run Code Online (Sandbox Code Playgroud)

这输出: 在此处输入图片说明

添加biblio-style参数:

---
output: 
  pdf_document:
    citation_package: biblatex
keep_tex: TRUE
bibliography: test.bib
biblio-style: authoryear
---

```{r}
knitr::write_bib(x = c("knitr", "rmarkdown") , file = "test.bib")
```

Some ref [@R-knitr]

Another ref [@R-rmarkdown]

# References
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

要了解有关您可以使用的不同样式的更多信息,请在此处查看:https : //www.sharelatex.com/learn/Biblatex_citation_styles

更进一步:YAML 仅提供对书目风格的一定程度的控制。例如,您不能citestyle直接指定。如果您想进一步更改 biblatex 样式,则需要编辑 pandoc 模板:https : //github.com/rstudio/rmarkdown/blob/master/inst/rmd/latex/default-1.15.2.tex . 不过,这有点高级,因此只有在您对 LaTex 感到满意时才推荐它:https ://rmarkdown.rstudio.com/pdf_document_format.html#custom_templates