在 Rmarkdown 中的每个部分中创建引用

Jul*_*tez 7 r pandoc r-markdown reproducible-research

我想使用 Rmarkdown,但我读到的是,当使用 pandoc 创建参考书目时,引用位于文档末尾:

pandoc/citeproc 问题:多个参考书目、nocite、citeonly

因此,即使我有一个名为 thesis.Rmd 的父文档,我也假设所有引用都将位于该文件的末尾。

我需要每个论文的章节必须有自己的参考文献,除了在我写的每个章节中放置参考书目标题然后单独编织每个章节之外,还有其他方法可以解决这个问题吗?

Fer*_*oao 2

可以使用multiple-bibliographies.lua过滤器。但是,.bib 文件应该是特定于章节的。

注意:在 pandoc >= 2.11 之后,每一章仅接受一个 .bib 文件,如本例所示

---
title: "Doc title"
author: "name name"
date: "23 08 2019"
output:
  html_document:
    toc: true
    toc_depth: 1
    number_sections: true
    pandoc_args: --lua-filter=multiple-bibliographies.lua

bibliography_chapter1: [chapter1.bib]
bibliography_chapter2: [chapter2.bib]
bibliography_chapter3: [chapter3.bib]    
csl: format.csl
link-citations: yes
---
Run Code Online (Sandbox Code Playgroud)

在每章末尾添加:

## References {-}

::: {#refs_chapterX}
:::
Run Code Online (Sandbox Code Playgroud)