5

I have recently discovered the TikZ packages for LaTeX: http://altermundus.com/pages/tkz/index.html

I have run the examples for tkz-euclide with success.

I would also like to use the tkz-fct package for plotting curves. Since I have not previously installed Gnuplot, when I compile examples using the tkz-fct package I get the error message: Plot data file `filename.tkzfct.table' not found.

I have read several web pages that describe how to compile the source for Gnuplot for Mac OSX and also some explanations on how to obtain binaries as part of other packages such as Octave and others. I have not tried these procedures yet, as they seam complicated and I am a novice at Mac OSX details.

What is the best practice for how to install Gnuplot for use with TexShop with MacTex 2012 distribution, on Mac OS-X 10.8.2 Mountain Lion for use with 'tkz-fct' package.

I apologize if a similar question was answered already, but there are so many different answers and many are a few years old.

Lonny T
  • 151
  • 1
    See if the instructions here work (they should): How to use GNU Plot to plot diagrams in TeXShop. – Alan Munn Jan 07 '13 at 05:15
  • I issued the command ./configure in the correct gnuplot-4.6.1 directory, but received the message, "configure: error: no acceptable C compiler found in $PATH", and make not found. I had read somewhere in another post, that I may have to get Developer account for MAC? It appears I need to install C compilers first. I have not installed these. What are the steps needed to install GNU C compilers if needed. – Lonny T Jan 07 '13 at 14:11
  • 2
    You need to have the Developer Tools installed. Under Lion and later that means installing the Xcode app from the App Store (it's free) and installing the command line tools from within the appp. There's a nice summary of it here: Developer tools on OS X 10.7 – Alan Munn Jan 07 '13 at 14:39
  • Thanks Alan, I currently downloading Xcode and will try the procedure in the link you provide. I also found the following link helpful. link – Lonny T Jan 07 '13 at 14:50
  • I have now installed Xcode, and installed Command Lines, was then able to compile GNU Plot,Package pgf Warning: Plot data file `Tikz-Plot-Example.sin.table' not found. – Lonny T Jan 07 '13 at 15:42
  • Are you talking about the test document in my linked answer? – Alan Munn Jan 07 '13 at 15:48
  • 1
    I have now installed Xcode, and installed Command Lines, was then able to compile GNU Plot, verified gnuplot running at terminal. Then following instructions on TexLive2012Changes.pdf and Eps-Tiff-Conversion.pdf, Appendix B - Adding Programs to the Restricted Program List, I added gnuplot in the file texmf.cnf and followed instructions, But when I run the example in the post "How to use GNU Plot to plot diagrams in TeXShop" I get Warning. "Package pgf Warning: Plot data file `filename.sin.table' not found." – Lonny T Jan 07 '13 at 16:06
  • With my tkz-fct example, the warning, "Package pgf Warning: Plot data file `filename.tkzfct.table' not found. The graph and annotation are typeset, but the function curves are not shown. It seems TexShop does not know what directory to find the .table files generated by GNU Plot. How can I direct PNG to find the .table files generated by gnu plot. – Lonny T Jan 07 '13 at 16:06
  • "Are you talking about the test document in my linked answer? – Alan Munn" Yes, the test docoment in your linked answer, and also my original tkz-fct example – Lonny T Jan 07 '13 at 16:09
  • Here is a complete message from the TexShop .log file: \openout3 = `Tikz-Plot-Example.x.gnuplot'.

    runsystem(gnuplot Tikz-Plot-Example.x.gnuplot)...disabled (restricted).

    Package pgf Warning: Plot data file `Tikz-Plot-Example.x.table' not found. on input line 7.

    So it appears that gnuplot is still not enabled by TexLive2012; I tried to follow the instructions for correct creation of texmf.cnf file and placement as described in Appendix B of Eps-Tiff-Conversion.pdf file. I will have to keep on looking for the solution to this.

    – Lonny T Jan 07 '13 at 23:35
  • 1
    In your TeXShop Preferences -> Engines -> pdfTeX (Latex) try adding --shell-escape to the command. So the whole command should read: pdflatex --file-line-error --synctex=1 --shell-escape. Restart TeXShop and try again. – Alan Munn Jan 08 '13 at 00:10
  • Success. Adding the option --shell-escape solved the problem. The MacTex web page http://www.tug.org/mactex/2012/TeXLive2012Changes.pdf indicates that using --shell-escape could be a security concern, and recommends using Restricted shell escape instead with instructions on how to do this. The instructions did not work for me earlier; but I will now go back and see if I can give Restricted access to Gnuplot and the defaults without opening up all in-line commands as recommended. Thanks Alan for your help, you saved me a lot of time and I learned a lot in the process. – Lonny T Jan 08 '13 at 02:20

2 Answers2

5

Most of the the answer to this is contained in the following question:

However, depending on how your system is set up you may need to do some extra things.

First, compiling source code on a Mac requires you to install XCode from the App store (it's free). See the following link for a nice description:

Second, you also need to allow TeX to run external programs like GnuPlot. Typically the way to do this is to run programs with the --shell escape option. However, recent version of TeX Live have created a system of so-called "restricted" shell escape, which allows you to add programs to a global list of external programs to minimize the security issues of using unrestricted shell escape.

There are a number of different ways to implement this on a Mac.

Create a TeXShop engine file for --shell-escape

The simplest way is probably to create a new TeXShop engine file which runs the appropriate LaTeX command with the --shell-escape option enabled. See:

Create a config file in your texmf-local folder

If you are using gnuplot capabilities a lot, it might be easiest to add gnuplot to your list of allowable programs. This can be done by creating a local texmf.cnf file. Create the following file:

shell_escape_commands =     bibtex,bibtex8,    kpsewhich,    makeindex,    mpost,    repstopdf,    gnuplot,

The file must end with a blank line. Save or copy this file into the following directory: (you will need administrator access to do this.)

/usr/local/texlive/texmf-local/web2c

Then run texhash to update the TeX database.

Now you should be able to use gnuplot from within your TeX documents.

Alan Munn
  • 218,180
0

The easiest way to install gnuplot on mac is to get the DMG file of Gnuplot, which is included in the DMG file of Maxima or Octave. Put the Gnuplot.app file in /Applications, and in your .bash_profile add a line

export PATH=$PATH:"/Applications/Gnuplot.app/Contents/Resources/bin"

After sourcing your new .bash_profile, you should be able to use gnuplot in terminal as well as in TikZ. Similar trick can be used to install Octave and Maxima painlessly. You should also configure your TeX engine with --shell-escape and --enable-write18.