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.


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:


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.