I'm using gnuplot to graph some things and I have to embed the graphics in latex. The document class I'm using is article. I'm using an epslatex terminal in gnuplot so I get two files, a .tex and a .eps file. If both of them are in the same directory as the document .tex file, using this works:


But I have the figure in another directory, and I have to use:


I get an error saying that graph.eps was not found. This error points to a line in the graph.tex file:


So it's looking for it in the main directory instead of ../img/. If I change that line to


then it works, but I would like to make it look in the directory directly, because I have a lot of images and it would be hard to change it for all of them. Can I do that somehow?


For graphics, you can configure \graphicspath in the preamble of your document.

Here is an example:

    {.} % document root dir

Then, you just need to call the figure name when using \includegraphics. In addition, you can use \DeclareGraphicsExtensions{.eps} to avoid specifying the file extension at every figure.

Regarding the \input and \include commands, you don't need that ./ before. Just call the directory before the name of the file: \input{directory/filename}


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.