[tex-live] Hook in kpathsea for files not found?

Zdenek Wagner zdenek.wagner at gmail.com
Thu Feb 21 16:19:24 CET 2013

2013/2/21 Dr. Werner Fink <werner at suse.de>:
> On Thu, Feb 21, 2013 at 03:15:55PM +0100, Zdenek Wagner wrote:
>> 2013/2/21 Dr. Werner Fink <werner at suse.de>:
>> > Hi,
>> >
>> > as I've been asked from users if it is possible to provide a message for
>> > each file not found, I'd like to asked for a feature in the kpathsea library.
>> >
>> > Such a feature may provide the possibility to show messages how to install a
>> > missed package like texlive-colortab or a virtual dependency like
>> > `tex(colortab.sty)' and how to install them.  This would be useful for TeXLive
>> > upstream as well as for distributions providing TeXLive packages[1,2].
>> >
>> I am afraid it will not be useful at all. Kpathsea looks at too many
>> places. Moreover, it may be instructed to look into the ls-R files and
>> not to the tree, thus a failure to find the file in ls-R will not tell
>> you which directory could contain the file. If you want to install the
>> package not existing in the TeX Live, you may wish to put it to
>> texmf-local. You should know TDS and structure the package that way.
>> Now the question is how to find texmf-local. It is simple:
>> kpsewhich --var-value TEXMFLOCAL
>> Similarly
>> kpsewhich --var-value TEXMF
>> will give you the list of all TEXMF trees.
>> You can also use --show-path option to see where a specified file type
>> is expected. And kpsewhich <filename> will tell you whether the file
>> will be found.
> This is not my task.  I'm asking for the possibility as package maintainer
> of TeXLive here at openSUSE to be able to provide the users a hint how to
> install a texlive package which provides a missing font/style/class and
> was build for openSUSE.
I just wrote how I do it. For instance, xindy looks for modules in
TEXMFMAIIN only, so user modifications are not supported. Moreover,
the structure has changed a little but a simple script can cope with
it. You can see it in my not-yet-released project:


Another package of mine is here:
It was developed before the new modules were added to the babel
distribution. It is no longer needed separately but I still keep it on
my web site. You can see how I cope with finding the path and use any
piece of my scripts (all my SW is either GPL or LPPL).

As another feature, I have my private tree for packages taht i
developed. Each of them has its own svn repository so I work on them
somewhere on my disk. In order to use them, I have texmf.cnf in the
root TL directory. It contains copied definitions of TEXMF and
TEXMFDBMS with the last tree added as !!$TEXMFDEVEL and its definition


The installation scripts then issues $(kpsewhich --var-value
TEXMFDEVEL) and thus it knows how to install these packages and what
to delete if I want to uninstall them.

This is easier that asking for a hook. If you cheat kpsea not to obey
texmf.cnf and look into directories instead of the ls-R file and try
to find something.sty, it will return names of possibly a few hundred
directories and none of them is the right path. If you wish to install
latex package "somepackage" then somepackage.sty sould be in
$TEXMF/tex/latex/somepackage. If the package is already installed,
kpsewhich will find it. If it is not installed, this directory
$TEXMF/tex/latex/somepackag does not exist and thus the hook will not
give you the right answer. It give you the long list of all
directories, ie the directories of all installed packages, the
directories of all plain TeX files etc. This is not the answer you
need for decision how to install a package.

My solution gives the right answer.

>> > [1] https://aspratyush.wordpress.com/2012/12/
>> > [2] http://jaegerandi.blogspot.de/2012/12/easy-way-to-install-tex-packages-for.html
> From [1] I guess that Jindrich Novyc from the Fedora project may have
> a similar wish ;)
>   Werner
> --
>   "Having a smoking section in a restaurant is like having
>           a peeing section in a swimming pool." -- Edward Burr

Zdeněk Wagner

More information about the tex-live mailing list