# External Tikz pictures

### 2017/12/12

I produce almost all pictures in my math $\mathrm{\LaTeX}$ writing in TikZ. This is a nice library (and I’ve learned it over the years), which allows for-loops, effects, etc. The downside for me always was that compiling inline TikZ pictures takes a lot of time. For some months now, while writing a particularly figure-heavy paper, I wondered how I can optimize this.

Following this stackoverflow discussion, I have now adopted a great way of optimizing TikZ pictures by placing them into separate standalone tex files.

For example, this file

can be fed into my usual latexmk

for automatic constant compilation, and the pdf result can be included into the main $\mathrm{\TeX}$ file using another thread of automatic latexmk compilation.

Note. For further possible optimization, $\mathrm{\TeX}$ class standalone can already produce png output, which (I think) cost less compile time to be included into the main $\mathrm{\TeX}$ file.

PS. I enjoy turning on latexmk to constantly recompile the $\mathrm{\LaTeX}$ sources for me. I think this might be the reason why my laptop battery just died…