Forrest logo
back to the latexdiff tool

latexdiff:tldr:19d1a

latexdiff: Determine changes between different versions of a LaTeX file (the resulting LaTeX file can be compiled to show differences underlined).
$ latexdiff ${old-tex} ${new-tex} > ${diff-tex}
try on your machine

This command is used to generate a LaTeX diff file that shows the changes between two versions of a LaTeX document. Here's a breakdown of the command:

  • latexdiff is a command-line tool used for highlighting the differences between two LaTeX files.
  • ${old-tex} refers to the path or filename of the original (or old) LaTeX document.
  • ${new-tex} refers to the path or filename of the modified (or new) LaTeX document.
  • ${diff-tex} refers to the path or name of the output diff file where the differences will be saved.

So when you run this command in the terminal, latexdiff compares the old and new LaTeX files and generates a new file that highlights the changes between them. The resulting diff file ${diff-tex} will contain LaTeX code with added commands to display the inserted text in a different color or style, and deleted text struck-through or removed.

For example, if you have an old.tex and new.tex file and want to generate a diff.tex file, you can run:

latexdiff old.tex new.tex > diff.tex

The generated diff.tex file will contain the highlighted differences between the old and new versions of your LaTeX document.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the latexdiff tool