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:
https://www.sharelatex.com/blog/2013/02/16/using-latexdiff-for-marking-changes-to-tex-documents.html
Thanks for reading!
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 (http://strawberryperl.com/). I then restarted my computer, and when I logged back in, the command worked!
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!
Pingback: Water Programming Blog Guide (3) – Water Programming: A Collaborative Research Blog