通过此链接我能够复制参考结果。
https://texblog.org/2013/08/20/rknitr-automatic-bibliography-generation-with-biblatex-in-rstudio/
我如何添加多个输出?我如何手动添加这些参考输出?
最近几天我一直在努力寻找如何做到这一点。但我没有成功。
有什么帮助吗?
这是代码:
\documentclass{article}
\usepackage{hyperref}
\usepackage[backend=bibtex, sorting=none]{biblatex}
\bibliography{references}
\begin{filecontents*}{references.bib}
@Manual{knitr2013,
title = {knitr: A general-purpose package for dynamic report
generation in R},
author = {Yihui Xie},
year = {2013},
note = {R package version 1.4.1},
url = {http://yihui.name/knitr/},
}
\end{filecontents*}
\begin{document}
\section*{Automatic biblatex bibliography generation in RStudio using knitr}
<<setup, include=FALSE, cache=FALSE, echo=FALSE>>=
opts_chunk$set(fig.path='figures/plots-', fig.align='center', fig.show='hold', eval=TRUE, echo=TRUE)
options(replace.assign=TRUE,width=80)
Sys.setenv(TEXINPUTS=getwd(),
BIBINPUTS=getwd(),
BSTINPUTS=getwd())
@
<<sample-data-hist-and-box, out.width='0.48\\textwidth'>>=
sampleData <- rnorm(1000, 0,1)
hist(sampleData)
boxplot(sampleData)
@
This document was produced in RStudio using the knitr package \cite{knitr2013} by \url{http://texblog.org}.
\printbibliography
\end{document}
答案1
中的示例https://texblog.org/2013/08/20/rknitr-automatic-bibliography-generation-with-biblatex-in-rstudio/使用filecontents
环境来生成.bib
文件并使示例自包含。
实际上,您通常不会在文档中使用它,而是在与文件相同的目录中filecontents
创建一个专用文件。该文件包含所有相关参考资料。references.bib
.tex
.bib
所以你的Rnw
文件看起来像
\documentclass{article}
\usepackage{hyperref}
\usepackage[backend=bibtex, sorting=none]{biblatex}
\bibliography{references}
\begin{document}
\section*{Automatic biblatex bibliography generation in RStudio using knitr}
<<setup, include=FALSE, cache=FALSE, echo=FALSE>>=
options(replace.assign=TRUE,width=80)
Sys.setenv(TEXINPUTS=getwd(),
BIBINPUTS=getwd(),
BSTINPUTS=getwd())
@
<<sample-data-hist-and-box, out.width='0.48\\textwidth'>>=
sampleData <- rnorm(1000, 0,1)
hist(sampleData)
boxplot(sampleData)
@
This document was produced in RStudio using the knitr package \cite{knitr2013} by \url{http://texblog.org}.
See also \cite{sigfridsson}.
\printbibliography
\end{document}
你references.bib
看起来会像这样
@Manual{knitr2013,
title = {knitr: A general-purpose package for dynamic report
generation in R},
author = {Yihui Xie},
year = {2013},
note = {R package version 1.4.1},
url = {http://yihui.name/knitr/},
}
@article{sigfridsson,
author = {Sigfridsson, Emma and Ryde, Ulf},
title = {Comparison of methods for deriving atomic charges from the
electrostatic potential and moments},
journaltitle = {Journal of Computational Chemistry},
date = 1998,
volume = 19,
number = 4,
pages = {377-395},
doi = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}