views:

122

answers:

5

Does anyone know of a diff viewer or comparison program that can do paragraph-based differentials? My repos has a large number of LaTeX files that are formatted into 80-character wide paragraphs (for easy editing with vim). It's currently very difficult to interpret the diffs between various versions, because any edit that caused the position of the line breaks to change results in a lot of spurious differences that show up in the diff.

A: 

If you don't mind reformatting before diffing, you could reformat each paragraph into one very long line, and then use a diff tool that shows intra-line differences (in addition to line differences, which in your case would represent paragraph differences).

Alternately, with more clever reformatting, you could reformat each paragraph such that there is one sentence per line.

Greg Hewgill
+1  A: 

I've always found it easier to manually line break at the end of sentences. This makes editing things easier, since if you've printed out a version of the pdf output and written on that, you can just scan the left hand side of the page for the start of the sentence you want to change.

This would also mean that any differential program would not give a ton of spurious diffs.

Seamus
I like this solution, but the problem is then to deal with coauthors that won't follow that kind of conventions...
Damien Pollet
+3  A: 

You want wdiff.

Although I endorse breaking the line at the end of each sentence. Not only does it make it easier with source-code control, it makes it easier with co-authors as well.

Norman Ramsey
I had to create a wdiff wrapper based on http://codesnippets.joyent.com/posts/show/1033, but after that this worked.
JSBangs
+1  A: 

I use latexdiff which works extremely well for minor edits, not so good if you have major changes.

Rob Hyndman