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 doestikz/pgf
automatically determine if it should run the.tex
file or if it should load thepdf
?
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 withpdflatex
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:
\documentclass{book}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize
\tikzsetexternalprefix{figures/}
\tikzset{external/force remake}
\begin{figure}[h!]
{\input{Figure1.tex}}
\end{figure}
\end{document}
A random tikz figure document (actually contains thousends of datapoints):
Figure1.tex:
\begin{tikzpicture}
\begin{axis}[%
\addplot [color=black, forget plot]
table[row_sep=crcr][%
0 0 \\
0.1 20\\
}
\end{axis}
\end{tikzpicture}%
Best Answer
I'm not sure if it get the problem. But you could try to compile with
pdflatex
:EDIT: Or with
lualatex
:NOTE: For lualatex you nedd the package
\usepackage{shellesc}
(Ref. @UlrikeFischer)Folder structure and result:
MWE:
main.tex:
Figure1.tex