# Managing texts with many TikZ-pictures

I am writing a long text with many TikZ pictures. Since compilation time is beginning to grow, I would like to tell TikZ not to draw some (all) pictures. So far I have just commented unnecessary pictures, but it is a quite cumbersome way to proceed. Are there better ways?

Moreover, when the tex file is full of code for Tikz pictures it tends to become excessively long and a bit messy. Do you have any hint on how to avoid this?

Finally, do you think it is wise to use TikZ pictures in long texts? I generally use them instead of including graphics because this way I can modify the pictures directly, but I am beginning to wonder if it is really convenient.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. You can put the code for the pictures in separate files and use `\input`. You can also use the `external` library which will mean the images are compiled only once, saving compilation time on subsequent runs. And/or you can combine this with the externalisation capabilities of a package such as `standalone`. Or you can compile them separately and just include them as graphics, of course. I use different approaches in different cases...
– cfr
Jun 11 '14 at 22:04
• You should probably copy-paste your tikz code in external .tex files that you include / input, following for instance this post. Have a look at \includeonly also. Jun 11 '14 at 22:15
• Welcome to the site! Have a look at tex.stackexchange.com/questions/59530/… and also tex.stackexchange.com/questions/111566/… Jun 11 '14 at 22:23

I think using TikZ is great, even for long texts with lots of pictures. When you start getting a lot of pictures slowing down compilation, I recommend using the TikZ `external` library. This allows you to create TikZ pictures that are compiled once, then retrieved by TikZ as external PDFs until they are modified. You won't have to comment out any of your pictures, and you can still see all of them without slowing down document compilation. To use the `external` library, include the following preamble commands:
``````\usetikzlibrary{external}
Be sure to run LaTeX using the `-shell-escape` option in order for this to work properly. For more details about how to get things up and running, see page 615 of the PGF/TikZ manual.