Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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 '12 at 9:44
2  
See Martin Scharrer's nice article on how to use svn-multi to do this. –  Andrew Swann Dec 17 '12 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:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\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{}
    \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.

share|improve this answer
    
I'm interested in similar functionality for mercurial. Do you know of anything like that? –  Faheem Mitha Jun 13 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. –  Martin Scharrer Jun 14 at 19:14
    
I asked a question along these lines. See tex.stackexchange.com/q/184672/3406 –  Faheem Mitha Jun 14 at 19:26

Your Answer

 
discard

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.