I had problems compiling with the \includeonly \include system since I had images in the document form different subdirectories. For example the main file would be at /Main/MainFile.tex and the included file at /Main/Chapter1/Chapter1.tex and one of the images would be at /Main/Chapter1/Images/Image1.jpg which was actually loaded through the Chapter1 file as \includegraphics{./Images/Image1}.

I had the problem fixed with the import package using \subimport{}{}, but I don't have the include functionality of different .aux files which keeps the pagination and cross references intact.

How do I get the best of both?


You can tell LaTeX where to look for included pictures, using the \graphicspath setting. For example,


will prompt LaTeX to look for pictures relative to both these folders. You can then include e.g. /data/experiments/plots/first/straightline.pdf as first/straightline, and /data/simulations/rollthedice.pdf just as rollthedice.

In this way, you can avoid typing out very long absolute paths every time, and yet you don't have to change anything if you move parts of your document from one directory to another.

| improve this answer | |

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.