I mostly use LaTeX for writing documents (LyX actually, but that doesn't matter here) and use Subversion for version control. For managing the revision info of a source code file I use Subversion's built in feature Keyword Substitution which expands some special keyword (like $Date$ or $Revision$) in the source code to their current values.

Now two questions arise here: - How to get the Subversion keywords nicely into LaTeX? Note that the $ character used for the Subversion keywords is already a reserved LaTeX control character and make things messy. - How to get the version info on every page (e.g. as a footer)?

For the first problem there exists different latex packages: e.g. svn, svninfo and svn-multi. I chose to go for svn-multi because it supports the use of different files for one LaTeX document (e.g. a master file and several subfiles).

Usage is simple:


The first line is obvious. The second line contains the Subversion keyword $Id$, so you need to set the subversion keyword property to at least Id on the file(s) (e.g. with svn propset svn:keywords "Id" document.tex) for expanding it to something like $Id: document.tex 1980 2008-01-28 17:49:28Z mickeymouse $. The \svnid{} call makes the svn-multi package parse the expanded Id. After this point, you can use several macros like \svnrev, \svndate and \svnauthor to insert the subversion information you need. When working with a multi-file document, the \svnid{$Id$} can be put in every file, while \usepackage{svn-multi} only needs to be in the preamble of the main document.

The second problem can be solved with for example the prelim2e package, which let you put text below the normal page content (even below footnotes). To put for example the complete Subversion Id (with \svnkw{Id}) there: