Take the tour ×

I was just wondering if anyone knows of a ConTeXt equivalent to latexdiff?

For those not familiar with latexdiff: it is a Perl script that marks up differences between 2 latex files. It is included with many LaTeX distributions.

It is used as follows:

$ latexdiff old.tex new.tex > diff.tex

Then when you compile the output diff.tex, it shows added text in blue, and deleted text in red strikethrough. E.g., http://haakoh.at.ifi.uio.no/latexdiff/

Does anyone knows of a ConTeXt tool that achieves something similar?

If not, can anyone offer any pointers on how the latexdiff Perl script might be leveraged/ported to a "contextdiff" equivalent?

Could you expand your question as to how exactly the tool you mention works differently from common diff? Context users might not be familiar with Latex specific programs. –  phg Oct 30 '12 at 12:24
Thanks, i followed your suggestion. –  Zorzal Zilba Oct 30 '12 at 23:38
add comment

2 Answers

up vote 2 down vote accepted

Try texdiff. It should work with ConTeXt.

Thanks, that's exactly what i was looking for. In my answer below I outline the ConTeXt pre-amble i used to get texdiff working similarly to latexdiff. –  Zorzal Zilba Oct 31 '12 at 10:09
add comment

@user21568 is right, texdiff works with ConTeXt.

However while the texdiff doco lists an example preamble for LaTeX, it doesn't offer any advice for ConTeXt.

So for the benefit of anyone else interested in using texdiff with ConTeXt, here is a preamble that i have found useful:

% Define a blue underline bar for insertions
\definebar[insbar][color=blue, offset=-0.4, continue=yes]

% Define a red strikethrough bar for deletions
\definebar[delbar][color=red, offset=0.5, continue=yes]

% Define the insertion macro. Note the inmargin marker.

% Define the deletion macro.

% Override ConTeXt protect command to do nothing.
% This might have undesired consequences for advanced ConTeXt users?

Note the redefinition of protect: this is a workaround of the fact that the protect commands that texdiff generates do not compile under ConTeXt - it seems that this command has different usage in ConTeXt than in LaTeX.

\protect reinstates the common catcodes, see its definition. Generally it is not safe to redefine but if you do make sure you don’t load any modules after that. You could try replacing the \protect calls in the generated code (but not in Context code) with \unexpanded or \normalprotected). –  phg Oct 31 '12 at 10:56
add comment

This site is currently not accepting new answers.

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