【问题标题】:How to change citation style in biblatex in R Markdown?如何在 R Markdown 中更改 biblatex 中的引用样式?
【发布时间】:2018-08-09 02:28:54
【问题描述】:

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

【问题讨论】:

    标签: r latex r-markdown citations biblatex


    【解决方案1】:

    此问题已在 March 2016 中解决。由于很多文档都是在此之前编写的,因此它并不总是出现在指南中。但是,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
    

    这输出:

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

    更进一步:YAML 仅提供对 biblio 样式的一定程度的控制。例如,您不能直接指定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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-14
      • 2022-08-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多