3

I'm trying to compile a file with context, and I get an error:

I couldn't open style file cont-no.bst
---line 2 of file dissertation.aux
 : \bibstyle{cont-no
 :                  }

I thought I would debug this by trying to figure out where kpsewhich seeks this file, but it wasn't found:

$ kpsewhich cont-no.bst

So I tried to use the --debug switch to find out what's going on, and to my surprise I find that it is searching all the listings it should be searching:

$ kpsewhich --debug=2 cont-no.bst
kdebug:/nix/store/msb4kcxagy3xkqx02wl25qdid1qgpnww-TeXLive-linkdir/texmf-config/ls-R: 10799 entries in 10172 directories (0 hidden).
kdebug:ls-R hash table:32003 buckets, 3564 nonempty (11%); 10799 entries, average chain 3.0.
kdebug:/nix/store/msb4kcxagy3xkqx02wl25qdid1qgpnww-TeXLive-linkdir/texmf-var/ls-R: 80 entries in 13 directories (0 hidden).
kdebug:ls-R hash table:32003 buckets, 3564 nonempty (11%); 10879 entries, average chain 3.1.
kdebug:/nix/store/msb4kcxagy3xkqx02wl25qdid1qgpnww-TeXLive-linkdir/texmf-dist/ls-R: 135626 entries in 9902 directories (0 hidden).
kdebug:ls-R hash table:32003 buckets, 30360 nonempty (94%); 146505 entries, average chain 4.8.

texmf-dist/ls-R indeed lists the necessary file:

$ cat /nix/store/msb4kcxagy3xkqx02wl25qdid1qgpnww-TeXLive-linkdir/texmf-dist/ls-R
…
./texmf-dist/bibtex/bst/context:
cont-ab.bst
cont-au.bst
cont-no.bst
cont-ti.bst
…

which exists:

$ ls /nix/store/msb4kcxagy3xkqx02wl25qdid1qgpnww-TeXLive-linkdir/texmf-dist/texmf-dist/bibtex/bst/context/cont-no.bst
/nix/store/msb4kcxagy3xkqx02wl25qdid1qgpnww-TeXLive-linkdir/texmf-dist/texmf-dist/bibtex/bst/context/cont-no.bst

So my question is, why doesn't kpsewhich return the path to this file? As far as I can see, it should have all the information it needs.

  • 1
    Welcome! Returns the correct result for me. TeX Live 2015, updated to the final version. – cfr Apr 29 '16 at 2:02
7

The file is included under texmf-dist/texmf-dist/.. but kpsewhich is searching under texmf-dist/ and the relevant ls-R is in texmf-dist/. So the file is not found because the file is one directory layer deeper than normal, but your TeX Live is not configured accordingly.

Note that the hierarchical structure of the file system matters. It is not sufficient that a file's location be correctly listed in the relevant ls-R. Rather, the file must be located on a path which is appropriate to its file type.

By way of illustration, consider this example:

kpsewhich -show-path=bst

On my system, this returns

.:/home/<username>/.texlive2015/texmf-config/bibtex/bst//:/home/<username>/.texlive2015/texmf-var/bibtex/bst//:/home/<username>/texmf/bibtex/bst//:!!/usr/local/texlive/2015/texmf-config/bibtex/bst//:!!/usr/local/texlive/2015/texmf-var/bibtex/bst//:!!/usr/local/texlive/texmf-local/bibtex/bst//:!!/usr/local/texlive/2015/texmf-dist/bibtex/bst//:/usr/share/texmf/bibtex/bst//:/home/<username>/.texlive2015/texmf-config/bibtex/csf//:/home/<username>/.texlive2015/texmf-var/bibtex/csf//:/home/<username>/texmf/bibtex/csf//:!!/usr/local/texlive/2015/texmf-config/bibtex/csf//:!!/usr/local/texlive/2015/texmf-var/bibtex/csf//:!!/usr/local/texlive/texmf-local/bibtex/csf//:!!/usr/local/texlive/2015/texmf-dist/bibtex/csf//:/usr/share/texmf/bibtex/csf//

These directories are searched in order. If preceded by !!, then the relevant ls-R will be used and the search will not examine the contents of the actual directory on disk. Otherwise, the search will examine everything under the relevant directory.

What this means is that a .bst file will not be found if it is located under, say, /usr/local/texlive/2015/texmf-dist/tex/latex/<some package>/ even if the location of the file is included correctly in the ls-R /usr/local/texlive/2015/texmf-dist/ls-R. Likewise, it will not be found under /usr/local/texlive/2015/texmf-dist/texmf-dist/bibtex/bst/ even if it is included in /usr/local/texlive/2015/texmf-dist/ls-R.

The best solution, I think, will involve eliminating the additional layer so that you return to a TDS compliant configuration.

  • This is true, but if you look at the ls-R entry it includes the extra layer (starts ./texmf-dist) — after reading that file, kpsewhich should be okay. – Twey Apr 30 '16 at 12:50
  • Or is the path in ls-R relative to something other than the location of the ls-R? – Twey Apr 30 '16 at 12:56
  • @Twey Please see edit above. The path is relative to the ls-R, but you are not taking account of the way kpsewhich searches. It does not look in all places for a file. Where it looks is a function of the file type. The search is heavily dependent on the file hierarchy adhering to the TDS. – cfr Apr 30 '16 at 21:25

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.