在我的R上加载tikz包时遇到了问题:
> require(tikzDevice)
Loading required package: tikzDevice
Warning message:
In fun(libname, pkgname) :
tikzDevice: No appropriate LaTeX compiler could be found.
Access to LaTeX is required in order for the TikZ device
to produce output.
The following places were tested for a valid LaTeX compiler:
the global option: tikzLatex
the environment variable: R_LATEXCMD
the environment variable: R_PDFLATEXCMD
the global option: latexcmd
the PATH using the command: pdflatex
the PATH using the command: latex
the PATH using the command: /usr/texbin/pdflatex
If you have a working LaTeX compiler, try one of the
following solutions:
Set the path to your compiler as the value of either latexcmd or
tikzLatex in .Rprofile using options().
Set the path to your compiler as the value of either R_LATEXCMD or
R_PDFLATEXCMD in .Renviron.
Ensure the folder containing your compiler is included in PATH.奇怪的是,当我使用终端时,我可以很好地运行我的脚本。知道GUI发生了什么吗?
我在MacOS 10.12.3上运行R3.3.2。我使用TexShop,这是我用MacTEX下载的。
发布于 2017-08-23 21:53:17
这一点很容易解决:
options(tikzLatex = "PATH")用LaTeX编译器的路径替换PATH。您可以通过在终端中为Mac用户键入以下内容来发现这一点:
which pdflatex发布于 2018-10-18 17:45:31
这对最近升级了操作系统的其他Mac用户可能是有用的。这对我来说是有效的,而不是一个与tikzDevice包相关的问题,而是因为Mac删除了编译pdflatex的路径(因为苹果开始阻止用户在usr/文件夹中安装胶乳项目,请参见MacTex f.a.q. on el Capitan的完整解释)。
我建议如下:
发布于 2022-08-14 03:25:33
在碰到相同的问题/完全相同的输出后,我遇到了这个页面,但是在Windows 11下。
我用tinytex。所以对我来说解决问题的是
options("tikzLatex"=tinytex:::win_app_dir('TinyTeX', 'bin', 'win32', 'pdflatex.exe'))
就在我的文档顶部,在第一个安装块中,在调用library(tikzDevice)之前。我试过很多其他的东西,但是不断地碰到上面的错误.真的把我逼疯了!
https://stackoverflow.com/questions/41917088
复制相似问题