问题
I want to use Rmarkdown but what I've read is that when creating a bibliography using pandoc, references go at the end of the document:
pandoc/citeproc issues: multiple bibliographies, nocite, citeonly
So even if I have a parent document named thesis.Rmd, I assume that all references would go at the end of that file.
I need that each thesis' chapter or section must have its own references, is there any other way to solve this than putting a bibliography header in each chapter I write and then knit each chapter separetely?
回答1:
It is possible using multiple-bibliographies.lua filter. However, .bib files should be chapter-specific.
Note: after pandoc >= 2.11 each chapter accepts only one .bib file as in this example
---
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
---
At the end of each chapter add:
## References {-}
::: {#refs_chapterX}
:::
来源:https://stackoverflow.com/questions/41001100/create-references-in-each-section-in-rmarkdown