Article View: net.bugs.v7
Article #75tbl vs. spanned text blocks
From: utzoohenry
Date: Tue, 08 Jun 1982 21:53
Date: Tue, 08 Jun 1982 21:53
52 lines
2127 bytes
2127 bytes
Tbl totally botches the line-length setting for text blocks which are
to span more than one column, if the starting column has an explicit
width specification. It takes the width to be that of the starting
column. Taking various other parameters from the starting column is
not unreasonable, but picking up the width from there defeats the
whole notion of spanning. I have a tentative fix; quite possibly
it misses some fine points, but it seems a good first approximation
to what's wanted, and it runs my test cases well. The policy is that
the formula given in the tbl manual is used unchanged if no explicit
widths are present (it gives reasonable results), and otherwise the
width is the sum of
- the widths of columns with explicitly-specified widths
- (linelength/ncolumns) for each defaulted column
- all intervening column-separation spaces
Here's a diff on src/cmd/tbl/tg.c; beware that line numbers may be off,
so don't apply it blindly.
9a13
> int colno, plus, ndefault, septotal;
33,36c37,62
< if (cll[icol][0])
< fprintf(tabout, ".ll %sn\n", cll[icol]);
< else
< fprintf(tabout, ".ll \\n(%du*%du/%du\n",SL,ctspan(ilin,icol),ncol+1);
---
> plus = ' ';
> septotal = 0;
> ndefault = 0;
> fprintf(tabout, ".ll");
> for (colno = icol; colno < ncol && (colno == icol || ctype(ilin, colno) == 's'); colno++)
> {
> if (cll[colno][0])
> {
> fprintf(tabout, "%c%sn", plus, cll[colno]);
> plus = '+';
> }
> else
> ndefault++;
> if (colno != icol)
> septotal += sep[colno-1];
> }
> if (plus == '+')
> {
> if (septotal != 0)
> fprintf(tabout, "+%dn", septotal);
> if (ndefault != 0)
> fprintf(tabout, "+\\n(%du*%du/%du", SL, ndefault, ncol);
> fprintf(tabout, "\n");
> }
> else
> fprintf(tabout, " \\n(%du*%du/%du\n",SL,ctspan(ilin,icol),ncol+1);
Technical Details
Message-ID:
<bnews.utzoo.2132>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
From: utzoo!henry Newsgroups: net.bugs.v7 Title: tbl vs. spanned text blocks Article-I.D.: utzoo.2132 Posted: Tue Jun 8 21:53:13 1982 Received: Tue Jun 8 21:53:13 1982 Subject: tbl vs. spanned text blocks Date: Tue, 08 Jun 1982 21:53:13 +0000 Message-ID: <bnews.utzoo.2132>