🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #6665

troff/ditroff & -me bug

#6665
From: John Robert LoVerso
Date: Fri, 05 Jan 1990 23:27
45 lines
2146 bytes
I haven't tracked down in the code the bug, but I have found it.  Feed
the following to psroff/ptroff/ditroff with -me:

	.ce
	this is a test
	.(c
	this is a test
	.)c

The bug is that the line centered by .ce will be correctly center,
while the block centered by .(c .)c will be off center!  I tracked
this down to the line following line from the .)c macro in tmac.e:

	.in (\\n(.lu-\\n(.iu-\\n(dlu)/2u

[I'm using the latest me macros; the ones with the redistributable
copyright notice; this line is the same in all the versions of -me
I've ever seen.]

This essientally subtracts the current indent (.i) and the width of
the longest line in the last diversion (dl) from the current line
length (.l), and then divides by 2.  And troff gets it wrong every
time!  If you replace the .l with $l, as thus:

	.in (\\n($lu-\\n(.iu-\\n(dlu)/2u

then both of the two lines above get centered correctly!  However,
prior to the .in, .l and $l have identical values.  [$l is the
last line length that me set].  So, there is no reason for the
stock -me macros - or rather the above .in computation - to fail
in this manner.

I've found this problem in every troff and ditroff I've tested;
this was not an exhaustive list, however.  It does include the
troff from 4.3tahoe, the troff from SunOS4.0.3, the ditroff from
Image Network, the ditroff from DWB2-1986, and an old ditroff of
which I don't know the genealogy.

Has anyone else seen this (does the above come out correctly on
your ditroff?)?  Thanks.

John
-- 
John Robert LoVerso			Xylogics, Inc.  617/272-8140x284
loverso@Xylogics.COM			Annex Terminal Server Development Group
Technical Details
Message-ID: <8172@xenna.Xylogics.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!mips!apple!oliveb!stratus!cloud9!xylogics!loverso

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!mips!apple!oliveb!stratus!cloud9!xylogics!loverso
From: loverso@Xylogics.COM (John Robert LoVerso)
Newsgroups: comp.text
Subject: troff/ditroff & -me bug
Summary: troff bug?
Keywords: ditroff troff me bug
Message-ID: <8172@xenna.Xylogics.COM>
Date: 5 Jan 90 23:27:48 GMT
Reply-To: loverso@Xylogics.COM (John Robert LoVerso)
Organization: Xylogics, Inc., Burlington MA
Lines: 45