add tag
joulev
Currently I am managing my custom packages in `~/texmf`, and it is going very well.

However, due to some reasons, I want to have many TEXMF trees in my system. For example, I want `/path/to/another/texmf` or `/path/to/another/different/texmf` to be treated by `kpsewhich` and TeX the same way `~/texmf` is being treated.

Is it possible?

I am using TeX Live 2019 in Windows 10 (but feel free to suggest Unix solutions :)).
Top Answer
Skillmon
If you're running TeXlive you can add a folder to the list of folders to be searched (without needing to be indexed, so like the `$TEXMFHOME`) by issuing the following command (this will be permanent, should be run as root -- on \*nix that is, no idea about Windows):

```sh
tlmgr conf auxtrees add /path/to/folder
```

A folder added this way might be removed using

```sh
tlmgr conf auxtrees remove /path/to/folder
```

---

Additionally the readme of https://github.com/pgf-tikz/pgf states the following possibility (but I never tried that one) for an inclusion for the current shell session (for example to test building the pgfmanual, this replaces your `$TEXMFHOME`):

```sh
tlmgr init-usertree --usertree <folder>
export TEXMFHOME=`realpath <folder>`
```
Answer #2
joulev
I think I figured it out.

When looking at `/path/to/texlive/2019/texmf-dist/web2c/texmf.cnf`, I found this line:

```none
TEXMF = {$TEXMFAUXTREES$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFLOCAL,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFDIST}
```

So I just add the following lines to my custom `texmf.cnf` file (`/path/to/texlive/2019/texmf.cnf`):

```
TEXMFCUSTOMONE = /path/to/texmf/first
TEXMFCUSTOMTWO = /path/to/texmf/second
TEXMFCUSTOMTHREE = /path/to/texmf/third
%...
TEXMF = {$TEXMFAUXTREES$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFLOCAL,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFDIST,$TEXMFCUSTOMONE,$TEXMFCUSTOMTWO,$TEXMFCUSTOMTHREE}
```

Now if I put a `.sty` file in `/path/to/texmf/first/tex/latex/a`, it works:

```
$ kpsewhich a.sty
/path/to/texmf/first/tex/latex/a/a.sty
```

However, I am not sure if I have completed everything. Is there anything I need to do now?

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.