In short: I stumbled upon a case where latexmk runs fine,
but pdflatex fails, using the command outputted by latexmk.
Some details:
my setup is gently exotic but I can't get why this could interfere and why pdflatex would only succeed when launched via latexmk.
The only hint I have,
from my scarce understanding of the sources,
is that latexmk can redefine $ENV{TEXINPUTS}.
I could not make other/simpler bugging cases than this one,
with dot2texi and a specific build directory.
Here is the tree of my working directory:
.
├── build/
├── dot2texi.sty
└── dot.tex
I'm using the dot2texi.sty patch from here to be able to compile with all the (numerous!) build files sent to the directory build/.
I use the settings proposed in this answer in the dot.tex file:
\documentclass{standalone}
\usepackage[inputdir=build/]{dot2texi}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\begin{dot2tex}[neato]
digraph G { a -> b }
\end{dot2tex}
\end{document}
When launching latexmk -pdf --output-directory=build --shell-escape dot.tex everything runs as expected.
The numerous build files are sent to build and the graph is correctly compiled.
When launching pdflatex -recorder -output-directory="build" --shell-escape "dot.tex"
(which is what latexmk says it runs) I get the following error:
Opening dot2tex stream dot-dot2tex-fig1.dot
! LaTeX Error: File `dot-dot2tex-fig1.tex' not found.
This buggy behaviour was reproduced on two machines,
under debian and gentoo.
I also tried to play a bit with the pdflatex options,
without success.
Definitely not the most critical bug of the century, but I'd like to understand what I'm doing wrong...
--output-directory="build"will add build as an input directory for pdflatex, but this is not passed to external commands called via shell-escape. – Ulrike Fischer May 03 '20 at 18:44latexmk? I'd expect both or none to fail. – letax May 03 '20 at 20:15latexmk's sources that environment variables might be modified. I also have many other use-cases with "regular" standalone tikzpictures built on the fly from a main document. Everything works as I expect, with bothlatexmkandpdflatexusing\standaloneconfig{`build={latexoptions={--shell-escape -output-directory=build/}}}. – letax May 04 '20 at 08:58latexmkby the way.) It was not clear for me, reading the documentation, thatlatexmkwould silently redefineTEXINPUTS, without being explicitly asked. Reading the logs, I didn't find any mention of this redefinition of the variables. Did I miss the info somewhere? I think you could turn your comment into an answer, as it may be useful to others. – letax May 04 '20 at 17:33