latexdiff: “track changes” for LaTeX

If you’re looking to display changes to a LaTeX document in different colors, say for a paper or thesis revision, you might be interested in latexdiff. This is a command-line tool that most likely came packaged with your LaTeX distribution—try running latexdiff --version in your terminal to see if you have it.

The idea is simple, just run:

latexdiff original.tex revised.tex > diff.tex

Then compile diff.tex into a PDF just like you would any LaTeX file. The result should look something like this:

This is a great tool! It isn’t completely foolproof, and you will sometimes encounter errors when compiling diff.tex, especially if you’ve changed citations between the original and revised versions. These can be resolved manually by editing diff.tex, just keep track of the line numbers where the errors are occurring.

A more detailed summary of options for latexdiff is available here:

Thanks for reading!

3 thoughts on “latexdiff: “track changes” for LaTeX

  1. Thanks Jon! I tried this out on Windows. I installed Texnic Center and MikTeX. I tried to run latexdiff on the command line and it said my Perl interpreter was not found. I then went and downloaded/installed Strawberry Perl for Windows ( I then restarted my computer, and when I logged back in, the command worked!

  2. Thanks for adding this. I’m running it from Cygwin, which has its own perl interpreter — didn’t even know it was running perl behind the scenes. Cool.

    Now that you mention it, I only came across latexdiff because it was installed automatically with the miktex distribution on Windows. So I think on OSX you would need to download the script and move it on your path somewhere like /usr/local/bin. If anyone tries this, post a comment!

  3. Pingback: Water Programming Blog Guide (3) – Water Programming: A Collaborative Research Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s