All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Audio Tools Font Tools Image Tools Subtitle Tools Video Tools
Archive Tools Document Tools Ebook Tools File Management Tools PDF Tools Presentation Tools
Config Tools Database Tools Dataset Tools JSON Tools Parser Tools Spreadsheet Tools XML Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

LaTeX Diff

Compare two .tex source files with optional comment and whitespace normalization. See a source diff, then download a marked-up diff.tex with latexdiff-compatible addition and deletion macros - no compiling or executing LaTeX.

Original (.tex)

Revised (.tex)

Paste or upload .tex source in both panels to compare.

How to compare two LaTeX files

Put the earlier source in Original (.tex) and the later source in Revised (.tex). LaTeX Diff compares the prepared sources line by line, reports Similarity, Added, Removed, and Unchanged, and creates a marked-up diff.tex with \DIFadd and \DIFdel macros. The two preparation options affect both the comparison and the downloaded source.

  1. Paste LaTeX into Original (.tex) and Revised (.tex), or select Upload for either panel. The file picker accepts .tex, .latex, and .txt files.
  2. Select Side-by-side to compare the panels next to each other, or select Unified for one combined view.
  3. Check Strip % comments before comparing to remove unescaped comment text from the prepared source.
  4. Check Normalize whitespace before comparing to reduce spacing changes in the prepared source.
  5. Review Similarity, Added, Removed, and Unchanged, then select Copy or Download diff.tex.

How LaTeX Diff compares two .tex files

The displayed comparison splits each prepared source into lines and compares those lines with a Myers diff. The marked-up file uses whitespace-separated tokens, so a changed command or value can be wrapped in addition and deletion macros.

Original (.tex): \title{Draft}
Revised (.tex):  \title{Draft v2}

Marked-up diff.tex: \DIFdelbegin \DIFdel{\title{Draft}}\DIFdelend \DIFaddbegin \DIFadd{\title{Draft v2}}\DIFaddend

The statistics describe the prepared source. Added, Removed, and Unchanged count line operations. Similarity is Unchanged divided by the larger prepared line count. If only one panel has text, LaTeX Diff compares it with an empty source.

What the LaTeX comparison options change

Strip % comments before comparing stops each line at a % whose immediately preceding character is not a backslash. It then removes trailing spaces and tabs from that line. The check examines that one preceding character; it does not parse LaTeX escape rules.

Normalize whitespace before comparing replaces each run of spaces or tabs with one space and trims each line. It reduces three or more consecutive newline characters to two, while separate paragraph lines remain separate. The prepared text feeds both the displayed diff and diff.tex.

What is in the generated diff.tex?

The output starts with a preamble that requires ulem and color. It defines \DIFadd, \DIFdel, and the add, delete, and modification begin/end markers. It does not add a document class, \begin{document}, or \end{document}. LaTeX Diff does not validate or compile the generated source.

Where this LaTeX diff comes up

Compare an earlier and revised manuscript, inspect changed lines, and download diff.tex for a review copy. The marked-up source wraps changed token runs, which lets you inspect edits to commands, values, or other source text.

When spacing is the expected difference, select Normalize whitespace before comparing. When comments should not affect the result, select Strip % comments before comparing.

Which comparison tool fits the source?

Use LaTeX Diff for LaTeX source and a marked-up diff.tex. For other formats, see Compare Text, Code, Lists, HTML, LaTeX & Markdown.

Use Code Diff Checker for programming code with syntax highlighting, line numbers, or a copyable patch. Use HTML Diff Checker for sanitized before-and-after rendered previews. Use Compare Text for plain text with word-, line-, or character-level differences and similarity results.

Frequently asked questions

Does LaTeX Diff compile or run LaTeX?

No. It compares source text and creates marked-up output in browser JavaScript. It does not compile, execute, or render LaTeX.

How does LaTeX Diff mark added and deleted text?

It wraps changed whitespace-separated token runs with macros such as \DIFadd, \DIFdel, \DIFaddbegin, and \DIFdelend. The generated file includes its macro preamble.

Can I compare LaTeX files with comments and different spacing?

Yes. Check Strip % comments before comparing to remove unescaped comment text, or check Normalize whitespace before comparing to collapse spaces and tabs. The selected preparation feeds the diff and diff.tex.

Does LaTeX Diff upload my source?

The comparison and markup generation run in browser JavaScript. This page's local implementation contains no source upload or server-processing request for the text entered here.

Related Tools

43 views