UK TeX FAQ -- question label RCS

### Version control using RCS, CVS or the like

If you use RCS, CVS, Subversion, Bazaar or Git to maintain your (La)TeX documents under version control, you may need some mechanism for including the version details in your document, in such a way that they can be typeset (that is, rather than just hiding them inside a comment).

The most complete solution for RCS and CVS is to use the (LaTeX) package rcs, which allows you to parse and display the contents of RCS keyword fields in an extremely flexible way. The package rcsinfo is simpler, but does most of what you want, and some people prefer it; it is explicitly compatible with LaTeX2HTML.

If, however, you need a solution which works without using external packages, or which will work in Plain TeX, then you can use the following minimal solution:

>     \def\RCS$#1: #2 ${\expandafter\def\csname RCS#1\endcsname{#2}}
>     \RCS$Revision: 1.3 $ % or any RCS keyword
>     \RCS$Date: 2009/10/06 22:23:45 $
>     ...
>     \date{Revision \RCSRevision, \RCSDate}

If you’ve entered the brave new world of Subversion, the package svn may be for you. It has explicit cleverness about dealing with dates:

> `\``documentclass``{<foo>}`
> `...`
> `\``usepackage{svn}`
> `\``SVNdate``$Date$`
> `\``author{...}`
> `\``title{...}`
> `...`
> `\``begin{document}`
> `\``maketitle`
> `...`
> `\``end{document}`

will (once subversion has committed a copy of the document) cause `\``maketitle` use the date that has been written into the `$Date$` keyword.

Another alternative for Subversion users is the svninfo package, which has much the same mechanisms as does svn but with a rather different focus. Svninfo does the date trick that svn performs (controlled by a package option), and can set up page foot-lines using package fancyhdr. There isn’t much to choose between the two packages: you should read the packages’ documentation to see which suits you best.

An alternative script-based approach to version control has been taken by the vc bundle, that in certain situations might work more reliably than any of the packages mentioned above. The vc bundle supports Bazaar, Git and Subversion usage and works with both LaTeX and Plain TeX. Note that vc is the only option that currently claims to support Bazaar- and Git-controlled repositories.

`rcs.sty`
  macros/latex/contrib/rcs (or browse the directory)
`rcsinfo.sty`
  macros/latex/contrib/rcsinfo (or browse the directory)
`svn.sty`
  macros/latex/contrib/svn (or browse the directory)
`svninfo.sty`
  macros/latex/contrib/svninfo (or browse the directory)
`vc`
  support/vc (or browse the directory)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=RCS