Search code examples
pdfversion-controllatex

Track and output changes/diffs between LaTeX document revisions to PDF?


We want to keep track of changes in a LaTeX document in such a way that people who can't read LaTeX can also see the changes at once. The .tex files are stored in a git repository. So detailed information about the changes is available.

For this purpose I think it might be possible to use the git diff output between two revisions to generate the PDF and somehow mark the changes since the selected other revision of the document.

Do you know of an (easy) way to achieve this?

Do you know of other ways to visualize differences between PDF files?


Solution

  • [Expanding on my comment, since it apparently helped :-) ]

    latexdiff is a Perl script that can diff two LaTeX documents and mark up changes without the distractions of the LaTeX markup itself. The README says:

    latexdiff is a Perl script, which compares two latex files and marks up significant differences between them (i.e. a diff for latex files). Various options are available for visual markup using standard latex packages such as "color.sty". Changes not directly affecting visible text, for example in formatting commands, are still marked in the latex source. Note that only files conforming to latex syntax will be processed correctly, not generic TeX files. Some further minor restrictions apply, see documentation.

    A rudimentary revision facilility is provided by another Perl script, latexrevise, which accepts or rejects all changes. Manual editing of the difference file can be used to override this default behaviour and accept or reject selected changes only.

    The author is F Tilmann.

    The project is developed on Github, but you can get the script in a tarball from CTAN if you prefer. The link in the comment is a useful overview of how to use it.