0

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.

Many thanks in advance.

  • 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
  • Why not to work with the precompiled pdf output given by tikz code in standalone class, then import to the main document as an image within figure environment using graphicx package like in this post Scaling different components of tikzpicture together. – J Leon V. Aug 17 '18 at 18:06
  • Also try \input{./_images/tikz/standalone/standalone_cube.tex} – John Kormylo Aug 18 '18 at 0:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.