[comp.text] Change/Side Bars in TeX/LaTeX wanted

karl@grebyn.COM (Karl Nyberg) (04/18/89)

I've looked through many back issues of TeXhax, and found requests for such
a feature, but have been unable to find an implementation of it (my search
may have been more exhausting than exhaustive).  I suspect it must be
available in the innards of TeX, as I have seen some of my output (when I
make mistakes!) come out indicating my errors.

If anybody has macros to implement creating the bars (as much for offset of
text as for actual CHANGE bars), I'd appreciate getting them.  Thanks.

-- Karl --

ertem@polya.Stanford.EDU (Tuna Ertemalp) (04/18/89)

In article <11939@grebyn.COM> karl@grebyn.com (Karl Nyberg) writes:
>If anybody has macros to implement creating the bars (as much for offset of
>text as for actual CHANGE bars), I'd appreciate getting them.  Thanks.

Forgive my ignorance, but what are "change bars"??? This the zillionth
time I read about it without knowing what it is. I know that there has
been a Change bars packet within one of the TeXhax-digests,
follow-uped by some corrections. I even used to have a copy, but
unfortunately deleted it due to my lack of knowledge how to use it.

Old issues of TeXhax-digest should be available from
cs.washington.edu.

Have fun
Tuna

ertem@polya.Stanford.EDU (Tuna Ertemalp) (04/18/89)

In article <8550@polya.Stanford.EDU> ertem@polya.Stanford.EDU (Tuna
Ertemalp), I write:
>Old issues of TeXhax-digest should be available from
>cs.washington.edu.

Oooops... It should have been june.cs.washington.edu.

Have fun
Tuna

mrd@sun.soe.clarkson.edu (Michael DeCorte) (04/22/89)

Change bars are lines in the margin indicate changes in the text from
a previous version.  Think of it being used for the various versions
of official specs so that a person can just read the new stuff.

There is one implementation that was posted to TeXhax's a few months
ago.  I have it here (and the TeXhax's) but it requires a special
driver that I don't have so I don't know if it works.  I *think* it
was for LaTeX.


--

Michael DeCorte // (315)265-2439 // P.O. Box 652, Potsdam, NY 13676
Internet: mrd@sun.soe.clarkson.edu  // Bitnet:   mrd@clutx.bitnet        
---------------------------------------------------------------------------
Clarkson Archive Server // commands = help, index, send, path
archive-server@sun.soe.clarkson.edu
archive-server%sun.soe.clarkson.edu@omnigate.bitnet
dumb1!dumb2!dumb3!smart!sun.soe.clarkson.edu!archive-server
---------------------------------------------------------------------------

bts@sas.UUCP (Brian T. Schellenberger) (04/28/89)

Changebars are lines on the side of the page to indicate that given
text has changed since the last revision of a docuemnt.

And I have EMailed this to many people; it is a common request, so I'm 
going to *post* it this time; please copy if if you are going to want it
someday!

This is not original with me; I got it at the TUG conference a couple of
years ago.  I've never used it myself, so no guarantees.  It seems to be
designed for LaTeX, but if you actually use plain TeX, you are presumably
enough of a TeXpert to make the necessary adaptions.


\makeatletter
%
%   Change bars are accomplished using the 'changebar' environment.
%   The text inside will be typeset with change bars in the left margin,
%   e.g.,
%		Input		    Output
%	    \begin{changebar}	    ...
%	    Some text here.\\	 |  Some text here.
%	    More text.		 |  More text.
%	    \end{changebar}
%
%   The text is first typeset into a vbox. Then that box is split up using
%   the \vsplit operation.  Each box is placed onto the current page along
%   with a rule of the proper dimensions. 
%
%   The width of the change bar is determined from \changebarwidth.  The
%   default width is \arrayrulewidth.  The separation of the rule from the
%   left margin is controlled by \changebarsep.
%
%   Restrictions:
%
%   You can't put a float, such as a 'figure' or 'table' environment or a
%   footnote, inside a 'changebar', not even via \begin{figure}[h], etc.,
%   to force the float into the change bar area.  You could instead put a
%   'changebar' inside of a 'figure' or 'table' or footnote.
%
%   Nested 'changebar' environments are not supported.
%
%   \changebar ==
%   BEGIN
%	\par						% Start a new paragraph
%	\box\changebarbox :=		    % Save up text in a temporary vbox
%	    \vbox\bgroup
%	    \hsize=\textwidth		% Set the horizontal size in this box
%   END
%
%   \endchangebar ==
%   BEGIN
%	\egroup				    % Matching brace for temporary vbox
%	\begingroup				% Localize parameter changes
%	    \vbadness := \@Mi	    % Suppress "Underfull \vbox" from \vsplit
%	    \vfuzz := \maxdimen		% Suppress "Overfull \vbox" from \vsplit
%	    \splittopskip := 0pt	    % Don't insert glue after \vsplit
%	    \offinterlineskip			    % No space between rules
%	    \changebarsize ::= \dimen0
%	    \lostglue ::= \skip0
%	    \thislinebox ::= \box0
%	    \changebarsize := height + depth of \changebarbox
%	    WHILE \changebarsize > 0pt
%	    BEGIN
%		\lostglue := height + depth of \changebarbox
%	    	\box\thislinebox := \vsplit\changebarbox	% Take a chunk
%		\box\thislinebox := \vbox{\unvbox\thislinebox}	    % Reset size
%		\lostglue := \lostglue - (height + depth of \changebarbox)
%			% \lostglue is now the difference between the old &
%			% new box
%		\lostglue := \lostglue - (height + depth of \thislinebox)
%			% \lostglue is now as big as the glue lost to the
%			% \vsplit operation, i.e.,
%			% \lostglue + \thislinebox =
%			%	(old \changebarbox - new \changebarbox)
%		\vtop{				% Align rule with chunk of text
%		    \llap					% No-width rule
%			{\vtop to 0pt			    % Box up the rule(s)
%			    {\offinterlineskip		% No glue between rules
%			    \hrule to size of \thislinebox
%			    \hrule to size of \lostglue
%			}
%		    \hskip \changebarsep}
%		    }
%		\box\thislinebox			    % Put box on page
%		\endgroup
%	    END

\newif\ifdebug
\newdimen\changebarwidth \changebarwidth=\arrayrulewidth
\newskip\changebarsep \changebarsep=\parindent
\newcount\@cbp
\def\@cbpenalty{\ifvmode \mark{\Penalty \@cbp}\fi\Penalty\@cbp}
\def\changebar{\par
%    \let\Penalty=\penalty
%    \def\penalty{\afterassignment\@cbpenalty \@cbp=}%
\chardef\@changebarbox=0
\setbox\@changebarbox = \vbox\bgroup}
\def\endchangebar{\egroup
    \vbadness\@Mi			% Suppress "Underfull box" from \vsplit
    \vfuzz\maxdimen			% Suppress "Overfull box" from \vsplit
    \splittopskip = 0pt			    % Don't insert glue after \vsplit
    \dimendef\changebarsize = 0
    \skipdef\lostglue = 0
    \chardef\thislinebox = 1
    \ifdebug \showbox\@changebarbox \fi
    \changebarsize = \ht\@changebarbox		    % Initialize loop control
    \advance\changebarsize by\dp\@changebarbox
    \noindent \leavevmode\strut
    \offinterlineskip					% No space between rules
    \@whiledim \changebarsize > \z@ \do
	{\lostglue = \changebarsize			    % Save old box size
	\setbox\thislinebox = \vsplit\@changebarbox to 1sp	% Take a chunk
	\setbox\thislinebox = \vbox{\unvbox\thislinebox	    % Reset the box size
	}\ifdebug \showbox\thislinebox \fi
%	\splitfirstmark			% Any marks (penalties!) before line?
	\changebarsize = \ht\@changebarbox
	\advance\changebarsize by\dp\@changebarbox	% Compute remaining size
	\advance\lostglue by-\changebarsize	% Difference between old and new
	\advance\lostglue by-\ht\thislinebox
	\advance\lostglue by-\dp\thislinebox		% Glue lost to \vsplit
	\ifdim\lostglue < \z@ \lostglue = \z@ \fi		% No glue lost
	\ifdebug \showthe\lostglue \fi
	\hbox
	{\llap
	    {\vtop to \z@		% Prepare an invisible box for the rule
		{\hrule \@height\ht\thislinebox \@depth\dp\thislinebox
			\@width\changebarwidth			    % First rule
%		\ifdebug \hrule \@height\changebarwidth \@depth \z@
%			\@width 10pt			%%%% marker rule %%%%%
%		\fi
		\hrule \@depth\lostglue \@height\z@
			\@width\changebarwidth			% Second rule
	    \vss}\hskip\changebarsep		% Space between bar and text
	}\box\thislinebox			% Now put the chunk on the page
	}\vskip\lostglue			% and insert the missing glue
%	\splitbotmark			    % Any marks (penalties!) after line?
	}\ifdebug \showlists \fi
}
\makeatother
-- 
-- Brian, the Man from Babble-on.		...!mcnc!rti!sas!bts
--
"Every jumbled pile of person has a thinking part that wonders what the part
that isn't thinking isn't thinking of" -- THEY MIGHT BE GIANTS