My documents live within a huge subversion repository.

When I print out a document, say, for proof reading or checking for typos, then I would like to have the repository version number printed on each page (top or bottom, doesn't matter). The motivation is that it would help me monitor which remarks on physical paper I have not already transmitted into the current version, or which of several print outs is to be regarded newest.

  • How do you obtain the number? One of the (more workflow oriented) problem would be, that in the usual workflow, you would write something and commit that to SVN (or as i do - git). But your approach would require to perform a new run of (pdf/Xe/Lua)LaTeX to include that number in the document, which would change the code in comparison to the commit. - Wouldn't it be enough to print \date (perhaps also time of compilation) in each - say - bottom left footer?
    – Ronny
    Dec 17, 2012 at 9:44
  • 2
    See Martin Scharrer's nice article on how to use svn-multi to do this. Dec 17, 2012 at 12:02

1 Answer 1


Because a larger LaTeX document is usually spread over multiple files (i.e. a main file and multiple sub-files) I wrote a package to collect all revision information for each one and provide the latest revision number and other details.

You need to enable keyword expansion using:

svn propset svn:keywords 'Id Author Date Rev URL' *.tex

or using your graphics interface liek e.g. TortoiseSVN, and place at least a \svnid{$Id$} at the begin of every .tex file. To get correct values you need to compile at least twice.

To place the SVN information into the header or footer you can use e.g. the fancyhdr package:

\fancyhead[ol]{\slshape\leftmark }
\fancyfoot[ol]{Rev: \svnrev\ (\svnfilerev)}
\fancyfoot[or]{\svnyear-\svnmonth-\svnday\ \svnhour:\svnminute} % Date
% If the information should be also placed
% on the chapter page use:
\fancypagestyl {plain}{%
    \fancyhead[ol]{\slshape \leftmark }
    \fancyfoot[ol]{Rev: \svnrev \ (\svnfilerev)}
    \fancyfoot[or]{\svnyear -\svnmonth -\svnday \ \svnhour:\svnminute} % Date

See my article Version Control of LATEX Documents with svn-multi, The PracTEX Journal, 2007, No. 3, for more details.

  • I'm interested in similar functionality for mercurial. Do you know of anything like that? Jun 13, 2014 at 8:49
  • @FaheemMitha: As far as I know you can configure Mercurial to generate keywords as well. If you simply configure it to produce the same keywords as Subversion the package should still work. Jun 14, 2014 at 19:14
  • I asked a question along these lines. See tex.stackexchange.com/q/184672/3406 Jun 14, 2014 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .