在我的 Rmd 文档的顶部没有写 "no cite" 的引用函数

No cite function writing "no cite" at the top of my Rmd document

我想弄清楚如何在不引用文本来源的情况下获得参考 sheet, 据我了解我应该使用:

# References
---
nocite: '@*'
...

问题是,当我编织文档时,我得到的只是

但是当我将那部分 nocite 代码添加到 YAML header 中时,如下所示:

它像往常一样生成一个参考 sheet 但是在文档的顶部我得到这个:

谁能解释一下我如何在不使用 in-text 引用的情况下创建参考书目。

根据 Rstudio here 的建议,您需要将其格式化为:

---
title: "Stack Overflow Answer"
author: "duckmayr"
date: "1/2/2021"
output: pdf_document
nocite: | 
  @*
bibliography: refs.bib
---

(在refs.bib文件中我有以下内容:)

@Article{CameronKastellec2016Are,
  author  = {Charles M. Cameron and Jonathan P. Kastellec},
  title   = {Are {S}upreme {C}ourt nominations a move the median game?},
  journal = {American Political Science Review},
  year    = {2016},
  volume  = {110},
  number  = {4},
  pages   = {778--797},
}

这将生成以下文档:

为了让区别更明显一点,你必须改变

nocite: '@*'

nocite: |
  @*

更新:使用natbib

如果你想使用 natbib 引文包,那么你只需要使用 LaTeX 命令来生成引文,如下所示:

---
title: "Stack Overflow Answer"
author: "duckmayr"
date: "1/2/2021"
output:
  pdf_document:
    citation_package: natbib
bibliography: refs.bib
---

\nocite{*}

这将生成以下文档: