诊断R包构建错误:pdfLatex不可用。

时间:2021-09-26 16:55:03

I am trying to build a package in R. I made the skeleton, and ran the command R CMD check package1. I got an an error described here. I followed the solution steps, and the results are:

我试图在R中构建一个包,我做了这个骨架,并运行了命令R CMD check package1。这里有个错误。我遵循了解决方案的步骤,结果如下:

  1. package devtools not available for R 2.15.1

    包devtools不能用于r2.15.1。

  2. punched in R CMD Rd2pdf package1.

    穿孔于R CMD Rd2pdf package1。

Hmm.. Looks like a package
Converting Rd files to LaTeX
Creating pdf output from LaTeX
Error in texi2dvi(file=file, pdf=true, clean=clean, quiet=quiet, : pdflatex not available
Error in running tools::texi2pdf
  1. I looked up this amongst other things, installed the complete tex live & MiKTeX. Same error message showed up.
  2. 我在其他东西中查找,安装了完整的tex live & MiKTeX。出现了相同的错误消息。
  3. I navigated to the directory where pdflatex is located and tried running the command from there. Didn't help.
  4. 我导航到pdflatex所在的目录,并尝试从那里运行命令。没有帮助。

Is there something I'm missing here, or is there a workaround? Or maybe, Is there a way to suppress pdf generation during package creation?

这里有什么我遗漏的东西吗,或者有变通方法吗?或者,是否有一种方法可以在包创建过程中抑制pdf生成?

UPDATE: This error was not thrown when I tried it in LINUX (CentOS).

更新:当我在LINUX (CentOS)中尝试时,这个错误没有被抛出。

4 个解决方案

#1


3  

Although you have installed MikTeX under Windows, this does not make it available to R. You need to add the location of the latex executables to your PATH environment variable. How to do this exactly depends on your Windows version. For example, this link describes how to do this for Windows 7. Googling for change environment variables (windows 7|windows xp|windows 95) will tell you how to change your environment variables.

虽然在Windows下安装了MikTeX,但这并不能使其可用,您需要将latex可执行文件的位置添加到PATH环境变量中。如何做到这一点完全取决于您的Windows版本。例如,这个链接描述了如何为Windows 7操作。谷歌搜索更改环境变量(windows 7|windows xp|windows 95)将告诉您如何更改环境变量。

#2


2  

you certainly can suppress the PDF generation.

您当然可以压制PDF生成。

R CMD check package --no-manual

From here

从这里

#3


0  

Just follow this video's instructions to install MikTex on windows:

按照这个视频的指示,在windows上安装MikTex:

https://www.youtube.com/watch?v=k-xSGZ-RLBU

https://www.youtube.com/watch?v=k-xSGZ-RLBU

I also had similar problems about pdfLatex Not Available. After installing MikTex this way, errors like "pandoc.exe: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed with error 41" can be solved when creating pdf using knitr.

我也有类似的关于pdfLatex的问题。这样安装了MikTex之后,错误就像“pandoc”。exe:pdflatex没有找到。pdf输出需要pdflatex。错误:pandoc文档转换失败,错误41“可以在使用knitr创建pdf时解决。

The installation file can be downloaded from:

安装文件可从以下网址下载:

http://mirrors.ctan.org/systems/win32/protext/ProTeXt-3.1.5-033015.exe

http://mirrors.ctan.org/systems/win32/protext/protext 3.1.5 - 033015. exe

#4


0  

Step 1: Download and Install MiKTeX from http://miktex.org/2.9/setup

步骤1:从http://miktex.org/2.9/setup下载并安装MiKTeX。

Step 2: Run

步骤2:运行

Sys.getenv("PATH") 

in R studio This command returns the path where Rstudio is trying to find pdflatex.exe In windows (64-bit) it should return C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe If pdflatex.exe is not located in this location Rstudio gives this error code 41.

在Rstudio中,这个命令返回Rstudio试图找到pdflatex的路径。exe在windows(64位),它应该返回C:\Program Files\MiKTeX 2.9 \ miktex \ bin \ x64 \ pdflatex。如果pdflatex exe。exe不在这个位置,Rstudio给出了这个错误代码41。

Step 3: To set this path variable run:

步骤3:设置此路径变量运行:

Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:/Program Files/MiKTeX 2.9/miktex/bin/x64/",sep=";"))

#1


3  

Although you have installed MikTeX under Windows, this does not make it available to R. You need to add the location of the latex executables to your PATH environment variable. How to do this exactly depends on your Windows version. For example, this link describes how to do this for Windows 7. Googling for change environment variables (windows 7|windows xp|windows 95) will tell you how to change your environment variables.

虽然在Windows下安装了MikTeX,但这并不能使其可用,您需要将latex可执行文件的位置添加到PATH环境变量中。如何做到这一点完全取决于您的Windows版本。例如,这个链接描述了如何为Windows 7操作。谷歌搜索更改环境变量(windows 7|windows xp|windows 95)将告诉您如何更改环境变量。

#2


2  

you certainly can suppress the PDF generation.

您当然可以压制PDF生成。

R CMD check package --no-manual

From here

从这里

#3


0  

Just follow this video's instructions to install MikTex on windows:

按照这个视频的指示,在windows上安装MikTex:

https://www.youtube.com/watch?v=k-xSGZ-RLBU

https://www.youtube.com/watch?v=k-xSGZ-RLBU

I also had similar problems about pdfLatex Not Available. After installing MikTex this way, errors like "pandoc.exe: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed with error 41" can be solved when creating pdf using knitr.

我也有类似的关于pdfLatex的问题。这样安装了MikTex之后,错误就像“pandoc”。exe:pdflatex没有找到。pdf输出需要pdflatex。错误:pandoc文档转换失败,错误41“可以在使用knitr创建pdf时解决。

The installation file can be downloaded from:

安装文件可从以下网址下载:

http://mirrors.ctan.org/systems/win32/protext/ProTeXt-3.1.5-033015.exe

http://mirrors.ctan.org/systems/win32/protext/protext 3.1.5 - 033015. exe

#4


0  

Step 1: Download and Install MiKTeX from http://miktex.org/2.9/setup

步骤1:从http://miktex.org/2.9/setup下载并安装MiKTeX。

Step 2: Run

步骤2:运行

Sys.getenv("PATH") 

in R studio This command returns the path where Rstudio is trying to find pdflatex.exe In windows (64-bit) it should return C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe If pdflatex.exe is not located in this location Rstudio gives this error code 41.

在Rstudio中,这个命令返回Rstudio试图找到pdflatex的路径。exe在windows(64位),它应该返回C:\Program Files\MiKTeX 2.9 \ miktex \ bin \ x64 \ pdflatex。如果pdflatex exe。exe不在这个位置,Rstudio给出了这个错误代码41。

Step 3: To set this path variable run:

步骤3:设置此路径变量运行:

Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:/Program Files/MiKTeX 2.9/miktex/bin/x64/",sep=";"))