我在R GUI上加载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上运行R 3.3.2。我使用的是TexShop,我是用MacTEX下载的。
答案 0 :(得分:0)
这很容易解决:
options(tikzLatex = "PATH")
通过LaTeX编译器的路径替换PATH。您可以在终端中为Mac用户输入以下内容来找到答案:
which pdflatex
答案 1 :(得分:0)
这对于最近升级了操作系统的其他Mac用户可能有用。这对我有用,不是与tikzDevice软件包有关的问题,而是与无法编译的胶乳有关,因为Mac已删除了编译pdflatex的路径(有关详细说明,请参见el Capitan上的MacTex f.a.q.,因为那是当苹果开始阻止用户在usr /文件夹中安装乳胶项目。
我建议以下内容: