Pandoc在书目后插入附录 [英] Pandoc insert appendix after bibliography
问题描述
我正在R中使用knitr软件包和pandoc将.Rmd文件转换为PDF. Pandoc链接到.bib文件,并自动在PDF的末尾插入参考书目 我的.bib文件中的条目如下所示,它们取自 http://johnmacfarlane.net/pandoc/demo/biblio.bib :
I'm using the knitr package and pandoc in R to convert a .Rmd file to a PDF. Pandoc is linked to a .bib file and automatically inserts the bibliography at the end of the PDF The entries in my .bib file look like these, taken from http://johnmacfarlane.net/pandoc/demo/biblio.bib:
@Book{item1,
author="John Doe",
title="First Book",
year="2005",
address="Cambridge",
publisher="Cambridge University Press"
}
@Article{item2,
author="John Doe",
title="Article",
year="2006",
journal="Journal of Generic Studies",
volume="6",
pages="33-34"
}
To build my bibliography, I'm using the following function, taken from: http://quantifyingmemory.blogspot.co.il/2013/02/reproducible-research-with-r-knitr.html
knitsPDF <- function(name) {
library(knitr)
knit(paste0(name, ".Rmd"), encoding = "utf-8")
system(paste0("pandoc -o ", name, ".pdf ", name, ".md --bibliography /Users/.../Desktop/test.bib --csl /Users/.../Desktop/taylor-and-francis-harvard-x.csl"))
}
.Rmd文件的内容是:
The contents of my .Rmd file is:
This is some text [@item1]
This is more text [@item2]
# References
输出的PDF看起来像这样:
And outputted PDF looks like this:
如果我尝试插入一个附录,引用仍然会打印在文档的末尾,如下所示:
If I try to insert an appendix, the references still print at the end of the document, like this:
如何在参考文献后插入附录?
How do insert an appendix after the references?
推荐答案
Eventually reference handling will change to make it possible to put the references wherever you like (https://github.com/jgm/pandoc/issues/771), but right now there's no easy way to do it.
根据建议此处,您可以将附录放在在单独的文件中,使用pandoc将其转换为LaTeX片段,然后使用--include-after-body
标志包含该片段.然后在书目之后出现.
As suggested here, you could put your appendix in a separate file, use pandoc to convert it to a LaTeX fragment, then include that fragment using the --include-after-body
flag. It would then come after the bibliography.
这篇关于Pandoc在书目后插入附录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!