Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The structure of the document I'm writing is the following.

Top level -> Plots -> some images
                   -> 1 -> some images
                   -> 2 -> some images
                   -> 3 -> some images
                   -> 4 -> some images

Using the command:

\graphicspath{{./Plots/}{./Plots/1/}

Seems to work fine and allow me to add images from these two folders, however, when I try to add folders 2, 3 and 4 to the \graphicspath, I get an error for all figures saying that it cannot find the images.

Is there a way to fix this, or for the graphics package to look within all subfolders?

\documentclass[12pt, a4paper, notitlepage]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{parskip}
\usepackage{setspace}
\renewcommand{\arraystretch}{1.15}
\onehalfspacing
\usepackage[pdftex]{graphicx}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\graphicspath{ {/Plots/}{/Plots/1/}{/Plots/2/}{/Plots/3/}{/Plots/4/} }

\title{Report}
\author{Me}
\date{April 2013}

\begin{document}

\maketitle
\thispagestyle{empty}

\newpage
\section{1}
Text.

\begin{figure}
\includegraphics[width=1\textwidth]{ImageFromPlots1}
\end{figure}    

\end{document}
share|improve this question
    
Welcome to TeX.SX. –  Claudio Fiandrino Apr 3 '13 at 17:50
    
its not because you need the last }? A full (MWE) document would ease the debugging here. –  zeroth Apr 3 '13 at 17:56
    
That was a typo in the original post, sorry. I've edited the OP with a MWE. This code does not find the image located in the /Plots/1/ folder. However, if I remove folders 2, 3 and 4, from the graphics path, it works fine. Thanks for your help. –  Rob Apr 3 '13 at 18:10
    
@Rob: Don't load graphicx twice (the first is sufficient). What OS are you running? Mac? Windows? Unix? –  Werner Apr 3 '13 at 18:28
    
Didn't notice I was doing that - thanks. Doesn't solve the issue. I'm using Mac OSX 10.8.3. –  Rob Apr 3 '13 at 18:30
show 1 more comment

1 Answer

up vote 2 down vote accepted

There shouldn't be a problem.

I'm using:

\graphicspath{{images/}{../images/}{svg/}{gnuplot/}{gnuplot/examples/}}

and it works just fine. You can also get down and into another directory as you can see in my example.

You access the filesystem-root and not the subfolders (as you access / and not ./). This is most likely your fault.

Try

\graphicspath{ {Plots/}{Plots/1/}{Plots/2/}{Plots/3/}{Plots/4/} }

rather than

\graphicspath{ {/Plots/}{/Plots/1/}{/Plots/2/}{/Plots/3/}{/Plots/4/} }

On Linux/Unix systems you won't need the ./ at the beginning. Not sure about it on a Mac-system.

share|improve this answer
    
Your suggestion of removing the leading ./ worked. Not sure why I didn't think to try that - must be time to stop for the evening! Thanks again. –  Rob Apr 3 '13 at 20:52
add comment

Your Answer

 
discard

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.