[Tex/LaTex] Generate List of Installed Packages with TeX Live

texlivetlmgr

I've been trying to generate a list of all packages that can be accessed using the \usepackage command in LaTeX & others (so it can be autocompleted by my text editor). Specifically, I've been using the command tlmgr list --only-installed and parsing the output. However, I've noticed that several (key) packages are missing from the output. For example, tikz, graphicx, lmodern and some others are not present.

At first, I used the answer given here to manually add the missing packages to the list. However, I noticed that tikz was also missing from the output. Now I have no idea which packages may be omitted, even though they are installed. To make things worse, it seems there are several "packages" that are not actually meant to be used as packages. David Carlisle's answer to the linked question explains that tlmgr treats packages differently to LaTeX, which only makes things harder.

Is there a tlmgr terminal command that will print a list of all packages that can be \usepackage'd in a .tex file (pdftex, luatex, xetex, etc. differences are not important)?

If not, is there any way at all to do this? The goal is to make it cross platform too, so a solution should be adaptable to Linux, macOS, and Windows. I have not tried MikTeX yet, but it needs to work with a standard TeX Live installation.

Finally, short of that solution, is there an exhaustive list of packages that are omitted?

Best Answer

tlmgr search --file '.*\.sty'

Note that this will find files installed with tlmgr. I assume, from your question, that it is these you are interested in. Obviously, other .sty files may be available locally, in addition to those installed with tlmgr, but, equally obviously, tlmgr knows nothing about those.