This post introduces how to use latexdiff to compare two versions of latex *.tex files, in order to visually mark changes to tex files.
(One colleague asked me about the usage of latexdiff, so I think it is a good time to write it up into a blog post to share with those who need some help with this.)
latexdiff is a Perl script and requires an installation of Perl 5.8 or higher.
Use latexdiff to mark differences and create a new LaTeX document with markup differences between two latex files.
Linux (Ubuntu) users
latexdiff can be found in Ubuntu repository and detailed description of usage can be found here.
In your terminal, issue the commands below to install latexdiff.
sudo apt-get update sudo apt-get install latexdiff
# open your terminal, and cd to the tex files you need to compare # issue the following command latexdiff original_version.tex revised_version.tex > diff.tex
Run the diff.tex file like you run a normal tex file, you will see beautifully marked differences in the pdf file.
Mac OS X users
$ latexdiff original_version.tex revised_version.tex > diff.tex
Multiple tex files for each version
If each version of your text files contains multiple (sub) tex files or if you want to use latexdiff with Git, check the Reference lists for potential solutions.
LATEXDIFF: SUPERB DIFF TOOL FOR LATEX (pdf) — talks about solutions to multiple files, but this can only deal with sub-files on the same level, not nested cases.
Two LaTeX gems: ShareLaTeX and latexdiff (pdf)
Using Latexdiff For Marking Changes To Tex Documents (pdf)
Multiple-file LaTeX diff (pdf) — this one is very good. – use python code to merge multiple tex files to one big tex file for each version and then use latexdiff to make comparision.
Latexdiff with subfiles (pdf) — this one talks about solutions to multiple tex files.
Using latexdiff with git (pdf) – Git Latexdiff — this is about using git together with latexdiff
Git and latexdiff: compare versions of LaTeX documents (pdf) — this is also about using git together with latexdiff