Run LaTeXdiff →

LaTeX Track Changes for Researchers

LaTeXdiff: What It Is
and How to Use It

latexdiff compares two .tex files and produces a third file where additions appear in blue and deletions in red strikethrough — the standard way to show changes for journal resubmission. Here's how it works and how to run it without installing anything.

% Original sentence:
The model uses \DIFdel{simple gradient} descent to minimise the loss.

% After revision:
The model uses \DIFadd{stochastic gradient} descent to minimise the loss.

% Compiled PDF: additions in blue, deletions in red strikethrough

What latexdiff actually does

latexdiff is a Perl script from CTAN that compares two LaTeX source files and writes a third .tex file with the differences marked up using two macros: \DIFadd{...} for additions and \DIFdel{...} for deletions. Compile that third file with pdflatex and you get a PDF where new text is highlighted in blue and removed text appears in red strikethrough, handled by the ulem package.

The key distinction from a generic diff tool is that latexdiff understands LaTeX structure. A plain diff or git diff compares files line by line — it treats your source as raw text. Rename a \section{}, and it flags the whole paragraph as rewritten even if only one word changed. latexdiff parses the LaTeX, then diffs at the level of paragraphs, sentences, equations, and citations. The output is a compilable .tex file, not a patch file.

Not a visual PDF comparison. latexdiff compares the source files, not the compiled output. Two different source files that produce identical PDFs will still show differences in the diff. The workflow is: diff the source → compile the marked-up file → share the marked-up PDF.

latexdiff vs git diff vs Overleaf Track Changes

Researchers working in LaTeX typically reach for one of three tools when they need to show changes. Here's what each one actually produces:

Tool What it diffs Output Compilable PDF LaTeX-aware
latexdiff .tex source Marked-up .tex file Yes Yes
git diff .tex source Line-by-line patch No No
Overleaf Track Changes Live editor changes Inline tracked changes Yes Yes
Word Track Changes .docx content Inline tracked changes No No

Overleaf's Track Changes feature is equivalent to what latexdiff produces, but it requires a paid Premium subscription and only works for changes made inside Overleaf's editor. If you're comparing two completed file versions — a submitted manuscript and a revised one, for example — latexdiff is the right tool regardless of where the files came from.

When researchers actually need latexdiff

Journal resubmission

Most journals require authors to upload two files after peer review: a clean revised manuscript and a marked-up version showing all changes made in response to reviewer comments. latexdiff produces that second file. It's the standard tool for this workflow — some journals explicitly mention it in their author guidelines.

Co-author review

When multiple authors are editing a paper, sharing a marked-up PDF is clearer than sending a revised source file and asking co-authors to find the changes. A latexdiff PDF makes every addition and deletion visible at a glance without anyone needing to compare source files manually.

Thesis revision rounds

PhD supervisors often request to see exactly what changed between draft submissions. Rather than describing changes in a cover letter, a latexdiff PDF shows them directly in context — especially useful for changes to equations or figures where prose descriptions are ambiguous.

Sanity-checking your own edits

Before submitting a revised version, running latexdiff against the original confirms that you haven't accidentally deleted or altered something you didn't intend to. Equation changes are particularly easy to miss by eye.

How to run latexdiff — two paths

Path 1: In a terminal (if you have Perl and TeX Live)

On Linux and macOS with TeX Live installed, latexdiff is usually already available:

latexdiff original.tex revised.tex > diff.tex
pdflatex diff.tex

On Windows, latexdiff is a Perl script and Perl is not preinstalled. You'd need to install Strawberry Perl, then ensure TeX Live can find it — a process that takes longer than the actual diff for most people.

Path 2: In the browser, no install

LaTeXdiff Online runs the real latexdiff Perl script server-side and returns the output in the browser. Paste your two .tex files (or upload a .zip for multi-file projects), click Generate Diff, and download the marked-up .tex file. No install, no terminal, works on any OS including Windows. Files are discarded immediately after processing.

1

Paste or upload the original file

The submitted or earlier version of your paper. Paste the raw .tex source, or upload a .zip if the project uses multiple files via \input{}.

2

Paste or upload the revised file

The version with your changes. Both files need to be the same project — latexdiff compares matching paragraphs and equations, not arbitrary text.

3

Generate the diff

The tool runs latexdiff server-side and returns a diff.tex file. Compile it with pdflatex locally or on Overleaf to get the marked-up PDF.

4

If it fails to compile — check these first

Missing ulem package is the most common cause. latexdiff adds \RequirePackage[normalem]{ulem} to the preamble. The second most common cause is journal class conflicts — switch the deletion style to SAFE and try again.

The four latexdiff options that matter

latexdiff has a long list of flags, but four cover the cases most researchers actually hit:

Marking style
Default: UNDERLINE
How additions are shown. UNDERLINE wavy-underlines them inline. CHANGEBAR puts a vertical bar in the margin instead — useful if your journal prefers marginal change marks over inline markup.
Deletion style
Default: COLOR
How deletions are shown. COLOR uses red strikethrough. SAFE is the most conservative option — use it when the default output breaks compilation, usually due to journal class conflicts with \DIFdel.
Float handling
Default: IDENTICAL
How figures and tables are handled. FLOATSAFE wraps every float in protective commands. Use it if figures are silently disappearing or misplacing in the diff output.
Math markup
Default: coarse
How equations are diffed. coarse marks any changed equation as one block. fine diffs inside the equation — useful when you changed a single symbol, though it's more fragile with complex expressions.

Run latexdiff in your browser

Paste two .tex files — or upload a .zip for multi-file projects.
No install, no Perl, works on Windows, Mac, and Linux.

Open LaTeXdiff Online →