[Tex/LaTex] How to run gnuplot/latex from inside texshop


I was able to write a piece of code that drew a graph in gnuplot and then
using tikz embedded that into my TeX document and run it via Texshop. I am
not able to do that anymore. I need to run

pdflatex --shell-escape foo.tex

For my graphs to appear properly. Is there some setting I can
enable in TexShop so I don't have to do this. I mean I want
to be able to just hit type set from inside TexShop to do this.
As I understand they have done away with the --shell-escape flag
in TexShop because of security vulnerabilities.

Can anyone help?

Best Answer

You need to go to TeXShop/Preferences and add the --shell-escape option to the Engine tab as shown here:

enter image description here

After restarting TeXShop, selecting LaTeX from the pull down will automatically have the --shell-escape option enabled.

Alternatively you can also create you own .engine files. An example of this is at Problems with implementing glossary.engine in TeXShop. As egreg commented, with your own custom engine it is clear to you that are enabling --shell-escape, especially if you name it something like LaTeX w ShellEscape.

This will enable --shell-escape but you still need to ensure that you indded have gnuplot installed. As I mentioned in an earlier answer at Generating graphs with gnuplot (Gnuplot, LaTeX and tkz-fct) you should have a look at this gnuplot tutorial and ensure that gnuplot is working.