pgf icon indicating copy to clipboard operation
pgf copied to clipboard

Support for automatically following -output-directory of main call with externalize

Open JordanSavoie opened this issue 2 years ago • 1 comments

Brief outline of the proposed feature

If I want to set the output directory and use the externalize package, then I have to manually set external/system call to include the output-directory argument. I feel like this is something that should be relatively straightforward to implement, but that assumes that the proper calls are in place to pass forward the output directory that was already set.

Usage example

mwe.tex:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
% \tikzset{external/system call={pdflatex \tikzexternalcheckshellescape -output-directory=output -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}
 
\begin{document}
	\begin{tikzpicture}
	\end{tikzpicture}
\end{document}

With the build command:

pdflatex -shell-escape -output-directory=output ./mwe.tex

JordanSavoie avatar Oct 13 '22 15:10 JordanSavoie

Not that straightforward (to implement) because there's no direct access to the value of CLI option -output-directory in pdftex. See https://tex.stackexchange.com/questions/294931/access-value-of-output-directory.

If, in addition, CLI option -recorder is used, it seems there exists an indirect way: get the full output path. @user202729's answer to the linked TeX-SX question shows one such attempt (I didn't check, sorry) that is based on package currfile.

muzimuzhi avatar Oct 13 '22 18:10 muzimuzhi