What the LaTeX Diff tool does
Enter the Original (.tex) and Revised (.tex) sources, choose any normalization options, inspect the line comparison, then copy or download the generated marked-up diff.tex. The tool does not compile, execute, or render LaTeX; comparison and markup generation run in browser JavaScript.
How to compare two LaTeX sources
- Paste source into either panel, or select Upload. The file picker accepts
.tex,.latex, and.txt. Drag-and-drop reads the first dropped file without checking its extension. - For a meaningful comparison, fill both panels. The tool also renders when only one panel contains text, comparing it with an empty source.
- Choose Side-by-side or select Unified to change the displayed layout. The comparison updates as you edit the sources or change an option.
- Review Similarity, Added, Removed, and Unchanged, then inspect the diff.
- Use Copy or Download diff.tex to take the generated marked-up source. Inspect and test it in your own LaTeX document and toolchain before relying on it.
Comparison options and result statistics
- Strip % comments before comparing removes the rest of a line after a
%, unless the immediately preceding character is a backslash. It also removes trailing spaces from each processed line; it checks that character only and does not parse LaTeX escape semantics. - Normalize whitespace before comparing changes each line by collapsing spaces and tabs, trimming the line, and reducing three or more consecutive newlines to two. It preserves line breaks; it does not join rewrapped paragraph lines.
Both options prepare the sources before the line comparison and the marked-up output is built, so their effects also appear in diff.tex. Added, Removed, and Unchanged count compared lines. Similarity is unchanged lines divided by the larger prepared line count, displayed to one decimal place.
What the generated diff.tex contains
The output starts with a macro preamble using ulem and color. Added and removed token runs can use \DIFadd, \DIFdel, \DIFaddbegin, \DIFaddend, \DIFdelbegin, and \DIFdelend. The selected normalization options are applied before diff.tex is generated. The script does not add a document class, \begin{document}, or \end{document}, and it does not validate or compile the result. Inspect and test the downloaded source in your own LaTeX document and toolchain.
Limitations to check before relying on the diff
- The comparison views use a line-based Myers comparison.
- The marked-up output uses whitespace-token comparison, not a LaTeX parser.
- The tool does not validate LaTeX syntax or whether the generated macros work in every command, environment, macro argument, or document context.
- Compatibility across all LaTeX commands, environments, and document classes is not documented by the local implementation.
Is the processing private?
The comparison and markup generation run in browser JavaScript. The local implementation contains no source-upload or server-processing workflow for the text you enter or load.
Frequently Asked Questions
Does this tool compile or run LaTeX?
No. It compares source text and creates marked-up output in your browser. It does not compile, execute, or render LaTeX.
Is the diff.tex output compatible with the real latexdiff tool?
The output uses macro names also used by latexdiff, including \DIFadd, \DIFdel, \DIFaddbegin/\DIFaddend, and \DIFdelbegin/\DIFdelend. It also includes definitions using ulem and color, but universal compatibility and complete standalone-document support are not established.
What does comment and whitespace normalization do?
Strip % comments before comparing removes the rest of a line after a % unless the immediately preceding character is a backslash, and removes trailing spaces from processed lines. Normalize whitespace before comparing collapses spaces and tabs within each line, trims lines, reduces runs of three or more newlines to two, and preserves line breaks. Both affect the comparison and generated diff.tex.
Is this tool private?
The comparison and markup generation run in browser JavaScript. The local implementation contains no source-upload or server-processing workflow for the text you enter or load.