I would like to compile an R Markdown document using the knitr package in Rstudio on a Windows 7 OS using MiKTeX. RStudio recommends the complete installation of MiKTeX, this encompasses over 3,167 packages as of today. Installing all of the packages is not an option that will work for me. I would like to find a subset of packages which will support the use of knitr in RStudio for the compilation of PDFs. All documents will be in English and won't include mathematical notation. They will feature figures created using the ggplot2 package.
[Tex/LaTex] Installing a Subset of MiKTeX Packages to use RStudio knitr PDF Compiler
knitrmiktexpackagesrstudio
Related Solutions
Following Fran's advice, it works by adding the following chunk code in the preamble (before \begin{document}) and change \usepackage{biblatex}
for \usepackage[backend=biber]{biblatex}
:
<<setup, eval= TRUE, include= FALSE, cache= FALSE, echo= FALSE>>=
system (paste ("biber", sub ("\\.Rnw$", "", current_input())))
@
I have no idea whatsoever of what it does, but it solves the problem. Please note that you have to compile (at least) twice the document every time you change its name e.g. mwe_2.Rnw to mwe_3.Rnw.
Moreover, don't setup cache = TRUE
in the knitr chunk.
My working MWE is the following:
\documentclass{article}
\usepackage[backend= biber]{biblatex}
\bibliography{BIBLIOGRAPHY_24th_March_2019}
% or \addbibresource{BIBLIOGRAPHY_24th_March_2019.bib}
<<biber, eval= TRUE, include= FALSE, cache= FALSE, echo= FALSE>>=
system (paste ("biber", sub ("\\.Rnw$", "", current_input())))
@
\begin{document}
Meningiomas which are thought to arise from arachnoidal cap cells, are the most common meningeal tumours subtypes \cite{louis_2016_2016}.
Malignant meningioma is a highly aggressive and often fatal variant that ... \cite{jenkinson_radiotherapy_2014}.
The behaviour and outcome of WHO Grade II meningiomas also called atypical are intermediate as they show a ... \cite{champeaux_who_2016}.
\printbibliography
\end{document}
Answers to this problem was already discuss here: knitr and biblatex.
Apparently, this problem can also be managed by latexmk https://mg.readthedocs.io/latexmk.html#, but it looks too complicated for me.
Thank you everyone.
Please note that you got a new command center for MiKTeX with the new version: MiKTeX Console. It includes all configuring tools together in one tool:
The old package manager you can get with clicking on Packages
(see red arrow, marked 3), the old update manager you can get with Updates
(red arrow, 2) or just click on check for updates
at the end of the shown window and the old settings manager you can get with Settings
(red arrow, 1) ...
With the new version of MiKTeX all old programs are deleted, only MiKTeX Console is working now. Therefore your old shortcuts can not work any longer and please note that they are not deleted by the installing routine for the new MiKTeX version. Simply delete them and use now MiKTeX Console ...
If you can not see the MiKTeX Console, please click on the windows sign on the left in the taskbar, choose apps and search for MiKTeX Console. Right Click on it to add it to the start menu etc.
Best Answer
The basic MikTeX installation works fine, you don't need to install the whole lot. When you run knitr for the first time, RStudio will download and install a handful of additional packages it needs. After that you only have to add more packages if your documents contain special features.