R3v3r3nD
R3v3r3nD

Reputation: 111

Add SVN branch name on LaTeX title page

I want to have SVN branch name added (under the title) as sort of version information. I want it to be done automatically so that when I copy files generating the documentation to another (new) branch I get that info put in automatically. Any hints?

Thanks!

Upvotes: 4

Views: 436

Answers (2)

R3v3r3nD
R3v3r3nD

Reputation: 111

Thanks for pointing me in the right direction! So apparently svn package is needed (like svn-multi) for example and xstring package.

  • First set keywords property on on your tex file:

    svn propset svn:keywords "URL Date Rev" >your_file<.tex

  • Next add at the beginning of the .tex file:

    \svnidlong

    {$HeadURL$}

    {$LastChangedDate$}

    {$LastChangedRevision$}

    {$LastChangedBy$}

  • Then in the document body add line similar to this (depending on what you want to extract)

    \StrBetween{\svnmainurl}{branches/}{/sourcecode} \\

  • Last commit the .tex file to svn so the data gets filled in

And that's it!! :)

Upvotes: 1

Nick
Nick

Reputation: 25799

Have a look at keyword substitution:

http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html

Edit:

Or alternatively you could use the svn info command to get the path from your working copy, write this to a file, read in the contents and parse using a regular expression. I'm assuming you have some sort of build process you use to generate the output document from the LaTeX source?

Also the posting here: http://magic.aladdin.cs.cmu.edu/2006/09/28/subversion-keywords-and-latex/ provides more information on doing what you want to do.

And here: http://www.ctan.org/pkg/svninfo

Upvotes: 1

Related Questions