My document contains quite a lot of images generated by tikz, forest, bussproofs, etc., so compiling takes way too much time. It would be much better if I could compile my images to PDFs first and simply insert these in my main document. In the ideal case, the image files are only compiled when the source code has been changed and the corresponding PDF isn't up to date anymore.
Yesterday, I read Outsourcing TikZ code and the standalone package seems to be the perfect way to solve my time consuming compilations. I created a subfolder with separate standalone files for every image and included them in my main file with \includestandalone. Unfortunately, that doesn't seem to speed things up. But then I noticed that Martin wrote in his answer on the aforementioned question:
It is also possible to compile all the TikZ files to single PDFs and include these in the document. This speeds up the compilation process significantly (except the first one, of course).
Right, so I actually have to compile all my image files first. Since I don't want to compile them manually, I started reading the standalone manual for a solution and found out that there are several input modes. I thought that mode=buildnew is exactly what I'm looking for, but when I compile the main file, none of the image files are compiled and I still have to wait ages for my PDF output. Same for the build and buildnew modes.
Am I misunderstanding the function of these modes? And my main problem remains unsolved: how can I automatically compile my standalone files before they are inserted in my main document?
latexmkcan help, the description sounds promising: An important feature is the "preview continuous mode", where the script watches all of the source files (primary file and included TeX and graphics files), and reruns LaTeX, etc., whenever a source file has changed. – Arash Esbati Apr 29 '16 at 11:56forest,bussproofs, etc. – Jeroen Apr 29 '16 at 12:15externallibrary. That said, it has never worked correctly for me in a real document. – cfr Apr 29 '16 at 13:45