Is there a way to avoid compiling a piece of TiKz code

\begin{tikzpicture} .....
     a heavy job here that takes 30 seconds to process 

so that, if we do not make changes on the "tikzpicture" it will not re-process it?

If for example I comment the code it will not process but then, no picture.

As an example, the package "Asymptote" let you use "latexmk" which checks if the figure was processed and not changed. Then if no changes, it will not re-process it again.

Of course, this would imply at least an auxiliary file but I believe it would be small.

Please do not include in your answer things like "save the picture in PDF", and then "include" it with "\includegraphics", or anything like that. I like to write documents "pdf/gif/jpeg/png..." free. This defeats the purpose of using TiKz. I want all my figures to be Tikz reproducible. Of course, photographs, images, and other files need to be "included" externally. ...

  • 3
    Have you tried to use external tikz figures? There is an externalization library specifically for the purpose of reducing compilation time. – Count Zero Nov 5 '15 at 17:16
  • @CountZero Thanks for your tip. I found a package called "standalone" and here is the link with information about this matter: tex.stackexchange.com/questions/79594/outsourcing-tikz-code – Herman Jaramillo Nov 5 '15 at 17:31
  • Actually I tried to use the "standalone" package and got this error: ! TeX capacity exceeded, sorry [main memory size=1500000]. <argument> \collectedbox l.561 ...ne[width=0.9\textwidth]{Figures/geodesic} % without .tex extension ! ==> Fatal error occurred, no output PDF file produced! Transcript written on input.log. Now, if I use "lualatex" the error dissapears but then another error appears on the "Asymptotic" library. So I am forced to use "pdflatex" or "latexmk" but none of them work with "standalone". – Herman Jaramillo Nov 5 '15 at 19:15
  • I am back to square 1. After reading the post above, I found that besides "standalone" (which does not work for me), the other way to do this is by creating "pdf" files from the "tikz" code, and including (input) the "pdf" files. This has two problems. First, I need to do extra work to create the pdf files, then I need extra space to store them. Would the pdf files would have the same resolution in the final document as the figures created with TiKz only? maybe, but I prefer some smart code that avoids unnecessary compilation of TiKz code. Perhaps this is still to be done. – Herman Jaramillo Nov 5 '15 at 19:35
  • 1
    The standalone class has no conflicts with pdflatex. The error you get is a memory problem, meaning that the data you are trying to compile exceeds the capacity allocated by Tex. – Nicolas Nov 5 '15 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.