TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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…


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

share|improve this question
take a look at the externalize library in the pgf manual. It does exactly what you need. It will not be in one file, however that can easily be done afterwards. – zeroth Feb 14 '12 at 10:00
Have a look at 'Standalone' TikZ pictures‌​, which seems to be the same basic question. I can recommend you the standalone class to create PDF versions of your TikZ pictures, see e.g. How should I organise my document/files in order to easily export TikZ figures as images? or TikZ to non-PDF (which besides the name also works for PDFs). – Martin Scharrer Feb 14 '12 at 10:43
up vote 10 down vote accepted

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. You have to run LaTeX with shell-escape enabled.

% main document, called main.tex
\tikzexternalize % activate!
\node {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
A simple image is \tikz \fill (0,0) circle(5pt);.
share|improve this answer
This is not quite true. Even if the picture has changed, you have to ask for the figure to be remade. TikZ will happily assume that anything with the right file name is up to date unless you do, for example by using \tikzset{external/force remake}. – qubyte Feb 14 '12 at 10:26
@MarkS.Everitt Thanks. I'll change the text. – Marc van Dongen Feb 14 '12 at 10:45
@Eagle It will do it for every tikzpicture in the current group. By putting the picture in a group and enforcing external/force remake at the start of the group, you can restrict the scope of the regeneration to the pictures inside the group. – Marc van Dongen Feb 14 '12 at 11:53
... but it will do it on each compilation run when that option is set. In a document with lots of pictures, I use the external/remake next key just before the one I'm currently working on and then delete it when I'm happy. Note that if you don't specify names for your pictures then they are named numerically and so if you insert a new picture not at the end, you'll have to regenerate the lot. – Loop Space Feb 14 '12 at 12:03
I like to keep a commented out force remake with every TikZ picture. Whenever I need to regenerate one I uncomment it. – qubyte Feb 14 '12 at 14:59

If you are on Windows or Linux you can use QtikZ, a dedicated TikZ editor that offers live compilation of your TikZ code and export to PDF and other formats.

You can also consider the standalone package to generate PDF compiling your TikZ code alone with pdflatex.

Finally, TikZ offers the external library to generate PDFs during the first compilation of your main file (chapter 32 of the manual).

share|improve this answer

You can try a semi graphical tikz editor Tikzedt which I feel has many features like creating pdf file and standalone files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.