Unlike Linux and macOS, Latex distributions for Windows are rubbish. Almost always gives some conflict and it is very difficult to fix without access to a good terminal, thing that Windows does not have.
What I have suggested in recent months for those who want to use R and Latex in Windows is the installation of the package Tinytex. Yes, it is a pro R package, but it installs a version of Tex Live that works very well. Installing it is very easy.
First, uninstall the Miktex.
Second, run the following commands inside the R
:
library(devtools)
install_github(c("yihui/tinytex", "rstudio/rmarkdown"))
tinytex::install_tinytex()
A warning and two error messages will appear during the execution of the second command. Ignore them by giving OK at the prompt that appears and you’re done. After the necessary procedures, your computer will be installed with Latex.
Close and open Rstudio before compiling the report for the first time.
That’s basically it. The minimum of Latex will be installed on your PC. If more packages are needed, Tinytex itself will install whatever it takes, as long as your computer is connected to the internet.
It will be possible to create Rmarkdown reports within Rstudio or compile files. tex from external text editor such as Texworks and Winedt.
Marcus thank you so much! It worked perfectly!
– Jessica Voigt