summaryrefslogtreecommitdiff
path: root/src/preproc
diff options
context:
space:
mode:
authorwl <wl>2008-07-18 07:37:16 +0000
committerwl <wl>2008-07-18 07:37:16 +0000
commitf0ce0cbcf58e473b9a3207f7d8f86651277328ab (patch)
treeb2fdf0efd7204ee2ff190e44eb7c35084dd28b52 /src/preproc
parent1eb6b2bde9646074a2e69c17d4ff7f42bfe6dc23 (diff)
downloadgroff-f0ce0cbcf58e473b9a3207f7d8f86651277328ab.tar.gz
* src/preproc/tbl/table.cpp (table::compute_separation_factor): Emit
warning messages if table gets squeezed. (table::compute_widths): Fix computation of AVAILABLE_REG. Emit warning if table is wider than line length. * src/preproc/tbl/tbl.man: Minor improvements.
Diffstat (limited to 'src/preproc')
-rw-r--r--src/preproc/tbl/table.cpp22
-rw-r--r--src/preproc/tbl/tbl.man23
2 files changed, 31 insertions, 14 deletions
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 7953b198..9cee7ea0 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2003, 2004, 2007
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2003, 2004, 2007, 2008
Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
@@ -2078,7 +2078,13 @@ void table::compute_separation_factor()
prints(".nr " SEPARATION_FACTOR_REG " \\n[.l]-\\n[.i]");
for (i = 0; i < ncolumns; i++)
printfs("-\\n[%1]", span_width_reg(i, i));
- printfs("/%1>?0\n", as_string(total_sep));
+ printfs("/%1\n", as_string(total_sep));
+ prints(".ie \\n[" SEPARATION_FACTOR_REG "]<=0 \\{"
+ ".tm warning: page \\n%: column separation set to zero\n"
+ ".nr " SEPARATION_FACTOR_REG " 0\n"
+ ".\\}\n"
+ ".el .if \\n[" SEPARATION_FACTOR_REG "]<1n "
+ ".tm warning: page \\n%: table squeezed horizontally to fit line length\n");
}
}
}
@@ -2158,13 +2164,19 @@ void table::compute_widths()
for (q = entry_list; q; q = q->next)
if (!q->mod->zero_width)
q->do_width();
- printfs(".nr " COLCOUNT_REG " %1\n", as_string(count_block_columns()));
- prints(".nr " AVAILABLE_REG " \\n[.ll]-\\n[.in]\n");
for (i = 0; i < ncolumns; i++)
compute_span_width(i, i);
for (p = span_list; p; p = p->next)
compute_span_width(p->start_col, p->end_col);
- prints(".nr " AVAILABLE_REG " 0>?\\n[" AVAILABLE_REG "]\n");
+ printfs(".nr " COLCOUNT_REG " %1\n", as_string(count_block_columns()));
+ prints(".nr " AVAILABLE_REG " \\n[.l]-\\n[.i]");
+ for (i = 0; i < ncolumns; i++)
+ printfs("-\\n[%1]", span_width_reg(i, i));
+ prints("\n");
+ prints(".if \\n[" AVAILABLE_REG "]<0 \\{"
+ ".tm warning: page \\n%: table wider than line width\n"
+ ".nr " AVAILABLE_REG " 0\n"
+ ".\\}\n");
make_columns_equal();
// Note that divide_span keeps equal width columns equal.
for (p = span_list; p; p = p->next)
diff --git a/src/preproc/tbl/tbl.man b/src/preproc/tbl/tbl.man
index 00ce84b7..71610bf1 100644
--- a/src/preproc/tbl/tbl.man
+++ b/src/preproc/tbl/tbl.man
@@ -1,5 +1,5 @@
.ig
-Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2006, 2007
+Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2006, 2007, 2008
Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
@@ -89,9 +89,9 @@ expects to find table descriptions wrapped in the
(table end) macros.
The line immediately following the
.B .TS
-macro may contain any of the following global options (ignoring the case
-of characters -- Unix tbl only accepts options with all characters lowercase
-or all characters uppercase):
+macro may contain any of the following global options (ignoring the case of
+characters \[en] Unix tbl only accepts options with all characters lowercase
+or all characters uppercase), separated by spaces, tabs, or commas:
.
.TP
.B center
@@ -111,7 +111,11 @@ as start and end delimiters for
.
.TP
.B expand
-Makes the table as wide as the current line length.
+Makes the table as wide as the current line length (providing a column
+separation factor).
+In case the sum of the column widths is larger than the current line length,
+the column separation factor is set to zero; such tables extend into the
+right margin, and there is no column separation at all.
.
.TP
.B box
@@ -167,7 +171,7 @@ Ignore leading and trailing spaces in data items (GNU tbl only).
.
.LP
The global options must end with a semicolon.
-There might be whitespace after an option and its argument in parentheses.
+There might be whitespace between an option and its argument in parentheses.
.
.LP
After global options come lines describing the format of each line of
@@ -176,6 +180,7 @@ Each such format line describes one line of the table itself, except that
the last format line (which you must end with a period) describes all
remaining lines of the table.
A single key character describes each column of each line of the table.
+Key characters can be separated by spaces or tabs.
You may run format specs for multiple lines together on the same line by
separating them with commas.
.
@@ -340,9 +345,9 @@ Ignore the corresponding column for width-calculation purposes.
.
.LP
A number suffix on a key character is interpreted as a column
-separation in ens (multiplied in proportion if the
+separation in en units (multiplied in proportion if the
.B expand
-option is on).
+option is on \[en] in case of overfull tables this might be zero).
Default separation is 3n.
.
.LP
@@ -578,7 +583,7 @@ A\[rs]*a;B
.
.
.SH REFERENCE
-Lesk, M.E.: "TBL -- A Program to Format Tables".
+Lesk, M.E.: "TBL \[en] A Program to Format Tables".
For copyright reasons it cannot be included in the groff distribution,
but copies can be found with a title search on the World Wide Web.
.