[Tex/LaTex] Question regarding pgfplots externalize


For the sake of speed and potential file size errors I have been trying to set up the externalization of pgfplots/tikz for my figures including/excluding luatex.

I have the following question which is unclear to me:

  • After externalization, should you call the figure from the pdf, or does tikz/pgf automatically determine if it should run the .tex file or if it should load the pdf?

It is giving me a few issues:

  • When externalizing using pdflatex, I get a memory exceedance error. Which is not produced with externalization switched of.
  • If externalization is performed all the way using lualatex, it still crashes when compiling with pdflatex afterwards.

I am not sure if this is a correct MWE:

Compile with either:

pdflatex.exe -synctex=1 -shell-escape -interaction=nonstopmode %.tex

lualatex.exe -synctex=1 -shell-escape -interaction=nonstopmode %.tex

In the main document:


\tikzset{external/force remake}



A random tikz figure document (actually contains thousends of datapoints):

\addplot [color=black, forget plot]
0 0 \\
0.1 20\\

Best Answer

I'm not sure if it get the problem. But you could try to compile with pdflatex:

pdflatex -shell-escape %

EDIT: Or with lualatex:

lualatex -shell-escape %

NOTE: For lualatex you nedd the package \usepackage{shellesc} (Ref. @UlrikeFischer)

Folder structure and result:

enter image description here



\usepackage{shellesc}% to compile with lualatex

\tikzset{external/force remake} %up-to-date checks of all following figures (see: 50.4.3 Remaking Figures or Skipping Figures in pgf manual)

%\pgfplotstableread[row sep=crcr]{
%0 0 \\
%5 20\\


\tikzsetnextfilename{SaveNameFigureOne}%image name

%\tikzsetnextfilename{TestImageTwo}%image name



\addplot [color=black, forget plot]table[row sep=crcr]{0 0 \\
0.1 20\\};