groff
[Top][All Lists]
Advanced

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

RE: [Groff] Is there an easy way to find out the width of the mo


From: Ted Harding
Subject: RE: [Groff] Is there an easy way to find out the width of the mo
Date: Thu, 04 Jan 2007 15:11:38 -0000 (GMT)

On 03-Jan-07 T. Kurt Bond wrote:
> Is there any way to find out the width of the most recent table?
> -- 
> T. Kurt Bond, address@hidden

The following should work. Indeed, it may always work!

When 'tbl' is invoked on groff code with ".TS"/".TE" blocks,
it seems that a register \n[TW] is created towards the end of
the 'tbl' output, whose value is the width of the table in
device units.

For example:

.LP
.TS
tab(#);
l0w(1i) l0w(1i) lw(1i).
X#Y#Z
.TE
.LP
This is an intervening line of text
.LP
This is the value of \n[TW]

using the PS device, prints the value of \n[TW] as 216000, i.e. 3 inches
(3 x 72 points x 1000).

The table is defined so that each column has width "at least" 1 inch
("w(1i)"), with zero inter-column spacing ("l0", "l0"), and the entries
are very short so that the columns should be exactly 1 inch each.

The only thing I'm not really sure of is whether the register \n[TW]
is created for every table (though I can;t imagine whyit should not be).
If it is so created, then you will get the table width every time.

Therefore, until you create a new table, \n[TW] should be available
for the most recently created table. If you want to preserve the
values for several tables, then you can of course copy the values
of \n[TW] to new registers, e.g.

.nr TW.1 \n[TW]
....
.nr TW.2 \n[TW]
....

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 04-Jan-07                                       Time: 15:11:33
------------------------------ XFMail ------------------------------




reply via email to

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