[Tex/LaTex] Changing the working directory when including files in a subdirectory

graphicsinclude

I'm working on a mathematics magazine that involves multiple articles from different authors. I would like to give each article a sub-directory in which I can store all the relevant files – .tex, image files, etc. However, when I then \include the article .tex file from the master file, the images won't be linked correctly without editing.

For example, suppose the article is stored in articles/article1/ and includes an image matrix.png. In the article .tex file this would be inserted, normally, through \includegraphics{matrix.png}. However, when we move to including the article in the magazine through the master file, all these instances would have to be changed to \includegraphics{articles/article1/matrix.png}

So, is it possible to change the LaTeX working directory before including the article such that instances of \includegraphics will not have to be changed, but rather that LaTeX will know to search for these files in the article directory? I'm thinking that this would be similar-ish in functionality to HTML's base href command for links.

Or, is there a better way to achieve all this?

Best Answer

Try

\graphicspath{{articles/article1/}}

before the \include.

Related Question