7

This question Add a version number to the title of a LaTeX document spurred my curiosity:

How do you add an auto-version number in Latex?

( So one is not doing this: {\bf Version:} 1.2 and then later {\bf Version:} 1.2 1.3) ?

Community
  • 1
  • 1
rlb.usa
  • 14,942
  • 16
  • 80
  • 128
  • Ooohhh. This'll be interesting. – physicsmichael Apr 14 '10 at 00:04
  • 2
    How exactly do you define the automatic incrementing? Add .1 every single time you compile? But surely you do a lot of see-if-I-did-that-right compilation, so not all of those should increment the number. Seems to me that you'll have to tell LaTeX when you want it incremented, and at that point you might as well just do it yourself. – Cascabel Apr 14 '10 at 06:02

2 Answers2

5
\usepackage[nofancy]{svninfo}
\svnInfo $Id: viperdefects.tex 125 2007-05-29 16:29:07Z longborb $
\svnKeyword $URL: file:///F:/Stuff/Repository/Development/Essays/Viper/viperdefects.tex $

If you use Subversion, the above code is an example of what you can do. SVN updates the information as you update the file, but beware: only if you up the containing file. It doesn't track updates elsewhere in the tree.

However, I get the feeling that this is now considered a bit old-fashioned; the modern trend is to DVCSs, where there isn't really a valid concept of a linearly incrementing version number.

Brent.Longborough
  • 9,567
  • 10
  • 42
  • 62
  • To be precise, it's not the distributed versus centralized aspect of version control that prevents linearly incrementing version numbers - it's the fact that modern VCSs can actually branch and merge (which is a prerequisite for a DVCS). That said, there are things you can do. For example, in git, if you tag your major versions ("releases") with version numbers, you can use `git describe` to get a nice string containing the most recent tag, the number of commits since then, and the abbreviated SHA1 of the current commit. – Cascabel Apr 14 '10 at 17:04
0

If you're using Windows, you can install Tortoise SVN and Collabnet Subversion Server. These tools work fine with the svn-multi package in LaTeX to produce the revision/version numbers that you need.

yCalleecharan
  • 4,656
  • 11
  • 56
  • 86