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 7:24

You can call

kpsewhich -var-brace-value=TEXINPUTS

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


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.

|improve this answer|||||

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.