running TeX tools from non-standard locations

In some configurations (for example, when using MacTeX), if you copy a TeX-related binary to non-standard location, the tool stops working. More precisely, if a tool uses kpathsea library, special setup is required. More practically, is you compile something like dvisvgm, it might not work.

Discussion: pointing kpathsea to the correct texmf tree.

Summary: texmf.cnf defines search paths in terms of SELFAUTO* variables (at least, in vanilla TeXLive and MacTeX 2009). Therefore, kpathsea looks for files relative to the location of the calling program.

Therefore, to find the files, the calling program should be located in the right place or all the AUTO-based search paths should be redefined. For me, the following wrapper implements the second idea:

—– begin


for i in         \
  TEXMFMAIN      \
  TEXMFDIST      \
  export $i=`kpsewhich -expand-var "$"$i` 


—– end

Running kpsewhich in a wrong location doesn’t work:

$ ./kpsewhich
warning: kpathsea: configuration file texmf.cnf not found in
these directories: ...
$ export export TEXMFCNF='{/usr/local/texlive/2009/.....
$ ./kpsewhich

But the wrapper helps:

$ ./kpsewhich
$ ./a.out

Leave a Reply