visualising evolution from one version to another
Hello, if you know a bit MS-Word, then you have seen perhaps the feature, that permits visualising differences between 2 versions of a document: added text in red, and deleted text stroke out. I would like to make something similar with ConTeXt: making a pdf-file from doc-versionX.tex and doc-versionY.tex with added text in some colour and deleted text displayed with \overstrikes{}. Do you have some ideas, how to do that? Cheers, Peter -- http://pmrb.free.fr/contact/
Peter Münster wrote:
Hello, if you know a bit MS-Word, then you have seen perhaps the feature, that permits visualising differences between 2 versions of a document: added text in red, and deleted text stroke out.
I would like to make something similar with ConTeXt: making a pdf-file from doc-versionX.tex and doc-versionY.tex with added text in some colour and deleted text displayed with \overstrikes{}.
Do you have some ideas, how to do that?
You need a way to create a merged ConTeXt document from the two separate files, perhaps using something like this: http://search.cpan.org/dist/Text-WordDiff/lib/Text/WordDiff.pm Cheers, taco
On Sun, 6 Aug 2006, Taco Hoekwater wrote:
You need a way to create a merged ConTeXt document from the two separate files, perhaps using something like this:
http://search.cpan.org/dist/Text-WordDiff/lib/Text/WordDiff.pm
Thank you for this hint! It's exactly what I need. I've also found a shell version: "wdiff" But I still have one problem: I can't have a paragraph in \overstrikes. Is there perhaps something like \startoverstrikes ... \stopoverstrikes ? Here is a little script, to show what I'm doing now: #!/bin/bash OLD="$1" NEW="$2" OUT="$3" shift 3 echo '\setupcolors[state=start]' >"$OUT.tex" echo '\long\def\startDeleted*#1\stopDeleted*{\overstrikes{#1}}' >>"$OUT.tex" echo '\long\def\startAdded*#1\stopAdded*{\startcolor[blue]#1\stopcolor}' \ >>"$OUT.tex" wdiff -w '\startDeleted*' -x '\stopDeleted*' \ -y '\startAdded*' -z '\stopAdded*' "$OLD" "$NEW" >>"$OUT.tex" texexec "$@" "$OUT" Cheers, Peter -- http://pmrb.free.fr/contact/
Peter Münster wrote:
On Sun, 6 Aug 2006, Taco Hoekwater wrote:
You need a way to create a merged ConTeXt document from the two separate files, perhaps using something like this:
http://search.cpan.org/dist/Text-WordDiff/lib/Text/WordDiff.pm
Thank you for this hint! It's exactly what I need. I've also found a shell version: "wdiff" But I still have one problem: I can't have a paragraph in \overstrikes. Is there perhaps something like \startoverstrikes ... \stopoverstrikes ?
Not that I know of. It should be possible to cook something up with metafun and/or \starttextbackgrounds i guess, but I do not have a ready-to-use solution for you. Taco
On Sun, 6 Aug 2006, Peter Münster wrote:
Hello, if you know a bit MS-Word, then you have seen perhaps the feature, that permits visualising differences between 2 versions of a document: added text in red, and deleted text stroke out.
I would like to make something similar with ConTeXt: making a pdf-file from doc-versionX.tex and doc-versionY.tex with added text in some colour and deleted text displayed with \overstrikes{}.
Do you have some ideas, how to do that?
There was a latex package with a perl script that did something like that. But I found it to be too cumbersome to use. If you are just using plain text, then it is easy to identify and mark what has changed. But what should happen if you change markup? What if a \bf is changed to \it or a \framed is added around a bit of text? Marking differences in math is altogether a different story. For small documents (~10 pages) I found it easier to copy version2 by another name, diff the two files in an editor, and add the markup by hand. (I actualy had a macro to mark the change, so it was just pressing one of three keystokes). With context, you can have \DIFFdeleted, \DIFFchanged{before}{after} \DIFFadded with these expanding to the default MS word look and feel for changed files. There are various diff programs, but I feel that for something slightly complicated, it is very hard to do identify the changes in a sensible way automatically. YMMV. Aditya
On Sun, 6 Aug 2006, Aditya Mahajan wrote:
But what should happen if you change markup? What if a \bf is changed to \it or a \framed is added around a bit of text? Marking differences in math is altogether a different story.
Yes, of course, I'll need to adjust manually in such cases. But I'm already quite lucky, because with word-diff, the task was much easier than I've ever hoped. My intention is, to be prepared, if one of my colleagues, who are all used to MS-Office, would ask for such a diff-document one day. Now I'm able to generate such a document. (My problem at work is, that I'm the only one not using MS-Office.) Cheers, Peter -- http://pmrb.free.fr/contact/
participants (3)
-
Aditya Mahajan
-
Peter Münster
-
Taco Hoekwater