Graphics, Figures & TablesInclusion of Graphics Files from different Folders

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
MatthiasN
Posts: 41
Joined: Sun Mar 11, 2012 1:21 pm

Inclusion of Graphics Files from different Folders

Post by MatthiasN »

Dear all,

I've seen before that it is possible to add figures from folders other than the one in wich you save your document. It has something to do with including the directory where your figure is located, but I don't really seem to get it right. Is there anyone who would be so kind to write a simple example. I think it will be a bit like:

Code: Select all

\begin{figure}
\includegraphics{Directory:name_of_figure}
\end{figure}
Thanks for reading.
Kind regards, Matthias
Last edited by localghost on Wed Oct 03, 2012 6:07 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Inclusion of Graphics Files from different Folders

Post by localghost »

You could use the \graphicspath command as described in Section of the graphicx manual. Before you do so, read Section 3.4 of l2tabu.


Thorsten
MatthiasN
Posts: 41
Joined: Sun Mar 11, 2012 1:21 pm

Re: Inclusion of Graphics Files from different Folders

Post by MatthiasN »

Thanks for the help. I now understand how to use the graphicspath. Unfortunately the second text you advised to read is in german, so I'm unable to understand.

I have one extra question though: If I tell LaTeX to search different directories everytime I include a graphic, won't this slow the building proces down? It seems to me that it would be a lot more efficient if I could specify the directory everytime.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Inclusion of Graphics Files from different Folders

Post by localghost »

MatthiasN wrote:[…] Unfortunately the second text you advised to read is in german, so I'm unable to understand. […]
I corrected the corresponding link to the CTAN entry. You will now also find versions in other languages.
MatthiasN wrote:[…] If I tell LaTeX to search different directories everytime I include a graphic, won't this slow the building proces down? It seems to me that it would be a lot more efficient if I could specify the directory everytime.
The compilation time should not increase noticeable. But you can specify the path for every single file. Let's say that you have a sub-folder "gfx" in your working directory where your source file is located. Then you should include it with this line.

Code: Select all

\includegraphics{gfx/‹filename›}
MatthiasN
Posts: 41
Joined: Sun Mar 11, 2012 1:21 pm

Inclusion of Graphics Files from different Folders

Post by MatthiasN »

Does this only work for subfolders or could I for instance do this:

\includegraphics{c:\...\gfx_someplace_else/<filename>}

And thanks for the english version. I'm from belgium, but reading dutch is stil very difficult.
Kind regards, Matthias
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Inclusion of Graphics Files from different Folders

Post by localghost »

Of course you can also use absolute paths. But even on a Wind0ws system you have to replace the backslashes by normal slashes.
MatthiasN
Posts: 41
Joined: Sun Mar 11, 2012 1:21 pm

Re: Inclusion of Graphics Files from different Folders

Post by MatthiasN »

Thanks a lot! This really helped.
Post Reply