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:
test.tex:
\documentclass[12pt,a4paper]{scrartcl}
\usepackage{tikz}
\begin{document}
\section{sub1}
\include{sub1/sub1}
\section{sub2}
\include{sub2/sub2}
\end{document}
sub1/sub1.tex:
\input{snip11.tikz}
\input{snip12.tikz}
sub2/sub2.tex:
\input{snip21.tikz}
\input{snip22.tikz}
The snip??.tikz contain some tikzpicture like
\begin{tikzpicture}
\draw (0,1) arc (90:130:1);
\end{tikzpicture}
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.
\sectioncommands should be in their respective included files, else you get a section title alone on a page. (And of course I recommend import.sty.) – Donald Arseneau Apr 04 '20 at 22:37