groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] tbl: text blocks vs. centering


From: Larry Kollar
Subject: Re: [Groff] tbl: text blocks vs. centering
Date: Thu, 7 Sep 2006 10:27:51 -0400

Werner LEMBERG wrote...

>> The text in the first column should be centered, but is left-
>> justified.
> 
> The crucial part of explaining the behaviour is this sentence from
> tbl.man:
> 
>   The default length of a text block is given by LC/(N+1), where `L'
>   is the current line length, `C' the number of columns spanned by the
>   text block, and `N' the total number of columns in the table.
> 
> As a consequence, the real field length is completely ignored;
> similarly, vertical border lines and the like are ignored too.  The
> algorithm for handling text blocks is roughly as follows:
> 
>   1. Put each text block into a diversion with the given width, either
>      following the above formula or using a user-specified width.
>   2. Set the adjust flags, sizes, etc., as specified.
>   3. Format the diversions.
>   4. Construct the table and use the diversions.
> 
> Step 4 shifts the diversions horizontally as needed by other fields,
> but within the diversions the horizontal spaces can't be changed
> anymore.  This causes the strange positions you observe.
> 
> With other words: Always specify a width for a column which contain
> text blocks.

That doesn't seem to make a difference. I can force centering by wrapping the 
text:
T{
.ad c
blah blah...
.fl
.ad l
T}

(Yes, the flush is necessary.) But if it's setting the adjust flags in step 2, 
why 
isn't the adjustment getting picked up from the column spec? Also, that 
doesn't address vertical centering: the diversion containing the text block has 
a known height, so it should be possible to put it where it belongs. Again, 
specifying a column width has no effect on centering, either horizontally or 
vertically.

> Here is what tbl.man says about `v':
> 
>   No effect if the corresponding table entry isn't a text block.
> 
> This means that for the third column the default vertical spacing
> (12pt) is used.

That's easy enough to work around, by creating a "tbleven" macro:

.de tbleven
.sp 2p
..

and using the x(tbleven) specifier in each column. Since this also requires a 
text block to fire, it only puts the extra space where it's needed.

-- Larry





reply via email to

[Prev in Thread] Current Thread [Next in Thread]