# How to use \graphicspath?

I am using MikTex 2.9 and TeXstudio for my TeX preparation. I would like to set the path to my figures folder containing all the figures, plots etc. required for my work.

I used \graphicspath to set the directory, but it gives me an error message:

\documentclass[12pt]{article}

\usepackage{graphicx}

\graphicspath{D:/LATEX/Reports@IIT/figures}

\begin{document}
\includegraphics[width=4.5cm,height=4cm,angle=0]{logo.jpg}

\end{document}


Error: Package pdftex.def Error: File logo.jpg' not found

However, when I prepend the filenames of the images with the same path in the \includegraphics command, it works just fine:

\documentclass[12pt]{article}

\usepackage{graphicx}

\begin{document}

\includegraphics[width=4.5cm,height=4cm,angle=0]{D:/LATEX/Reports@IIT/figures/logo.jpg}

\end{document}


Why does \graphicspath than not accept the path?

-
What happen if you add / after figures in graphicspath? – Ludovic C. Oct 18 '13 at 8:02
@percusse: why is miktex relevant in this question? – kiss my armpit Oct 18 '13 at 8:35
@Marienplatz It's a windows machine and paths are system dependent. If somebody else needs a windows solution miktex is a viable option. – percusse Oct 18 '13 at 8:58
@percusse But \graphicspath works the same irrespective of platform – Joseph Wright Oct 18 '13 at 10:16
@JosephWright Also true. But that's not people search unfortunately, including me. Added TeXLive too so hopefully both can end up here. – percusse Oct 18 '13 at 18:02

\graphicspath{{D:/LATEX/Reports@IIT/figures/}}


Try it!

More general case:

\graphicspath{{subdir1/}{subdir2/}{subdir3/}...{subdirn/}}


The ... is not the part of the syntax for sure! It is there just to represent something like 1,2,3,...,n in a set theory.

-
Thank you. It is working – Litun John Oct 18 '13 at 8:23
I often find this useful: \graphicspath{{./figs/}} This will include a subdirectory named figs which is in the same directory as your current .tex file – kevin Dec 18 '14 at 0:47

Every specific path shoud be ended by /, and contained by a pair of braces. Try:

\graphicspath{{D:/LATEX/Reports@IIT/figures/}}

-
Thank you. It is working – Litun John Oct 18 '13 at 8:25

Just a heads-up, you definitely need to include the trailing /: \graphicspath{{./figures}} won't work but \graphicspath{{./figures/}}` will. In case anyone else is scratching their head about this when they should be writing more dissertation sections...

-
This repeats what is said by Ch'en Meng: I'm minded to remove this (duplicate) answer. – Joseph Wright Apr 7 at 7:25
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Symbol 1 Apr 7 at 7:31
Oops! Missed Ch'en Meng's note - feel free to remove mine. – philadams Apr 7 at 14:22