Track changes and highlight revisions in LaTeX documents with latexdiff

When several authors are editing a paper, it is sometimes necessary to quickly highlight what changes have been made in a particular version of the paper compared to previous versions. Word processors have long had revision tracking features for this but some LaTeX authors are unaware that there is a handy utility called latexdiff that can also highlight changes between two revisions by comparing two LaTeX documents:

latexdiff can highlight and show changes between two versions of a LaTeX document.

This page briefly describes this program. While LaTeX authors can use revision control software like software developers to track changes, there are cases where this is not convenient. For example, grad students may revise papers, get feedback from their advisor and then revise the paper again (I know I did). The advisor just wants to see quickly and with formatting what changes were made on the manuscript without learning how to use revision control software. latexdiff provides a way to do this. It performs a “diff” (like the Unix utility) on the two documents and then creates a new LaTeX document where the changes are made clear.


  • Ensure that the latexdiff program is in your system path. Windows users with MiKTeX will find that it already comes with latexdiff: there are several latexdiff*.exe files in MiKTeX's bin directory. I usually use latexdiff-so.exe.
  • Make sure that Perl is on the system path, as it is required by latexdiff to run.


Obviously you need to have two versions of your document to compare. latexdiff can be run with the following command:

latexdiff-so old_version.tex new_version.tex > differences.tex

The resulting differences.tex file can be run through LaTeX to produce the version with revisions highlighted.

It has been pointed out to me that the file names should not have spaces or else you will have to enclose them in quotes.

Additional Tips

Sometimes latexdiff produces wrong output that will give an error when you run LaTeX on the file. In the cases I have seen, you simply need to go to the place where the error occurs and make sure that the various commands that latexdiff adds are properly closed. For example, you may have to add some \DIFaddend to unclosed \DIFadd commands.

The program does not necessarily handle complex math equations properly but I have found that it is enough to do the job most of the time. It also has a number of command line options that I have not had to use yet.

Finally, if your document is split up into sections, it might be best to split the LaTeX files up into a file per section so the diff process can work more smoothly. I have been particularly lazy and have not done this for my journal submissions but it is probably a good idea.

About Peter Yu I am a research and development professional with expertise in the areas of image processing, remote sensing and computer vision. I received BASc and MASc degrees in Systems Design Engineering at the University of Waterloo. My working experience covers industries ranging from district energy to medical imaging to cinematic visual effects. I like to dabble in 3D artwork, I enjoy cycling recreationally and I am interested in sustainable technology. More about me...

Feel free to contact me with any questions about this site at [user]@[host] where [user]=web and [host]

Copyright © 1997 - 2021 Peter Yu