2

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

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

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 05 '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: http://tex.stackexchange.com/questions/79594/outsourcing-tikz-code – Herman Jaramillo Nov 05 '15 at 17:31
  • Actually I tried to use the "standalone" package and got this error: ! TeX capacity exceeded, sorry [main memory size=1500000]. \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 05 '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 05 '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 05 '15 at 22:41
  • So, why I do not get that problem when "standalone" is not used? Adding packages to the preamble increases the size of the memory. – Herman Jaramillo Nov 05 '15 at 23:36
  • standalone usually does more jobs than article. So... yes! you are the lucky guy who (barely) steps on the limit of TeX. Try to increase the memory size manually. It is not hard to Google it. – Symbol 1 Nov 06 '15 at 07:39
  • I know how to extend the memory. I know how to google and fix this issue. I want to add that standalone works for me with "lualatex" but I do not see any gain on processing time, which is my bottle neck at the moment. I do not care much about the organizational issue (outsourcing files) . I care about re-compiling what does not need to be re-compiled since it has not changed. – Herman Jaramillo Nov 06 '15 at 20:04

0 Answers0