how to include graphics from directory?

17,659 views
Skip to first unread message

Pawel_Iks

unread,
May 19, 2009, 6:38:03 AM5/19/09
to LaTeX Users Group
Hello everyone!

I have some problems with including graphics to my article. When
graphics is in the same directory as the tex file, everything is all
right, however when I placed it in another directory, there are some
problems. WHen I simply write:

\begin{figure}
\includegraphics{dir/figure1.pdf}
\end{figure}

there are some errors. I tried also to use subimport package:

\begin{figure}
\includegraphics{\subimport{dir/}{figure1.pdf}}
\end{figure}

but it also didn't work. Please help me with this...

Bisheng Du

unread,
May 19, 2009, 6:52:47 AM5/19/09
to latexus...@googlegroups.com
Put the \graphicspath{./dir/}  in the preamble part, and then you can use the graphics in that dictionary.

Bisheng
--
Bisheng Du
PhD Student

Department of Business Studies
Aarhus School of Business
University of Aarhus
Fuglesangs Alle 4
DK-8210 Aarhus V, Denmark

URL           http://www.dubisheng.com/
MAIL          dubi...@gmail.com
MSN          dubi...@hotmail.com
OFFICE     +45-8948-6889
CELL         +45-5027-6668

David Owen

unread,
May 19, 2009, 5:28:22 PM5/19/09
to latexus...@googlegroups.com
Hi, Pawel,
The following worked for me: This is exactly what I used, so you may use the bits you need:
 
\begin{figure}[H]
\begin{center}
\scalebox{0.3 }{ \includegraphics{dir/figure1.eps}}
\renewcommand{\figure}{Fig.}
\caption{ }
\end{center}
\end{figure}
"dir" is the folder which contains the figures: figure1.eps, figure2.eps,...etc. You will use  .pdf
 
Please see if this works.
dowen

David Owen

unread,
May 19, 2009, 5:40:51 PM5/19/09
to latexus...@googlegroups.com
dowen, here again. I forgot to tell you, you should put in the preamble
\graphicspath{{dir1/}{dir2/}} if you have two dirs and so on. I remembered this after seeing the reply from Bisheng du.
dowen

Pawel_Iks

unread,
May 21, 2009, 8:05:31 AM5/21/09
to LaTeX Users Group
many thanks for help for all of you! it works properly now :)

On 19 Maj, 23:40, David Owen <twychi...@gmail.com> wrote:
> dowen, here again. I forgot to tell you, you should put in the preamble
> \graphicspath{{dir1/}{dir2/}} if you have two dirs and so on. I remembered
> this after seeing the reply from Bisheng du.
> dowen
>
> On Tue, May 19, 2009 at 5:28 PM, David Owen <twychi...@gmail.com> wrote:
> > Hi, Pawel,
> > The following worked for me: This is exactly what I used, so you may use
> > the bits you need:
>
> > \begin{figure}[H]
> > \begin{center}
> > \scalebox{0.3 }{ \includegraphics{dir/figure1.eps}}
> > \renewcommand{\figure}{Fig.}
> > \caption{ }
> > \end{center}
> > \end{figure}
> > "dir" is the folder which contains the figures: figure1.eps,
> > figure2.eps,...etc. You will use  .pdf
>
> > Please see if this works.
> > dowen
>

Mihai Cazac

unread,
Jun 1, 2009, 3:56:32 PM6/1/09
to LaTeX Users Group
In "l2tabuen -- An essential guide to LaTeX2e usage" is stated that:

There are several reasons why you should avoid the \graphicspath
macro. Replace it by
setting environment variable TEXINPUTS

set TEXINPUTS=.\PictureDir;%TEXINPUTS%


http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=ftp%3A%2F%2Fftp.tex.ac.uk%2Ftex-archive%2Finfo%2Fl2tabu%2Fenglish%2Fl2tabuen.pdf&ei=3DAkSoL5KszR-Qbh8MzYCQ&usg=AFQjCNEV7vSOdF_7_Ds9wgTsOhJ87KSEyw&sig2=a3LWjtpoi70P398TTY9OBQ

hsiehkanusea

unread,
Mar 16, 2015, 2:35:01 PM3/16/15
to latexus...@googlegroups.com
Try standard bash navigation. That is, suppose I'm writing a paper in a directory called "/tex/papers", but my images are in "/tex/images". Inside my paper:

\includegraphics[scale=0.75]{../images/photo.jpg}\\

This always works for me. Hope this helps.
Reply all
Reply to author
Forward
0 new messages