# Weird tikz / gnuplot / TeXShop issue

I'm trying to use gnuplot under tikz to generate a graph; here's a MWE:

\documentclass[12pt]{article}
\usepackage{tikz, pgf}
\begin{document}
\begin{tikzpicture}[domain=0:4.1, xscale=1.5, yscale=1.5]
\draw[blue, line width=2pt, samples=1000] plot[id=foo]
function{x**2} node[right] {$f(x)$};
\end{tikzpicture}
\end{document}


The gnuplot script is getting generated correctly (so, test.foo.gnuplot exists and looks right), but gnuplot is not getting invoked properly, which I can tell because test.foo.table doesn't exist. If I go into a terminal and navigate to my folder and manually invoke gnuplot on the auto-generated script, the table gets generated, and then tikz will correctly draw the graph on the next compile.

I started poking around in the console and in the logs, and here's the thing I noticed in the console that looks most pertinent:

(/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))sh: gnuplot: command not found


Just in case this was a bash vs. sh thing, I manually invoked gnuplot in a sh terminal, and it worked fine, so that's not the problem either.

I'm using TeXShop 3.75 under Mac OS X 10.11. My command is:

pdflatex --file-line-error --synctex=1 --shell-escape


My distribution information:

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex 2015.5.24)


Ideas on what's maybe going on here?

Thanks!

EDIT: With the help of some people on /r/LaTeX, I figured out what the issue was. It turns out that TeXShop has its own little path setting buried deep in the preferences windows, and also that you can't seem to add more than one directory to that path setting. So, I just created a symbolic link to gnuplot in the directory that's set as the default path (/Library/TeX/texbin, if you're curious), and now everything works fine.

I'm adding TeXShop to the tag list, because this really ended up being a TeXShop issue, and I'm setting this question to "answered."

• Welcome! Please post the part of the log relevant to the plot. – cfr Jan 31 '17 at 23:59
• That is, there's nothing wrong with the code (although loading pgf is unneeded, since tikz loads it anyhow) and you clearly have gnuplot installed. So my guess is that it cannot be found when needed, but the log would tell you whether that's a correct guess or way off the mark. – cfr Feb 1 '17 at 0:08
• My bet is that if you remove the .gnuplot and .table files and you rerun pdflatex from TeXShop, you'll find this line in the .log: runsystem(gnuplot spencer.foo.gnuplot)...disabled (restricted) – egreg Feb 1 '17 at 0:37
• Try to start TeXShop from your Terminal. – Paul Gaborit Feb 1 '17 at 6:21
• Hi @cfr, here's the relevant log bits: \openout3 = reduce.foo.gnuplot'. runsystem(gnuplot reduce.foo.gnuplot)...executed. Package pgf Warning: Plot data file reduce.foo.table' not found. on input line 9. So, @egreg, nope, the --shell-escape appears to be working properly. – Spencer Bagley Feb 1 '17 at 16:44