If I have a figure folder hierarchy such as:



How can I point B/a.pdf when A/a.pdf precedes it,
without needing to change the file name?

  • 1
    you need to change the graphicspath or use \includegraphics{Figures/B/a.pdf] – David Carlisle May 13 '16 at 17:29
  • is there any method to merely extend the filename to include the first path back only? as in \includegraphics{B/a.pdf}. My figures would be many folders deep and sometimes I just want to be able to add one added above directory path to differentiate between those with the same file name in different directories. – kando Jun 10 '16 at 16:03
  • 1
    B/a.pdf will work if Figures is in your search path (by the way adding comments to old questions are unlikely to be seen, you were lucky this time as it pinged me as the only person to have commented) – David Carlisle Jun 10 '16 at 16:29
  • @DavidCarlisle Your reputation precedes you ; j (I checked it before posting; I thought you might be on sooner or later.) These are alternative answers to Heiko - why not post them as an answer for an upvote as well? – kando Jun 10 '16 at 17:03
  • 1
    it's really same as Heiko's anwser he doesn't hav e absolute paths either /usr/local/foo/bar.png would be different but a.pdf, A/a.pdf, Figures/A/a.pdf are all more or less handled the same way as a local name which is appended to each directory in the search path – David Carlisle Jun 10 '16 at 17:28

The file name can be specified with the path:


Or the graphics path can be set by:

\includegraphics{a}% Figures/A/a.pdf
\includegraphics{b}% Figures/A/b.pdf
\includegraphics{a}% Figures/B/a.pdf
\includegraphics{b}% Figures/B/b.pdf
  • For the latter method, could you add script to save the original universal path for easy swapping between the global and the custom path? – kando May 16 '16 at 16:28
  • 1
    @kando Just put it inside a group, after the group end, the original path is restored automatically. – Heiko Oberdiek May 16 '16 at 17:04

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.