5

I want to use gnuplot within a tikzpicture, but that somehow does not seem to work when I compile with lualatex. I use the following example from the tikz manual:

\documentclass{article}
\usepackage{tikz}

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

If I compile this .tex file with

pdflatex --shell-escape tikz.tex

everything works fine.

However, if I use use the exact same command with lualatex instead of pdflatex, my log file says

gnuplot tikz.x.gnuplot

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

gnuplot tikz.sin.gnuplot

Package pgf Warning: Plot data file `tikz.sin.table' not found. on input line 1
7.

Does anyone know what's the problem here? Thanks in advance.

1
  • 1
    beware calling your testfile tikz.tex doing so masks a file in the tikz distribution /usr/local/texlive/2016/texmf-dist/tex/plain/pgf/frontendlayer/tikz.tex Sep 21, 2016 at 15:35

1 Answer 1

7

\write18 shell escape does not work by default for newer luatex, the shellesc package puts it back, this works for me:

\RequirePackage{luatex85,shellesc}
\documentclass{article}
\usepackage{tikz}

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .