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)?
cdto the desired temporary directory, compile the file there (specify full/relative path), then copy the PDF file back.-output-directoryjust breaks a lot of packages. – user202729 Dec 10 '21 at 13:01Regarding the second suggestion, well if it's not too hard to do this
– atticus Dec 10 '21 at 13:05cdI think it's not worth adding anything which has security implications. Thanks again, would you mind writing a short answer, so I can accept it? ;)openout_any=aworks? (I didn't try it.) – user202729 Dec 10 '21 at 13:11openout_any=a pdflatex -shell-escape -output-directory='tex-aux' main.texgives the same error. I think I'll go with thecdsolution (so now I'm trying to avoid thatcluttexadds theoutput-directoryoption ^^ But if that doesn't work, I think I'll have to uselatexmkor something else again...) – atticus Dec 10 '21 at 13:15cd tex-aux && cp ../main.tex ./ && lualatex -recorder -halt-on-error -interaction=nonstopmode -file-line-error -shell-escape -jobname='main' "main.tex" && cp $@ ../for now ($@comes from the Makefile target). Not pretty but functional for now. But I'm hoping there will be a fix forcluttex(at least some way of disabling the use ofoutput-directoryin the latexengine command) since this way I'm missing automatic recomilation (if one run isn't enough) – atticus Dec 10 '21 at 14:16cdonly works if there are no\inputstatements. For now I think I'll have to cope with all the temporary files in my workin directory – atticus Dec 10 '21 at 21:13..to\input@pathon compilation (possibly necessary for the tikzexternalize command as well). But I'll have to see and test what I'm going to use. – atticus Dec 12 '21 at 13:04` ... `for inline code format and'for apostrophe.) (not an expert on this. Go ask the actual experts.) – user202729 Dec 13 '21 at 03:29