Graphics, Figures & Tablesgraphics path

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Alonso67231
Posts: 5
Joined: Wed Jun 11, 2014 4:52 am

graphics path

Post by Alonso67231 »

Hi,

I am writing a document but it contains lots of pictures and well, every time I want to insert one I have to set its path, \includegraphics{/users/mac/documents/article/picture/pic1.png} is there a way I can avoid doing this, but without taking out the folder? What I am trying to say is there a way to establish maybe in the preamble the path I want, so when I want to include a picture I just write down \includegraphics{pic1.png}.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

graphics path

Post by kaiserkarl13 »

Yes: \graphicspath{{figures/}} will include (current-directory)/figures/*.{pdf,jpg,png} files without using the path.

If you need more than one directory, separate them like so: \graphicspath{{figures1/}{figures2/}}
Alonso67231
Posts: 5
Joined: Wed Jun 11, 2014 4:52 am

Re: graphics path

Post by Alonso67231 »

Thank you!!!

is there a way to do the same but with \input{}?
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

graphics path

Post by kaiserkarl13 »

Alonso67231 wrote:Thank you!!!

is there a way to do the same but with \input{}?
Yes, but not within LaTeX itself. Each distribution may be slightly different, but on my system there is an environment variable called TEXINPUTS; setting it like this:

Code: Select all

export TEXINPUTS='.:/path/to/my/directory:'
will search, in order, the current directory ("."), then "/path/to/my/directory", then the default system directories. Don't leave off the trailing colon!
Post Reply