# [OS X TeX] finding all dependencies of a (La)TeX document

Claus Gerhardt claus.gerhardt at urz.uni-heidelberg.de
Thu Apr 22 01:35:53 EDT 2004

```The snapshot package by the AMS might be what you want. Below is a
description.

Claus

The snapshot package

The snapshot package helps the owner of a LaTeX document obtain a list
of the external dependencies of the document in a form that can be
embedded at the top of the document. In other words, it provides a
snapshot of the current processing context of the document, insofar as
it can be determined from inside LaTeX.

If a document contains such a dependency list, then it becomes
possible to arrange that the document be processed always with the same
versions of everything, in order to ensure the same output. This could
be useful for someone wanting to keep a LaTeX document on hand and
consistently reproduce an identical DVI file from it, on the fly; or
for someone wanting to shield a document during the final stages of its
production cycle from unexpected side effects of routine upgrades to
the TeX system.

Normal usage involves the following steps:
1.  	 Add a \RequirePackage statement at the top of the document:
\RequirePackage{snapshot}
\documentclass{article}
...

2.  	 Run LaTeX on the document. This will produce a dependency list
in a file \jobname.dep.
3.  	 Insert the .dep file at the top of the document, before the
\documentclass statement. The following example shows what you would
typically end up with for a document that used the article
documentclass and the graphicx package:
\RequirePackage{snapshot}
\RequireVersions{
*{application}{TeX}     {1990/03/25 3.x}
*{format} {LaTeX2e}     {1999/06/01 v2.e}
*{package}{snapshot}    {1999/11/03 v1.02}
*{class}  {article}     {1999/01/07 v1.4a}
*{file}   {size10.clo}  {1999/01/07 v1.4a}
*{package}{graphicx}    {1999/02/16 v1.0f}
*{package}{keyval}      {1999/03/16 v1.13}
*{package}{graphics}    {1999/02/16 v1.0l}
*{package}{trig}        {1999/03/16 v1.09}
*{file}   {graphics.cfg}{0000/00/00 v0.0}
*{file}   {dvips.def}   {1999/02/16 v3.0i}
}
\documentclass{article}
\usepackage[dvips]{graphicx}
...

Making the necessary arrangements to ensure that future LaTeX runs of
the document actually call in the specified versions is left to be
system-dependent. The snapshot package only provides a way to generate
the dependency list.

However, the \RequireVersions statement does record the given
information in a form that can be accessed from within LaTeX. (It is
for this purpose that it is not simply a comment.) In principle a
package could be set up so that a later version would automatically
attempt to emulate an earlier version if an earlier version was
specified---much as LaTeX currently switches to 2.09 compatibility mode
if it sees \documentstyle instead of \documentclass.

The package is included on the current TeX Live CD; it can also be
the AMS:
snapshot.zip
snapshot.tgz
snapshot.tar.Z

On 22.04.2004, at 05:53, Fernando Pereira wrote:

> I'm looking for any tool that would find all included files and
> formats that a (La)TeX source file depends to facilitate the creation
> of self-contained archives that can be recompiled elsewhere. I know
> that this is impossible in general (TeX is Turing-complete), but a 95%
> solution would help a lot.
>
> Thanks
>
> Fernando Pereira
> Dept. of Computer and Information Science
> University of Pennsylvania
>
> -----------------------------------------------------
> Please see <http://www.esm.psu.edu/mac-tex/> for list
> guidelines, information, and LaTeX/TeX resources.
>
>
>

Claus Gerhardt
Institut für Angewandte Mathematik
Ruprecht-Karls-Universität Heidelberg
Im Neuenheimer Feld 294
69120 Heidelberg
Germany

http://www.math.uni-heidelberg.de/studinfo/gerhardt/

PGP Public Key available from
ldap://keyserver.pgp.com
http://pgpkeys.mit.edu

Digital Signature for pdf files available from
http://www.math.uni-heidelberg.de/studinfo/gerhardt/
DataExchangeClausGerhardt.fdf

-----------------------------------------------------