# Are there any LaTeX packages to compute and render the diff between two text files?

I look for a TeX package that could do the following, or anything close. I image the simpler use case as giving two text files of any kind as parameters :

\diff{file1}{file2}


and this command would compute a diff over these files and include into the produced document a visual rendering like:

with maybe the line number or any other useful information about it.

Does anyone know if such a TeX package exists?

-
The simplest way would be to run diff on the files and use listings to include the result. You would have to define your own syntax highlighting scheme. –  Andrey Vihrov Sep 15 '11 at 11:15
Certainly the simplest if nothing else exists... not the most convenient to use though :-( –  Stéphane Péchard Sep 15 '11 at 12:59
The question title is misleading in a way that the question seems to be off topic. You might want to rephrase it so that your intent becomes more clear (somewhat in the direction of "Are there any LaTeX packages to compute/typeset the diff between two files?") –  Daniel Sep 15 '11 at 13:16
@Daniel: just did it, thanks for the suggestion –  Stéphane Péchard Sep 15 '11 at 13:25
Coding a diff tool in TeX would be overkill and not required. The only thing you could expect is a formatting package for the result of a diff output. Even for this an external tool might be better suited. –  Martin Scharrer Sep 15 '11 at 14:30

## 1 Answer

I would recommend external tools and implement them using shortcuts, scripts ... You can use Winmerge for it on windows. Similar tools exist for linux/unix.

-