Subject: Re: Exact column widths in 'tbl' References: <xfmail.110810125351.ted.hard...@wlandres.net>
>Greetings all! >This is a follow-up to Chriss Schaller's query yesterday, >and the subsequent replies. I have opened e new thread, >since it is a topic of general interest. >Of course the keyword w(...) in the table format line, >e.g. >.TS >tab(#); >l lw(3i) lw(1.25i). >[...] >.TE >specifies a *minimum* column width. So it will not do >for setting a maximum column width, especially where there >are long text blocks in some cells. >The following example shows how to do it in general. The >basis is that a ".ll" request in a text block sets a line >length and this will be reflected in the resulting column >width (unless something else, e.g. a long entry which is >not a text block, forces a wider column). >Put the following into a file temp.tr : >--8<--cut here--8<-------------------------------------------- >.TS >tab(#); >| l | l | l |. >_ >08/08/2011#T{ >.ll 3i >This is quite a long paragraph of text specially composed >for yesterday's date. >The purpose is to see what happens to it in a 3-inch >column width. >T}#T{ >.ll 1.25i >And this is some silly stuff to fill column 3, >1.25 inches wide. >T} >09/08/2011//12:15#T{ >.ll 3i >And this is another long paragraph specially composed >to suit the particular circumstances that apply at this moment >of this date. >T}#T{ >.ll 1.25i >And this is more silly stuff to fill column 3, >still 1.25 inches wide. >T} >_ >.TE >.sp 0.5m >Finally, we follow up with a lot of text outside the table >just to show that the per-column settings of \f[CB].ll\fP >in the above table have not affected the general ambient >line-length outside the table. >--8<--cut here--8<-------------------------------------------- >Then execute >groff -t temp.tr > temp.ps >and view the resulting PostScript file temp.ps Does that actually use the tbl command? If not, how can this be done with tbl, given the following broken example: tbl<<EOF | nroff -Tascii | uniq .TS box tab(|); cb|cb|cb|cb. col1 | col2 | col3 | long column .T& l|c|c|lp20. short|short|short|this is a very long string of text that should be wrapped into several lines so it will not run off the page .TE EOF