Purplelink
← All guides

latexdiff online for a multi-file project

A revision usually asks for a marked-up PDF, and a real manuscript is rarely one file. This guide covers the commands for a project with \input and \include, the options that fix the usual failures, and what our online tool does with a project.

Everything below about latexdiff, latexdiff-vc and latexpand comes from their own documentation: the manual embedded in the latexdiff source and the help text of latexpand, both read on 2026-10-13. I did not run the commands for this page, because neither program is installed on the machine I wrote it on, so there is no sample output here. Run them on a copy of your project first.

Which tool for which job

One file

With a single .tex file per version:

latexdiff old.tex new.tex > diff.tex
pdflatex diff.tex

The manual says the old and new files must be real files, not pipes. It also says the preamble is compared line by line while the body is compared word by word, so a changed preamble shows up as commented lines (%DIF) rather than as marked text.

A project with several files

latexdiff compares the text of the two files you give it. If the main file only contains \input{intro}, a comparison of two main files sees an unchanged line. You need the included text in front of latexdiff. There are three ways to get it.

Option 1: latexdiff-vc with git

If the project is in a git repository, latexdiff-vc (installed alongside latexdiff) can check out two revisions into a temporary directory, flatten them and compare them. From the documentation:

# working copy against the last commit
latexdiff-vc --git --flatten -r HEAD main.tex

# two named revisions
latexdiff-vc --git --flatten -r v1-submitted -r HEAD main.tex

Here v1-submitted stands for any tag, branch or commit in your repository. Points from the documentation worth knowing:

Option 2: flatten with latexpand, then compare

If the versions are two folders rather than two commits, flatten each one first. latexpand expands \input and \include and, by default, strips comments.

latexpand old/main.tex -o old-flat.tex
latexpand new/main.tex -o new-flat.tex
latexdiff old-flat.tex new-flat.tex > diff.tex

Two options from its help text matter for manuscripts. --keep-comments keeps comment lines, which is the documented workaround for verbatim blocks, because latexpand does not recognise verbatim environments and would strip a % inside one. --expand-bbl FILE inlines a compiled .bbl file; --biber FILE does the same for biblatex with biber. Compile diff.tex in the folder of the new version, or copy that version's figures and class files next to it, so LaTeX can find them.

Option 3: let latexdiff flatten

latexdiff has its own flag:

latexdiff --flatten old/main.tex new/main.tex > diff.tex

The manual says this replaces \input and \include in the body with the file contents, recursively, honours \includeonly, and also handles \import, \subimport and \subfile. It assumes included files sit in the same directories as the old and new main files. It also warns that processing time can become prohibitive for larger documents and that the result no longer reflects the structure of your input files. If it is slow on a long thesis, option 1 or 2 is the fallback.

Common failures and the options that exist for them

Every option below is listed in the latexdiff manual. Add them to the same command line.

A moved paragraph is compared as text, so it shows as deleted in one place and added in another. The manual describes no move detection.

What our online tool does today

Everything here is taken from the LaTeX diff tool page itself.

The tool page does not list any latexdiff options, so you cannot pass --math-markup or --append-textcmd to it, and it does not say how it handles a bibliography. If your project needs those, run latexdiff locally with the commands above. Install LaTeX on a Mac if you do not have a TeX distribution yet.

After the PDF

Check your journal's submission instructions for whether it wants a marked-up PDF. Producing a diff PDF for journal resubmission covers producing one. To compile the project itself in a browser, see compile a LaTeX project online, and check your response letter before resubmitting before it goes out.