With knitr and .Rnw for LaTeX, how do you print the full bibliography in PDF output?

寵の児 提交于 2019-12-04 05:32:47

As the error messages told you:

  1. Don't use \bibliographystyle{plain} (this does not work for biblatex); use the style option in \usepackage[]{biblatex} instead;
  2. \bibliography{jabrefbibtest} must be put in the preamble instead of the body.

After you correct these issues, it should work:

\documentclass[11pt]{article}  

\usepackage[backend=bibtex]{biblatex}
\bibliography{jabrefbibtest}
% or use \addbibresource{jabrefbibtest.bib}

\begin{document}

Here is one citation \cite{ABFWomenFirstChairs2015} and
here is a second \cite{ACCGCSkills2013}.

Now do full References show below?

\printbibliography   
\end{document}

BTW, RStudio probably does not support the default backend biber of biblatex, so the backend=bibtex option was used.

I use exactly this setup below to get (note I'm not a fan of changing wd in knitr/rmarkdown and removed this; also your keys in the Rnw didn't match the key in the mwe):

\documentclass[11pt]{article}

\usepackage[american]{babel}
\usepackage[style=apa,backend=biber,bibencoding=latin1]{biblatex}
\DeclareLanguageMapping{american}{american-apa}

\addbibresource{jabrefbibtest.bib}


\begin{document}

<<bibbackground, echo=FALSE, include=FALSE>>=
#setwd("~/R/knitr docs/")
Sys.setenv(TEXINPUTS=getwd(),
           BIBINPUTS=getwd(),
           BSTINPUTS=getwd())
@

%\bibliographystyle{plain}

Here is one citation \cite{GreentargetEngagement2012} and here is a second \cite{CitiprivateBank}.

Now do full References show below?

\printbibliography
\end{document}

Also after the Rnw knits I have to run the tex file though a LaTeX compiler to render the references the first time.

I always just place \bibliography{jabrefbibtest} at the end of the script where I want the references to occur.

To include all references from your .bib file in your bibliography, i.e. even ones that you didn't end up citing, include the line \nocite{*} right before the line \printbibliography

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