5

If I have a figure folder hierarchy such as:

./Figures/A/a.pdf
./Figures/A/b.pdf
./Figures/A/c.pdf

./Figures/B/a.pdf
./Figures/B/b.pdf
./Figures/B/c.pdf

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

5
  • 1
    you need to change the graphicspath or use \includegraphics{Figures/B/a.pdf] Commented May 13, 2016 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
    Commented Jun 10, 2016 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) Commented Jun 10, 2016 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
    Commented Jun 10, 2016 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 Commented Jun 10, 2016 at 17:28

1 Answer 1

3

The file name can be specified with the path:

\includegraphics{Figures/A/a.pdf}
\includegraphics{Figures/B/a.pdf}

Or the graphics path can be set by:

\graphicspath{{Figures/A/}}
\includegraphics{a}% Figures/A/a.pdf
\includegraphics{b}% Figures/A/b.pdf
...
\graphicspath{{Figures/B/}}
\includegraphics{a}% Figures/B/a.pdf
\includegraphics{b}% Figures/B/b.pdf
4
  • 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
    Commented May 16, 2016 at 16:28
  • 1
    @kando Just put it inside a group, after the group end, the original path is restored automatically. Commented May 16, 2016 at 17:04
  • this didn't work for includesvg
    – con
    Commented Jan 17 at 1:28
  • @con The documentation of package svg says otherwise: (a) it provides \svgpath and (b) the paths of \graphicspath are also searched. It recommends not to use non-ASCII characters, spaces and quotes. Commented Jan 20 at 18:58

You must log in to answer this question.

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