[Tex/LaTex] How to make “\input” in a “\include”-d file use the correct current path


I'm having a master file let's say test.tex and also some folders sub1/ and sub2/. There is also a TeX file in each of them: sub1/sub1.tex and sub2/sub2.tex. In the sub1/ and sub2/ are also some snippets sub1/snip11.tikz, sub1/snip12.tikz, sub2/snip21.tikz and sub2/snip22.tikz. The files look like following:












The snip??.tikz contain some tikzpicture like

    \draw (0,1) arc (90:130:1);

If one tries to compile it, it will obviously fail, because while being in sub1/sub1.tex the \input command will look for snip11.tikz in the root folder instead of in the folder sub1/.

Is there any way to make \input look in the same folder as the folder in which the containing TeX file is located?

Of course I could add the correct path in the sub1/sub1.tex, but I'm having tons of subfolders and also this is not the solution I'm looking for.

Best Answer

The FAQ suggests the packages import or chapterfolder: