So far, I have successfully used RStudio and R Markdown to write scientific papers and insert citations from the medical literature without significant problem as shown in the minimal example (MWE) below which produces a .pdf file.
---
title: ""
csl: nature.csl
output: pdf_document
bibliography: BIBLIOGRAPHY_24th_March_2019.bib
---
Meningiomas which are thought to arise from arachnoidal cap cells, are the most common meningeal tumours [@louis_2016_2016].
# References
I am now starting to write a PhD thesis always with RStudio but, this time with R Sweave (knitr to weave .Rnw files) as I want to use the functionalities of Latex. What seems simple in theory is in fact not.
The following MWE producing this error:
using fall-back bibtex(8) backend: functionality may be reduced/unavailable...
\documentclass{article}
\usepackage[backend= bibtex]{biblatex}
% or \usepackage[backend= biber]{biblatex}
\addbibresource{BIBLIOGRAPHY_24th_March_2019.bib}
% or %\bibliography{BIBLIOGRAPHY_24th_March_2019}
<<setup, eval= TRUE, include=FALSE, cache=FALSE, echo=FALSE>>=
Sys.setenv(TEXINPUTS=getwd(),
BIBINPUTS=getwd(),
BSTINPUTS=getwd())
@
\begin{document}
Meningiomas which are thought to arise from arachnoidal cap cells, are the most common meningeal tumours subtypes \cite{louis_2016_2016}.
\printbibliography
\end{document}
My simple bibliography file (BIBLIOGRAPHY_24th_March_2019.bib) is store in the same folder as the mwe.Rnw file (C:\Users\Charles\Documents\R) and is built as follow:
@article{louis_2016_2016,
title = {The 2016 World Health Organization Classification of Tumors of the Central Nervous System: a summary},
volume = {131},
issn = {1432-0533},
doi = {10.1007/s00401-016-1545-1},
shorttitle = {The 2016 World Health Organization Classification of Tumors of the Central Nervous System},
pages = {803--820},
number = {6},
journaltitle = {Acta Neuropathologica},
shortjournal = {Acta Neuropathol.},
author = {Louis, David N. and Perry, Arie and Reifenberger, Guido and von Deimling, Andreas and Figarella-Branger, Dominique and Cavenee, Webster K. and Ohgaki, Hiroko and Wiestler, Otmar D. and Kleihues, Paul and Ellison, David W.},
date = {2016-06},
pmid = {27157931}
}
I have reviewed countless webpages (https://cimentadaj.github.io/phd_thesis/thesis_template_example/2017-10-24-thesis-template.html; https://texblog.org/2013/08/20/rknitr-automatic-bibliography-generation-with-biblatex-in-rstudio/; https://stackoverflow.com/questions/33332654/with-knitr-and-rnw-for-latex-how-do-you-print-the-full-bibliography-in-pdf-out and so on) and tried different packages without success even by adding the following code chunk into my .Rnw document:
Sys.setenv(TEXINPUTS=getwd(),
BIBINPUTS=getwd(),
BSTINPUTS=getwd())
My bibliography (BIBLIOGRAPHY_24th_March_2019.bib) file was exported from Zotero.
I am working with Windows 10, MikTeX for LaTeX. All packages and softwares are up-to-date.
My question is: does anyone knows a simple and effective way to insert references, even directly from the web with DOI, into a .Rnw file produce with Rstudio, R Sweave and knitr?
biblatexis in fact easy to use. Start with a simple bibliography as here, without using the bibtex backend, just as in the last part of this answer. Once you realize it works, try with your bibliography and only if still work, try other biblatex options (otherwise, of course, debug your .bib file) (3) JabRef can make .bib references with the DOI and some other codes (ISBN, PMID.,..) . – Fran Mar 24 '19 at 20:32pdflatex. You must runbiberexternally. Once created the.bblfile you can compile from the updates form Rstudio without problems if you do not change the references. – Fran Mar 24 '19 at 21:54backend=bibtexand the R chunk work like a charms without need of runbibtexexternaly. Just "Compile PDF" and ready. And without the R chunk also in my Linux. According here is because RStudio usestexi2dvithat only knowsbibtex. – Fran Mar 24 '19 at 22:20system(paste("biber", sub("\\.Rnw$", "", current_input())))should do the job. – Fran Mar 24 '19 at 22:26bibtexwithbiblatexis really not recommended these days, so I wouldn't go that route. – Alan Munn Mar 24 '19 at 22:28biber) but I've left all the routes open, because if something does not work, maybe a bad fix is better that nothing. – Fran Mar 24 '19 at 22:41