# latexdiff: seeing what changed between two LaTeX files

> latexdiff is a Perl script that compares two LaTeX files and writes a third file with the differences marked up for visual review, using standard LaTeX packages such as color.sty. It is not a text diff, and it ships in three variants that do not agree on every difference.

**ftilmann/latexdiff** — Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors

- Repository: https://github.com/ftilmann/latexdiff
- Stars: 678 · Forks: 87
- Language: TeX
- License: GPL-3.0
- Published: 2026-10-21 · Updated: 2026-10-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/ftilmann-latexdiff

## latexdiff writes a third LaTeX file, not a list of changed lines

latexdiff takes two LaTeX files and produces a LaTeX document that shows the differences between them, which the README describes as a diff for LaTeX files. The output is meant to be looked at, not read as text, and the markup uses standard LaTeX packages such as color.sty, so the marked-up file compiles like any other document.

The rule that catches people is that changes which do not touch visible text are still marked in the LaTeX source. A command that only affects formatting, say a switch added to a sectioning macro, shows up in the diff even though the rendered page looks the same. That is a deliberate choice, since formatting changes are often the substantive edit in an academic paper, but it means the diff is noisier than the visual difference between the two PDFs.

The other hard limit is the input. The README states that only files conforming to LaTeX syntax will be processed correctly, not generic TeX files, and that further minor restrictions apply, with the details in the documentation. A document heavy in plain TeX macros, or one that depends on package-specific tricks, is where you should expect trouble.

The manual is distributed as a PDF, latexdiff-man.pdf, linked from the CTAN page, and usage instructions are also in the man pages. The change history lives in comment lines at the top of the Perl scripts latexdiff, latexdiff-vc and latexrevise, which is an old-fashioned but effective convention for a tool whose users edit the source.

## Three variants that do not always find the same differences

latexdiff comes in flavours that differ in speed, in dependencies, and in output. The standard latexdiff script needs the Algorithm::Diff Perl package, available from CPAN, listed at version 1.19 in the README. The problem the author describes is that latexdiff uses internal functions of Algorithm::Diff whose calling format or availability can change without notice, so the preferred method is now the standalone version latexdiff-so, which has version 1.15 of the package inlined and needs no external installation.

The third variant, latexdiff-fast, inlines a modified Algorithm::Diff that internally uses the UNIX diff command. The README is explicit about the consequence: because the algorithm differs from the UNIX diff behaviour, the resulting set of differences will generally not be the same as for the standard latexdiff. In most practical cases the differences are minor, though. That is the trade-off in one sentence. The fast build is quicker on large documents and its output is not guaranteed to match the standard build, which matters if you compare diffs produced by different people on different machines.

All three need Perl 5.8 or higher, and the scripts are plain files you copy into place rather than a package with a dependency manager. The repository layout shows the family clearly: Algorithm-Diff-Block, Algorithm-Diff-Fast, the scripts latexdiff, latexdiff-vc and latexrevise, a testsuite directory and a testsuite-vc directory, plus a legacy directory for older versions.

## Installing on UNIX with make install, and testing before you commit

The README calls the basic installation almost trivial. You copy latexdiff, latexrevise and latexdiff-vc into a directory on the search path and make them executable, using latexdiff-so instead of latexdiff if the Algorithm::Diff package is not installed. You copy latexdiff.1 and latexrevise.1 into the correct man directory, and optionally create soft links named latexdiff-cvs, latexdiff-rcs, latexdiff-git, latexdiff-svn and latexdiff-hg for latexdiff-vc. The README also notes that doing it by hand is often as easy as using the Makefile.

The Makefile offers three install targets and three matching test targets, chosen by which Algorithm::Diff you want:

```bash
  `make install`          (for the stand alone version)
```

```bash
  `make install-ext`      (for the version using the external Algorithm::Diff)
```

```bash
  `make install-fast`     (for the version using the UNIX 'diff' function for fast differencing)
```

The test targets are make test, make test-ext and make test-fast, and they run the respective version against a brief example before installation. The repository ships example-draft.tex and example-rev.tex for exactly this purpose, and the Makefile distribution target also builds dist/doc/example-diff.tex, which is the marked-up result you can inspect. Running the test first tells you whether the version you plan to install behaves on your machine, which is worth the minute it takes, given that the fast variant is known to disagree with the standard one.

The Makefile in the repository carries VERSION=1.4.1a, which is the development version ahead of the last release.

## latexrevise turns a marked-up document into an accept or reject decision

Generating the diff is only half of the workflow. The README describes a rudimentary revision facility provided by a second Perl script, latexrevise, which accepts or rejects all changes. The intent is that you review the marked-up document, decide which changes you want, and let the script fold the rejected ones back out.

Rudimentary is the honest word. The facility is all or nothing, and the README explains how to go finer grained: manual editing of the difference file can be used to override the default behaviour and accept or reject selected changes only. In other words, the fine-grained path is you editing the generated LaTeX by hand, and latexrevise is the convenience for the common case where you want all of it or none of it.

That division shapes the real workflow for a paper revision. You run latexdiff on the submitted version and the revised version, read the result, then either keep everything with latexrevise and adjust the text yourself, or hand-edit the difference file to select individual changes. Teams that need a formal per-change approval trail, or a reviewer UI, are outside what this script pair provides.

The other Perl script in the family, latexdiff-vc, wraps latexdiff for version control systems. The soft links named latexdiff-cvs, latexdiff-rcs, latexdiff-git, latexdiff-svn and latexdiff-hg point at it, so the same invocation works across several systems.

## A wrapper ecosystem, including a browser-only build that needs no Perl

The contrib directory collects code written by other people, and the README names the pieces and their authors. latexdiff-wrap, by V. Kuhlmann, is an alternative wrapper that can be used instead of latexdiff-vc and is meant as a template for customised wrappers. latexdiff.spec, by T. Doerges, is a spec file for RPM generation. latexchanges, by Jan-Ake Larsson, wraps latexdiff for use with numbered document versions, with details in contrib/README.latexchanges.

The external support programs are where the interesting differences in approach appear. latexdiffr, by David Hugh-Jones, is a small library that uses the latexdiff command to create a diff of two Rmarkdown, Rnw or TeX files, so it extends the reach into R workflows. latexdiffcite, by Christer van der Meeren, wraps latexdiff to make citations diff properly by expanding cite commands using the bbl or bib file, so citations are treated as normal text instead of atomic units.

git-latexdiff, with lead author Matthieu Moy, is a bash wrapper that diffs two revisions of a LaTeX file under git version control. The README is careful to separate it from latexdiff-git, which is normally installed as a soft link to latexdiff-vc, and notes that git-latexdiff allows more fine-grained control, while latexdiff-vc offers similar functionality via the --git option with the --flatten option included in the distribution.

The most different option is latexdiff-ui, by Tan Jing Jie, a browser-only web application that runs latexdiff entirely on the client through WebAssembly and WebPerl via the wasm-latex-tools package. Users paste or drop old and new .tex files into a three-column editor, set options such as --type, --subtype, --floattype, --math-markup, --encoding, --flatten and --allow-spaces, and copy or download the generated diff.tex without uploading sources to a server. It targets authors who want tracked-changes markup without installing Perl, which is a genuinely different deployment model from the same underlying algorithm.

## Where latexdiff is the wrong tool

The clearest wrong-tool case is a document that is not LaTeX. The README says plainly that only files conforming to LaTeX syntax will be processed correctly, not generic TeX files. The script parses the source, which means it must understand the constructs it encounters, and a document leaning on plain TeX expansion or unusual package internals is outside that guarantee. Further minor restrictions apply, and the documentation is where you would find them.

The second wrong-tool case is automation that needs a stable, machine-readable difference set. latexdiff outputs LaTeX markup, not a structured list of changes, and the fast variant is documented to disagree with the standard variant on which differences it reports. If your pipeline compares output on two different machines, or diffs the output of the fast and standard builds against each other, the differences in the difference set become a source of noise that you have to explain.

The third is a process that needs per-change sign-off. latexrevise accepts or rejects everything, and anything finer is manual editing of the generated file. A review workflow with named reviewers, tracked decisions and an audit trail is not what these scripts provide, and no wrapper listed in the contrib directory changes that.

There is also a licensing angle to weigh. The project is released under the GNU General Public License Version 3, which governs the tool. The marked-up document that latexdiff produces, and the fact that this tool exists in the CTAN distribution, mean the GPL obligations attach to the software, while the document you generate is your own work and the two questions should be kept apart when you decide how latexdiff fits your workflow.

## Release cadence, CTAN distribution and what the versions tell you

latexdiff is distributed through CTAN at ctan.org/pkg/latexdiff and mirrors, and the README points to the manual PDF on the CTAN mirrors. Releases are recorded in the repository: version 1.3.3 on 2022-09-25, version 1.3.4 on 2024-07-21 and version 1.4.0 on 2026-01-02. The README header for the current release lists the trio that ships together, latexdiff 1.4.0, latexrevise 1.3.2 and latexdiff-vc 1.3.4, so the three scripts move at their own pace rather than in lockstep.

The last push was on 2026-09-20, and the Makefile version string of 1.4.1a indicates that work has continued on the 1.4.1 line since the January release. The gap between 1.3.3 and 1.3.4 is about two years, and 1.3.4 to 1.4.0 is about a year and a half, so this is a project with long intervals between tags rather than a continuous release stream. For a tool like this that is a reasonable rhythm, since the work depends on LaTeX itself evolving slowly, but it does mean your distribution may be a year behind the repository.

Packaging is handled by the Makefile, whose distribution target assembles the scripts, the man pages, the manual PDF, the example documents, the COPYING file, the README and the contrib directory into a release tree, then tars it with the top level directory named latexdiff, a convention CTAN requested. Contributors are welcome through pull requests, with the wiki holding the detail, and the changelogs stay in the comment headers of the scripts rather than in a separate file.

## Conclusion

latexdiff suits authors and reviewers who need a readable redline of a LaTeX document, and it fits badly for generic TeX files, for markup you plan to feed to a machine, or for teams that want the same difference set on every machine. Before adopting it, run make test on your platform to see whether the inlined Algorithm::Diff output matches the examples, check whether your files use macros that the script cannot expand, and confirm that GPL-3.0 obligations are acceptable for a tool whose output becomes part of your published document.

## FAQ

### What does latexdiff compare and what does it produce?

It compares two LaTeX files and produces a LaTeX document with the differences marked up, using standard packages such as color.sty. Formatting-only changes are also marked in the source even though they do not change the visible text.

### How do I install latexdiff on Linux?

Copy latexdiff, latexrevise and latexdiff-vc into a directory on the search path and make them executable, or use the Makefile targets make install, make install-ext or make install-fast. The matching test targets are make test, make test-ext and make test-fast. Perl 5.8 or higher is required.

### What is the difference between latexdiff, latexdiff-so and latexdiff-fast?

latexdiff needs the external Algorithm::Diff package, latexdiff-so inlines version 1.15 of it and is the preferred method, and latexdiff-fast uses the UNIX diff command and is much faster. The README warns that the fast version will generally report a different set of differences from the standard one.

### How do I accept or reject individual changes in a latexdiff result?

latexrevise accepts or rejects all changes at once. For finer control the README says to manually edit the difference file, overriding the default behaviour to accept or reject selected changes only.

### Can I use latexdiff without installing Perl?

Yes. The README describes latexdiff-ui, a browser-only web application that runs latexdiff on the client through WebAssembly and WebPerl, where you paste two .tex files, set options, and download the generated diff.tex without uploading sources.

## Sources

- [ftilmann/latexdiff on GitHub](https://github.com/ftilmann/latexdiff)
- [Issues](https://github.com/ftilmann/latexdiff/issues)
- [License: GPL-3.0](https://github.com/ftilmann/latexdiff/blob/master/LICENSE)
- [README](https://github.com/ftilmann/latexdiff/blob/master/README.md)
- [Releases](https://github.com/ftilmann/latexdiff/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/ftilmann-latexdiff
