groff
[Top][All Lists]
Advanced

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

Re: [Groff] A trap with 'tbl'!


From: Ted Harding
Subject: Re: [Groff] A trap with 'tbl'!
Date: Sat, 30 Jul 2011 09:58:41 +0100 (BST)

On 30-Jul-11 06:08:55, Heinz-Jürgen Oertel wrote:
> Am Samstag 30 Juli 2011 schrieb Deri James:
> 
>> I think this could be because tbl needs to know the max width of each
>> column 
>> before starting to output, so when considering the first column it
>> will have to 
>> examine the width of \*[lmn] foreach row that you use it on. So these
>> six 
>> accesses to get the width trigger the increment before it starts to
>> output the 
>> first row.
> 
> Hello,
> this is my assumption as well.
> As a work around in such cases, we define the number register in the
> first row.
> 
> .ds lmn \Z'\v'-1.5m'\h'-\w'\\n+[lmno]\0\0\0\0\0'u'\\n[lmno]'
> .TS H
> expand tab(#);
> ce cw(2.0i) ce.
> Name (in Capitals)#Address#Signature
> _
> .TH
> .T&
>|l |l |l|.
> .nr lmno -0 1
> \*[lmn]
> _
> \*[lmn]
> _
> \*[lmn]
> _
> \*[lmn]
> _
> \*[lmn]
> \*[lmn]
> _
> .TE
> 
> regards
>    Heinz

Thank you, Derio and Heinz. You are both correct. In fact I had made
a mistake last night (it was getting late, and my caffeinaemia levels
were low), and I did not capture all of the output of 'pic' in that
test example, but only the first part (see below). (I had left off
thre ".TE" in copying the code into 'pic'.

In fact, 'pic' goes through the table twice, generating output in
two parts.

In the first part, it outputs number register definitions in terms
of widths which troff will evaluate using "\w'...'". This will be
done for each line of the table.

In the second part, it outputs printing commands to troff using the
registers it has defined in the first part, again for each line of
the table. As a result, an incrementing register will be incremented
by troff during the first part, for column width evaluation, and
again during the second part, for printing.

As Heinz points out, the cure is to define the number register in
the first line of the table. I then got the following code for the
example I posted:

.vs 5m
.ds lmn \Z'\v'-1.5m'\h'-\w'\\n+[lmno]\0\0\0\0\0'u'\\n[lmno]'
.nr lmno 0 1
.nr FM \n[FM]+5m
.TS H
expand tab(#);
ce cw(2.0i) ce.
Name (in Capitals)#Address#Signature
_
.TH
.T&
|l |l |l|.
.nr lmno 0 1
\*[lmn]
_
\*[lmn]
_
\*[lmn]
_
\*[lmn]
_
\*[lmn]
_
\*[lmn]
_
.TE

which works perfectly.

Greetings to all! (Caffeinaemia now rising ... ).
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 30-Jul-11                                       Time: 09:58:38
------------------------------ XFMail ------------------------------



reply via email to

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