# svn for multiple files

Can someone explain how to use `svn-multi` in order to typeset the current revision (i.e., not the current file version)?

I had to split a document into several `.tex` files. One file is the main, and all the rest are called via `\input{}`. I want the title to include the current version of the document. If I just typeset `\svnrev` I get the current version of `main.tex`, rather than the highest version of any of the subfiles.

Another question: I know that `svn-multi` has a Perl script. Is there a way to get the desired result without any such external script?

-

According to the svn-multi documentation

The document global macros, like `\svnrev`, return the latest version control information (keyword data) for the whole multi-file document, i.e. the information of the latest changed file of the document.

Also (section 2.2)

Subversion keywords are included using `\svnid` or `\svnidlong`. These macros should be written very early in each file, i.e. in the preamble of the main document soon after `\documentclass` and `\usepackage{svn-multi}` and as first in every subfile before an `\chapter` or similar macro. [original emphasis]

Are you sure you're issuing a `\svnid(long)` macro in each subfile?

Regarding the perl script, it is only for including version information from files which are not directly processed by latex. It can for example be used to extract the revision number from C source code (in case you are writing documentation for a C program in latex). For a latex document where you only want the revision information from the various parts of the document itself, no external script is necessary.

-
I'm the author of `svn-multi` and I agree with the answer of Villemoes. The `\svnrev` is the correct macro, but you have to have a `\svnid` or `\svnidlong` macro in every `.tex` file you use. The Perl script is only for non-tex files like images, but has now been superseded by the (experimental) `autokw` option. This options reads the revision information direct from the `.svn/entries` file and also works for `.tex` files, so you don't need to place the above macros in every subfile. The drawback is that this depends on the version of Subversion and might not work with to new versions. – Martin Scharrer Apr 12 '11 at 7:27
Yes, that was exactly my mistake. for some reason, the documentation just confused me. Thanks! – Ran G. Apr 12 '11 at 7:29

You might want to have a look at the vc bundle. The purpose of the vc bundle is exactly to avoid messing with file revisions, which is problematic in different ways, and use repository revisions instead. The version control systems currently supported by the vc bundle are Subversion, Git and Bazaar.

The vc bundle is a script driven solution that requires an AWK interpreter installed (for Windows you can find one in the GnuWin32 utilities; simply put `gawk.exe` from the Binaries package somewhere into your path). I plan to port the script(s) to Lua, since recent TeX distributions contain `texlua`, a Lua interpreter that should work out-of-the-box on most platforms. But I haven't found the time to implement that change, yet.

-