TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to keep track of revisions to a document and I use version control software for basically everything (SVN by the way, monotonically increasing revision numbers are their own reward).

I want to add SVN tags like $Id$ for example, SVN will then replace this (if the property is set) with the revision's ID. I'd be nice to show this somehow if only so I can keep track of things more easily. Ideally I'd like to have this info below the title, a list of the files that make up the document (a list of these IDs)

I am using subfiles to allow this to span multiple tex files if that helps.

I am hoping for an easy/canned way of doing this.

I'd like to then compile the document a certain way and have none of this info shown.

I did some searches for LaTeX pre-processor (so I could define a constant if I wanted this info for example) but I'd then have to search for displaying info on the front (which can be done, contents pages prove this) and stitch it all together.

I doubt I am the first to want to do this, so rather than reinvent the wheel, I ask you lot.

share|improve this question

Did you try a asking a search engine? One of the first links mentions svn-multi, which can do exactly what you want to achieve.

You can get the info from your repository by adding this to your document.


after setting the svn:keywords to HeadURL LastChangedDate LastChangedRevision LastChangedBy.

With \usepackage{fancyhdr} you can then add the info (Repository URL, last revision and time of last commit) like so

\fancyfoot[OR]{\tiny \href{\svnkw{HeadURL}}{Revision \svnkw{LastChangedRevision}} --- last commit on \svnkw{LastChangedDate} --- page \thepage}
\fancyfoot[EL]{\tiny page \thepage\ --- \href{\svnkw{HeadURL}}{Revision \svnkw{LastChangedRevision}} --- last commit on \svnkw{LastChangedDate}}

Take a look at this article by Mark Eli Kalderon in a PracTeX Journal from 2007, which explains everything nicely.

share|improve this answer
You do not explain how to stop the info being shown, it's also very SVN specific, I was hoping for a mechanism where I could conditionally add content to pages you see, like a pre-processor. This is still a good answer - if rather specific – Alec Teal Feb 5 '14 at 17:17
I skimmed the link (I can use SVN I skipped the sections on using it) it doesn't talk about removing the info for the final version. If you see my comment on the other answer I mention the layout risk conditionally adding content has, does this suffer the same problem? – Alec Teal Feb 5 '14 at 17:21
Well you did specify SVN! In particular, you said you wanted to include SVN tags. – cfr Feb 5 '14 at 17:36
@AlecTeal -- All you need to do to adapt this answer is to wrap the \fancyfoot commands in a conditional. Something like \newif\ifsvn then \ifsvntrue\fancyfoot{<with SVN info>}\else\fancyfoot{<without SVN info>}\fi. The default is \svnfalse, but a simple \svntrue would print the information. – jon Feb 5 '14 at 17:55
Well, I thought the answer is needed to be very SVN specific since you mention "version control info" in the title of your question. As @jon showed, a conditional addition of comments (without changing the layout) is easily possible. Or do you want to conditionally show it depending on certain SVN tags? – Habi Feb 7 '14 at 8:13

This \Pagestamp[] macro I wrote for one of our internal styles. Without the optional argument, it uses the word DRAFT as the page stamp. However, you can use the optional argument to place (as I did) \today to give a date stamp to the document. If you had defined a version number in a \def, that could be included, as well.

\StopPageStamp will halt the stamp on subsequent pages.

In this case, the stamp is applied to the header and footer. That can be redone in the ps@... definitions.

EDITED to leave original page dimensions intact.



Does this page have a stamp?

The stamp should be gone.

enter image description here

enter image description here

share|improve this answer
I like this because it is general purpose (unlike the other answer) and is shows that the content may be removed. This is perfect. I mentioned in my question "(to footers say?)" as a reference to alignment, adding content to a page could change boundaries and rejig the layout (which is why I added the bit about "under the contents table") any thoughts on this? – Alec Teal Feb 5 '14 at 17:19
@AlecTeal It is true my original answer changed some page size settings. I have updated the answer to leave the original page sizes intact, so that turning on/off the stamp should not affect the remaining page dimensions from their defaults. – Steven B. Segletes Feb 5 '14 at 17:28

This is a variant of what I use. It is svn specific. It does not change the page layout. It is easy to switch off. It does not interfere with configured headers/footers. I've added a command to print a preliminary page containing the title, author etc. and a table of revision information for all files used in producing the document.

Here is a sample of the first two pages with the stamps enabled and the preliminary page included:

first two pages with svn info (draft)

This makes use of several packages. prelim2e makes it easy to include the information at the bottom of pages (below the regular footer) and to switch between using this and not. I've also used a conditional from the package in a custom command which includes a table of revision information since you mentioned wanting to include information for all files, not just the main file.

Like Habi, I've used svn-multi to get the svn information included. I've used \tableofrevisions in the custom command to include information for all files. url is used to format the url.

titling is used so that \maketitle can be issued twice - once for the preliminary page and once for the regular first page.

I've used fake svn entries to show how these are handled. Obviously you would not really type these in yourself - you would let svn complete and update these as necessary.

Here's the code:


% comment this line and uncomment the next to remove the stamp
% \usepackage[final]{prelim2e}

% to pretty print the url

% to reuse title, author etc. easily

% to handle the SVN info nicely
  % for example only - uncomment lines below to let svn populate fields
    {$HeadURL: http://www.myfiles.com/myfiles/mainfile.tex $}
    {$LastChangedBy: somebody $}
    {$LastChangedRevision: 6897559 $}
    {$LastChangedDate: 1012-04-01 012:20:43 +0100 (Wed, 01 Apr 1012) $}
%   \svnidlong
%       {$HeadURL:  $}
%       {$LastChangedBy:  $}
%       {$LastChangedRevision:  $}
%       {$LastChangedDate:  $}
% % if you prefer a more concise format
% % \svnid{$Id:  $}
    \svnRegisterAuthor{somebody}{Some Body}

% adjust to taste
                \centering \small \textsf{Draft --- \today\ --- Revision \svnrev\ --- \svnyear--\svnmonth--\svnday\ \svnhour:\svnminute:\svnsecond}\\[1em]
                \centering \tiny \textsf{\svnkw{HeadURL}}%
                }% end parbox
        }% end sbox

% for example only

    {$HeadURL: http://www.myfiles.com/myfiles/subfile.tex $}
    {$LastChangedBy: somebody $}
    {$LastChangedRevision: 6897541 $}
    {$LastChangedDate: 1012-04-01 01:20:43 +0100 (Wed, 01 Apr 1012) $}

\title{Great paper}
\author{S.\ Body}





To exclude the information, comment the line \usepackage[draft]{prelim2e} and uncomment \usepackage[final]{prelim2e}. Then the preliminary page will not be included and the first two pages will instead look like this:

first two pages in 'final' mode

Note that pagination, page breaks, headers and footers are unaffected. All that changes is the preliminary page is omitted and the information beneath the regular footer is not typeset.

Adjust and enjoy.

share|improve this answer
This is superb, thank you. I want to tick two answers (neither of which is the highest rated one!) – Alec Teal Feb 5 '14 at 19:48
@AlecTeal I can't help you there, I'm afraid. I took your question to be about displaying SVN tags etc. but I think perhaps you meant something a little different given your comments on other answers... – cfr Feb 5 '14 at 21:58
@AlecTeal, you can accept any answer that you think is best, not only the highest rated one. Maybe I misunderstood you and this answer here suits you better, although I think they both achieve the same, since you either have to change the draft option (this answer) or conditionally turn off the SVN info in the footer (my answer). – Habi Feb 7 '14 at 8:16
I notice that also, in your sample as in my tentative, in the footers Revision is -2 and date is 0000... How to fix? – unlikely Feb 19 '15 at 0:07
@unlikely Yes, sorry. Don't use a savebox as it fixes the content. However, I can't get it to switch for the subfiles, even though I can get it to use the right values for the main document... – cfr Feb 19 '15 at 1:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.