I have a project written in LaTeX, that has many pictures (about 1000) which I have divided into 4 folders: letter, legal, booklt and screen for different purposes. I have a folder called "images" containing all the images of the project, and here comes my question:

How do I add this folder so that latex finds it by default?

I have read the documentation for TeXLive(2011/2012) and https://texfaq.org/FAQ-graphicspath on "environment variable TEXINPUTS".

I'm using TeXLive 2012 on Fedora 17; can someone clarify if this possible or is it better to use:


For now I edit the .bashrc file and add:

export TEXINPUTS=~/images//:${TEXINPUTS}

but I'm not sure if that's the best way to do things.

3 Answers 3


With that many files you are probably best to ignore the latex \graphicspath macro (which implements a linear iteration through directories via tex macros) and (a) put the directories under a // TEXINPUTS path as you suggest and then (b) re-hash the kpath search database using mktexlsr or texhash or a config in your IDE (depending on the system you use) then latex will find the files without having to traverse the file system to look for them and things will be quicker.

  • Thank you very much Master David for the reply, now it is clear that the best is to use TEXINPUTS, the question is how I do it globally (not modified .bashrc for each user) modifying texmf.cnf for this purpose. Jul 2, 2012 at 23:55
  • would the downvoter care to say why? I implemented \graphicspath and I would certainly use TEXINPUTS in preference in most cases. Jul 24, 2013 at 16:28

I have a graphics folder in my my local texmf/tex/latex (for me, on a Mac ~/Library/texmf/tex/latex folder; for most Linux distributions ~/texmf/tex/latex). Anything there is accessible to any document. The files don't need to be there physically: you can put a symbolic link to the folder into the texmf folder, and keep the files anywhere you like.


i'm not sure i understood your question. Are you asking which one of the two options is better?

The link you provided states \graphicspath is inefficient because LaTeX will be called for each single entry you define in the path list. But not only the environment variable method might have the same problem (i don't have info on that), i also think the performance issue is that much relevant here, unless you're dealing with slower machines, or an extremely large tex project

The main advantage of the environment variable is that it works not just for images, but for every latex input (other tex files for example) So it is good if you write a lot of documents that depend on the same input

If you're only looking to simplify the code, and not have to write the same image path over and over, then the \graphicspath would be better, and also make the document more portable (no need to set env variables on other machines, as long as the input files are in the same path)

  • Thanks for the comment, the issue is that this machine in particular has installed Linux / Windows only for the purpose of this project, and the images folder (at the moment is on the linux partition). my question is as follows, to modify. bashrc I do it for each user of the project, my idea is to modify texmf.cn for this to be comprehensive, ie, all users can access the default images folder, without having to changed. bashrc each. Jul 2, 2012 at 22:49
  • In the future, stay the images folder on a server (using Samba or NFS, still do not know) and users will access this machine remotely to their accounts, to modify only their copies of the file. Jul 2, 2012 at 22:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .