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 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?

share|improve this question

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.

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.