3

I have the same problem as written here before, but the externalization doesn't work. I always get the following message:

tikz: Sorry, the system call 'pdflatex -halt-on-error -interact

I try to input some simulation result from Matlab via matlab2tikz. If I run my .tex file without externalization it works just fine, but if I write

\tikzexternalize[prefix=tikzfig/]

it does not work any more.

Here is a part of my header:

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{plot coordinates/math parser=false}
\usepackage{tikz}
\usepackage{tikzscale}
\usepgfplotslibrary{external}
\tikzexternalize[prefix=tikzfig/]

I also saw the answer here, but it still doesn't work.

I am using Miktex and Texstudio. I am also compiling via dvips since I am using psfrag. The compile command is:

pdflatex -shell-escape name

where name is just the file name without file extension, here .tex.

Max
  • 31

1 Answers1

2

The error message you get is incomplete. If you invoke pdflatex from the command line, you will get a full error message:

! Package tikz Error: Sorry, the system call 'pdflatex -halt-on-error -interaction=batchmode -jobname "chapter-figure0" "\def\tikzexternalrealjob{chapter}\input{chapter}"' did NOT result in a usable output file 'chapter-figure0' (expected one of .pdf:.jpg:.jpeg:.png:).

Your problem is different, but you may be able to resolve it in a similar way. For me, manually running 'pdflatex -halt-on-error -interaction=batchmode -jobname "chapter-figure0" "\def\tikzexternalrealjob{chapter}\input{chapter}"' got me the file that I needed, but this is not satisfactory for a large number of pictures. Further debugging using "\tracingall" resulted in this error:

\pgf@tempa ->pdflatex -halt-on-error -interaction=batchmode -jobname "chapter-figure0" "\def\tikzexternalrealjob{chapter}\input{chapter}" runsystem(pdflatex -halt-on-error -interaction=batchmode -jobname "chapter-figure0" "\def\tikzexternalrealjob{chapter}\input{chapter}")...disabled (restricted).

This can be resolved by running pdflatex with the "--shell-escape" option. The precise procedure to add this option depends on your tex editor. For TeXstudio, go to Options, Configure texstudio, Commands, and change "pdflatex -synctex=1 -interaction=nonstopmode %.tex" to "pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex". This fully fixed the problem.