在 Rmarkdown 的每个部分创建引用 [英] create references in each section in Rmarkdown

查看:61
本文介绍了在 Rmarkdown 的每个部分创建引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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 问题:多个参考书目、nocite、citeonly

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

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?

推荐答案

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

It is possible using multiple-bibliographies.lua filter. However, .bib files should be chapter-specific.

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

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
---

在每章末尾添加:

## References {-}

::: {#refs_chapterX}
:::

这篇关于在 Rmarkdown 的每个部分创建引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆