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

For the graphicx package, we can use \graphicspath{...} so that we can directly use filenames in the argument of \includegraphics{...}. Can a similar thing be done for directly using filenames in \input{...}. I know of the method mentioned here but if this was the way to do it, then why does \graphicspath{...} exist?

share|improve this question
up vote 27 down vote accepted

\graphicspath comes from LaTeX's \input@path, just using the paths for graphics files. \input@path can be set independently, e.g.:


Internally package graphics stores its path of \graphicspath in \Ginput@path and locally sets \input@path to \Ginput@path, if it looks for files via \IfFileExists.

Addition to \input@path

The macro \input@path can be undefined (usually the default in LaTeX) or it can already contain other path entries. Therefore, \providecommand in the following code first defines the macro for the case that \input@path is undefined. Then \g@addto@macro extends the definition of \input@path.

\g@addto@macro\input@path{{path1/}{path2/}}% append

Alternatively \edef can be used, which expands the definition text. The next example uses it to prepend the contents to \input@path to the old meaning of \input@path:

\edef\input@path{{path1/}{path2/}\input@path}% prepend
share|improve this answer
how do you add to that list without removing whatever is there already? – Frederick Nord Sep 23 '15 at 20:54
@FrederickNord Answer updated for showing how to append or prepend new path elements. – Heiko Oberdiek Sep 23 '15 at 21:44

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.