TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the package import for chapters of a document. This makes it possible for me to use relative paths when I call \input. It also adjusts paths when I call \includegraphics. It does not, however, adjust the path when I call \graphicspath.

Q: How can I prepend the current sub-directory from \subimport to \graphicspath.


paper.tex contains:


and subdirectory/contents.tex contains:


The error is then:

LaTeX Error: File `picture' not found.

It is at ./subdirectory/images/picture.png

Edit: I have posted my own unsatisfactory workaround to this problem below.

share|improve this question

Here's my current solution. I redefine \graphicspath to inject the directory (in this case subdirectory).


I then call renewcommand before each call to subimport with the same path.

This is not optimal for me, however, because it does not work if I enclose the path in a block, as in:


So, I've had to edit all the graphicspath calls to remove the blocks, as in:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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