[Tex/LaTex] a good way to show changes between two versions

changeshighlighting

I would like to highlight changes between two versions of a LaTeX document.

I have both my versions in git. Is there an easy way of generating a output document where all changes are highlighted. So the highlighting should be in the output and not in the source.

The whole purpose is to indicate for my supervisor which changes I made so that he can review and approve them quickly.

Best Answer

  Rewritten answer

Because of the regular structure of typical Latex documents, it's feasible to write a diff-like program that looks at the two Latex source files and creates a compilable Latex diff output where additions and deletions are delineated using macros. With the appropriate macro definitions, you can make these appear as appropriate markup (inline, with changebars) in the compiled diff document.

There are two programs I know of on CTAN that do this, both of which are Perl scripts:

  1. latexdiff, which is the more widely used, and has support for automatic revision acceptance and version control;
  2. texdiff, my preference, which is less sophisticated and I find more predictable. texdiff doesn't try to insert Latex code into the preamble, which means you have to do this yourself, but which means it is more convenient for multifile documents, and for when you want to handle the insert/delete markup yourself.
Related Question