开发者

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!


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


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!! :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜