[Tex/LaTex] export Tikz figures to PDF

tikz-externaltikz-pgf

I am in the process of writing my master thesis and i am using Tikz to generate few graphs. Unfortunately, the input file for the graphs are not so small, so i already faced the problem that space limitation (solved). Nevertheless, it will take a long time to generate those plots.

My question is whether it is possible to save the generated Tikz figures into a file and to load the file instead? Since the problem is always that the labels do not have the right font sizeā€¦

PS.

I am using scrbook and pdflatex, I would have no problem to change to something else if it will solve my problem.

Best Answer

You can do this with the TikZ library external. It saves each picture in an external file, which has a proper graphics format. From now on TikZ will read the external file unless you tell it to regenerate the external file.

There are several methods that regenerate the external graphics files. For example, by setting the TikZ key external/force remake at the start of your document, you tell TikZ to regenerate subsequent external pictures. You may set the key as follows: tikzset{external/force remake}. Other methods, including methods that use Makefiles, are explained in Section 32.4.3 of the pgf manual.

The following is shamelessly copied from the TikZ manual.

Note: You have to run LaTeX with shell-escape enabled.

\documentclass{article}
% main document, called main.tex
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize % activate!
\begin{document}
\begin{tikzpicture}
\node {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
};
\end{tikzpicture}
A simple image is \tikz \fill (0,0) circle(5pt);.
\end{document}
Related Question