6

I have a machine where I know that pdflatex plus some packages are installed. I can compile any given .tex file on that machine and view the output, but I cannot inspect the machine directly.

What is the easiest way to produce a PDF that describes the LaTeX installation found on that machine, with all the packages, classes, and fonts, plus their versions? Is this at all possible?

9
tlmgr info

lists all TeXLive packages with a preceeding i, if already installed. Or use

tlmgr list --only-installed

You can also create a complete list as pdf (run with lualatex --shell-escape <file>):

\documentclass[fontsize=11pt,paper=a4,pagesize]{scrartcl}
\usepackage{luacode,ltablex}
\begin{document}
\section*{Installed packages in \TeX{}Live}
\begin{luacode}
local fh,err = io.popen("tlmgr list --only-installed")
if not fh then
  texio.write(err)
  os.exit(-1)
end
tex.print("\\begingroup\\footnotesize\\noindent")
tex.print("\\begin{tabularx}{\\linewidth}{@{} r @{.~} l X @{}}")
local i=0
for line in fh:lines() do
  i = i + 1
  tex.print(i .. "&" .. line:gsub("^i ", ""):gsub(": ", "&", 1)
    :gsub("\\", "\\textbackslash{}"):gsub("_", "\\_"):gsub("$","\\\\"))
end
tex.print("\\end{tabularx}\\endgroup")
fh:close()
\end{luacode}
\end{document}

I have no idea how it can be done for MiKteX.

2

A pdflatex version; run with -shell-escape.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{xparse}

\ExplSyntaxOn

\NewDocumentCommand{\listpackages}{}
 {
  \krlmlr_list_packages:
 }

\ior_new:N \g_krlmlr_read_stream

\cs_new_protected:Nn \krlmlr_list_packages:
 {
  \ior_open:Nn \g_krlmlr_read_stream { |"tlmgr~list~--only-installed" }
  \ior_map_inline:Nn \g_krlmlr_read_stream
   {
    \__krlmlr_process_line:n { ##1 }
   }
 }

\cs_new_protected:Nn \__krlmlr_process_line:n
 {
  \__krlmlr_process_line_aux:w #1 \q_stop
 }
\cs_new_protected:Npn \__krlmlr_process_line_aux:w #1~#2~#3 \q_stop
 {
  \noindent\texttt{\tl_to_str:n { #2 }}~\tl_to_str:n {#3}\par
 }
\ExplSyntaxOff

\begin{document}

\listpackages

\end{document}

enter image description here

(Just the first few entries and not the whole 76 pages.)

  • Nice! Is it possible to align the columns? – Sigur Feb 16 '16 at 17:39
  • @Sigur Yes, of course, by using longtable, for instance. An easy exercise. – egreg Feb 16 '16 at 17:41
  • I only recognise the line \noindent\texttt{\tl_to_str:n { #2 }}~\tl_to_str:n {#3}\par with TeX commands. So I suppose that here is the place to edit. Thanks. – Sigur Feb 16 '16 at 17:43
  • 1
    @Sigur \tl_put_right:Nn \l__krlmlr_table_body_tl { \texttt{\tl_to_str:n { #2 }} & \tl_to_str:n {#3} \\ } } and supplement the first macro with \begin{longtable}{ll} \l__krlmlr_table_body_tl \end{longtable} Reducing the font size is obviously necessary. – egreg Feb 16 '16 at 17:49

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.