开发者

gnuplot with texshop in osx

开发者 https://www.devze.com 2023-02-08 18:59 出处:网络
I have installed gnuplot through macports but when i compile my latex document in texshop it doesn\'t show the plots and I get these errors in the log file:

I have installed gnuplot through macports but when i compile my latex document in texshop it doesn't show the plots and I get these errors in the log file:

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


Package pgf Warning: Plot data file `tutorial.sin.table' not found. on input li
ne 19.


Package pgf Warning: Plot data file `tutorial.exp.table' not found. on input li
ne 21.

I'm just trying to compile this basic example:

%开发者_JAVA技巧 Author: Till Tantau
% Source: The PGF/TikZ manual
\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{tikz}

% GNUPLOT required
\begin{document}
\pagestyle{empty}


\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}


Yes, you need to turn the .gnuplot files that tikz creates into the tables files. You have two choices for this:

  1. you can run (pdf)latex with the additional command line switch --shell-escape, sometimes also called --enable-write-18, then gnuplot is run automatically for you. (You might not be comfortable with allowing arbitrary programs to be starte from within pdflatex, though.)

  2. you can run gnuplot yourself on the test.exp.gnuplot, test.sin.gnuplot, test.x.gnuplot etc. files. Simply gnuplot test.exp.gnuplot should do it. (Can't verify here, since my gnuplot version is too old.)

0

精彩评论

暂无评论...
验证码 换一张
取 消