5

I am using standalone package by Martin Scharrer in a report. I read in this answer by Martin that if the document loads with a [mode=buildnew]{standalone} package, then for each picture that is included using \includestandalone[<options>]{<filename>}, a compilation using the pdflatex -shell-escape main will compile all \includesstandalone'ed files automatically as graphics and build these graphics if the source file is newer than the existing graphics file.

My question is, is this valid also if the tikzpic.tex file includes plot data from another data file ? Because if the changes are made in the data file, then would the standalone package will still be including the pdf of plot of old data?

5
  • 2
    No, it isn‘t. There is not a make-like transitive dependency tracking, but basically a simple comparison of the file dates. Commented May 31, 2018 at 14:16
  • @Daniel ok, then should I close this question? Or can you put your reply in an answer so that I can accept it. Commented May 31, 2018 at 14:30
  • 1
    If you use the external library, you can declare a dependency for a picture on another file, I think. However, I don't think the standalone strategy can do this. (I'm not sure as I always externalise rather than using this functionality from standalone and just use standalone for its inputting features.) Commented May 31, 2018 at 23:24
  • @cfr Can you add a MWE to Daniel's answer using 'external' library? Commented Jun 2, 2018 at 18:25
  • Daniel's answer is completely different and has nothing to do with the external library. You are less likely to get answers with MWEs when you don't bother to provide an MWE yourself. Anyway, my comment doesn't answer the question because it by-passes standalone's support for including compiled pictures altogether: if you externalise, the standalone file is just input and TikZ figures out whether to compile each tikzpicture in the document (whether in another file or not). Commented Jun 3, 2018 at 0:58

1 Answer 1

4

While the [mode=buildnew] option of standalone is pretty nifty, it does not work transitively. That is, it invokes the recompilation only if the source file itself is newer than the PDF, but does not extend this test recursively to further dependencies of the source file.

A possible, but untested, workaround might be to use [mode=build], that is, always invoke the compiler, but use either make (with an appropriate Makefile) or latexmk as the compiler executable for standalone. (Look for latex + latexoptions or command in the standalone documentation).

Thereby, the dependency handling would be delegated to make or latexmk, which consider recursive dependecies. However, the price would be slightly higher compilation times, as the external compiler is aways invoked – even if it does not need to do any work.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.