Sign up ×
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.

This question already has an answer here:

I have a document with a lot of tikzpicture made with pgfplots, most of them take data from files so the compilation may be very long. In order to have only a draft I would like to have blank images with same dimension of the full ones.

Until now I used a trick of having a tikzpicture with an empty axis environment of the same dimensions of the original one and with some if statements I included the blank or the full image like this:

\newcommand{\img}{Y} % immages Y(es) or N(o)

file full.tex

  \begin{axis}[height=9cm, width=.8\textwidth]
    \addplot table [x index=0, y index=2] {dati.dat};

file empty.tex

  \begin{axis}[height=9cm, width=.8\textwidth]

But today I read this question How I can speed up the compilation of a document with multiple images? and now I would like to know if there is a similar way to the draft option of the package graphicx that does the same thing with tikzpicture.

share|improve this question

marked as duplicate by cmhughes, Paul Gaborit, mafp, T. Verron, Qrrbrbirlbel Jun 28 '13 at 14:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

There are a few related questions about this on the site e.g.… if you search for tikzpicture draft you can see more. – percusse Jun 28 '13 at 12:18
Just to make sure: Have you thought about using the external library, which compiles your tikzpictures into external PDFs that then only have to be included in your final document? – Jake Jun 28 '13 at 12:40
@Jake Ok, with your suggestions I got the solution, can I answer to my own question? – Red Jun 28 '13 at 13:03
@Red: Sure! You just have to wait a day (I think) before you can accept the answer, but you can (and should) post the answer – Jake Jun 28 '13 at 13:09

1 Answer 1

up vote 5 down vote accepted

A part of the total solution is to use the external library as suggested and then put the option draft to \documentclass[draft]{whatever}. But doing so the image is replaced by a box of fixed dimensions, not equal to those of the real image.




  \caption{caption of this beautiful image}



enter image description here

This happens because the external image created is not imported with \includegraphics, to correct this it is sufficient to add this line (\pgfkeys{/pgf/images/include external/.code=\includegraphics{#1}}) before \tikzexternalize. In this way we obtain the desired result:

enter image description here

share|improve this answer

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