Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have just made significant revisions to my thesis which has been typeset with ConTeXt. The project file pulls from approximately 20-30 files spread over 8 directories producing a document of 414 pages.

This document is amazingly resistant to normal diffing tools, even if I export the files in an amazingly broken XML export. Is there a diff or wdiff technique that can produce a list of changes and is intelligent enough to detect when whole sections have been moved around?

Is the "best" way simply to wdiff input files and then somehow concatenate those diffs into an output file?

share|improve this question
    
What can I say... Are you sure that such a complicated structure is the best possible one? One possible solution might be to pdf2txt the resulting document and diff this one. This might be a better idea after making a special "mode" to eliminate page numbers, headers etc. –  mbork Apr 1 '12 at 19:42
    
I've tried that with very poor results. I think the answer is, as you note: "Don't" but I'm hoping to be surprised. –  Brian Ballsun-Stanton Apr 1 '12 at 19:46
    
Although the output here will be typeset with ConTeXt, I don't see how the question relates to TeX. Producing the diff is, as described, not done using TeX or a related tool. –  Joseph Wright Apr 1 '12 at 20:11
    
Well, part of it is getting diffable output from context or some (unknown?) aspect of context that could do diffing trivially. –  Brian Ballsun-Stanton Apr 1 '12 at 20:19
2  
Moving sections around confuses any "diff" tool I know. They are simply not built to do this. The easiest thing would be to have each section in a file of its own, and when you have to reorder them, reorder the \include statements in the master document. –  DevSolar Apr 2 '12 at 10:51
add comment

1 Answer 1

up vote 8 down vote accepted

There is no way for ConTeXt (or any other TeX macro package or engine) to know you have moved sections around. So unless you added some structure beforehand (by putting things in named buffers or separate input files, for example) the diff output will be large.

The XML export in ConTeXt is indeed using the output order, but comparing the XML output (whether it is good or bad) is not very easy with non-XML tools and besides, it is not quite the input as the link to files and line numbers is lost (same problem with pdf2txt export).

My approach to complex changes tracking in large projects is to use a version control system and/or IDE. But if you cannot do that, I assume pdf2txt is your least crappy option to get something that diff likes, or alternatively use something like xmldiff on ConTeXt's XML export.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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