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

How to change citation style in biblatex in R Markdown?

citation_package: biblatex包含在.Rmd文件的YAML中时,是否可以指定引用样式?我在各种 R markdown 手册中找不到这方面的任何信息。

This issue was resolved in March 2016. As a lot of the documentation was written before this, it doesn't always show up in the guidance. However, the NEWS file on rmarkdown is always a good place to check for new features.

您可以在 YAML 中使用 biblio-style 参数。如果你熟悉latex,这基本上就是填\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

这输出:

添加 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

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

Taking this further: the YAML only provides a certain amount of control of the biblio-style. For example, you cannot specify citestyle directly. if you want to go further with changing the biblatex style, you will need to edit the pandoc template: https://github.com/rstudio/rmarkdown/blob/master/inst/rmd/latex/default-1.15.2.tex . This is a bit more advanced though, so only recommend it if you are comfortable with LaTex: https://rmarkdown.rstudio.com/pdf_document_format.html#custom_templates