微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决没有引用函数在我的 Rmd 文档的顶部写“no cite”

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

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

问题是当我在编织文档时这样做时,我得到的只是

enter image description here

但是当我将那段 nocite 代码添加到 YAML 标头中时:

enter image description here

它像正常一样生成一个参考表,但在文档的顶部我得到了这个:

enter image description here

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

解决方法

按照 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},}

这会产生以下文档:

enter image description here

为了使差异更明显,你必须改变

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{*}

这会产生以下文档:

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。