Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have two files paper.tex and paper_suggested_changes.tex the latter is a modified version of the former with corrections.

I need to go through the two files and choose which changes to accept or reject, how would I go about this?

share|improve this question
    
You may also want to see this question over at tex.sx: tex.stackexchange.com/questions/65453/track-changes-in-latex –  Daniel E. Shub Dec 20 '12 at 11:53
add comment

7 Answers

up vote 12 down vote accepted

Install an utility like Meld (there are other utilities for doing this, too, but I like Meld since it doesn't have KDE/GNOME dependencies) and use it for visually diffing/merging the files.

Meld is a visual diff and merge tool targeted at developers. Meld helps you compare files, directories, and version controlled projects. It provides two- and three-way comparison of both files and directories, and has support for many popular version control systems.

enter image description here

share|improve this answer
2  
Ow, nice! Why didn't I find this some months ago? Thanks so much. –  Sigur Dec 15 '12 at 23:13
add comment

I would certainly use vimdiff, simply because vim is my default editor. Check if your editor has a diff option first, as it makes things easier.

There are many graphical tools, the most user-friendly being Meld (as suggested by Renan).

Also consider using latexdiff to see the differences in a nice pdf format.

latexdiff paper.tex paper_suggested_changes.tex > changes.tex
pdflatex changes.tex

That will create a changes.pdf document with changes in different colours, and the old ones striked out.

share|improve this answer
add comment

I have never used Meld but based on the screenshot posted by @Renan it looks pretty good for the purpose.

I use vim for this and it works perfectly if you don't mind to learn how to use the keystrokes to navigate and work with the differences. The advantage of learning this is that vim likely exists in most *NIX systems so you don't need to install additional software. Here's how to use it.

  1. Run either of:

    gvimdiff paper.tex paper_suggested_changes.tex
    gvim -d paper.tex paper_suggested_changes.tex
    vimdiff paper.tex paper_suggested_changes.tex
    vim -d paper.tex paper_suggested_changes.tex
    

    gvimdiff is a shortcut to gvim -d. If you don't have gvimdiff then use gvim -d. Likewise for vimdiff. gvim is slightly easier to use than vim.

  2. You will see a vertically split window, with paper.txt in the left buffer and paper_suggested_changes.tex in the right buffer, with the differences highlighted with different colors depending on the type of the change, for example: line was added, line was deleted, lines are different.

  3. You can jump to the next difference with the key sequence ]c

  4. You can jump to the previous difference with the key sequence [c

  5. To accept a change from the other file and apply it in the current file where you have the cursor, move the cursor over the change and enter do.

  6. To switch between the left and right buffers, press ctrl+w w.

share|improve this answer
1  
I just want to mention :diffthis here. –  Bernhard Dec 20 '12 at 10:20
add comment

As some of the other answers mentioned, use Vimdiff. Here's a short list of most useful key commands you might find useful: http://stackoverflow.com/q/5288875/212942

share|improve this answer
add comment

I recommend using version control on the file. Tracking versions in a version control system will make your life a lot easier.

The simplest version control system to learn is CVS. It's basic, which means you can quickly learn its useful features, but you won't get the benefit of more complex systems' advanced features. Commit each successive version of the file, and use cvs diff paper.tex to see the differences between a new version and the last committed version, or cvs diff -r1.3 -r1.4 paper.tex to see the differences between version 1.3 and version 1.4.

With several people editing a document concurrently, you will benefit from a distributed version control system. Three common DVCS are Bazaar, Git and Mercurial. Commit each contributor's version on a branch (or better yet, set up a single repository for sharing and have each contributor commit their work to it). Periodically merge versions between branches. The DVCS keeps track of which changes you've already merged — this is a huge help to ensure you don't accidentally lose some work. The DVCS's merge command will also automatically merge parts that have only been changed by one person, so you'll only have to manually clean up the parts where there's a conflict.

share|improve this answer
3  
That, my friend, is an insane idea. I only need to diff because my collaborator is incapable of typing % and starting a new line. I quite like git, but the chances of persuading others to use it is absolutely zero. –  Lucas Dec 16 '12 at 11:09
2  
You don't have to persuade anybody. You can use a DVCS by yourself and enjoy all the benefits. –  janos Dec 20 '12 at 10:32
    
I can and do :) –  Lucas Dec 21 '12 at 6:16
add comment

You can use any of the above suggested solutions, vimdiff/gvimdiff are great if you are used to with vim. Meld is also good, but I personally like beyondcompare, It's another GUI tool like meld, meld sometimes mislead with big files, so I shifted from meld to bcompare. beyond compare is available on ubuntu software centre, also you can download .deb file from http://www.scootersoftware.com/download.php this link.

share|improve this answer
add comment

You can use xxdiff for effective selection and combining of two or three files. It can also compare directories (only 2).

It can be found here, but is also in many distros

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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