[OS X TeX] How to plot functions with PGF and TeXShop ?

Franck Pastor franck.pastor at skynet.be
Sun Jan 15 05:44:30 EST 2006


Hello,

I'm facing a strange problem with PGF (a package for drawings, by  
Till Tantau, that I am currently testing) and TeXShop. This package  
needs and calls Gnuplot to plot functions. To do this, you have to  
call pdflatex with the option "shell-escape". Here is an example:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\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}
\end{document}

If I name this program "pgf-test.tex", and if I enter in the Terminal:

pdflatex --shell-escape pgf-test.tex

everything works fine. But if I compile it with TeXShop (whose  
preferences are set to "--shell-escape", of course), the functions  
are not drawn ! And I can't understand why. It seems that TeXShop  
can't find Gnuplot, which is installed in /sw/bin via Fink.

Any idea to help me understand this problem (and solve it if possible) ?

Thanks,

Franck Pastor
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list