R Markdown: place an Appendix after the “References” section?

痴心易碎 提交于 2020-06-16 06:21:06

问题


I am writing a report with R Markdown in which I include references. The problem is that R markdown automatically places references at the end of the report. I would like to place an Appendix after the references, is there a way to do it? I saw that it is possible with a child document but I would like to have everything in a unique .Rmd file.

Below is a reproducible example:

---
title:
author:
date: 
abstract: 

output: 
  pdf_document:
    template: NULL
    number_sections: true
    citation_package: biblatex
bibliography: references.bib
biblio-style: bwl-FU
---

# Partie 1

\cite{greenwood_financial_1989}

<!-- where I would like the references to be -->

# Appendix

bla bla 

and here is the content of the references.bib file:

@article{greenwood_financial_1989,
  title = {Financial Development, Growth and the Distribution of Income},
  url = {https://www.nber.org/papers/w3189},
  number = {3189},
  journaltitle = {NBER Working Paper Series},
  date = {1989},
  author = {Greenwood, Jeremy and Jovanovic, Boyan}
}

Any idea ?


回答1:


This is explained in the R Markdown Cookbook (section 3.5.4). We can force the bibliography to be printed at a particular place with:

# References

<div id="refs"></div>

# Appendix

Note that:

  • this works if we cite the papers with @id_of_paper (which is the recommended way in R Markdown) but not with \cite{id_of_paper}.
  • this does not work if we use citation_package: biblatex in YAML

Here's my adapted example:

---
title:
author:
date: 
abstract: 
output: 
  pdf_document:
    template: NULL
    number_sections: true
bibliography: references.bib
biblio-style: bwl-FU
---

# Partie 1

@greenwood_financial_1989


# References

<div id="refs"></div>


# Appendix

bla bla 


来源:https://stackoverflow.com/questions/58187514/r-markdown-place-an-appendix-after-the-references-section

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!