Subversion and LaTeX

How do I include Subversion version control information in a LaTeX file?

In this example, the last changed date, current version number and name of the author will be added to a LaTeX file called exercises.tex.

1. Add


to the preamble. There are other packages which allow LaTeX to access svn data, but svn-multi appears to be the most flexible.

2. Add


to the preamble.  These commands (actually macros) give you access to the subversion change control information. You may choose not to use all the information in the document but it useful to include all the options. You could add

\svnRegisterAuthor{hutchins}{Susan Hutchinson}

which associates your full name with the username that owns the repository.

3. In the directory where your .tex file is stored enter

svn propset svn:keywords 'LastChangedBy LastChangedRevision LastChangedDate HeadURL'\ exercises.tex
property 'svn:keywords' set on 'exercises.tex'

4. Add

\small{Last changed on \svnday  -\svnmonth -\svnyear \space at \svnhour :\svnminute \space by \svnFullAuthor{\svnauthor} \hfill Revision 1.\svnrev}

to the place in the .tex file where you want the version control information to appear and save the changes. In this case the typeset version will read

Last changed on 23-07-2007 at 12:03 by Susan Hutchinson                           Revision 1.30

5. Make sure that the .tex file compiles and then close the file.

6. Enter

svn status

You should see

MM     exercises.tex

which means that exercises.tex has changes both to the content and properties which need to be commited.

7. Enter

svn commit -m"Added subversion information."

to save the changes on the repository.

8. Compile the .tex file twice and the version control information should appear.

For more information about the svn-multi package see

- The package documentation:
- A very useful article from the PracTeX journal: