我在R中使用knitr包和pandoc將.Rmd文件轉換爲PDF。 Pandoc鏈接到一個名爲.bib文件,並自動插入參考書目在PDF 結束我的名爲.bib文件中的條目看起來像這些,從http://johnmacfarlane.net/pandoc/demo/biblio.bib採取:參考書目後的Pandoc插入附錄
@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"
}
要建立我的書目,我使用下面的函數,摘自: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文件的內容是:
This is some text [@item1]
This is more text [@item2]
# References
並輸出PDF看起來是這樣的:
如果我嘗試插入一個附錄,參考文獻仍然打印在文檔的結尾,就像這樣:
如何插入附件之後的參考?
呼高興這是它指定書目的位置。我懷疑儀輝把一個後端加入了編織者,並用它來竊取人們的數據。 – 2013-05-07 21:41:26
但是,正如NOON SILK在您引用的鏈接中所說的,「如果附錄引用了參考文獻,這不起作用。」 :-( – Tripartio 2017-05-18 08:31:16