3

I'm using TikZ for my thesis but have run into a small problem. In order to maintain some overview of the main tex file I have split all images into separate TikZ files (This also allows me to edit them with KtikZ which is nice). All images are put into a separate directory, say /images, which contains the TikZ files as well as any data file they include for plots (these are drawn with the \draw plot file{<filename>}; command).

Now, my problem is that when I import an image (\import inside an figure environment) all the file paths inside the TikZ file become wrong.

So, is there any way of changing the evaluation directory inside the scope or to provide the TikZ file with an relative path or something? All ideas are welcome!

migrated from stackoverflow.com Jan 19 '12 at 15:28

This question came from our site for professional and enthusiast programmers.

3

I follow the same process of keeping my TikZ images in a separate file, editing them in QTikZ and then including them in my main file. The way I do this is to define a new command that I can set in different locations. I have the command \tikzimgpath in my main file defined as:

\newcommand{\tikzimgpath}{images}

In the QTikZ template file (/usr/share/qtikz/templates/template_example.pgs), I define \tikzimgpath as:

\newcommand{\tikzimgpath}{/home/username/documents/teaching/latex-templates/includes/images}

Then, whenever I want to include the file, I can say:

\includegraphics{\tikzimgpath/filename}
0

If your qtikz template is stored in the directory of your tex project, you can simplify @recluze's solution by adding a line

\graphicspath{{.}}

in the template. Then, no \tikzimgpath macro is needed anymore, and the tikz file works the same in qtikz as it does when included in your main .tex file.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.