The svninfo package
Achim D. Brucker
brucker@member.fsf.org
http://www.brucker.ch/

March 23, 2010
Version 0.7.4
Abstract
This package is used to extract the revision and file information provided by the Subversion (http://subversion.tigris.org) and the svk(http://svk.elixus.org) revision control system.

1

Introduction

To maintain different versions of a document or to keep track on the development of one, the document is kept under a revision control system like
SCCS, CVS, Subversion, or svk. This package assumes you are using either the Subversion or the svk system. To present the version information of a document, one needs to extract it from somewhere. For example, svk and Subversion offer several keywords that are expanded by theSubversion and svk update commands.1 The most informative keyword is$Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $ which contains
a lot of useful information. This information is made available through thispackage. Additionally, the package allows one to extract also the informationfrom the more specific keywords, e.g., $Author$ or $Date$.
In this documentation we use Subversion in the examples; but the results
should be similar if you are using svk. Note that you have to use the svk option
if you use svk.
Moreover, one has to set the Subversion property for keywords expansion ofthat file, e.g., by executing:svn propset svn:keywords "Id" svninfo.dtx

Please consult the manual of Subversion (e.g., h) or svk for further details about
keyword expansion.
The information obtained from the expanded $Id$ string are
1 The expansion of keywords has to be enabled manually, e.g., svn propset svn:keywords"Id" svninfo.dtx.

1• the filename,• the revision number,• the date and time of the last Subversion co command, and• name of the user who has done this action.
For each of these items a macro is defined. When updating a file, the Subversion
keywords should be contained in the updated source. Further, one has to set
the Subversion property for keyword expansion of that file, e.g.
svn propset svn:keywords "Id" svninfo.dtx

See the Subversion documentation for more details.
If you want to read about the implementation, put a % before \OnlyDescription in the code marked with <*driver> in the file svninfo.dtx.

2

User Interface

2.1

Options

Options for this package are:svk Use svk for parsing the Id information generated by svk.
today Set the date of \today to the date obtained by the Subversion information. If the $Id$ string is not expanded (see below), the current date isused.
notoday Don’t use the Subversion date for \today.
revrange For multi-file documents, display minimum and maximum revision. Every file of the document must either include a \svnInfo or a
\svnKeyword $Revision:$ statement. This is information needs two runsof LATEX to be correct.
fancyhdr We use the fancyhdr package to fill the footline with Subversion
information: filename, revision-number and date.
If the fancyhdr package is not already loaded, it will be loaded by thispackage. To use the footnotes, put something like:\pagestyle{fancyplain}\fancyhead[RE,LO]{\leftmark}\fancyhead[LE,RO]{\thepage}in the preamble.
nofancy We don’t define the footline. The fancyhdr package is not loaded.
scrpage Use scrpage2 instead of fancyhdr.
2

eso-foot Use eso-pic for showing a tiny info line at the bottom line of thepaper.
margin Use margin for showing the version info in the margin area.
long If used together with fancy / fancyhdr the date string is printed in
the long format as \today returns it. If fancy / fancyhdr is not used,nothing.
short If used together with fancy / fancyhdr the date string is printed in the
short format YYYY-MM-DD. If fancy / fancyhdr is not used, nothing.
final Don’t define the footline. If you want the Subversion in the final document, please use\usepackage{draft}
draft If nofancy is not used, show a footline with Subversion information.
If the babel package is used, the \svnToday string is language dependent.
The default options are: draft,today,long. You may also configure the default
fancy heading packages in the configuration file svninfo.cfg.

\svnInfo

2.2

Commands

2.2.1

Defining the Subversion Id information

There is only one macro to define the information: \svnInfo. Since it must
collaborate with Subversion it has an “unusual” calling sequence: The arguments are prefaced with a ‘$’ and completed with a ‘$t ’ (note the final space or
carriage return). The following arguments are valid:\svnInfot $Id$t\svnInfot $Id:$t\svnInfot $Id:t file t rev t YYYY-MM-DD t hh:mm:ss t owner t $t
In the first two forms, Subversion has not expanded the $Id$ string. This
form will usually be used before the file is checked in the first time.
YYYY-MM-DD is a date, hh:mm:ss a time. Note: when you perform theSubversion check out command, the $Id$ string is expanded by Subversion
automatically.
To take effect, \svnInfo must follow the \begin{document}. If you areusing multiple files for a document, you could place \svnInfo at the beginningof each file, so the information from the current file is obtained.
2.2.2

Accessing the Subversion Id information

There are the following macros to access the information provided by Subversion.
If Subversion has not expanded the $Id$ string, or no \svnInfo command isgiven, default values are returned.
\svnInfoFile• The name of the source file. Default: --sourcefile--.
3• The revision number, of the checked out file. Default: --revision--.

\svnInfoRevision\svnInfoMinRevision• The minimum revision number of multi-file documents. Every file of the
document must either include a \svnInfo or a \svnKeyword $Revision:$statement. This is information needs two runs of LATEX to be correct.
Default: --minrevision--.

\svnInfoMaxRevision• The maximum revision number of multi-file documents. Every file of the
document must either include a \svnInfo or a \svnKeyword $Revision:$statement. This is information needs two runs of LATEX to be correct.
Default: --maxrevision--.

\svnInfoDate• The date in the form YYYY-MM-DD, when the file was checked out.
Default: the current date.

\svnInfoTime• The time, when the file was checked out. Default: --time--.

\svnInfoOwner• The user name of the file owner. Default: --owner--.

\svnInfoYear• The year YYYY of \svnInfoDate. Default: the current year.

\svnInfoMonth• The month MM of \svnInfoDate. Default: the current month.
• The day DD of \svnInfoDate. Default: the current day.

\svnInfoDay\svnInfoLongDate• The date in the form of \today when the file was checked out. This islanguage depended. Default: the current date.

\svnId• Mimics the behavior of the $Id$ strings, i.e. it prints a string with asummary of the above described information.

\svnToday• The date obtained from the Subversion information in the format \today
is using.

\svnInfoMaxToday• The date obtained from the latest Subversion revision in the format\today is using.

3

Examples\svnInfo not expanded, no colon\svnInfo $Id$
\svnInfoFile svninfo.dtx\svnInfoRevision 4705
\svnInfoMinRevision 12\svnInfoMaxRevision 4705
\svnInfoDate 2010-03-23\svnInfoTime 19:57:29Z
\svnInfoOwner brucker\svnInfoYear\svnInfoMonth\svnInfoDay\svnInfoLongDate\svnToday\svnInfoMaxYear\svnInfoMaxDay\svnInfoMaxMonth\svnInfoMaxToday\svnId svninfo.dtx 4705 2010-03-23 19:57:29Z brucker
4

2010
3
23
March 23, 2010
March 23, 2010
2010
23
03
March 23, 2010

\svnInfo not expanded, having colon\svnInfo $Id:$\svnInfoFile svninfo.dtx\svnInfoYear\svnInfoRevision 4705
\svnInfoMonth\svnInfoMinRevision 12\svnInfoDay\svnInfoMaxRevision 4705
\svnInfoLongDate\svnInfoDate 2010-03-23\svnToday\svnInfoTime 19:57:29Z
\svnInfoMaxYear\svnInfoOwner brucker\svnInfoMaxDay\svnInfoMaxMonth\svnInfoMaxToday\svnId svninfo.dtx 4705 2010-03-23 19:57:29Z brucker

2010
3
23
March 23, 2010
March 23, 2010
2010
23
03
March 23, 2010

\svnInfo standard version\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $\svnInfoFile\svnInfoRevision\svnInfoMinRevision\svnInfoMaxRevision\svnInfoDate\svnInfoTime\svnInfoOwner\svnInfoYear\svnInfoMonth\svnInfoDay\svnInfoLongDate\svnToday\svnInfoMaxYear\svnInfoMaxDay\svnInfoMaxMonth\svnInfoMaxToday\svnId svninfo.dtx 4705 2010-03-23 19:57:29Z brucker
svninfo.dtx
4705
12
4705
2010-03-23
19:57:29Z
brucker2010
3
23
March 23, 2010
March 23, 2010
2010
23
03
March 23, 2010

\svnInfo standard version without owner\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $\svnInfoYear\svnInfoMonth\svnInfoDay\svnInfoLongDate\svnToday\svnInfoMaxYear\svnInfoMaxDay\svnInfoMaxMonth\svnInfoMaxToday\svnId svninfo.dtx 4705 2010-03-23 19:57:29Z brucker\svnInfoFile\svnInfoRevision\svnInfoMinRevision\svnInfoMaxRevision\svnInfoDate\svnInfoTime\svnInfoOwner

svninfo.dtx
4705
12
4705
2010-03-23
19:57:29Z
brucker2010
3
23
March 23, 2010
March 23, 2010
2010
23
03
March 23, 2010

\svnInfo standard version within the owner\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $5

\svnInfoFile\svnInfoRevision\svnInfoMinRevision\svnInfoMaxRevision\svnInfoDate\svnInfoTime\svnInfoOwner\svnInfoYear\svnInfoMonth\svnInfoDay\svnInfoLongDate\svnToday\svnInfoMaxYear\svnInfoMaxDay\svnInfoMaxMonth\svnInfoMaxToday\svnId svninfo.dtx 4705 2010-03-23 19:57:29Z brucker
svninfo.dtx
4705
12
4705
2010-03-23
19:57:29Z
brucker2010
3
23
March 23, 2010
March 23, 2010
2010
23
03
March 23, 2010

\svnInfo no leading $\svnInfo Id: svninfo.dtx 12 2002-04-19 12:27:55 brucker $\svnInfoFile\svnInfoRevision\svnInfoMinRevision\svnInfoMaxRevision\svnInfoDate\svnInfoTime\svnInfoOwner\svnInfoYear\svnInfoMonth\svnInfoDay\svnInfoLongDate\svnToday\svnInfoMaxYear\svnInfoMaxDay\svnInfoMaxMonth\svnInfoMaxToday\svnId svninfo.dtx 12 2002-04-19 12:27:55 brucker

4\svnKeyword

svninfo.dtx
12
12
4705
2002-04-19
12:27:55
brucker

2002
4
19
April 19, 2002
April 19, 2002
2010
23
03
March 23, 2010

The generic Subversion keyword interface

In addition to the already presented \svnInfo macro which is specially built foranalyzing the Subversion $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $information we also provide a generic interface via \svnKeyword. This interface
can be used to extract information from the remaining keywords:• $Date$: The date of the last commit with changes. This information canalso be accessed using the keyword $LastChangedDate$.
• $Revision$: The revision of the last commit with changes. This information can also be accessed using the keyword $LastChangedRevision$
or $Rev$.
• $Author$: The author of the last commit with changes. This information
can also be accessed using the keyword $LastChangeBy$.
• $HeadURL$: The the full URL to the latest version of the file in the repository. This information can also be accessed using the keyword $URL$.
These keywords can be accessed using the \svnKeyword macro. This macro
accepts a single argument that should be of the form $hKeyword i$ (unexpanded)or $hKeyword i:t hvalueit $ (expanded), e.g.:6

\svnKeyword $Author: brucker $The \svnKeyword updates the corresponding Subversion Id information, e.g.,
our example updates \svnInfoOwner. In more detail:• \svnKeyword $Date:$ updates the date and time information, e.g.,\svnInfoDate, \svnInfoMonth, or \svnInfoTime.

\svnInfoDate\svnInfoMonth\svnInfoTime\svnInfoRevision\svnInfoOwner\svnInfoHeadURL• \svnKeyword $Revision:$ updates \svnInfoRevision.
• \svnKeyword $Author:$ updates \svnInfoOwner.
• \svnKeyword $HeadURL:$ updates \svnInfoHeadURL.
Note, the parser used by \svnKeyword is not that powerful than the
one used by \svnInfo. Thus it is advisable to use \svnKeywordId for the$Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $ keyword and \svnKeyword
only for the keywords described in this section.
Further, the \svnKeyword macro does not reset all keyword definitions globally, i.e., you can combine the $Revision$ of one file, with the $Author$ of
another file. Please take care of that!

5

Acknowledgments

This package is based on rcsinfo from Dr. Jürgen Vollmer. The rcsinfo package is distributed via the CTAN archives (’macros/latex/contrib/rcsinfo’).
The code for parsing generic Subversion keywords was taken from the svn
packages written by Richard Lewis. The svn package is distributed via the
CTAN archives (’macros/latex/contrib/svn’).
Further I want to thank all the people that reported bugs and ideas
for improvements, often including patches: Andreas Haller, Benjamin Hiller,
Christophe Jacquet, Dries Kimpe, Jami Lawrence, Henning Lenz, Stefan Mann,
Nigel Metheringham, Igor Nikolic, Michael Niedermair, Heiko Oberdiek, OliverPons, Bernd Raichle, Krzysztof Retel, Jörg, Sommer, Arnout Standaert, DanielTrümper, Thomas Weber, and Uwe Ziegenhagen.

6

Copyright and License

Copyright ( c ) 1995
Dr. Jürgen Vollmer
Copyright ( c ) 2003–2010 Achim D. Brucker brucker@member.fsf.org
This program can be redistributed and/or modified under the terms of the
LATEX Project Public License Distributed from CTAN archives in directory’macros/latex/base/lppl.txt’; either version 1 of the License, or any later
version.

7

Change History
v0.1
General: Initial version, mainly
a modified version of thercsinfo package. . . . . . . . . .
v0.2
General: Removed LATEX2HTML
build-dependency. . . . . . . . . .
v0.2.1
General: Added
svnId. . . . . . . . . . . . . . . . . .
v0.3
General: Added support for $Id:$
keywords without owner information. . . . . . . . . . . . . . . . .
v0.4
General: Added new package options draft, final, eso-foot,and scrpage. Fixed problem
with ‘ ’ in file names. . . . . . .
v0.5
General: Removed support for
LATEX2HTML (it is non-free software and also seems to be unmaintained) and added newcommandsvnKeyword for defining arbitrary svn keywords (e.g.
Author :). . . . . . . . . . . . . . . .
v0.6
General: Added
svnInfoMinRevision andsvnInfoMaxRevision together
with the option revrange.

Also added support for \ inkeywords. . . . . . . . . . . . . . . . 1
v0.7
General: Added option margin
for showing version info in
the margins of the document;
added option svk for supporting the keyword expansion ofsvk; added command
svnMaxToday; and fixed theuse of fancyhdr for singlesided documents. . . . . . . . . .
v0.7.1
General: Fixed
svnMaxToday and introduced
svnInfoMaxToday as an alternative name. Improved documentation . . . . . . . . . . . . . . .
v0.7.2
General: Fixed documentation:
the option for using the
scrpage2 package is called
scrpage. Fixed support forsvk. . . . . . . . . . . . . . . . . . . .
v0.7.3General: Fixed bug resulting inwrong date for maximal revision . . . . . . . . . . . . . . . . . . .
v0.7.4General: Fixed localization of dateformats, e.g.,
svnToday. . . . . . . . . . . . . . . .

1

1

1

1

1

1

1

1

1

1

1

Index
Numbers written in italic refer to the page where the corresponding entry is
described; numbers underlined refer to the code line of the definition; numbers
in roman refer to the code lines where the entry is used.
S\svnId . . . . . . . . . . . . . . . . . . . . . . 4\svnInfo . . . . . . . . . . . . . . . . . . . . 3\svnInfoDate . . . . . . . . . . . . . . . 4, 7
\svnInfoDay . . . . . . . . . . . . . . . . . . 4\svnInfoFile . . . . . . . . . . . . . . . . .
\svnInfoHeadURL . . . . . . . . . . . . . .
\svnInfoLongDate . . . . . . . . . . . . .
\svnInfoMaxRevision . . . . . . . . . . .
\svnInfoMaxToday . . . . . . . . . . . . .

8

3
7
4
4
4

\svnInfoTime . . . . . . . . . . . . . . . 4, 7
\svnInfoYear . . . . . . . . . . . . . . . . . 4\svnKeyword . . . . . . . . . . . . . . . . . . 6\svnToday . . . . . . . . . . . . . . . . . . . 4\svnInfoMinRevision . . . . . . . . . . . 4\svnInfoMonth . . . . . . . . . . . . . . 4, 7
\svnInfoOwner . . . . . . . . . . . . . . 4, 7
\svnInfoRevision . . . . . . . . . . . 4, 7

9