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!


2 Answers 2


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:


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


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


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


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .