Latex compilation errors

Error: No LaTeX installation detected.

To compile R-Markdown (incl. LaTeX functionalities), you require an installed LaTeX distribution on your computer. Tinytex is a lightweight and popular option you can install directly within R. Just in case anyone might need it, see the corresponding documentation here, incl. commands for (re)installing.

To install, install the package as usual first, then run the install_tinytex() command.

install.packages('tinytex') # install package
tinytex::install_tinytex()  # install tinytex with r-function

LaTeX Error: File `.sty’ not found.

The error tells you that no style file (.sty) was found. Similar error could occur if you are missing (some file from) a package, etc. tinytex provides some helper functions to solve problems of this kind:

library(tinytex)
tlmgr_search('/times.sty')   # search for times.sty (or other style files)
tlmgr_install('psnfss')      # install the psnfss (or other) packages
tlmgr_update()               # update everything

Remote repository newer than local

This error may indicate that your TinyTeX distribution is outdated or corrupted. You can reinstall and update TinyTeX with the reinstall_tinytex() command.

tinytex::reinstall_tinytex()
Next