Skip to content

Instantly share code, notes, and snippets.

@cgarbin
Created February 10, 2021 13:06
Show Gist options
  • Save cgarbin/032a2a525b27f22e38584d44f863adfc to your computer and use it in GitHub Desktop.
Save cgarbin/032a2a525b27f22e38584d44f863adfc to your computer and use it in GitHub Desktop.
Comparing and annotating version of LaTex documents

How to compare versions of a LaTeX project

Instructions tested on Mac OS

Tool: https://ctan.org/pkg/latexdiff

Using it with multi-file projects: https://tex.stackexchange.com/a/167894

Mac OS installation: https://tex.stackexchange.com/a/548553

With Overleaf:

  1. Go to "History"
  2. Select the old version > "Download project at this version"
  3. Select the new version > "Download project at this version"
  4. Unzip both files
  5. Run latexdiff

The command below:

  • Processes subfiles
  • Generates one output file (--flatten)
  • Handles commands that break the diff output if not flagged (--append-textcmd=...). For example the FIXme package)
latexdiff --append-safecmd="subfile" \
    --append-textcmd="chrfatal,chrnote,dsquestion,dsanswer" \
    old/main.tex new/main.tex \
    --flatten > diff.tex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment