I have a main document with lots of tikz pictures, which happens to be added from different directories within the main directory by using the 'input' and 'figure' commands. There are also some other files which make up the main file, like chapters and commentaries added the same way as the tikz pictures.

Since I want to modify some of those pictures and also files separately I don't want to compile the whole document every time I make a change because it takes a lot of time.

My question is whether by any chance there's some package or a workaround to manage this.

What I'm trying at the moment when I need to modify an input file is opening the file, pasting all the preamble of the main file in it, and then compiling it as an article class. The problem with this approach is that when I'm finished with it then I have to take out the preamble again and the other stuff I have added to compile (document class, begining and end document, etc). Also another drawback is that this process generates a lot of extra files.

Thanks for any help

  • 2
    You should look into the standalone package. I think you'll still end up with extra files, but it should solve your other problems. – Teepeemm Aug 10 '16 at 0:28
  • 1
    This is what standalone is for, in fact. You might also consider externalisation when you compile the main document, either using standalone's options or the external library (which works fine with standalone, if you prefer that combination). – cfr Aug 10 '16 at 0:33
  • 1
    there is package subfiles – touhami Aug 10 '16 at 6:05
  • Thanks for the suggestions @cfr The standalone package works great, except I was having problem because everything was cropped into one line. Now I know that I have to state the "preview" option as part of the class document to avoid this. Also I still don't like that I have to write all packages as part of the preamble in each input file because I often don't know which of the main file are being used in a particular input document so I just copy all of them from the main file. The advantage is I don't have to take this preamble out when I'm done so is ready for future modifications. – sunny Aug 10 '16 at 15:00
  • 2
    @sunny Create a file e.g. preamble.tex and then \input{preamble} each time. This is a lot easier than remembering to change every copy if you update something, believe me! – cfr Aug 10 '16 at 15:33