I'm writing a document organized in many parts, so I use the subfiles packages.

Each subdocuments has a directory for it's images :


So my code ressemble to that :

% main.tex

And my subfile :


When I compile the main file it works as excepted but when I compile the subfile the image is not found.

So I tried to copy the \graphicspath both into the main and subfiles but in this case the subfile find the image but not the main.

Does any of you guys know how to fix it ? Thanks in advance :)

  • Copy the graphicspath{...} code from the main.tex into the subfile.tex, it would work!
    – C. Davide
    Mar 4, 2021 at 23:51
  • did you fixed this issue?
    – Dolphin
    Oct 25, 2023 at 6:31

1 Answer 1


Apply the command \subfix to the path in your subfiles, like \graphicspath{{\subfix{./img/}}}. That should fix the issue.

  • 1
    Thanks for your quick answer, but the behaviour is still the same :( Mar 4, 2021 at 10:04
  • 1
    Is your installation up-to-date? I can compile your mwe without problem.
    – schoekling
    Mar 4, 2021 at 13:25
  • this did not work for me.
    – Dolphin
    Oct 25, 2023 at 6:25

You must log in to answer this question.

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