[texworks] technical problem involving \include, \includegraphics \graphicspath and grffile package

Paul A Norman paul.a.norman at gmail.com
Sun Apr 17 07:55:25 CEST 2011


Dear Mehdi Ranjbaran,

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.

You may be able to put a Windows "short file path" in your   \graphicspath{

I have just posted a script that may help you do this in TeXworks.

Use the script, selkect an appropriate file, and just take the filename.jpg
off for use in \graphicspath{

See Tw issue http://code.google.com/p/texworks/issues/detail?id=261#c58

And

http://twscript.paulanorman.com/downloads/?ShortName for the necessary two
scripts.

I hope that this helps,

Paul

On 17 April 2011 03:25, Mehdi Ranjbaran <ranjbrans at yahoo.com> wrote:

> Hello,
>
>
> 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:
>
>
> \include{chap2}
>
>
> 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:
>
>
> \usepackage[space]{grffile}
>
> \graphicspath{../../My Graphic Files/}
>
>
> but get the error message:
>
> "
>
> ! Package pdftex.def Error: File `fig1.pdf' not found.
>
>  See the pdftex.def package documentation for explanation.
>
> Type H <return> for immediate help.
>
> ...
>
>  l.20 ...udegraphics{fig1.pdf}
>
>  ?
>
> "
>
>
> 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:
>
>
> \includegraphics{../../My Graphic Files/fig1.pdf}
>
> 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.
>
> Thank you.
>
>
> ----- configuration info -----
> TeXworks version : 0.4.0r759 (MiKTeX 2.9)
> Install location : C:/Program Files (x86)/MiKTeX
> 2.9/miktex/bin/texworks.exe
> Library path     : C:/Users/mehdi/AppData/Local/MiKTeX/2.9/TeXworks/0.4\
> pdfTeX location  : C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/pdftex.exe
> Operating system : Windows Microsoft Windows Vista Home Basic Edition,
> 64-bit Service Pack 2 (build 6002)
> Qt4 version      : 4.7.2 (build) / 4.7.2 (runtime)
> ------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20110417/00962297/attachment.html>


More information about the texworks mailing list