henry (06/09/82)
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);