The program latexdiff is a simple program that can compare the changes of two versions of TeX files and generate a new TeX file with highlights of the changes. The program is shipped with most tex distributions.
There is a lot discussions on how to integrate latexdiff with version control systems like git. If you have your tex documents git-controlled. You want to check the change of two revisions visually (not the standard git-diff for text files but you want see the difference in a pdf file for two tex files). For sophisticated solution integrating with git, you may consider using git-latexdiff.
A simple solution is to run the command
latexdiff <(git show oldcommit:file.tex) file.tex > diff.tex
and then simply run e.g.
pdflatex -interaction=nonstopmode diff.tex
to see the changes in diff.pdf.
UPDATE: If you run into troubles that some tex environments (e.g. tables) do not diff properly with latexdiff, you could provide a custmized config file. e.g. ld.cfg containing the following information
PICTUREENV=(?:picture|DIFnomarkup|table)[\w\d@]
and run latexdiff as
latexdiff -c ld.cfg <(git show oldcommit:file.tex) file.tex > diff.tex
Leave a Reply