Following my previous question, I have successfully created a dif.tex file of a large, complex project, the results of which can be seen here. (This was done, in the end by updating latexdiff to the latest version: 1.0.3 which is not in Ubuntu 12.04 ppas and using: PICTUREENV=(?:picture|DIFnomarkup|lstlisting|figure|table)[\w\d*@]* as the configuration file.

It is great to be able to scroll through the document and see all the improvements that have been made. Thank you latexdiff!

The next problem is that the pdf document is very large and changes are relatively sparse - I cannot expect my examiners to look through all 300 pages looking for red and blue text to indicate changes. What I need is a summary of changes. This would, at a minimum, contain the text that had changed. Ideally it would also contain surrounding words for context and (a long shot) the page number of the alteration. Ways I've though of doing this:

  • Redefine the \DIFdelbegin environment
  • Use a regex like grep to extract all lines from dif.tex containing \DIF and compile this separately
  • Do it using latexdiff commands (I've checked the documentation, but cannot see how.
  • Would a different approach altogether be better for solving this problem (making an accessible list of changes made, without including text that has stayed the same).

I know a similar question was closed on this site. Hopefully the clarity of this question and provision of an example will make it useful for others.

3 Answers 3


There is a new functionality in latexdiff since version 1.1.0 that outputs only those pages where a change has been made.

Check out option --only-changes to latexdiff-vc or options -s ONLYCHANGEDPAGE or -s ZLABEL for latexdiff. The former is much more convenient as the post-processing is done behind the scenes.

(I know this question is really old, but the improvement to latexdiff in this respect since the original answers were posted are significant)


I think the easiest way by far is to use grep. The GNU implementation of grep (which is what you have if you're running GNU/Linux), provides a switch called -C to do exactly what you want: it provides context lines around the match.

Something like this should help

grep -C 5 '\\DIF' source.tex > destination.tex

This will provide 5 lines before and 5 lines after the match. Modify ad libido.

Ways this can fail

  • If the context lines cross LaTeX environment/group boundaries, your new document will fail to compile.
  • If a \DIF exists within a 5-line "radius" of another one, grep's output will contain duplicates. This may not be much of an issue if your edits are indeed sparse but you may have to check for it visually.
  • 1
    This is a good effort Joseph, thanks for alerting me to the power of the -C switch in grep. It certainly pulled out all the text that had changed, but, as you warn, it does not compile due to unfinished environments etc. The output file grep -C 2 '\\DIFdelbegin' dif.tex > difsum.tex needs a LOT of cleaning: dropbox.com/s/folthk89y6k6gzu/difsum.tex . Another problem is that the output, once cleaned is all squished together: dropbox.com/s/30f7ihwex8qyko6/difsumm.pdf There must be a better way! Dec 26, 2013 at 0:49

Do it manually.

I found that the best way to create a "summary of changes" was to search through the dif.tex file and hand-pick the changes that I needed. This was great, as it allowed me to include only the changes that were needed and include enough context to allow others to understand why the changes had been made.

The result (see difsum.pdf), along with the relevant .tex files and reproducible code and example data thesis have been put GitHub to encourage transparent and repeatable research: https://github.com/Robinlovelace/thesis-reproducible . Hopefully this will be of use to other people looking to optimize their use of LaTeX for the submission and alteration of thesis projects.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .