Produces a PDF from two LaTeX sources with all changes visually marked — insertions in dark green, deletions in red strikethrough by default. Both colours are configurable.
Wraps latexdiff and handles the full build pipeline: bibliography generation, multi-file projects, and arXiv-style embedded .bbl files.
pdfdiff [OPTIONS] <original> <modified>
Each source can be:
| Form | Example |
|---|---|
| Git branch name | main |
.tex file path |
paper/main.tex |
| Project directory | paper/ |
For directories and branches, the file containing \documentclass is used as the root automatically.
diff.tex and diff.pdf are written to ./diff/ by default, or to the directory specified with --output.
Never use your active project directory as the output path. The modified source is copied into the output directory during the build — any existing files there can be overwritten.
| Flag | Default | Description |
|---|---|---|
--output <DIR> |
./diff/ |
Directory to write diff.tex and diff.pdf |
--no-cleanup |
— | Keep intermediate build files in the output directory |
--add-color <COLOUR> |
green!50!black |
Colour for inserted text |
--del-color <COLOUR> |
red |
Colour for deleted text |
Colours accept any xcolor expression: named colours (blue, orange), DVIPSNames (NavyBlue, ForestGreen), or mixed expressions (red!70!black, blue!50!white).
# Compare two git branches, output to ./diff/
pdfdiff main feature-branch
# Compare two directories
pdfdiff paper-v1/ paper-v2/
# Compare specific .tex files
pdfdiff old/main.tex new/main.tex
# Write output to a custom directory
pdfdiff main feature-branch --output out/
# Keep all intermediate build files
pdfdiff main feature-branch --no-cleanup
# Custom colours
pdfdiff --add-color blue --del-color orange old.tex new.texWorks on Linux and macOS. Windows 10+ should be supported as long as the dependencies are installed.
Required:
latexdiff— usually part of TeX Live / MiKTeXpdflatexgit(for branch inputs)
Optional but recommended:
latexpand— enables--flattenso\input/\includedirectives are inlined; ships with TeX Livebibtex/biber— required if the project has a bibliography
Either download the latest release, or if you have cargo installed you can run:
cargo install pdfdiff- Each source is resolved to a root
.texfile (extracting git branches viagit archiveinto a temp directory as needed). - The modified project is copied into the output directory so all relative asset paths work.
- The modified source is pre-built (
pdflatex+ bibliography tool) to generate.bbland other artifacts before the diff is compiled. latexdiffproducesdiff.texwith change markup.- Colour overrides are injected just before
\begin{document}: insertions are coloured, deletions get a strikethrough —\soutin text mode,\bcancelin math mode (since\soutdoes not work inside equation environments). diff.texis compiled twice withpdflatexto resolve cross-references.
Projects that embed \input{main.bbl} instead of a live \bibliography{} call are handled automatically: a minimal .aux stub is written and bibtex is run to synthesise the missing .bbl before compilation.