0

I know that I can check from where one particular package would be called, using

kpsewhich <packagename>.sty

and that if I want a custom package, I usually have to put it in the same folder as my document.

I assume that similar to a $PATH, LaTeX checks a list of paths in an attempt to find my package.

Which paths are those? In what order are they checked? If this is system-specific, how can I find out the configuration for my system?

Related questions:

>    /usr/local/texlive/2009/texmf
>    /usr/local/texlive/2009/texmf-dist
>    /usr/local/texlive/texmf-local
>
> as well as other directories.

(Neither of those lists is complete).

  • texlive 2009?? really? kpsewhich --help will you give a lot of options. texdoc kpathsea will open the documentation. The pathes themselves are in the texmf.cnf. – Ulrike Fischer Aug 23 '19 at 14:01
  • I have a feeling this might be an 'XY' question: is there some broader reason you are asking? – Joseph Wright Aug 23 '19 at 17:26
  • kpsewhich uses a file called ls-R (inside the texmf-dist folder) which contains a list of known files and their location inside the texmf tree. Is that what you are looking for? – Phelype Oleinik Aug 23 '19 at 17:33
  • @JosephWright: I was seeking to broaden my understanding of how LaTeX works in general; the use case that prompted the question was that I wanted to move a package file to a subfolder of a git repository. – LokiRagnarok Aug 26 '19 at 07:24

1 Answers1

3

You can call

kpsewhich -var-brace-value=TEXINPUTS

and you get (reformatted adding a line break after :):

.:
<userhome>/texlive/2019/texmf-config/tex/kpsewhich//:
<userhome>/texlive/2019/texmf-var/tex/kpsewhich//:
<userhome>/texmf/tex/kpsewhich//:
!!/usr/local/texlive/texmf-local/tex/kpsewhich//:
!!/usr/local/texlive/2019/texmf-config/tex/kpsewhich//:
!!/usr/local/texlive/2019/texmf-var/tex/kpsewhich//:
!!/usr/local/texlive/2019/texmf-dist/tex/kpsewhich//:
<userhome>/texlive/2019/texmf-config/tex/generic//:
<userhome>/texlive/2019/texmf-var/tex/generic//:
<userhome>/texmf/tex/generic//:
!!/usr/local/texlive/texmf-local/tex/generic//:
!!/usr/local/texlive/2019/texmf-config/tex/generic//:
!!/usr/local/texlive/2019/texmf-var/tex/generic//:
!!/usr/local/texlive/2019/texmf-dist/tex/generic//:
<userhome>/texlive/2019/texmf-config/tex/latex//:
<userhome>/texlive/2019/texmf-var/tex/latex//:
<userhome>/texmf/tex/latex//:
!!/usr/local/texlive/texmf-local/tex/latex//:
!!/usr/local/texlive/2019/texmf-config/tex/latex//:
!!/usr/local/texlive/2019/texmf-var/tex/latex//:
!!/usr/local/texlive/2019/texmf-dist/tex/latex//:
<userhome>/texlive/2019/texmf-config/tex///:
<userhome>/texlive/2019/texmf-var/tex///:
<userhome>/texmf/tex///:
!!/usr/local/texlive/texmf-local/tex///:
!!/usr/local/texlive/2019/texmf-config/tex///:
!!/usr/local/texlive/2019/texmf-var/tex///:
!!/usr/local/texlive/2019/texmf-dist/tex///

I just masked the path to my home dir; in your case you can get <userhome>/.texlive (this is distribution dependent). A trailing // or /// means that the directory is searched recursively. A leading !! means that the (recursive) search is done by looking in a ls-R file generated by maketexlsr. Otherwise the (recursive) search is performed at runtime.

The various paths are searched in the specified order, a match will stop the search.

The first . represents the working directory when the TeX engine is called from.

egreg
  • 1,121,712