R Markdown:在“参考"之后放置一个附录部分? [英] R Markdown: place an Appendix after the "References" section?
问题描述
我正在用 R Markdown 编写一份报告,其中包含参考资料.问题是 R markdown 会自动在报告末尾放置引用.我想在参考文献后面放一个附录,有什么办法吗?我看到子文档是可能的,但我想把所有东西都放在一个唯一的 .Rmd
文件.
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
这里是 references.bib
文件的内容:
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}
}
有什么想法吗?
推荐答案
这在 R Markdown Cookbook(第 3.5.4 节).我们可以强制将参考书目打印在特定位置:
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
注意:
- 如果我们使用
@id_of_paper
(这是 R Markdown 中推荐的方式)引用论文而不是\cite{id_of_paper}
,则此方法有效. - 如果我们在 YAML 中使用
citation_package: biblatex
,这将不起作用
- 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
这是我改编的例子:
---
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
这篇关于R Markdown:在“参考"之后放置一个附录部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!