1

I have been using Texpad (1.7.23) for quite some time now on a Mac without any problems. Recently I decided to try to draw my graphs on TikZ instead of drawing them somewhere else and importing them. So I followed these steps:

  1. I installed gnuplot (5.0.3) running brew install gnuplot on terminal;
  2. Tried to draw a simple function on terminal using gnuplot, worked fine;
  3. On Texpad preferences, I allowed packages to use the --shell-escape directive.

The thing is when I try to run the example from the TikZ and PGF Manual:

\begin{tikzpicture}[domain=0:4]
\draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
\draw[color=red]    plot[id=x]   function{x}           node[right] {$f(x) =x$};
\draw[color=blue]   plot[id=sin] function{sin(x)}      node[right] {$f(x) = \sin x$};
\draw[color=orange] plot[id=exp] function{0.05*exp(x)} node[right] {$f(x) = \frac{1}{20} \mathrm e^x$};
\end{tikzpicture}

I always get the error message:

Package pgf Warning: Plot data file `example.x.table' not found. on input line 40.

I have tried reinstalling gnuplot compiling from source with readline library, still get the same error message with and empty graph on the pdf.

Please enlighten me on what I might be doing wrong.

  • Try disabling "Hide intermediate files". – Benjamin Mar 02 '16 at 18:27
  • @Benjamin Tried it, didn't work. – gtovieira Mar 03 '16 at 20:09
  • Does it work from the terminal with latexmk --shell-escape -pdf example.tex? – Benjamin Mar 03 '16 at 20:25
  • @Benjamin it turns out that Texpad has two places where you can change the option to hide intermediate files, one in the preferences and the other on the compilation menu of the document itself. The first time I only changed it in the preferences pane. Now it worked! Thank you very much! – gtovieira Mar 03 '16 at 20:50

1 Answers1

0

To summarize the comments: To plot functions with gnuplot in tikz using Texpad

  • Shell Escape has to be enabled and
  • Hide intermediate files has to be disabled

for the project.

Texpad

Benjamin
  • 4,781
  • Any tips for if this still isn't working? I've got the settings shown plus shell escape enabled and hide files disabled in the main settings. – pancini May 03 '17 at 19:35
  • @ElliotG I just checked it again. Still works fine for me. What's the error message you are getting? – Benjamin May 03 '17 at 19:45
  • Thanks for the reply. Ive got "Sorry, the system call 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "Final-figure0" "\def\tikzexternalrealjob{Final}\input{Final}"' did NOT result in a usable output file 'Final-figure0' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls." – pancini May 03 '17 at 19:46
  • Its actually rendering the Tikz correctly but not externalizing them (which saves a TON of time) and not outputting PDFs of each plot, which is helpful since you can copy them into presentations. – pancini May 03 '17 at 19:47
  • Ok, so I tested it again using \usetikzlibrary{external}\tikzexternalize and it also works for me. It actually now even works using Auto-Sense. Are you testing with a MWE? E. g. http://texample.net/tikz/examples/gnuplot-basics/ or is there some "unrelated" TeX-Code in your document. – Benjamin May 03 '17 at 19:59
  • No this is part of my thesis which is quite long. By adding %& -shell-escape at the top, it compiles now with no error but still doesn't output PDFs. I have to go but I will try again later. – pancini May 03 '17 at 20:04
  • I'm not using the MWE you linked and it works until i use \usetikzlibrary{external}\tikzexternalize, so I guess that is the problem. I will keep trying but thanks for the help. – pancini May 03 '17 at 21:43