Lucas De Abreu Maia Lucas De Abreu Maia - 6 months ago 42
R Question

tikzDevice package not loading in R GUI

I'm having trouble loading the tikz package on my R GUI:

> 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.

Now the weird part is that I'm able to run my script just fine when I use the terminal. Any idea of what is happening with the GUI?

I'm running R 3.3.2 on a MacOS 10.12.3. I use TexShop, which I downloaded with MacTEX.

Answer Source

This can easily be solved thusly:

options(tikzLatex = "PATH")

Substitute PATH by the path of your LaTeX compiler. You can find that out by typing the following in the Terminal, for Mac users:

which pdflatex
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download