0

I try to run the example given by pgfplots :

\documentclass{article}
\usepackage[margin=0.25in]{geometry}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9}

% We will externalize the figures \usepgfplotslibrary{external} \tikzexternalize

\begin{document}

\begin{tikzpicture} \begin{axis}[ axis lines = left, xlabel = (x), ylabel = {(f(x))}, ] %Below the red parabola is defined \addplot [ domain=-10:10, samples=100, color=red, ] {x^2 - 2x - 1}; \addlegendentry{(x^2 - 2x - 1)} %Here the blue parabola is defined \addplot [ domain=-10:10, samples=100, color=blue, ] {x^2 + 2x + 1}; \addlegendentry{(x^2 + 2x + 1)}

\end{axis} \end{tikzpicture}

\end{document}

I use xelatex to compile:

xelatex ./demo.tex

But tikz gives me this error message:

(/usr/share/texmf-dist/tex/latex/base/ts1cmr.fd)
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
Package pgfplots notification 'compat/show suggested version=true': you might b
enefit from \pgfplotsset{compat=1.18} (current compat level: 1.9).

===== 'mode=convert with system call': Invoking 'xelatex -halt-on-error -intera ction=batchmode -jobname "demo-figure0" "\def\tikzexternalrealjob{demo}\input{d emo}"' ========

! Package tikz Error: Sorry, the system call 'xelatex -halt-on-error -interacti on=batchmode -jobname "demo-figure0" "\def\tikzexternalrealjob{demo}\input{demo }"' did NOT result in a usable output file 'demo-figure0' (expected one of .pdf :.jpg:.jpeg:.png:.bmp:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 1 8' or something like that. Or maybe the command simply failed? Error messages c an be found in 'demo-figure0.log'. If you continue now, I'll try to typeset the picture.

See the tikz package documentation for explanation. Type H <return> for immediate help. ...

l.36 \end{tikzpicture}

why is that? How can I handle it?

aszswaz
  • 267

1 Answers1

0

If all you want to do is generate a plot in your document, remove the lines:

\usepgfplotslibrary{external}
\tikzexternalize

If you want to externalize tikz drawings you need to do shell escape. If you don't know what that means just remove \tikzexternalize and your document will work (although it'll compile slightly slower).

If you want to enable shell escape see How can I enable shell-escape?

JJ Marr
  • 48