7

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?

Martin Schmelzer
  • 23,283
  • 6
  • 73
  • 98
  • AFAIK there is no way to do this. I had a simpler problem (moving the biblio section before the appendix section) and had to write a quick pandoc filter just for that. – Sergio Correia Dec 07 '16 at 04:03
  • @SergioCorreia apparently I'm going to need and appendix after my biblio section, could you please explain what is a pandoc filter for this and how does it work? – Juliana Benitez Jan 19 '18 at 19:53

1 Answers1

2

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}
:::
Ferroao
  • 3,042
  • 28
  • 53