2

I would like to know if anyone has a nice way of combining latexdiff-rcs with printing actual RCS tags in their document.

For example, I am using CVS to version control a latex document. My document page headers have the RCS tags Revision, Date and Author in the preamble of my tex document,

\usepackage{rcs}

\RCS$Revision: 1.36 $ % or any RCS keyword
\RCS$Date: 2011/11/01 09:53:19 $
\RCS$Author: shaun $
\date{Revision \RCSRevision, \RCSDate, \RCSAuthor}

\fancyhf{}
\chead{Revision \RCSRevision, \RCSDate, \RCSAuthor}
\rhead{\thepage}
\pagestyle{fancy}

If I then use latexdiff-cvs with an earlier revision, latexdiff parses this into,

\RCS\DIFdelbegin \DIFdel{$Revision: 1.26 $ }\DIFdelend \DIFaddbegin
\DIFadd{$Revision: 1.27 $ }\DIFaddend % or any RCS keyword
\RCS\DIFdelbegin \DIFdel{$Date: 2011/03/08 08:22:24 $
}\DIFdelend \DIFaddbegin \DIFadd{$Date: 2011/04/29 06:50:24 $
}\DIFaddend \RCS$Author: shaun $

Which doesn't really compile the page header at all. However, if latexdiff gave me this,

\RCS$Revision: \DIFdelbegin \DIFdel{1.26}\DIFdelend \DIFaddbegin \DIFadd{1.27} \DIFaddend $ % or any RCS keyword
\RCS$date: \DIFdelbegin \DIFdel{2011/03/08 08:22:24}\DIFdelend \DIFaddbegin \DIFadd{2011/04/29 06:50:24}\DIFaddend $
\RCS$Author: shaun $

Then it compiles very nicely, and looks good.

1

I do not use rcs.sty exactly because of this problem. Instead I put

\date{$ $Revision: 1.11 $ $ $ $Date: 2009-02-26 22:25:59 $ $}

which parses to

\DIFaddbegin \date{$ $Revision: 1.11 $ $ $ $Date: 2009-02-26 22:25:59 $ $}
\DIFaddend \DIFdelbegin %DIFDELCMD < \date{$ $Revision: 1.10 $ $ $ $Date: 2009-02-12 18:49:04 $ $}
%DIFDELCMD < %%%

You can do the same with your headers, I think, like this:

\documentclass{article}
\usepackage{fancyhdr,lipsum}
\def\Revision{$ $Revision: 1.2 $ $}
\lhead{\Revision}
\pagestyle{fancy}
\begin{document}
Added line

\lipsum
\end{document}
  • Thanks Boris, put this doesn't seem to work either. All this seems to do is to put the date as the current revision, it doesn't seem to have both revisions with a red strike-through on the old revision. Also, I can't seem to get this to work in the header – Shaun Nov 4 '11 at 0:47
  • Well, it seems that latexdiff-cvs takes care of deleting version tags, so having the last one seems to be the least bad option: at least it compiles. I've added example that works with RCS tags in headers. – Boris Nov 4 '11 at 1:43
  • Ok, I guess I see your point. If you just wanted the header and date enviroments to display ONLY the latest revision, then this works, without having any compiling problems. Although this is better than I originally had, I guess I was hoping to have both the old and new revision tags in the header or date environments, just with the old tags having a red strike-through that latexdiff does. The point being that when you compile the diff tex, a reader can not only see what the differences are, but can also tell what two revisions are being compared. – Shaun Nov 4 '11 at 2:28
  • I started a new question relating to the custom command argument (I hope this is ok) tex.stackexchange.com/questions/33630/… – Shaun Nov 4 '11 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.