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.

  • No idea about knitr or R myself but for general latex you can download a basic miktex installation and install packages on the fly - this can be quite slow first time you try compiling (if loading a lot of packages) but possibly that can be used as a sort-of auto detect for which packages are needed with knitr.
    – Dai Bowen
    Oct 18, 2016 at 22:06
  • The LaTeX packages that must be installed depend of the LaTeX code generated by the markdown and the LaTeX code generated by the R chunks. May be none beside the basic MikTeX installation, may be two or three dozens of extra packages only for that document. If all these packages must be downloaded and installed when you push the compile button, effectively it could be quite slow, and it can fail too. At the end of day, a complete installation is faster and safer, at the cost of install of about 4 Gb, a ridiculous amount for today 0.25-3 Tb hard disks.
    – Fran
    Oct 19, 2016 at 4:58

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .