I am using upstream's TeX Live on a GNU/Linux system with default paths except for the use of symbolic links to facilitate switching between different versions of TL. So, for example, TEXMFMAIN is /usr/local/texlive/2015/texmf-dist, TEXMFLOCAL is /usr/local/texlive/texmf-local and TEXMFHOME is ~/texmf. All quite standard, I think.

I use a 'dummy' package to convince my distro's package manager that TeX Live is installed and that dependencies are fulfilled when I ask it to install an editor, for example.

This all works fine.

However, this does not work for additional software which installs files into a TEXMF tree but which are managed by my distro's package manager. I'm thinking of things like r and gnuplot. In these cases, the TeX files are secondary, of course: the primary point of the software is not TeX, but the TeX files are required for integration.

These files are installed in /usr/share/texmf but my TeX installation does not, of course, know anything about this TEXMF tree. There is no database of files here and the tree is not in the path searched by kpathsea.

Obviously, there are different ways of working around this kind of issue. You could create symbolic links to the files from a working directory, from appropriate places in TEXMFHOME or from TEXMFLOCAL. But these are not altogether satisfactory since an update to r or gnuplot might change the available files, breaking symbolic links or rendering linkage incomplete.

So I guess that it might be better to add an additional TEXMF tree. However, I am not sure if there are drawbacks to doing this, or how best exactly to do it. It would certainly be better if I did not need to create a database of files there. So, if this is the way to go, I suspect I should set the additional tree to be searched on disk. (Since there are only ever likely to be a handful of files here, I can't imagine this being a problem.)

Or perhaps it would be better to manipulate TEXINPUTS. I'm not sure what the relative advantages or disadvantages of this method would be.

What is the best way to integrate files from /usr/share/texmf so that they can be used by my TeX Live installation seamlessly without any nasty surprises?


I think the best way to achieve this is the following:

  1. Add a line TEXMFDISTRO = /usr/share/texmf to /usr/local/texlive/2015/texmf.cnf, creating it if it is not present.
  2. Copy the definition of TEXMF and TEXMFDBS from /usr/local/texlive/2015/texmf-dist/web2c/texmf.cnf to /usr/local/texlive/2015/texmf.cnf
  3. Add TEXMFDISTRO between TEXMFLOCAL and !!$TEXMFDIST in the definition of TEXMF, and similiar in the one of TEXMFDBS

At the end the /usr/local/texlive/2015/texmf.cnf should look like (or contain) the following lines:

TEXMFDISTRO = /usr/share/texmf

I have done this now (my installation is in ~/tl/2105) and when I search for all preview.sty I get:

$ kpsewhich -all preview.sty

If you want that the installed upstream TeX Live takes precedence, then you have to add the TEXMFDISTRO entry at the end of the two above definitions.

In the above example I am using !! in front so that a ls-R file is required. If you prefer that the tree is actually searched if necessary, remove the !!.

  • This looks great - thanks very much! Would you mind editing it to make clear that the use of DEBIAN is just an example? Otherwise, people looking for a solution might think this answer is Debian-specific but, as far as I can tell, it would work equally well elsewhere. (I know that technically it doesn't matter that you use TEXMFDEBIAN and you could use this on, say, Fedora, but that is unlikely to be entirely obvious at first glance.) I guess TEXMFDISTRO would be less particular, but I think just saying DEBIAN is an example would be clear enough.
    – cfr
    Aug 20 '15 at 12:44
  • Also, correct me if I'm mistaken, but doesn't the use of !! require the creation of ls-R for the tree? So that syntax would require mktexlsr? If I add the additional tree without the !! prefix, then I think TeX will just search the tree directly on disk without my needing to create a database. At least, I did that and it seems to be working. That is, I added TEXMFARCH = /usr/share/texmf TEXMF = {$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFDIST,$TEXMFARCH} TEXMFDBS = {!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFDIST,$TEXMFARCH}.
    – cfr
    Aug 20 '15 at 12:59
  • I edited the answer to use TEXMFDISTRO and added a comment concerning the !!. It is up to the user whether one wants to search only the ls-R or search the actual tree.
    – norbert
    Aug 21 '15 at 9:57
  • Thanks - this is great! As I said in the question, in my case, I definitely don't want a database there. For one thing, I would have to remember to update it if anything installed there got updated when I update the system, which would be a pain. For another, it would generate permissions errors when I update TL, I think. (I don't have write permission to /usr/share/texmf when I update TL.) But obviously it might be preferable for other configurations.
    – cfr
    Aug 21 '15 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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