Newbie here, just inherited a large (250+ page) doc written in LaTeX after the previous author left the company. Is there an easy way to determine all the LaTeX packages installed on my system? I'm using Ubuntu 12.10 as a workstation and I installed texlive-full and a couple other packages when I was initially trying out LaTeX.

I got a list of the packages that the project uses from the .tex file, so I know which packages I need. But it seems like there are multiple places on my system where packages were installed, so I'm having problems figuring out if the necessary packages are all there. Is it possible to get a full list of all LaTeX packages installed? Or even a list of all locations where the packages are stored would be enough. It seems like there are packages installed in multiple locations across my system, so I can't just simply look under the texmf folder.

Before I start installing the additional packages from CTAN, I'd really like to make sure I'm not duplicating any of them...

Apologies for what I'm sure is a silly question, but I looked and looked online for an answer and wasn't able to dig up anything. Your help is greatly appreciated in maintaining my sanity here. :)

Thanks, -Colin

  • 5
    Welcome to the site! Doesn't sound like a silly question to me :) How about something like cd / and then find -name "*.sty" It's generally best to use the in-built package manager to install packages, rather than doing it manually, as demonstrated in (for example) How do I update my TeX distribution? – cmhughes Jul 22 '13 at 20:48
  • 2
    Thanks for the quick response! I saw references to using 'tlmgr' to manage the packages, but it looks like the default Ubuntu apt-get install of Texlive doesn't include tlmgr. Would it be best to uninstall the Ubuntu TexLive install and then install TexLive directly from the source? If that would allow me to use tlmgr to take care of the packages, that would probably be worth it. – Colin Jul 22 '13 at 21:11
  • 2
    yes, that's what I would do: How to install "vanilla" TeXLive on Debian or Ubuntu? – cmhughes Jul 23 '13 at 8:14
  • Is simply running pdflatex filename a bad idea? – Jim Hefferon Jul 23 '13 at 10:33

You can find all locations that TeX will search for files using

kpsepath tex

The format is a bit weird: items are separated by colons, directories that should be searched using a ls-R index file start with !!, directories to be searched recursively end with //. To clean it up, we can process the output a bit:

kpsepath tex | tr ':' '\n' | perl -ne 'm-^(!!)?(/.*?)(//)?$- && print "$2\n"'

For each of those paths, you can find out which installed packages have put files under those paths using dlocate:

dlocate --package-only /path

(if you don't have dlocate, install it and make sure to run sudo update-dlocatedb). Putting it all together and eliminating duplicate package names from the output:

kpsepath tex | tr ':' '\n' | perl -ne 'm-^(!!)?(/.*?)(//)?$- && print "$2\n"' | while read path; do dlocate --package-only $path ; done | sort -u

For example, on my system, that prints:


There's some stuff there that I wouldn't have expected, like gnuplot-x11, but dpkg -L shows that it includes a gnuplot-lua-tikz.sty. Who knew?!

| improve this answer | |
  • 4
    +1. But this doesn't actually tell you which individual packages are installed since all those texlive- packages include several (or many) individual packages. – jon Jul 22 '13 at 22:05
  • True. It shows you which "Ubuntu packages" were installed, which may themselves contain many "LaTeX packages". If you want the latter, you can see the full contents of each "Ubuntu package" with "dpkg -L packagename". – Jim Paris Jul 22 '13 at 22:06

I am very reluctant to install anything that is not in official packages from a Linux distribution, but LaTeX and R are the exceptions that confirm my rule.

As Ubuntu packages for LaTeX could be outdated, the list of Ubuntu packages is not the list of LaTeX packages, and not all TeX Live stuff are available from .deb packages (notably tlmgr), I think that the best way to control what is already installed is:

  1. Uninstall all the .deb packages related with LaTeX.
  2. Install the recent TeX Live 2013 followings instructions from www.tug.org.
  3. Then, you can obtain easily the list with: tlmgr list | more and detailed information for specific packages (for example: tlmgr info xcolor)

I do not think that obtain that list justifies the download of some gigabytes and change the installation, but it is a good excuse to have tlmgr so you can update and install all the latest TeX Live packages that you will need.

| improve this answer | |
  • 1
    The TeX Live repository of Ubuntu is pretty decent, I tend to install everything tex-full to avoid problems later. If for some reason it is older than what you expect (typical pgfplots) there are Launchpad versions that are more updated. I never had to deal with the tlmgr. – alfC Jul 23 '13 at 1:22
  • @alfC Despite the name, texlive-full is not the full TeX Live, is metapackage to install about 150 Ubuntu packages, roughly 1.2Gb, surely a decent collection more that enough for many users, but this is far from the really full TeX Live 2013, with a ISO around 2.4Gb. – Fran Jul 23 '13 at 12:22
  • The sizes in HD will be about twice those of .deb packages or the ISO image. In my HD the apt-get install texlive-full will take 2312 MB of space but /usr/local/texlive/2013 have 3764 MB. – Fran Jul 23 '13 at 16:52
  • @alfC, In my short experience I never found something missing in texlive-full that is not on TeX live. The only problem I had was with versions, up to Ubuntu 12.04, TeXLive was 2009, bit outdated. Now the situation improved a lot. – alfC Jul 23 '13 at 17:14
  • 1
    @giordano mostly off-topic ;-) – Fran Jul 23 '13 at 17:49

Using unix tools:

To seach per user packages:

find ~ -name '*.sty' | grep -oE '/([^/]+)/[^/]+\.sty$' | cut -f2 -d'/' | sort | uniq

To search system-wide packages:

find /usr -name '*.sty' | grep -oE '/([^/]+)/[^/]+\.sty$' | cut -f2 -d'/' | sort | uniq

To search all file system:

sh -c "find / -name '*.sty' | grep -oE '/([^/]+)/[^/]+\.sty$' | cut -f2 -d'/' | sort | uniq" 2>/dev/null

2>/dev/null is to suppress "Permisson denied errors"

| improve this answer | |

Another way is

kpsepath tex | tr ':' '\n' | perl -ne 'm-^(!!)?(/.*?)(//)?$- && print "$2\n"' |xargs -J % find % -name '*.sty' | grep -oE '/([^/]+)/[^/]+\.sty$' | cut -f2 -d'/' | sort | uniq

This follows from combining Ilya's and Jim's answer, except that it prevents searching a whole directory structure and it does not need dlocate (only find).

| improve this answer | |

If you're using TeX Live, then you can type :

$ tlmgr list --only-installed
(running on Debian, switching to user mode!)
i pdfpages: Include PDF documents in LaTeX
| 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.