1
\begin{tikzpicture}
    \begin{axis}
    \addplot[color=red]{exp(x)};
    \end{axis}
    \end{tikzpicture}
    %Here ends the 2D plot
    \hskip 5pt
    %Here begins the 3D plot
    \begin{tikzpicture}
    \begin{axis}
    \addplot3[
        surf,
    ]
    {exp(-x^2-y^2)*x};
    \end{axis}
    \end{tikzpicture}

Gives the following error:

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

And when looking in the log:

This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.4.7)  8 FEB 2023 12:32
entering extended mode
 restricted \write18 enabled.
 file:line:error style messages enabled.
 %&-line parsing enabled.
**PATH/main.tex
(PATH/main.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-02-24> (c:/texlive/2022/texmf-dist/tex/latex/base/report.cls
Document Class: report 2021/10/04 v1.4n Standard LaTeX document class
(c:/texlive/2022/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
)

(when compiling with --escape-shell):

This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.4.7)  8 FEB 2023 13:22
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
**main.tex
(./main.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-02-24>
(c:/texlive/2022/texmf-dist/tex/latex/base/report.cls
Document Class: report 2021/10/04 v1.4n Standard LaTeX document class
(c:/texlive/2022/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
)

and later:

===== 'mode=convert with system call': Invoking 'pdflatex -halt-on-error -interaction=batchmode -jobname "main-figure0" "\def\tikzexternalrealjob{main}\input{main}"' ========
runsystem(pdflatex -halt-on-error -interaction=batchmode -jobname "main-figure0" "\def\tikzexternalrealjob{main}\input{main}")...disabled (restricted).

\openout3 = `main.auxlock'.


./0_abstract.tex:14: Package tikz Error: Sorry, the system call 'pdflatex -halt-on-error -interaction=batchmode -jobname "main-figure0" "\def\tikzexternalrealjob{main}\input{main}"' did NOT result in a usable output file 'main-figure0' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in 'main-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.14     \end{tikzpicture}

I have included the right packages etc.:

\usepackage{tikz}
\usepackage{pgfplots}

\pgfplotsset{width=10cm,compat=1.9}

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

I have also tried running it with things such as: --shell-escape main.tex --enable-write18 main.tex or adding \tikzexternalize[shell escape=-shell-escape] But this does not seem to work, everything does work correctly when I e.g. open it in Overleaf.

minimal reproducible example:

\documentclass[11pt,a4paper,oneside]{report}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9}

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

% Do not automatically indent text
\setlength\parindent{0pt}


\begin{document}

\begin{tikzpicture}
    \begin{axis}
    \addplot[color=red]{exp(x)};
    \end{axis}
    \end{tikzpicture}
    %Here ends the 2D plot
    \hskip 5pt
    %Here begins the 3D plot
    \begin{tikzpicture}
    \begin{axis}
    \addplot3[
        surf,
    ]
    {exp(-x^2-y^2)*x};
    \end{axis}
    \end{tikzpicture}

\end{document}
Gier
  • 11
  • 4

0 Answers0