I use revision control (Subversion, to be exact) to keep track of the edits to my LaTeX documents. Is there a LaTeX package that interfaces with revision control? Specifically, it would be nice to see the revision number and time and date inside the document. (Obviously, I'd turn this off in the final version.) Also, it might be nice to get a PDF showing what was added and removed in a given revision.
|
Yes, there are packages called |
|||||||
|
|
For systems like CVS or Subversion, which modify source files, the TeX FAQ's bare-bones answer is my favourite:
It's not very sophisticated, but you're only going to use it for draft versions, so this is a case where simple and robust beats pretty. Systems like Mercurial or Git don't modify source files. In such cases, a good solution is to generate a file which can be
I Update: the OP also mentioned changes between versions. That turns out to be a bit tricky in LaTeX, but the TeX FAQ has a discussion of the various (not completely satisfactory) possibilities. Edit: More recent versions of Mercurial require the Edit: |
||||
|
|
For the last part of your question, I like the Perl script |
|||||||||||||||||
|
|
For Git and Mercurial the only packaged option for writing revision information to the output document is the vc-bundle, which works without keyword substitution by writing to an For rendering a diff document a commit hook could be used that calls latexdiff-vc. Just inspecting diffs word-based instead of line based can be done with wdiff, or dwdiff. Git has a helpful diff mode with --color-words
|
|||||
|
|
Keyword substitution is frowned on by revision control purists and is not facilitated in some modern systems such as Git and Darcs. Solution recommended to me is to have a script generate the information and then write it to a file.
Then add the information from file using |
|||||||
|
|
To get the revision id, date and time inside the document you need to use keyword substitution. Once you've set up your repository to do the substitution you can then insert |
|||
|
|
|
To do this I don't use a LaTeX package, but I play with a Makefile and some simple shell scripts. (But that also mean that this is a Unix/Linux/Cygwin hack). Add something like this a Makefile
Then add something like this in a .tex file
Maybe with a check so you don't get a error if you don't want to include this svn info.
This can be changed to include some kind of diff if you rather would like that. Add something like this in your Makefile to include a diff between the current version and verison 40.
Then add something like this to your .tex.
And this can then be enhanced with whatever shell scripts you feel like, so I don't see any problem doing more or less the same for other systems like git. /Have fun |
||||
|
|
|
If your document uses multiple source files like |
||||
|
|
|
there is a nice package called gitinfo for the use with git. In combination with some easy Makefile gymnastics, this gives pretty nice results, all explained well in the manual of the package. |
||||
|
|
|
For better diff-s in git, set Configuration in my repo:
|
|||
|
|
Regarding highlighting differences between documents under version control, there is also a discussion here: texdiff for multi-file documents in subversion As I mentioned in that post, if you have multi-file projects in Subversion and want to highlight differences the only reliable solution I found is first to flatten the document and then run latexdiff on that document. I created a batch file that does everything, from flattening to creating a PDF highlighting the differences, automatically with one click. You can find a little tutorial and download the batch on my website http://www.jwe.cc/2012/02/workflow-with-subversion-and-latex/. |
|||
|
|
