8

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?

Lucas
  • 1,447
  • You may also want to see this question over at tex.sx: http://tex.stackexchange.com/questions/65453/track-changes-in-latex – StrongBad Dec 20 '12 at 11:53

7 Answers7

12

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

Renan
  • 17,136
10

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.

balkian
  • 452
3

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.

janos
  • 11,341
1

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

TCSGrad
  • 151
1

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.

a.m.
  • 111
0

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

jpk83
  • 19
0

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.

  • 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