# Using TikZ library `external` with images that require multiple compilations

I have a fairly large LaTeX document that requires compiling a number of times (because of a lot of (cross)references, appendices, etc.). Part of this document are a number of TikZ images that require a different number of compilations to come out right (here's an example); Some require 2, and some require 3, or 4.

Since my overall compilation process requires 4 executions of (`pdf`)`latex`, it would be nice to speed things up a little bit, just by skipping unnecessary TikZ compilations. But if I use tikzlibrary "external", only the first run of (`pdf`)`latex` will work on the TikZ images, and those that need multiple runs will never reach maturity.

Can I somehow tell TikZ how often to compile a given image during each run? That way the first run of (`pdf`)`latex` would take care of maturing all TikZ images, and in the next run, the image would simply be pasted from it's ready-made pdf rendering.

• Well, you could put each tikzpicture into a separate file using \documentclass{standalone} and replace the original tikzpicture with \includegaphics{filename.pdf}. Dec 17, 2013 at 17:30
• I guess that's the best way to do it. Do you want to type that up into an answer to be able to get rep/credit for it? Dec 19, 2013 at 13:41

``````\documentclass{standalone}
``````\includegaphics{filename.pdf}