I am writing a scientific paper with my collaborator. We have submitted a version to a journal and now we got a review from them, so we need to fix a few things. In Microsoft Word there is the option to "track changes", which displays the deleted text as crossed out and the new text bolded (if I remember the details correctly). Is there a way to achieve a similar result in LaTeX?

I was thinking to create a new file for the revised version and then write a script which would basically compare the two files and make the differences either bold or crossed out before sending it to latex. Is there a tool that already does it?

  • 14
    Well, there are always solutions. The key question is: do you need a solution which operates on PDF level? Or would you be satisfied with a diff-based solution (i.e. comparison of the .tex source files)? You could simply create a mercurial or git repo and commit your files - and get the history on source level for free. A solution which highlights changes in the PDF is much more difficult. What are your requirements? – Christian Feuersänger Aug 1 '12 at 12:26
  • 2
    Mendeley (mendeley.com/features/read-and-annotate) allows communal pdf markup. You'd still have to write the changes to the LaTeX source, though. – Ethan Bolker Aug 1 '12 at 12:30
  • 2
    The changebar latex package has \begin{changebar}...\end{changebar} as well as a cross environment version \cbstart...\cbend. Also the framed latex package has \begin{leftbar}...\end{leftbar}. – user1189687 Aug 1 '12 at 13:16
  • 2
    See also this question, this question, and this question – Scott H. Aug 1 '12 at 20:16
  • 1
    latexdiff is one of a solution for your requirement... – MadyYuvi Oct 20 at 7:36

11 Answers 11

up vote 141 down vote accepted

You can process your TeX files with the Perl program latexdiff that is included with most LaTeX distributions.

From the manual:

Briefly, latexdiff is a utility program to aid in the management of revisions of latex documents. It compares two valid latex files, here called old.tex and new.tex, finds significant differences between them (i.e., ignoring the number of white spaces and position of line breaks), and adds special commands to highlight the differences.

  • That looks really useful. Now I just need to script it into my document build process, which has the added complexity that most of my project's documentation is actually written in Markdown and translated to LaTeX by pandoc. So the script would have to retrieve a past revision, translate it to LaTeX, translate the present revision to LaTeX, then run latexdiff. While it will be fussy to do, it is probably easier than using a diff of the Markdown source text to drive markup of the generated LaTeX. – RBerteig Aug 2 '12 at 0:33
  • 6
    I found using latexdiff in combination with svn a killer solution. See also my earlier realted question (and answer) on this topic: tex.stackexchange.com/q/61405/2090 – Rabarberski Aug 4 '12 at 17:36
  • 7
    latexdiff is very complete and comes with many options: for instance, use the "--flatten" option if your document is divided into separate files (using \input or \include commands) – meduz Aug 8 '12 at 12:36

I have used the changes package in the past and I find it very useful. It has a key=value system so most of the things are customizable. You can define different authors and the changes are tracked depending on the id; here is a simple example (mostly from the manual).


\usepackage{lipsum}% <- For dummy text
\definechangesauthor[name={Per cusse}, color=orange]{per}


This is \added[id=per,remark={we need this}]{new} text.
This is \added[id=per,remark={has to be in it}]{new} text.
This is \deleted[id=per,remark=obsolete]{unnecessary}text.
This is \replaced[id=per]{nice}{bad} text.

This is \added[remark={we need this}]{new} text.
This is \added[remark={has to be in it}]{new} text.
This is \deleted[remark=obsolete]{unnecessary}text.
This is \replaced{nice}{bad} text.


enter image description here

And the nice thing is that if you supply the final option to the package declaration that is \usepackage[final]{changes} it clears the traces of changes made by the authors and respecting the last changes. See the replaced and deleted text for an example.

enter image description here

  • 12
    Care to explain why this is downvoted? – percusse Aug 1 '12 at 15:25
  • 2
    This is unrelated to downvotes. I just want to understand how the changes package works. The Changes package gives you a way to manually annotate an existing document with changed, deleted, etc. Each individual changed part of the document needs to be manually identified and then manually annotated (by further changing the document)? – Trevor Boyd Smith Aug 1 '12 at 18:55
  • 2
    This is awesome! – Zenon Aug 1 '12 at 19:47
  • 4
    @TrevorBoydSmith This is more suited to more than one authors, not necessarily heavy coders, such as me and my supervisor. For example, writing an article is a painful and kind of a unilateral process. My supervisor always wants to see what I did changed without reading the whole thing again etc. And he doesn't want to compile the whole thing etc. each time. So manually I plug in some changes and we discuss afterwards. I would really recommend the die-hard daily coders stay away from such stop and smell the flowers type of solution. But it's kind of indispensable for us. – percusse Aug 1 '12 at 20:10
  • 2
    @percusse, I can definitely see it happening where there is a student writing a paper with an adviser. The student has lots of time and the advisor has very little time. The student can spend lots of time marking his document to show the changes... and then maximize the productivity with the adviser. (but definitely it looks like it would take a lot of work) – Trevor Boyd Smith Aug 2 '12 at 12:38

Latex documents are plain text. Therefore you can handle tracking changes for Latex documents using the same robust methods that millions of software developers have been using for decades!

Short description of how software developers track changes in their source code:

  • keep the source in version control (git, svn, or whatever)
  • use differencing software to see what changes are made in between each revision (diff, vimdiff, Beyond Compare)

Here is a screenshot of what a diff program looks like (in this case this is a stock photo from Beyond Compare's website):

Beyond Compare Screenshot

(I actually don't use Beyond Compare. I prefer plain diff with vim which colorizes the diff.)

So whenever a change is made the change is saved in version control. And your version control keeps track of all changes. Allowing you to do things like: compare the two most recent versions, or compare the most recent with 5 versions back... or compare arbitrary version to arbitrary version. You have all the versions stored in version control!

  • 4
    @gt6989b, Yep I already saw the answer that talks about latexdiff (and I upvoted it). I decided to answer because latexdiff only allows you to diff between two versions... but does not help you keep track of the different versions. My answer focuses on both using diff AND keeping track of different versions. – Trevor Boyd Smith Aug 1 '12 at 14:33
  • 3
    The problem with plain diff on latex files are the newlines. There are two ways people store tex files. Either having a single paragraph as a single line, or using a fixed line width. With the first changing a single character in a paragraph leads to marking the whole paragraph as changed in the diff which is useless. In the second mode some editors (e.g., vim paragraph autoformat) would potentially mark multiple (sometimes all) lines in the paragraph as changed as well. Diff-ing tex documents is not a trivial issue. And that was only about plain text, no tables or equations. – walkmanyi Aug 1 '12 at 15:02
  • 2
    @walkmanyi Most diff programs have an option for ignoring white space. For GNU diff, you can use diff -w -B. – Aditya Aug 1 '12 at 15:15
  • 3
    @Aditya: simply ignoring whitespace is not sufficient, because it still respects newlines: rewrapped text would still show up as multiple changed lines even if only on one line a word had been added. Better to use wdiff or a similar tool here. – Jaap Eldering Aug 1 '12 at 19:02
  • 2
    This solution has the advantage that changes to latex comments and non-text things like tikz code show up nicely in the diff. It also allows you to diff between arbitrary revisions (e.g., what have I changed in the last month?) – Neil G Aug 1 '12 at 22:11

For completeness sake, Adobe Acrobat Professional offers an excellent tool to compare PDFs. That tool has been heavily revised for v9 and now works extremely well for all sorts of text, including tables, font changes etc.

Some advantages over latexdiff:

  • Can track changes in the bibliography
  • Changed text is "overlayed", not crossed out or underlined, allowing for a cleaner document.
  • All changes are stored as comments that can be exported.


  • 2
    latexdiff tracks changes in the bibliography as long as you include it in your text (that is by including your bbl file if you use bibtex). – meduz Aug 8 '12 at 12:34
  • 6
    diffpdf is a rather good open source alternative. – Beni Cherniavsky-Paskin Jun 10 '13 at 7:31
  • Acrobat fails on larger, more complex PDFs (e.g., 49 page LaTeX generated PDF with images), in my experience. – littleturtle yesterday

You can simply create two commands for marking added and deleted text and display them as you wish. LyX features a change tracking mechanism, which is implemented in the source like this:


%% Change tracking with ulem

Whatever you mark with \added{...} will be displayed in blue and \deleted{...} in red and strikenthrough. If such a functionality would be just enough for you, in the final compilation of your document simply redefine \added to plain text passing and \deleted to be omitted. I.e., the following snippet should do:


Note, these are commands, so you cannot use that for too long text snippets. If your changes are more like blocks of text, take a look at the versions package at CTAN.

If you need to mark the changes in the \LaTeX source, the package http://trackchanges.sourceforge.net/TrackChanges is very helpful. It comes with a couple of python programs for globally accepting or rejecting changes as well.

  • 2
    Please explain the package. Link answers are discouraged on stackexchange sites. – WetlabStudent Oct 29 '15 at 7:47

Most answers focus on one part of the question which is how to compare two versions of a document. The other part being how to keep track of changes in the document.

As it has been underlined by other answers, .tex files are actually plain text files containing the latex markup language. It can be handled using classical software development tools.

So for comparison of versions you can use diff tools.

And for keeping track of multiple versions you can use a Revision control software. I would recommend git or mercurial. Those software typically embed diff tools to check differences between various revisions of the document. The main advantage over a simple copy paste of the .tex file is that you can keep track of the whole history of the document: what changes you made 2 weeks ago ?

It is also great for multiple author writing as revision control software can keep track of who made what change as well as merge changes of automagically !

I created revdiff to build diff versions of my papers before sending them to reviewers. They have told me several times that the result was really helpfull. Hope it can be useful for you.

Find it here: http://pedromateo.github.io/revdiff-LaTeX/

If you use pdflatex, there is an Acrobat (Professional) function to compare two PDFs. For a high-level overview on the major differences, it works surprisingly well IMHO.

I think unfortunately there is no way to work with an advisor that knows latex but that likes MS Word track-changes option so much that you need to pass him directly the pure latex .tex file and he works with word on it...

For the sake of completeness, the accepted answer to an even older, similar question on Stack Overflow mentions the package todonotes, which offers "MS Word-style" commenting, and more, for those reviewers who are comfortable enough to edit the actual LaTeX code. Haven't used it myself, but it looks pretty solid. The documentation is updated as of July 2018, and provides nice examples.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.