Dear Mehdi Ranjbaran,<div><br></div><div>I have struck similar problems  occasionally where for one reason or another no combination of LaTeX packages seem to help, or it is just faster to insert a short file + path  name.</div>
<div><br></div><div>You may be able to put a Windows "short file path" in your   \graphicspath{</div><div><br></div><div>I have just posted a script that may help you do this in TeXworks.<br></div><div><br></div>
<div>Use the script, selkect an appropriate file, and just take the filename.jpg off for use in \graphicspath{</div><div><br></div><div>See Tw issue <a href="http://code.google.com/p/texworks/issues/detail?id=261#c58">http://code.google.com/p/texworks/issues/detail?id=261#c58</a><br>
</div><div><br></div><div>And </div><div><br></div><div><a href="http://twscript.paulanorman.com/downloads/?ShortName">http://twscript.paulanorman.com/downloads/?ShortName</a> for the necessary two scripts.</div><div><br>
</div><div>I hope that this helps,</div><div><div class="gmail_quote"><br></div><div class="gmail_quote">Paul</div><div class="gmail_quote"><br></div><div class="gmail_quote">On 17 April 2011 03:25, Mehdi Ranjbaran <span dir="ltr"><<a href="mailto:ranjbrans@yahoo.com">ranjbrans@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit"><p><span>Hello,</span></p>
<p><span><br></span></p><p><span>I have a couple of difficulties with my Latex document which I hope you can resolve. I have a main file in which a chap2.tex is included:</span></p><p><span><br></span></p><p><span>\include{chap2}</span></p>
<p><span><br></span></p><p><span>In chap2.tex I include a graphic file fig1.pdf using \includegraphics within the figure environment. The graphic file is in a
 directory other than the current directory in which main.tex is. The path to the directory contains, however, space characters and that's the source of my problems. I use grffile package together with \graphicspath:</span></p>
<p><span><br></span></p><p><span>\usepackage[space]{grffile}</span></p><p></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></p><p></p><p><span>\graphicspath{../../My Graphic Files/}</span></p><p><span><br></span></p><p><span>but get the error message:</span></p>
<p><span>"</span></p><p><span>! Package pdftex.def Error: File `fig1.pdf' not found.</span></p><p></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">See the pdftex.def package documentation for explanation.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Type  H <return>  for immediate help.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> ...                                              </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">                                                  </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">l.20 ...udegraphics{fig1.pdf}</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">                                                  </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">?</p><p></p><p><span>"</span></p><p><span><br></span></p><p><span>However, when I don't use \graphicspath and include the full path of the graphic file in \includegraphics I have no difficulty and the final .pdf file is produced:</span></p>
<p><span><br></span></p><p><span><span style="font-family:arial"></span></span></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-family:Calibri, sans-serif">\includegraphics{../../My Graphic
 Files/fig1.pdf}</span></p><div><span style="font-family:Calibri, sans-serif"><br></span></div><div><span style="font-family:Calibri, sans-serif">Do you know how I can get rid of this pesky error? I don't want to write the full path every time I use \includegraphics.</span></div>
<div><span style="font-family:Calibri, sans-serif"><br></span></div><div><span style="font-family:Calibri, sans-serif">Thank you.</span></div><div><span style="font-family:Calibri, sans-serif"><br></span></div><div><span style="font-family:Calibri, sans-serif"><br>
</span></div><p></p><p><span>----- configuration info
-----</span> <br>
<span>TeXworks version : 0.4.0r759
(MiKTeX 2.9)</span> <br>
<span>Install location : C:/Program
Files (x86)/MiKTeX 2.9/miktex/bin/texworks.exe</span> <br>
<span>Library
path     :
C:/Users/mehdi/AppData/Local/MiKTeX/2.9/TeXworks/0.4\</span> <br>
<span>pdfTeX location  :
C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/pdftex.exe</span> <br>
<span>Operating system : Windows
Microsoft Windows Vista Home Basic Edition, 64-bit Service Pack 2 (build 6002)</span>
<br>
<span>Qt4
version      : 4.7.2 (build) / 4.7.2 (runtime)</span> <br>
<span>------------------------------</span>
</p></td></tr></tbody></table></blockquote></div><br></div>