Skip to content

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

4 messages · Anthony Hammond, Duncan Murdoch, Oliver Madsen +1 more

#
Hello,

Since updating to the current version of R (4.1.2) I can't seem to pass the
R cmd checks, I get the below message. I've read a lot online about
installing and linking MikTex, which I've done. Another suggests I need the
function texi2dvi(), which is available in the tools package. So I'm not
sure what to do. Any assistance would be appreciated

Thank you
Anthony

checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
* checking PDF version of manual without hyperrefs or index ... ERROR
Re-running with no redirection of stdout/stderr.
Hmm ... looks like a package
You may want to clean up by 'rm -Rf
C:/Users/ANTHON~1/AppData/Local/Temp/RtmpqkDPxl/Rd2pdf3bb84cc32d1c'
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  :
  pdflatex is not available
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  :
  pdflatex is not available
Error in running tools::texi2pdf()
* DONE
Status: 1 ERROR, 1 WARNING
#
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
#
For windows simply search "environment variable" which will allow you to
open the environment variable gui. In thete append the folder to the
pdfmatex executable under user variables, and then it should be found by R
after restarting the session.

/Oli er
On Mon, 24 Jan 2022, 13:50 Duncan Murdoch, <murdoch.duncan at gmail.com> wrote:

            

  
  
#
a last thing I'd like to add to this:
You can change the path as perceived by R permantly with this:
writeLines('PATH="C:\\Miktex\\bin;${PATH}"', con = "~/.Renviron")
Not sure if this is good practice, but it works for unzip, see https://bookdown.org/brry/rdwd/fread.html

Regards,
Berry