Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (41 sloc) 1.78 KB
layout title date comments categories published show-date more-text
post
External Tikz pictures
2017-12-12 00:00:00 -0800
true
blog math tech latex
true
true

I produce almost all pictures in my math <script type="math/tex">\mathrm{\LaTeX}</script> 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 {%highlight tex linenos%} \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} %tikz code \end{tikzpicture} \end{document} {%endhighlight%} can be fed into my usual latexmk {%highlight bash%} latexmk -pdf -pvc -f -silent -synctex=1 FILENAME {%endhighlight%} for automatic constant compilation, and the pdf result can be included into the main <script type="math/tex">\mathrm{\TeX}</script> file using another thread of automatic latexmk compilation.

Note. For further possible optimization, <script type="math/tex">\mathrm{\TeX}</script> class standalone can already produce png output, which (I think) cost less compile time to be included into the main <script type="math/tex">\mathrm{\TeX}</script> file.

PS. I enjoy turning on latexmk to constantly recompile the <script type="math/tex">\mathrm{\LaTeX}</script> sources for me. I think this might be the reason why my laptop battery just died...