PDF Latex is not found

Error: LaTeX failed to compile Practice_assignment.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. In addition: Warning message: In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) : '"pdflatex"' not found Execution halted

No LaTeX installation detected (LaTeX is required to create PDF output). You should install a LaTeX distribution for your platform: https://www.latex-project.org/get/

If you are not sure, you may install TinyTeX in R: tinytex::install_tinytex()

Otherwise consider MiKTeX on Windows - http://miktex.org

MacTeX on macOS - https://tug.org/mactex/ (NOTE: Download with Safari rather than Chrome _strongly_ recommended)

Linux: Use system package manager

Solutions:

Option 1: Run these commands in the R console (in this specific order!):

  • install.packages("tinytex", dependencies = TRUE)
  • library("tinytex")
  • install_tinytex()

Option 2: If you are using a Windows computer and option 1 didn’t work, try downloadingMikTeX. Then try knitting again.

Option 3: If you are using a Mac computer and option 1 didn’t work, try downloading MacTeX. Then try knitting again.

Option 4: If none of the above options work, knit your RMarkdown file to a Word document and then save it as a pdf.