How can I define a document command \FilesRequire that writes to the .log (or to the output console) a list of all packages internally required by the declared document class and by the packages that have been loaded by the user in a document?
For example, with this document
\documentclass{book}
\usepackage{graphicx}
\usepackage{amsmath}
\FilesRequire
\begin{document}
test
\end{document}
The output will be something like
Document class book: doesn't require additional packages.
Package graphicx requires: keyval, graphics.
Package amsmath requires: amstext[1995/01/25], amsbsy[1995/01/20],
amsopn[1995/01/20].
The command should have an optional argument for a comma separated list of the packages which will be inquired:
\documentclass{book}
\usepackage{graphicx}
\usepackage{amsmath}
\FilesRequire[amsmath]
\begin{document}
test
\end{document}
will produce just the information for the document class and for amsmath:
Document class book: doesn't require additional packages.
Package amsmath requires: amstext[1995/01/25], amsbsy[1995/01/20],
amsopn[1995/01/20].
Basically, the command must produce a list of the arguments for all \RequirePackage commands found inside the .cls and .sty files used in a document.
I am not interested in external scripts.
\LoadClassand\RequirePackage(and\usepackage, if the hooking is done after\documentclass). But it is not completely straightforward to get everything right. Maybe if you described your goal it would be possible to find an alternate solution (within TeX). – Bruno Le Floch Jun 17 '13 at 09:20\listfilesdoesn't show if a package was internally loaded by another package. My main interest is to have that information available. – Gonzalo Medina Jun 19 '13 at 15:42\@filelist? There all packages are listed in a comma separated list. – Marco Daniel Jun 30 '13 at 19:04