'LaTex not findable during rmarkdown render to pdf [duplicate]

I am havng trouble rendering pdfs in rmarkdown. Everything has been working fine until a point yesterday that I started getting this error message (abbreviated for brevity below);

"Error: LaTeX failed to compile test2.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. In addition: Warning messages: 1: In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) : '"pdflatex"' not found 2: In system2(...) : '"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/"

Over the past 6 months I have successfullly run many pdf renders on other reports which now return the same error message as above, as does my attempt to render the new file.rmd default text (see below) to pdf;


title: "test2" author: "SB" date: "r Sys.Date()" output: pdf_document: default html_document: df_print: paged

options(tinytex.verbose = TRUE)

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)

Including Plots

You can also embed plots, for example:

plot(pressure)

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

I have installed and loaded the package tinytex and I have also installed MiKTeX in my failed attempts to troubleshoot. I am running the latest versions of R and RStudio. I made no changes to my computer setup or installations between when everything was working to when I started getting the error message above, literally from one rendering to the next. Thanks in advance for your help.

MiKTeX returns this error log; 2022-04-20 18:45:37,088+1000 INFO pdflatex - this process (27228) started by Rterm in directory C:\Users\sebur\Documents\F3EC\L4WBatsWorkshop with command line: C:\Users\sebur\AppData\Local\Programs\MiKTeX\miktex\bin\x64\pdflatex.exe -halt-on-error -interaction=batchmode BatsGuideSCC.tex 2022-04-20 18:45:37,088+1000 INFO pdflatex - this is MiKTeX-PDFTEX 4.10.0 (1.40.24) (MiKTeX 22.3) 2022-04-20 18:45:37,119+1000 INFO pdflatex - allowing known shell commands 2022-04-20 18:45:37,186+1000 INFO pdflatex - going to create file: pdflatex.fmt 2022-04-20 18:45:37,186+1000 INFO pdflatex.core - start process: miktex formats build pdflatex --engine pdftex 2022-04-20 18:45:41,536+1000 FATAL pdflatex.core - GUI framework cannot be initialized. 2022-04-20 18:45:41,536+1000 FATAL pdflatex.core - Data: 2022-04-20 18:45:41,536+1000 FATAL pdflatex.core - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp:126 2022-04-20 18:45:41,552+1000 FATAL pdflatex - GUI framework cannot be initialized. 2022-04-20 18:45:41,553+1000 FATAL pdflatex - Info: 2022-04-20 18:45:41,553+1000 FATAL pdflatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp 2022-04-20 18:45:41,553+1000 FATAL pdflatex - Line: 126 2022-04-20 18:45:41,556+1000 INFO pdflatex - this process (27228) finishes with exit code 1 2022-04-20 18:45:41,566+1000 FATAL pdflatex - major issue: So far, you have not checked for MiKTeX updates. 2022-04-20 18:45:41,567+1000 WARN pdflatex.core - still open: BatsGuideSCC.tex 2022-04-20 18:45:41,567+1000 WARN pdflatex.core - still open: BatsGuideSCC.log



Solution 1:[1]

I solved this issue by following the link stackoverflow.com/questions/33148587

In essence, opening the Miktex console, and in settings changing the update on the fly check box from "ask me" to "always".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user438383