Hello there
Currently trying to implement the external library but cant seem to make it work
\documentclass{article}
% pgfplots
\usepackage{pgfplots}
% % Uncommenting generates error
% \usetikzlibrary{external}
% % External lib
% \tikzexternalize % turn externalization on/off
% \tikzsetfigurename{./figures/figure_\arabic{part}.} % set names
\pgfplotsset{
compat = newest,
width = 10cm, % width
height = 7cm, % height
samples = 10,
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[hide axis]
\addplot3 [
% Aparence
surf,
opacity=0.5,
fill opacity= 1,
faceted color = white,
shader=faceted interp,
% Scope
data cs = cart, % cart/polar/polarrad
% Variable
domain = -1:1,
domain y = -1:1,
]{
x^2-y^2
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[hide axis]
\addplot3 [
% Aparence
surf,
opacity=0.5,
fill opacity= 1,
faceted color = white,
shader=faceted interp,
% Scope
data cs = cart, % cart/polar/polarrad
% Variable
variable = u,
variable y = v,
domain = 0:360,
domain y = -180:0,
]
(
{cos(u)*sin(v)},
{sin(u)*sin(v)},
{cos(v)}
);
\end{axis}
\end{tikzpicture}
\end{document}
Uncommenting external library code generates the following error:
Package tikz Error: Sorry, the system call 'lualatex -shell-escape -halt-on-error -interaction=batchmode -jobname "./figures/figure_0.1" "\def\tikzexternalrealjob{"stack q"}\input{"stack q"}"' did NOT result in a usable output file './figures/figure_0.1' (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 './figures/figure_0.1.log'. If you continue now, I'll try to typeset the picture.
Notes:
./figures/figure_0.1.logwas never written, it might seem that there is problem with writing some file, but it isnt the case as files with.md5have been created.- Compilation call is:
lualatex --synctex=1 --shell-escape --output-dir=.build --interaction=nonstopmode --file-line-error %DOC%
List of .build directory files:

Update 1
Changes:
- Fix directory to include
.build/ - Added
tikzsetexternal/system callcommand
\documentclass{article}
% pgfplots
\usepackage{pgfplots}
% uncommenting generates error
\usetikzlibrary{external}
% External lib
\tikzexternalize[
up to date check={simple},
prefix=./.build/figures/
] % turn externalization on/off
\tikzsetfigurename{figure_\arabic{part}.} % set names
% Using tikzset returns error
\tikzset{%
external/system call={%
lualatex \tikzexternalcheckshellescape
--halt-on-error
--shell-escape
--interaction=batchmode
--jobname "\image" "\texsource"
}
}
\pgfplotsset{
compat = newest,
width = 10cm, % width
height = 7cm, % height
samples = 10,
}
\begin{document}
% \tikzsetfigurename{figure_\arabic{part}.} % set names
\begin{tikzpicture}
\begin{axis}[hide axis]
\addplot3 [
% Aparence
surf,
opacity=0.5,
fill opacity= 1,
faceted color = white,
shader=faceted interp,
% Scope
data cs = cart, % cart/polar/polarrad
% Variable
domain = -1:1,
domain y = -1:1,
]{
x^2-y^2
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[hide axis]
\addplot3 [
% Aparence
surf,
opacity=0.5,
fill opacity= 1,
faceted color = white,
shader=faceted interp,
% Scope
data cs = cart, % cart/polar/polarrad
% Variable
variable = u,
variable y = v,
domain = 0:360,
domain y = -180:0,
]
(
{cos(u)*sin(v)},
{sin(u)*sin(v)},
{cos(v)}
);
\end{axis}
\end{tikzpicture}
\end{document}
Notes:
- Now its possible to see the
.loggenerated files. they all disclaim the same message
...
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.13 \tikzsetfigurename
{figure_\arabic{part}.} % set names
...
Displacing \tikzsetfigurename to after \begin{document} has no effect.
- removing
--output-directoryoption from compilation call and replacingexternalrelated commands with:
% uncommenting generates error
\usetikzlibrary{external}
% External lib
\tikzexternalize[
up to date check={simple},
prefix=./figures/
] % turn externalization on/off
\tikzsetfigurename{figure_\arabic{part}.} % set figure names
% Using tikzset returns error
\tikzset{%
external/system call={%
lualatex \tikzexternalcheckshellescape
--halt-on-error
--shell-escape
--interaction=batchmode
--jobname "\image" "\texsource"
}
}
Still generates the same error as before.
Conclusion
Turns out the problem is that the main file has spaces in the name, creating a new question to address this issue here.
Here is the current working MWE renamed to stackq.tex:
\documentclass{article}
% pgfplots
\usepackage{pgfplots}
% uncommenting generates error
\usetikzlibrary{external}
% External lib
\tikzexternalize[
up to date check={simple},
prefix=./.build/figures/
] % turn externalization on/off
\tikzsetfigurename{figure_\arabic{part}.} % set figure names
% Using tikzset generates error
\tikzset{%
external/system call={%
lualatex \tikzexternalcheckshellescape
--halt-on-error
--shell-escape
--interaction=batchmode
--jobname "\image" "\texsource"
}
}
\pgfplotsset{
compat = newest,
width = 10cm, % width
height = 7cm, % height
samples = 10,
}
\begin{document}
% \tikzsetfigurename{figure_\arabic{part}.} % set figure names
\begin{tikzpicture}
\begin{axis}[hide axis]
\addplot3 [
% Aparence
surf,
opacity=0.5,
fill opacity= 1,
faceted color = white,
shader=faceted interp,
% Scope
data cs = cart, % cart/polar/polarrad
% Variable
domain = -1:1,
domain y = -1:1,
]{
x^2-y^2
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[hide axis]
\addplot3 [
% Aparence
surf,
opacity=0.5,
fill opacity= 1,
faceted color = white,
shader=faceted interp,
% Scope
data cs = cart, % cart/polar/polarrad
% Variable
variable = u,
variable y = v,
domain = 0:360,
domain y = -180:0,
]
(
{cos(u)*sin(v)},
{sin(u)*sin(v)},
{cos(v)}
);
\end{axis}
\end{tikzpicture}
\end{document}



standaloneclass, its just an example, the class is used just to simplify the MWE – Felipe9 Jan 22 '22 at 16:44articleis better for everyone. Note here that the error persists after changing to thearticleclass. – Felipe9 Jan 22 '22 at 16:54--output-directoryis set'd to.build/which is the one displayed in the question. – Felipe9 Jan 22 '22 at 17:15figure_0.0.logcan now be written, updating that in the question – Felipe9 Jan 22 '22 at 17:42externalizerelated commands were commented cause they aren't working, the procedure i'm using is the (now updated) current one (without commenting out). – Felipe9 Jan 22 '22 at 18:53prefix= figures/everything works fine. – Ulrike Fischer Jan 22 '22 at 19:01output-directorystill generates an error, going to add a note on that – Felipe9 Jan 22 '22 at 19:06prefix=./.build/figures/key, it quite probably points now to an not existing directory. – Ulrike Fischer Jan 22 '22 at 19:07--output-directoryas.build/– Felipe9 Jan 22 '22 at 19:17stackq.tex(without spaces!) – Simon Dispa Jan 22 '22 at 19:32subfilesi solved by creating a command\mainfilewith the file name (using spaces), there must be something similar withexternalise– Felipe9 Jan 22 '22 at 19:50