[net.text] Change bars in TeX

aw@grpthry.UUCP (Alan Whitton) (05/28/86)

*********

I am looking for a solution to a rather challenging problem. I am hoping to
use SCCS for version control of documents I am typesetting in TeX. The problem
is, how to use SCCS version control sequences to create change bars (similar
to those used in IBM documentation). This could be done in many ways and I
was just wondering if anyone had any ideas (or even, hope of hopes, has 
experience doing this). Does this need to know the internal format of SCCS
files, or could SCCS just tell where the changes are? Any help will be 
gladly appreciated.

					"You can tell a man who boozes,
					 by the company he chooses,
					 so the pig got up
					 and slowly walked away..."

					 alan 

					 { ..!utzoo!dciem!nrcaer!grpthry!aw }

clewis@mnetor.UUCP (06/06/86)

In article <154@grpthry.UUCP> aw@grpthry.UUCP (Alan Whitton) writes:
>*********
>
>I am looking for a solution to a rather challenging problem. I am hoping to
>use SCCS for version control of documents I am typesetting in TeX. The problem
>is, how to use SCCS version control sequences to create change bars (similar
>to those used in IBM documentation). This could be done in many ways and I
>was just wondering if anyone had any ideas (or even, hope of hopes, has 
>experience doing this). Does this need to know the internal format of SCCS
>files, or could SCCS just tell where the changes are? Any help will be 
>gladly appreciated.

Three approaches (I investigated this and implemented one of them recently):

	1) "get -m" will emit the document with each line preceded with
	   an SCCS id.  You can then write a filter that takes the input,
	   strips off this information, except for inserting the appropriate
	   nroff change bar commands when the SCCS id changes.

	   I have a filter that does this in a fancy way - you get to decide
	   which SCCS revisions you want to mark, and with what marks.  It
	   also generates a ".Sr" macro (with the help of "prs" also providing
	   input), that when invoked will print a list of revisions, their 
	   marks, SCCS comments, dates, and the user that did the change.  
	   If anybody wants it, send me mail (and if sufficient interest is 
	   shown I'll post it to net.sources)

	   The main difficulty with this approach is that it can *only* mark
	   additions.  Not deletions.

	2) System V (R1 I think) has a utility called "diffmk":
	   From the SV manual page:

		diffmk name1 name2 name3

		"Diffmk compares two versions of a file, and creates a third
		file that includes "change mark" revisions for nroff and
		troff."

	   You'd just have to "get" the current and previous revision and
	   run thru diffmk then [nt]roff.

	   Main difficulty is that it works only with one set of differences.
	   Nor can it get at any of the SCCS info (comments etc.).  Though,
	   you could easily get prs information thru another filter and
	   cat the results together.

	3) Read the s. file and follow the "^AI", "^AD" and "^AE" directives, 
	   emitting mc's as you go.  The internal format of SCCS isn't all 
	   that hard to understand, particularly if you aren't interested in the
	   SCCS control information.

We're using the first approach because it was relatively easy, and we wanted
to be able to have more than one set of revisions marked.  The 3rd is by far 
the most flexible.  One of these days....

Since you're using TeX, you'd have to modify the suggestions above to
work with TeX change bar mechanisms rather than [nt]roff's (".mc <mark>").

BTW: One particular annoyance with [nt]roff is that the ".mc" character can
only be one character.  Grrrr.  (I wanted to use the SCCS id itself!)
-- 
Chris Lewis,
{pyramid|watmath|utcsri|decvax|allegra|linus|ihnp4}!utzoo!
{utcsri|cbosgd}!utcs!
{yetti|lsuc|genat|mot|oakhill}!
... mnetor!clewis
BELL: (416)-475-8980 ext. 321

guy@sun.uucp (Guy Harris) (06/12/86)

> 	2) System V (R1 I think) has a utility called "diffmk":

R2, etc., as well.  It's a shell script, so it may be modifiable to produce
the appropriate TeX commands.

> 	3) Read the s. file and follow the "^AI", "^AD" and "^AE" directives, 
> 	   emitting mc's as you go.  The internal format of SCCS isn't all 
> 	   that hard to understand...

And is sort of documented in SCCSFILE(4 or 5, depending on what version of
UNIX you're running).

Note, of course, that SCCS doesn't understand that changing

	The long sobs of the violins of autumn
	wound my heart with a monotonous languor

to

	The long sobs
	of the violins of autumn
	would my heart
	with a monotonous languor

(assuming that TeX is filling this text) should not get change bars, while
changing it to

	The long sobs of the violins of autumn
	wound my heart with a monotonous ennui

should.  "diff" (which gives SCCS its marching orders, at least when it
comes to indicating what's been inserted and what's been deleted) has no
idea why lines changed, it merely knows that they've changed, and tells SCCS
so.  Be prepared either 1) to hand-tune the margin bar indications (".mc" in
"[nt]roff" has enough other problems that you have to do this anyway if you
want it to be correct) or 2) to have them act as guides, which will
sometimes falsely indicate that something has changed, rather than as
reliable indicators of change.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)