"Track changes" in LaTeX

You can process your TeX files with the Perl program latexdiff that is included with most LaTeX distributions.

From the manual:

Briefly, latexdiff is a utility program to aid in the management of revisions of latex documents. It compares two valid latex files, here called old.tex and new.tex, finds significant differences between them (i.e., ignoring the number of white spaces and position of line breaks), and adds special commands to highlight the differences.


I have used the changes package in the past and I find it very useful. It has a key=value system so most of the things are customizable. You can define different authors and the changes are tracked depending on the id; here is a simple example (mostly from the manual).

\documentclass{article}

\usepackage{changes}
\usepackage{lipsum}% <- For dummy text
\definechangesauthor[name={Per cusse}, color=orange]{per}
\setremarkmarkup{(#2)}


\begin{document}
\lipsum[1-7]

This is \added[id=per,remark={we need this}]{new} text.
This is \added[id=per,remark={has to be in it}]{new} text.
This is \deleted[id=per,remark=obsolete]{unnecessary}text.
This is \replaced[id=per]{nice}{bad} text.

This is \added[remark={we need this}]{new} text.
This is \added[remark={has to be in it}]{new} text.
This is \deleted[remark=obsolete]{unnecessary}text.
This is \replaced{nice}{bad} text.


\listofchanges
\end{document}

enter image description here

And the nice thing is that if you supply the final option to the package declaration that is \usepackage[final]{changes} it clears the traces of changes made by the authors and respecting the last changes. See the replaced and deleted text for an example.

enter image description here


Latex documents are plain text. Therefore you can handle tracking changes for Latex documents using the same robust methods that millions of software developers have been using for decades!

Short description of how software developers track changes in their source code:

  • keep the source in version control (git, svn, or whatever)
  • use differencing software to see what changes are made in between each revision (diff, vimdiff, Beyond Compare)

Here is a screenshot of what a diff program looks like (in this case this is a stock photo from Beyond Compare's website):

Beyond Compare Screenshot

(I actually don't use Beyond Compare. I prefer plain diff with vim which colorizes the diff.)

So whenever a change is made the change is saved in version control. And your version control keeps track of all changes. Allowing you to do things like: compare the two most recent versions, or compare the most recent with 5 versions back... or compare arbitrary version to arbitrary version. You have all the versions stored in version control!