loverso@Xylogics.COM (John Robert LoVerso) (01/06/90)
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
brainerd@unmvax.unm.edu (Walt Brainerd) (01/07/90)
In article <8172@xenna.Xylogics.COM>, loverso@Xylogics.COM (John Robert LoVerso) writes: > 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 > > 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. The problem is that the indentation computation line shown above is done in environment 1, in which the line length has (at least in the default case) a value different from that in environment 0, whereas the value of the number register $l is global to both environments, so its use produces the correct centering. Prior to use of the macros, $l and .l have the same values because the test is made in environment 0. I guess we must call this a bug in the -me macros for failing to use the "correct" line length when computing the indentation for centering in the )c macro. It is NOT a bug in troff. -- Walt Brainerd Unicomp, Inc. brainerd@unmvax.cs.unm.edu 2002 Quail Run Dr. NE Albuquerque, NM 87122 505/275-0800 505/275-0801 (fax)