Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
3  
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
1  
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
add comment

3 Answers

up vote 6 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.

\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}
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
    
by setting tikzset{external/force remake}, will it force it to generate the pdf files each time? or only in case of a change? –  Eagle Feb 14 '12 at 11:39
    
@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
    
@Eagle I should have added after the \tikzset{external/force remake} at the end of the first sentence of my previous comment. –  Marc van Dongen Feb 14 '12 at 12:03
show 8 more comments

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
add comment

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
add comment

Your Answer

 
discard

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.