Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 http://www.tex.ac.uk/cgi-bin/texfaq2html?label=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:

\graphicspath{...}

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.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
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. –  Pablo González L Jul 2 '12 at 23:55
    
would the downvoter care to say why? I implemented \graphicspath and I would certainly use TEXINPUTS in preference in most cases. –  David Carlisle Jul 24 '13 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.

share|improve this answer

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)

share|improve this answer
    
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. –  Pablo González L Jul 2 '12 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. –  Pablo González L Jul 2 '12 at 22:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.