I'm using tikzexternalize to speed things up and to have a clean working directory, And I'm using -output-directory
on compilation to have a clean working directory (actually I use cluttex
, but I've seen the problem with just -output-directory
as well).
So my tex code looks something like this
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=figures/] % activate and define figures/ as cache folder
\begin{document}
\begin{tikzpicture}
\node[draw] {lore ipsum};
\end{tikzpicture}
\end{document}
and compile with
pdflatex -shell-escape -output-directory='tex-aux' main.tex
(actually I'm using LuaLaTeX, but the problem remains when using normal (pdf)latex).
The error I get is
\write18 enabled.
entering extended mode
! I can't write on file `figures/main-figure0.log'.
(Press Enter to retry, or Control-D to exit; default file extension is `.log')
Please type another transcript file namesystem returned with code 256
! Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "figures/main-figure0" "\def\tikzexternalr
ealjob{main}\input{main}"' did NOT result in a usable output file 'figures/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 simpl
y failed? Error messages can be found in 'figures/main-figure0.log'. If you con
tinue now, I'll try to typeset the picture.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.12 \end{tikzpicture}
So I know when removing -output-directory='tex-aux'
everything works just fine (I even tried manually creating the folder tex-aux/figures
just for the case this is the trouble, but it didn't help).
I also know that the hint to check if system calls are enabled shouldn't be the problem, since they are enabled with -shell-escape
.
Any suggestions on what the problem might be (and how to solve it)?
cd
to the desired temporary directory, compile the file there (specify full/relative path), then copy the PDF file back.-output-directory
just breaks a lot of packages.openout_any=a
works? (I didn't try it.)