I have a TikZ figure (fig.tex) in a subfolder as an standalone, and I want to use mode=buildnew in my main document so that I can optimize compilation times. I indicate the subfolder by using \graphicspath{{images/}}.
However, the figure is not build separately but compiled every time, together with the main document, and I get the warning Graphic 'fig.pdf' could not be build.
If I move fig.tex out of the subfolder, and leave it in the main one, together with main.tex, then it works properly and generates fig.pdf. I would like to get this result also when referring to TikZ figures in the subfolder.
I have version 1.2 of the standalone package and I included the "magic" TeXstudio comment % !TeX TXS-program:compile = txs:///pdflatex/[-shell-escape] in the main file, according to some of the answers that I have found around.
Here is the MWE:
fig.tex
\documentclass[tikz]{standalone}
\usepackage{fontenc}
\begin{document}
\begin{tikzpicture}[node distance=35mm,auto]
\node[draw,fill=yellow] (n) {Fig};
\end{tikzpicture}
\end{document}
main.tex
% !TeX TXS-program:compile = txs:///pdflatex/[-shell-escape]
\documentclass{article}
\usepackage[mode=buildnew]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{tikz}
\selectlanguage{british}
\graphicspath{{images/}}
\begin{document}
Text.
\includestandalone{fig}
\end{document}
EDIT:
Some things I already tried:
- Adding
--enable-write18to the magic comment. - Changing the path to
\graphicspath{{./images/}}.
And some additional information
- If I use
\includestandalone{images/fig}and take away\graphicspathit works properly and the figure is compiled. - My OS is Windows 10.
\graphicspath{{./images/}}(see question here) – dexteritas Jan 21 '17 at 14:49Package standalone Warning: Graphic 'fig.pdf' could not be build.is shown, the final result includes the standalone figure as expected. – Ignasi Jan 24 '17 at 10:20buildnewoption. So it should generate the fig.aux, fig.log and fig.pdf in all cases, and give no warnings, but it does not work. Should I edit the question to make it less confusing? – Fernando Jan 24 '17 at 13:42\graphicspathis not yet a feature ofstandalone. However, there is already a feature request for it. – Martin Scharrer Mar 16 '18 at 07:44