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've read that LaTeX image directories can be searched recursively with the \graphicspath command by including a double slash at the end - i.e. \graphicspath{{../my_images//}}.

However, the recursive part of this doesn't seem to be happening. I've tried several different iterations, including / vs \, absolute paths, and pdftex vs latex. Any ideas what is wrong? Google has turned up nothing but confirmation that this should work. I'm on Windows 7 using Miktex 2.9. I've not had the opportunity to try this on another platform.

share|improve this question

migrated from stackoverflow.com Aug 11 '11 at 6:44

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

Where did you read that? Recursive path search through \graphicspath is impossible. – AlexG Aug 11 '11 at 7:12
@Alexander: While it is impossible to list directory contents in pure TeX, it should be possible with \write18 or LuaTeX. – Andrey Vihrov Aug 11 '11 at 7:14
Actually, this (recursive search) seems to be a good idea for a LaTeX package. Is there one yet? – Andrey Vihrov Aug 11 '11 at 7:18
I've not seen it work but is stated in the LaTeX wiki section on \includegraphics: "The last command searches the files recursively because of the double slash "//"." – mas Aug 11 '11 at 9:57
It is also stated in an accepted answer on this site in relation to MikTeX. – mas Aug 11 '11 at 10:27
up vote 3 down vote accepted

To summarise the responses in the comments:

(a) For many platforms, ending the specified path to \graphicspath with a double-slash does not invoke recursion through directories below that.

(b) For some users, ending the path to \graphicspath with a double slash does invoke recursion. All the cases I have seen documented and where the platform was mentioned were MikTeX users, e.g. see an accepted answer on this site. At the time of writing the LaTeX Wiki also mentions this behaviour.

As the OP put in a comment, it "shouldn't work, but there are instances of it working". There was general agreement that it would be a handy feature, especially given that any overhead of time and memory would likely be of little consequence to most users.

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.