2

I am working on a LaTeX document that includes lots of pgfplots. I would like to disable them for the time being until I work on the rest of the text so that I can build the document fast. If I include the option draft to the document class the figures are no longer included but the pgfplots are created and they take a considerable amount of time. Is there an easy way to disable/enable these plots without having to go through the document commenting/uncommenting text?

aaragon
  • 3,041
  • 1
    Not exactly what you ask for, but have you thought about externalizing the plots? See the manual, it's a chapter in the part about Related libraries. – Torbjørn T. Mar 14 '16 at 14:35
  • I don't like that solution. I actually found a quick way to disable pgfplots using if statements. Should I post my answer? – aaragon Mar 14 '16 at 14:57

1 Answers1

2

I found it's quite easy to enable/disable text in general by defining conditional compilation statements. I defined in the preamble:

\newif\iffigures
%\figurestrue % comment out to hide figures

and then I enclosed every figure (pgfplot or not) with the following code:

\iffigures
\begin{figure}[htbp]
   ...
\end{figure}
\fi

and thus if I comment the \figurestrue value, all my figures are not compiled and compilation of the document is fast.

aaragon
  • 3,041