Managing a project: separate .tex-files, externalized TikZ, folders

You can try something along this:

In main.tex:

\def\useexternalfile#1{\tikzsetnextfilename{#1-output}\input{\csname tikzexternal@filenameprefix\endcsname#1.tikz}}




EDIT: A cleaner, more LaTeX-y definition of \useexternalfile would be


For the record, \tikzexternal@filenameprefix is the internal macro where \tikzsetexternalprefix saves the "current prefix". Also, you can substitute #1-output for your favourite expression (maybe generated-figure-#1?)


In chapter1.tex:


In chapter1/tikz/myfigure.tikz:

\draw (0,0) rectangle (4,4);

(I tested this in my OSX system and it works; I use something slightly simpler). This differs from your question in that myfigure-output.pdf lives in folder chapter1/tikz/ and not in chapter1/ as you seem to want. Perhaps you (or others) can tweak it a bit more.