# When using \input{document_with_tikz.tex} the paths inside document_with_tikz.tex getting wrong

I have some main document and want to insert another .tex file which contains a tikz-picture (standalone documentclass). In my project I have a folder for some shared preambles like commands of usepackages etc. Compiling just my document with the tikzpicture works correct as the path shows the correct "way":

``````%%File with the picture: standalone_cube.tex%%
\input{../../../_shared_preambles/tikz_packages.tex}
begin
<<code for picture>>
end
``````

But when using \input from the main-file to include this picture:

``````\input{_images/tikz/standalone/standalone_cube.tex}
``````

I think latex just replace the "insert" with the text standing in my standalone_cube.tex. But when this get an 1:1 copy the path I use inside this is getting wrong I guess and so my document wont compile.

Is there any kind of solution that latex track the movement to the file I want to insert and so the relative path still work? I guess I could just place all files in one folder so do't have to go up- or downwards in folders, but then the structure gets messy.

• in your title you use `\insert` I assume you did not use `\insert` in your document, please edit to clarify – David Carlisle Aug 17 '18 at 16:17
• Also try `\input{./_images/tikz/standalone/standalone_cube.tex}` – John Kormylo Aug 18 '18 at 0:09