Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to generate a TeX-file with all information needed about the installed packages of a TeXLive distribution?

If you want only certain elements of the table, you can use this snippet. :-)

 dofile( assert( kpse.find_file( "tlpdb.tlu", "texmfscripts" ) ) )
 tlpdb = read_tlpdb( kpse.var_value("SELFAUTOPARENT") )
 for name, pkg in pairs( tlpdb ) do 
  texio.write_nl( name )
  tex.print( "\\section*{" )
  tex.print( name )
  tex.print( "}" )
  tex.print( "" )
  if pkg.longdesc ~= nil then
    tex.write( tostring(pkg.longdesc) )
    tex.print( "" )
  if pkg. revision ~= nil then
    tex.write( tostring(pkg.longdesc) )
    tex.print( "" )
  tex.print( "\\clearpage" )
share|improve this question
add comment

2 Answers

up vote 12 down vote accepted

The information about installed packages is stored in a plain text database <installation root>/tlpkg/texlive.tlpdb. For a simple list of packages in a database you can use this one-liner:

awk '/^name/ {print $2}' texlive.tlpdb

For anything more complicated you would need to parse the database file yourself (if you know perl or lua you could use some code from TeX Live for that purpose).

Edit: here's an example using luatex that prints info about each package on a separate page (Edit2: with package names sorted alphabetically).

dofile( assert( kpse.find_file( "tlpdb.tlu", "texmfscripts" ) ) )
tlpdb = read_tlpdb( kpse.var_value( "SELFAUTOPARENT" ) )
pkglist = {}
for name in pairs( tlpdb ) do 
  table.insert( pkglist, name )
table.sort( pkglist )
for i, name in ipairs( pkglist ) do 
  texio.write_nl( name )
  tex.print( "PACKAGE: " .. name )
  tex.print( "" )
  for field, value in pairs( tlpdb[name] ) do 
    if type( value ) ~= "table" then
      tex.write( field .. ": " .. tostring( value ) )
      tex.print( "" )
  tex.print( "\\clearpage" )
\directlua{ dofile "\jobname.lua" }
share|improve this answer
add comment

I took up the challenge with pdf(La)TeX (and the code could easily be modified to use only eTeX). It ain't pretty. It should produce a ~5000 pages long pdf file with all the info (and it takes forever to compile... like, 4hrs). I had to hard-code the path of the texlive install (first line of the code).

\openin\tl@read \tlpath/tlpkg/texlive.tlpdb\relax
\def\tl@analyse#1 {%
  \ifcsname #1\endcsname
    \csname #1\expandafter\endcsname
      \chapter{Packages starting with \tl@i}%
      \ifx\tl@revision\empty\else \space r. \tl@revision\fi}%
\def\tl@oneliner#1#2#3\relax{\tl@open@if@new{#1}{#2: #3}{}{}}
\tl@def@oneliner{shortdesc}{Short description}
\tl@def@oneliner{containersize}{Container size}
\tl@def@oneliner{containermd5}{Container md5}
\tl@def@oneliner{doccontainersize}{Doc container size}
\tl@def@oneliner{doccontainermd5}{Doc container md5}
\tl@def@oneliner{srccontainersize}{Source container size}
\tl@def@oneliner{srccontainermd5}{Source container md5}
\tl@def@oneliner{catalogue-ctan}{On CTAN}
\def\longdesc#1\relax{\tl@open@if@new{longdesc}{Long description: #1}{}{#1}}
  {Doc files: #1\@gobble}{\def\tl@current{}}{}}
  {Run files: #1\@gobble}{\def\tl@current{}}{}}
  {Source files: #1\@gobble}{\def\tl@current{}}{}}
\title{All of the packages in \TeX{}live}
\readline\tl@read to\tl@line
share|improve this answer
You can avoid hard coding the path: \usepackage{catchfile}\CatchFileDef{\tlpath}{|"kpsewhich --var-value SELFAUTOPARENT"}{} \begingroup\makeatletter \edef\x{\endgroup\edef\noexpand\tlpath{\noexpand\zap@space\tlpath\space\noexpand‌​\@empty}}\x Works also without calling with the --shell-escape option (TeX Live 2010 or later) –  egreg Dec 19 '11 at 18:25
The final pdf had 5203 pages (not counting the toc: I'm not ready to compile a second time). –  Bruno Le Floch Dec 19 '11 at 18:33
@egreg: I wasn't expecting it to be possible without --shell-escape. –  Bruno Le Floch Dec 19 '11 at 18:34
kpsewhich is one of the allowed programs for the restricted shell escape, along with bibtex, bibtex8, makeindex and repstopdf. –  egreg Dec 19 '11 at 18:36
@egreg: thanks. The macros I'm using here are too slow to be of any practical use anyways, so I won't bump the question just to add your suggestion. I hope you don't mind. –  Bruno Le Floch Dec 19 '11 at 18:52
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.