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

10
当在.Rmd文件的YAML中包含时,是否可以指定引用样式?我在各种R markdown手册中找不到任何信息。
1个回答

8
这个问题已在 2016年3月 得到解决。由于许多文档是在此之前撰写的,因此并不总是在指南中显示出来。但是,rmarkdown 上的 NEWS 文件始终是检查新功能的好地方。
您可以使用 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

这将输出: enter image description here

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

enter image description here

想要了解更多可用的不同样式,请查看此处: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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接