Since my first post on version control systems (VCS) and latexdiff, the whole kaboodle has become much easier for the user. Instead of looking for some python scripts to ease the generation of diffs, latexdiff itself offers this functionality. For example,
latexdiff-vc --hg --pdf -r 0 example.tex
will create a diff between the original(-r 0) and current version of example.tex handled by mercurial (--hg), and compile the resulting diff by pdflatex (--pdf).
Even better, latexdiff supports multi-file documents, the use of which is highly advisable for dissertations and books or other long documents. The workflow is simple: as usual, we create the repository and add files to it, but this time all files have to be included:
hg init hg add master.tex file1.tex ... filei.tex ... filen.tex hg commit -m "Initial version"
And after editing an arbitrary file:
hg commit -m "Did this or that" latexdiff-vc --hg --pdf --flatten -r 0 master.tex
Voilà, here's your compiled diff. 😎
As a sidenote: I have seen way too many students trying to compile the active chapter of their dissertation, just to realize that only the master file including their active chapter can be compiled. Hence, they classical sequence: compile – oops, switch tabs, compile, switch tabs, edit, compile – oops, etc. etc. ad nauseum. Except for masochistically inclined witers, there's a simpler and better way.
Indeed, many specialized LaTeX editors (TeXWorks, TeXStudio) and also several of the most prominent general programming editors with a LaTeX extension (Sublime Text with LaTeX Tools, VS Code with LaTeX Workshop, Vim with Vimtex ...) respect the following magic command at the top of the active chapter:
% !TeX root = master.tex
Only Emacs with auctex needs a slightly different syntax:
% -*- TeX-master: "master.tex" -*-
After setting this command, you can just type and compile, and your focus will not be distracted any longer by the compilation cycle sketched above.