tikzDevice包未在R GUI中加载

时间:2017-01-29 02:34:22

标签: r

我在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下载的。

2 个答案:

答案 0 :(得分:0)

这很容易解决:

options(tikzLatex = "PATH")

通过LaTeX编译器的路径替换PATH。您可以在终端中为Mac用户输入以下内容来找到答案:

which pdflatex

答案 1 :(得分:0)

这对于最近升级了操作系统的其他Mac用户可能有用。这对我有用,不是与tikzDevice软件包有关的问题,而是与无法编译的胶乳有关,因为Mac已删除了编译pdflatex的路径(有关详细说明,请参见el Capitan上的MacTex f.a.q.,因为那是当苹果开始阻止用户在usr /文件夹中安装乳胶项目。
我建议以下内容:

  1. 下载并安装MacTex
  2. 指定要在texshop / texworks中而不是usr / bin put / Library / TeX / texbin中进行编译的路径
  3. 立即检查tikzDevice是否在您的GUI中运行(应该是现在!)