[Tex/LaTex] Determine full list of installed LaTeX packages in Ubuntu

installingpackagestexliveUbuntu

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

Best Answer

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:

asymptote
cm-super-minimal
context
dblatex
feynmf
gnuplot-x11
latex-beamer
latex-cjk-common
latex-make
latex-xcolor
latex2html
lgrind
lilypond-data
lmodern
pgf
preview-latex-style
tex-common
tex-gyre
tex4ht-common
texinfo
texlive-base
texlive-bibtex-extra
texlive-extra-utils
texlive-font-utils
texlive-fonts-extra
texlive-fonts-recommended
texlive-generic-recommended
texlive-lang-other
texlive-latex-base
texlive-latex-extra
texlive-latex-recommended
texlive-luatex
texlive-math-extra
texlive-metapost
texlive-pictures
texlive-pstricks
texlive-science
texlive-xetex
texpower
tipa

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?!

Related Question