[tex-live] kpsewhich search order and how to change it

Philip K.F. Hölzenspies p.k.f.holzenspies at utwente.nl
Fri Nov 16 17:07:17 CET 2007


Dear Zdeněk, Norbert, all,

> Did you get some errors during rehashing, i.e. that some directories
> were skipped because they are not writable? This may be also a problem
> of permissions of the ls-R files, not only directories.

The access rights really wouldn't have anything to do with it; like I said: I 
can simply write my ~/texmf/ls-R, so anything in there that would be 
inaccessible, would actually not be *readable* as opposed to writable. 
Anything that's not readable can't be used in the first place.

> Hmm, this is strange.
> 
>         kpsewhich -progname latex  -show-path .tex
> 
> gives any hint?
> 
> (Mind, I am not an expert with kpathsea searching, it is a mystery)

This was actually very helpful. I didn't know too much about the implications 
of these TEXINPUTS.<progname> variables. The outcome was actually quite 
informative:

holzensp:~> kpsewhich -progname pdflatex  -show-path .tex | sed -e "s/:/\n/g"
.
/home/aid/holzensp/texmf/tex/latex//
!!/etc/texmf/tex/latex//
!!/var/lib/texmf/tex/latex//
!!/usr/share/texmf/tex/latex//
!!/usr/local/share/texmf/tex/latex//
!!/usr/share/texmf/contrib/tex/latex//
/home/aid/holzensp/texmf/tex/generic//
!!/etc/texmf/tex/generic//
!!/var/lib/texmf/tex/generic//
!!/usr/share/texmf/tex/generic//
!!/usr/local/share/texmf/tex/generic//
!!/usr/share/texmf/contrib/tex/generic//
/home/aid/holzensp/texmf/tex///
!!/etc/texmf/tex///
!!/var/lib/texmf/tex///
!!/usr/share/texmf/tex///
!!/usr/local/share/texmf/tex///
!!/usr/share/texmf/contrib/tex///

/home/aid/holzensp/.TeX
/usr/share/doc/.TeX
/usr/doc/.TeX
/home/aid/holzensp/.TeX
/usr/share/doc/.TeX
/usr/doc/.TeX


This led me to my /etc/texmf/web2c/texmf.cnf, which shows:

TEXMF = {$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFMAIN,!!
$TEXMFLOCAL,!!$TEXMFDIST}

and

TEXINPUTS.pdflatex      = .;$TEXMF/tex/{latex,generic,}//

Because TEXMF is a {...} list and {latex,generic,} is a list too, the first is 
iterated over first. This means that my ~/texmf gets interwoven with the 
global texmfs in the search list (i.e. in the kpsewhich output 
above, /home/aid/holzensp hits are not grouped together). Should this be 
considered a bug?

Anyway, when I move ~/texmf/tex/pgf to ~/texmf/tex/latex/pgf it all works 
fine.

The reason that I have a single directory for the entire pgf package 
(including the generic, context, tex and latex parts) is that it makes it so 
much easier to do manual package maintenance. Putting this pgf directory in 
the latex part of my texmf means plain tex and context won't be able to find 
it.

Norbert, I would suggest to either find a different format for the texmf.cnf, 
such that these directories are grouped by locality, or to make an explicit 
note about this behaviour somewhere.

I have a workable solution and my understanding of TeX (Live) has increase. As 
such, I'm as happy as can be ;)

Kind regards,
Philip


More information about the tex-live mailing list