2

for a long time my TeX files imported the file ~/lib/tex/mylib.tex, using the assignment TEXINPUTS=".:~/lib/tex:" and referencing this file with \input{mylib}.

after changing from Suse linux to Debian 10 (buster) that method failed.

in order to pinpoint the problem i tried the following:

mkdir d1
touch d1/f1.tex
mkdir d2
touch d2/f2.tex

kpsewhich --path="d1:d2" f1.tex  # A
d1/f1.tex
kpsewhich --path="d1:d2" f2.tex  # B
# no result

kpsewhich --path="d2:d1" f1.tex  # C
# no result
kpsewhich --path="d2:d1" f2.tex  # D
d2/f2.tex

to my surprise the result depends on the order of path elements in the path string. what can i do to get the intended result in the cases B (d2/f2.tex) and C (d1/f1.tex)?

info: 'kpsewhich' belongs to the package 'texlive-binaries/oldstable,now 2018.20181218.49446-1 amd64'.

2
  • FWIW: the behavior is the same in version 6.3.3 of kpathsea from the 2021 texlive. Aug 27 at 18:57
  • That said if instead of using the --path= syntax, I set the path using TEXINPUTS, the output is as expected. (And indeed I have not problems with inputs the way you mentioned.) (Can you try TEXINPUTS='d1/:d2/' kpsewhich f2.tex)? Aug 27 at 19:08
2

i tried the following under debian 10:

export -n TEXINPUTS # cleanup
unset TEXINPUTS     # cleanup

TEXINPUTS='d1/:d2/' kpsewhich f2.tex    # E
d2/f2.tex

TEXINPUTS='d1/:d2/'         # F
kpsewhich f2.tex
# no result

export TEXINPUTS            # G
kpsewhich f2.tex
d2/f2.tex

as can be seen from case 'F', under debian it is not enough to create the shell variable TEXINPUTS and assigning it a value. furthermore it is necessary to make TEXINPUTS an environment variable by exporting it (s.a. https://www.baeldung.com/linux/bash-variables-export).

my /etc/bash.bashrc.local contained step 'F' only. this worked under SUSE Linux Enterprise Server (SLES) 11 SP4 (11.4) but not under debian. i think the debian behaviour is correct only. a reason for the suse-behaviour could be, that some nested suse script contained a 'set +o allexport' statement.

0

TeX live, on most platforms, will look for a user input tree in ~/texmf/tex¹,²,³. In most cases, the simplest approach is to simply put your input files there or in its subdirectories, or if you want to keep the files elsewhere to make a symlink to those other directories in ~/texmf/tex.


  1. On MacOS, it looks instead for ~/Library/texmf/tex.

  2. While Windows doesn't use the same syntax, the effect is the same, it will look in the texmf\tex subdirectory of the user's home directory.

  3. Other subdirectories of ~/texmf are used for things like Metafont sources, BibTeX inputs, etc.

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.