UK TeX FAQ -- question 192

### Bits of document from other directories

A common way of constructing a large document is to break it into a set of files (for example, one per chapter) and to keep everything related to each of these subsidiary files in a subdirectory.

Unfortunately, TeX doesn't have a changeable "current directory", so that all files you refer to have to be specified relative to the same directory as the main file. Most people find this counter-intuitive.

It may be appropriate to use the "path extension" technique used in temporary installations to deal with this problem. However, if there several files with the same name in your document, such as chapter1/fig1.eps and chapter2/fig1.eps, you're not giving TeX any hint as to which you're referring to when in the main chapter file you say `\input{sect1}`; while this is readily soluble in the case of human-prepared files (just don't name them all the same), automatically produced files have a way of having repetitious names, and changing them is a procedure prone to error.

The import package comes to your help here: it defines an `\import` command that accepts a full path name and the name of a file in that directory, and arranges things to "work properly". So, for example, if /home/friend/results.tex contains

      Graph: \includegraphics{picture}
      \input{explanation}

then `\import{/home/friend/}{results}` will include both graph and explanation as one might hope. A `\subimport` command does the same sort of thing for a subdirectory (a relative path rather than an absolute one), and there are corresponding `\includefrom` and `\subincludefrom` commands.

`import.sty`
  macros/latex/contrib/supported/misc/import.sty