Skip to content
Prev 7654 / 12125 Next

[R-pkg-devel] LaTeX errors when creating PDF version, Error in texi2dvi

On 24/01/2022 5:58 a.m., Anthony Hammond wrote:
You should fix the ERROR first.  It's saying that the `pdflatex` program 
isn't being found.  Since you say you've installed MikTeX, that probably 
means that it isn't on the system path.  You need to do 2 things:

1.  Find out where pdflatex.exe is on your system.
2.  Make sure its directory is on the PATH that R sees.

You do step 1 using Windows search tools.  For step 2, use 
Sys.getenv("PATH") in R to see the current path.

If you found pdflatex.exe in C:\Miktex\bin\pdflatex.exe then you'd need 
to add "C:\Miktex\bin" to your path.  You can do this temporarily within 
R using

     Sys.setenv(PATH = paste0(Sys.getenv("PATH"), ";C:\\Miktex\\bin")

but this will only last for the current session.  To add it permanently, 
you'll need to use some Windows configuration tools.

Duncan Murdoch