Skip to Main Content

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 output 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}{pdfeTeX} {0000/00/00 v0.14013}
      *{format} {LaTeX2e}     {2011/06/27 v2.e}
      *{package}{snapshot}    {2012/08/06 v2.13}
      *{class}  {article}     {2007/10/19 v1.4h}
      *{file}   {size10.clo}  {2007/10/19 v1.4h}
      *{package}{graphicx}    {1999/02/16 v1.0f}
      *{package}{keyval}      {1999/03/16 v1.13}
      *{package}{graphics}    {2009/02/05 v1.0o}
      *{package}{trig}        {1999/03/16 v1.09}
      *{file}   {graphics.cfg}{2010/04/23 v1.9}
      *{file}   {dvips.def}   {1999/02/16 v3.0i}
    }
    \documentclass{article}
    \usepackage{graphicx}
      ...
    

Making the necessary arrangements to ensure that future LaTeX runs of the document actually call in the specified versions is left to be handled separately, since the best way to go about this is highly 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 in the current TeX Live distribution; it can also be downloaded from CTAN (the Comprehensive TeX Archive Network) or from the AMS: snapshot.zip