首页 > 解决方案 > 包括 RMarkdown 中的整个书目条目 - 相当于 \fullcite?

问题描述

有没有办法在我的 Rmarkdown 文档的正文中包含整个书目条目?如果我使用 LaTeX,我会使用\fullcite{Smith2000}. 然后它会在我想要的任何地方打印:

Smith, J. 2000。 一本好书。牛津:牛津大学出版社。

这是一个示例 .Rmd 文件

---
title: "hi"
author: "dmt"
date: "30/04/2020"
output: html_document
bibliography: bib.bib
biblio-style: apalike
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown


```{r cars}
summary(cars)
```

Here is the citation of a book I am reading:

@Smith2000

But I would like to put the whole reference here like this: 

Smith, J. 2000. A nice book. Oxford: Oxford University Press.

How can I do this without writing it out?

这是一个示例 .bib 文件:

@book{Smith2000,
    Address = {Oxford},
    Author = {Smith, J},
    Date-Added = {2020-04-30 17:03:32 +0100},
    Date-Modified = {2020-04-30 17:04:03 +0100},
    Publisher = {Oxford University Press},
    Title = {A nice book},
    Year = {2000}}

标签: latexr-markdownknitrbiblatex

解决方案


这对我来说很好:

在你的 RMD 文件中执行这个块:

```{r, echo=FALSE}
biblio <- bibtex::read.bib("bib.bib")
```

然后,您可以在脚本中使用以下行:

`r capture.output(print(biblio["Smith2000"]))`

推荐阅读