Index: groff_hdtbl.man
===================================================================
RCS file: /sources/groff/groff/contrib/hdtbl/groff_hdtbl.man,v
retrieving revision 1.12
diff -u -r1.12 groff_hdtbl.man
--- groff_hdtbl.man	23 Jan 2010 07:47:40 -0000	1.12
+++ groff_hdtbl.man	4 Feb 2010 17:13:42 -0000
@@ -897,6 +897,30 @@
 .
 .SH HDTBL CUSTOMIZATION
 .
+.PP
+Before creating the first table,
+you should configure default values
+to minimize the markup
+needed in each table.
+The following example
+sets up defaults
+suitable for typical papers:
+.PP
+.RS
+.nf
+.CR ".ds t*bgc white\e\[dq] background color
+.CR ".ds t*fgc black\e\[dq] foreground color
+.CR ".ds t*bc black\e\[dq]  border color
+.CR ".nr t*cpd 0.1n\e\[dq]  cell padding
+.fi
+.RE
+.PP
+The file
+.B examples/common.roff
+provides another example setup
+in the ``minimal Page setup'' section.
+.
+.PP
 A table which does not fit on a partially filled page is printed
 automatically on the top of the next page if you append the little
 utility macro
@@ -918,6 +942,31 @@
 .B ms
 macro package.
 .
+.PP
+The macro
+.CR t*EM
+checks for held or kept tables,
+and for missing
+.CR ETB
+macros (table not closed).
+You can append this macro
+to the ``end'' macro of your document's main macro package.
+For example:
+.
+.PP
+.RS
+.nf
+.CR ".am pg@end-text"
+.CR ".  t*EM"
+.CR ".."
+.fi
+.RE
+.
+.PP
+If you use the
+.B ms
+macro package.
+.
 .
 .SH AUTHOR
 .
Index: hdmisc.tmac
===================================================================
RCS file: /sources/groff/groff/contrib/hdtbl/hdmisc.tmac,v
retrieving revision 1.12
diff -u -r1.12 hdmisc.tmac
--- hdmisc.tmac	23 Jan 2010 07:47:40 -0000	1.12
+++ hdmisc.tmac	4 Feb 2010 17:13:43 -0000
@@ -26,7 +26,7 @@
 .
 .\" %beginstrip%
 .
-.if d getarg \
+.if d t*getarg \
 .  nx
 .
 .
@@ -68,7 +68,7 @@
 .\"
 .\"		sets string `ddd' to value `=', and `args' contains
 .\"		`aaa=xxx bbb eee'.
-.de getarg
+.de t*getarg
 .  ds \\$1
 .  ds args
 .
@@ -146,12 +146,12 @@
 .\"	Utility macro:	.index <string1> <string2>
 .\"
 .\"		Check whether <string2> is a substring of <string1> and
-.\"		return its position in number register `index', starting
+.\"		return its position in number register `t*index', starting
 .\"		with 1.  If not found, return 0.  If <string2> is empty,
-.\"		set `index' to -999.
-.de index
+.\"		set `t*index' to -999.
+.de t*index
 .  if "\\$2"" \{\
-.    nr index -999
+.    nr t*index -999
 .    return
 .  \}
 .
@@ -168,23 +168,23 @@
 .  \}
 .
 .  ie (\\n[*] == \\n[**]) \
-.    nr index 0
+.    nr t*index 0
 .  el \
-.    nr index (\\n[*] + 1)
+.    nr t*index (\\n[*] + 1)
 ..
 .
 .
 .\"	******************************************************************
-.\"	********	non-accumulating space .SP [v]		**********
+.\"	********	non-accumulating space .t*SP [v]	**********
 .\"	**                                                              **
 .\"	**	nl vor erster Seite -1, oben auf Seite 0 resp. tH	**
 .\"	**	.k nach .sp oder .br 0,					**
 .\"	**		sonst Laenge der angefangenen Zeile		**
-.\"	**	Der Merker M# fuer vorangegangenes .SP wird in .HM am	**
+.\"	**	Der Merker M# fuer vorangegangenes .t*SP wird in .HM am	**
 .\"	**	Seitenanfang zurueckgesetzt.				**
 .\"	**	ganz richtig ist .sp + .br = .br + .sp = .sp		**
 .\"	******************************************************************
-.de SP
+.de t*SP
 .  if (\\n[nl] < 0) \
 .    br			\"	start very first page
 .  nr * \\n[.p]		\"	save current page length
@@ -194,7 +194,7 @@
 .  el \
 .    pl +\\$1		\"	otherwise use \\$1
 .
-.  nr ** (\\n[.p] - \\n[*])	\" ** now holds arg for .SP in base units
+.  nr ** (\\n[.p] - \\n[*])	\" ** now holds arg for .t*SP in base units
 .  pl \\n[*]u		\"	restore page length
 .
 .  \" we do nothing at start of new page or column
@@ -205,7 +205,7 @@
 .    \}
 .    el \{\
 .      if (\\n[**] - \\n[S#]) \{\
-.        sp (\\n[**]u - \\n[S#]u)\"	emit difference to previous .SP
+.        sp (\\n[**]u - \\n[S#]u)\"	emit difference to previous .t*SP
 .        nr S# \\n[**]	\"	store ** in S#
 .    \}\}
 .
@@ -218,7 +218,7 @@
 .\"	**		Perform all arguments once			**
 .\"	**			P1 is nestable				**
 .\"	******************************************************************
-.de P1
+.de t*P1
 .  \" `while' command is about five times faster than recursion!
 .  while \\n[.$] \{\
 .    nop \\$1
@@ -229,22 +229,27 @@
 .
 .\"	******************************************************************
 .\"	**	Hilfsmakro zum Einstellen von Schriftgroesse und	**
-.\"	**	Zeilenabstand, bezogen auf Anfangswerte \n[s] und \n[v]	**
-.\"	**	sowie fuer Hyphenation:					**
+.\"	**	Zeilenabstand, bezogen auf Anfangswerte \n[t*s]		**
+.\"	**	und \n[t*v] sowie fuer Hyphenation:			**
 .\"	**		.pv s v hy# hart;  macht .br			**
 .\"	**	Bei 4. Argument setzen der Register s und v und hy.	**
 .\"	**	Fuer angefangene Zeile die vorgefundenen Einstellungen	**
+.\"	**								**
+.\"	**   Auxiliary macro to set internal registers for font size	**
+.\"	**   and line spacing, relative to initial values \n[t*s] and	**
+.\"	**   \n[t*v]. Optionally sets hyphenation. A fourth argument	**
+.\"	**   initializes internal registers to global default values.	**
 .\"	******************************************************************
-.de pv
+.de t*pv
 .  br
 .
 .  if \\n[.$] \
-.    ps (\\n[s]u * \\$1z / 1z)
+.    ps (\\n[t*s]u * \\$1z / 1z)
 .
 .  ie (\\n[.$] - 1) \
-.    vs (\\n[v]u * \\$2p / 1p)
+.    vs (\\n[t*v]u * \\$2p / 1p)
 .  el \{\
-.    vs (\\n[v]u * \\$1p / 1p)
+.    vs (\\n[t*v]u * \\$1p / 1p)
 .    return
 .  \}
 .
@@ -252,9 +257,9 @@
 .    hy \\$3
 .
 .  if !""\\$4" \{\
-.    nr v \\n[.v]
-.    nr s \\n[.ps]
-.    nr hy \\n[.hy]
+.    nr t*v \\n[.v]
+.    nr t*s \\n[.ps]
+.    nr t*hy \\n[.hy]
 .  \}
 ..
 .
@@ -289,9 +294,9 @@
 .
 .
 .\"	******************************************************************
-.\"	**		processs diversion				**
+.\"	**		process diversion				**
 .\"	******************************************************************
-.de DI
+.de t*DI
 .  nr * \\n[.u]
 .  nf		\"	diversion is already formatted - output it unchanged
 .  \\$1		\"	output the diversion ...
@@ -300,4 +305,21 @@
 .    fi		\"	reactivate formatting
 ..
 .
+.\"	******************************************************************
+.\"	**		error checking at end				**
+.\"	******************************************************************
+.de t*EM
+.
+.  if !"\\*[t*kept]"" \{\
+.    tm1 "hdtbl: Not all tables have been printed.
+.    tm1 "       Add `.bp' at the end of your document.
+.  \}
+.  if !"\\*[t*held]"" \{\
+.    tm1 "hdtbl: There are held tables which haven't been printed.
+.    tm1 "       Add `.t*free' at the end of your document.
+.  \}
+.  if \\n[t*#] \
+.    tm hdtbl: Missing `.ETB' macro; last .TBL in \\*[t*FN] at line \\*[t*LN].
+..
+.
 .\" EOF
Index: hdtbl.tmac
===================================================================
RCS file: /sources/groff/groff/contrib/hdtbl/hdtbl.tmac,v
retrieving revision 1.14
diff -u -r1.14 hdtbl.tmac
--- hdtbl.tmac	23 Jan 2010 07:47:40 -0000	1.14
+++ hdtbl.tmac	4 Feb 2010 17:13:43 -0000
@@ -55,12 +55,16 @@
 .nr t*csp .5n
 .nr t*b .1n
 .nr t*cols 1
+.nr t*v \n[.v]
+.nr t*s \n[.ps]
+.nr t*hy \n[.hy]
+.nr t*l \n[.ll]
 .
 .
 .\"			defaults for table captions
 .nr t*cptn 0 1
 .ds t*cptn "".sp .4" \
-            ".pv 1.4 1.4" \
+            ".t*pv 1.0 1.0" \
             ".ad l" \
             "\m[\\*[t*fgc]]Table \\n+[t*cptn]:\0\c\k*"\"
 .
@@ -107,7 +111,11 @@
 .  \}
 .  nr t*# +1
 .
-.  getarg cols \\$@\"	from here string `args' contains the rest of \\$@
+.  \" Save current location for error checking at end
+.  ds t*FN \\[.F]
+.  ds t*LN \\[.c]
+.
+.  t*getarg cols \\$@\"	from here string `args' contains the rest of \\$@
 .  ie "\\*[cols]"" \
 .    nr t*cols\\n[t*#] \\n[t*cols]
 .  el \{\
@@ -117,7 +125,7 @@
 .      tm \\n[.F]:\\n[.c]: Invalid number of columns value `\\*[cols]'.
 .  \}
 .
-.  getarg cpd \\*[args]                 \"	cell padding
+.  t*getarg cpd \\*[args]                 \"	cell padding
 .  ie "\\*[cpd]"" \
 .    nr t*cpd\\n[t*#] \\n[t*cpd]
 .  el \{\
@@ -127,7 +135,7 @@
 .      tm \\n[.F]:\\n[.c]: Invalid cell padding value `\\*[cpd]'.
 .  \}
 .
-.  getarg csp \\*[args]                 \"	cell spacing
+.  t*getarg csp \\*[args]                 \"	cell spacing
 .  ie "\\*[csp]"" \
 .    nr t*csp\\n[t*#] \\n[t*csp]
 .  el \{\
@@ -137,7 +145,7 @@
 .      tm \\n[.F]:\\n[.c]: Invalid cell spacing value `\\*[csp]'.
 .  \}
 .
-.  getarg border \\*[args]              \"	border thickness
+.  t*getarg border \\*[args]              \"	border thickness
 .  ie "\\*[border]"=" \
 .    nr t*b\\n[t*#] 0-1
 .  el \{\
@@ -150,7 +158,7 @@
 .        tm \\n[.F]:\\n[.c]: Invalid border thickness value `\\*[border]'.
 .  \}\}
 .
-.  getarg bc \\*[args]                  \"	border color
+.  t*getarg bc \\*[args]                  \"	border color
 .  ds t*bc\\n[t*#] \\*[t*bc]\"
 .  if !"\\*[bc]"" \{\
 .    ie m\\*[bc] \
@@ -170,14 +178,14 @@
 .      ds t*bc\\n[t*#] \\*[bc]\"
 .  \}
 .
-.  getarg width \\*[args]               \"	table/col widths
+.  t*getarg width \\*[args]               \"	table/col widths
 .  if "\\*[width]"=" \
 .    ds width
 .
 .  nr b/2\\n[t*#] (\\n[t*b\\n[t*#]] / 2)\"	shortcut
 .  nr cscp\\n[t*#] (\\n[t*csp\\n[t*#]] + \\n[t*cpd\\n[t*#]])\"  aux. register
 .
-.  getarg height \\*[args]              \"	table outline height
+.  t*getarg height \\*[args]              \"	table outline height
 .  ie "\\*[height]"" \
 .    nr t*height\\n[t*#] 0
 .  el \{\
@@ -192,7 +200,7 @@
 .  t*cl \\*[width]                      \"	get cell widths and offsets
 .  t*args \\n[t*#]                      \"	look for common arguments
 .
-.  getarg tal \\*[args]                 \"	table horizontal alignment
+.  t*getarg tal \\*[args]                 \"	table horizontal alignment
 .  if "\\*[tal]"" \
 .    ds tal \\*[t*tal]\"
 .  ie "\\*[tal]"l" \
@@ -211,7 +219,7 @@
 .  nr t*r#\\n[t*#] 0		        \"	initialize row index
 .  mk toptbl\\n[t*#]
 .
-.  P1 \\*[args]
+.  t*P1 \\*[args]
 ..
 .
 .
@@ -228,14 +236,14 @@
 .      return
 .    \}
 .
-.  getarg val \\$@
+.  t*getarg val \\$@
 .  ds args\\n[t*#] "\\*[args]\"
 .
-.  index "\\*[args]" .TR
-.  ie \\n[index] \{\
+.  t*index "\\*[args]" .TR
+.  ie \\n[t*index] \{\
 .    ds *a\\n[t*#] "\\*[args]\"
-.    substring args\\n[t*#] 0 \\n[index]
-.    substring *a\\n[t*#] \\n[index]-2 -1
+.    substring args\\n[t*#] 0 \\n[t*index]
+.    substring *a\\n[t*#] \\n[t*index]-2 -1
 .  \}
 .  el \
 .    ds *a\\n[t*#]
@@ -249,15 +257,15 @@
 .  el \{\
 .    ll (\\n[ll\\n[t*#]]u + \\n[in\\n[t*#]]u)
 .    in \\n[in\\n[t*#]]u
-.    P1 \\*[t*cptn]
+.    t*P1 \\*[t*cptn]
 '    in +\\n[*]u
-.    P1 \\*[args\\n[t*#]]
-.    pv 1 1
+.    t*P1 \\*[args\\n[t*#]]
+.    t*pv 1 1
 .    in
 .    mk toptbl\\n[t*#]
 .  \}
 .
-.  P1 \\*[*a\\n[t*#]]
+.  t*P1 \\*[*a\\n[t*#]]
 ..
 .
 .als *CPTN CPTN
@@ -283,7 +291,7 @@
 .  nr c#\\*[#t#r] 0 1			\"	clear cell counter
 .  nr dntr\\*[#t#r] 0 1			\"	clear accumulated row height
 .
-.  getarg height \\$@
+.  t*getarg height \\$@
 .  ie "\\*[height]"" \
 .    nr t*height\\*[#t#r] 0
 .  el \{\
@@ -297,7 +305,7 @@
 .  \"	is too high by 3/2 b, independent of the number of TR with `height'.
 .  t*args \\*[#t#r] \\n[t*#]            \"	look for common arguments
 .
-.  P1 \\*[args]
+.  t*P1 \\*[args]
 ..
 .
 .
@@ -309,15 +317,15 @@
 .\"		else like .TD
 .de TH
 .  ft 1
-.  getarg hal \\$@
+.  t*getarg hal \\$@
 .  if "\\*[hal]"" \
 .    ds hal c\"
 .
-.  getarg val \\*[args]
+.  t*getarg val \\*[args]
 .  if "\\*[val]"" \
 .    ds val m\"
 .
-.  getarg fst \\*[args]
+.  t*getarg fst \\*[args]
 .  if "\\*[fst]"" \
 .    ds fst B\"
 .
@@ -336,7 +344,7 @@
 .  ds *#trc* \\*[#t#r]*\\n[c#\\*[#t#r]]\"	table cell identifier
 .					\"	(<level>*<row>*<column>)
 .
-.  getarg rowspan \\$@
+.  t*getarg rowspan \\$@
 .  nr rowspan 1
 .  if !"\\*[rowspan]"" \{\
 .    ie \B\\*[rowspan] \{\
@@ -347,7 +355,7 @@
 .      tm \\n[.F]:\\n[.c]: Invalid value of `rowspan' keyword.
 .  \}
 .
-.  getarg colspan \\*[args]
+.  t*getarg colspan \\*[args]
 .  nr colspan 1
 .  if !"\\*[colspan]"" \{\
 .    ie \B\\*[colspan] \
@@ -421,9 +429,9 @@
 .  ad \\*[t*hal\\*[#trc]]
 .  fam \\*[t*ff\\*[#trc]]
 .  ft \\*[t*fst\\*[#trc]]
-.  pv \\*[t*fsz\\*[#trc]]
+.  t*pv \\*[t*fsz\\*[#trc]]
 .
-.  P1 \\*[args]
+.  t*P1 \\*[args]
 ..
 .
 .
@@ -454,14 +462,14 @@
 .  in 0                          \"	reset indent
 .  gcolor \\*[t*m\\n[t*#]]       \"	reset previous fgc
 .
-.  getarg hold \\$@
+.  t*getarg hold \\$@
 .  if !\\n[t*#] \{\
 .    sp .5
 .    di
 .    in \\n[t*i]u
 .    ie "\\*[hold]"" \{\
 .      ie (\\n[.t] - \\n[dn]) \
-.        DI t*tbl0
+.        t*DI t*tbl0
 .      el \{\
 .        rn t*tbl0 t*tbl\\n+[t*numb]
 .        ds t*kept \\*[t*kept] t*tbl\\n[t*numb] \\n[dn]\"
@@ -476,7 +484,7 @@
 .    ev				\"	restore previous environment
 .  \}
 .
-.  P1 \\*[args]
+.  t*P1 \\*[args]
 ..
 .
 .
@@ -513,7 +521,7 @@
 .
 .    ie (\\n[.t] - \\n[*]) \{\
 .      ev t*tbl
-.      DI \\*[*]
+.      t*DI \\*[*]
 .      ev
 .    \}
 .    el \{\
@@ -536,7 +544,7 @@
 .\"		Nested tables are processed from inside to outside.
 .
 .de t*divs
-.  ll (\\n[l]u + 1c)			\"	avoid warning `can't break line'
+.  ll (\\n[t*l]u + 1c)			\"	avoid warning `can't break line'
 .  nf
 .
 .  nr b/2 \\n[b/2\\n[t*#]]		\"	some abbreviations
@@ -886,7 +894,7 @@
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg bgc \\*[args]         \"	background color
+.  t*getarg bgc \\*[args]         \"	background color
 .  if !"\\*[bgc]"" \{\
 .    ie m\\*[bgc] \
 .      ds t*bgc\\$1 \\*[bgc]\"
@@ -899,7 +907,7 @@
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg fgc \\*[args]         \"	foreground color
+.  t*getarg fgc \\*[args]         \"	foreground color
 .  if !"\\*[fgc]"" \{\
 .    ie m\\*[fgc] \
 .      ds t*fgc\\$1 \\*[fgc]\"
@@ -912,22 +920,22 @@
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg hl \\*[args]          \"	horizontal line between cells
+.  t*getarg hl \\*[args]          \"	horizontal line between cells
 .  if !"\\*[hl]"" \
 .    ds t*hl\\$1 \\*[hl]\"
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg vl \\*[args]          \"	vertical line between cells
+.  t*getarg vl \\*[args]          \"	vertical line between cells
 .  if !"\\*[vl]"" \
 .    ds t*vl\\$1 \\*[vl]\"
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg hal \\*[args]         \"	horizontal table cell alignment
+.  t*getarg hal \\*[args]         \"	horizontal table cell alignment
 .  if !"\\*[hal]"" \{\
-.    index bcrl \\*[hal]
-.    ie \\n[index] \
+.    t*index bcrl \\*[hal]
+.    ie \\n[t*index] \
 .      ds t*hal\\$1 \\*[hal]\"
 .    el \{\
 .      tmc \\n[.F]:\\n[.c]: Invalid horizontal alignment `\\*[hal]':
@@ -936,10 +944,10 @@
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg val \\*[args]         \"	vertical table cell alignment
+.  t*getarg val \\*[args]         \"	vertical table cell alignment
 .  if !"\\*[val]"" \{\
-.    index tmb \\*[val]
-.    ie \\n[index] \
+.    t*index tmb \\*[val]
+.    ie \\n[t*index] \
 .      ds t*val\\$1 \\*[val]\"
 .    el \{\
 .      tmc \\n[.F]:\\n[.c]: Invalid vertical alignment `\\*[val]':
@@ -948,19 +956,19 @@
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg ff \\*[args]          \"	font family
+.  t*getarg ff \\*[args]          \"	font family
 .  if !"\\*[ff]"" \
 .    ds t*ff\\$1 \\*[ff]\"
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg fst \\*[args]         \"	font style
+.  t*getarg fst \\*[args]         \"	font style
 .  if !"\\*[fst]"" \
 .    ds t*fst\\$1 \\*[fst]\"
 .  if "\\*[args]"" \
 .    return
 .
-.  getarg fsz \\*[args]         \"	font size and spacing factor
+.  t*getarg fsz \\*[args]         \"	font size and spacing factor
 .  if !"\\*[fsz]"" \
 .    ds t*fsz\\$1 \\*[fsz]\"
 ..
@@ -987,7 +995,7 @@
 .      break
 .    \}
 .
-.    DI \\*[*]
+.    t*DI \\*[*]
 .  \}
 .  ev
 ..
Index: examples/col_rowspan_colors.roff
===================================================================
RCS file: /sources/groff/groff/contrib/hdtbl/examples/col_rowspan_colors.roff,v
retrieving revision 1.6
diff -u -r1.6 col_rowspan_colors.roff
--- examples/col_rowspan_colors.roff	23 Jan 2010 07:47:40 -0000	1.6
+++ examples/col_rowspan_colors.roff	4 Feb 2010 17:13:43 -0000
@@ -58,7 +58,7 @@
 .   color#
 .   as html " \\*[help] ".TR height=\\nW" ".TD colspan=\\nI bgc=c\\n#"
 .\}
-.P1 \\*[html]
+.t*P1 \\*[html]
 ..
 .
 .pv 1.2 1.2 "" x
Index: examples/common.roff
===================================================================
RCS file: /sources/groff/groff/contrib/hdtbl/examples/common.roff,v
retrieving revision 1.1
diff -u -r1.1 common.roff
--- examples/common.roff	23 Jan 2010 07:47:40 -0000	1.1
+++ examples/common.roff	4 Feb 2010 17:13:44 -0000
@@ -24,6 +24,8 @@
 ..
 .
 .
+.mso hdtbl.tmac\"			load table macros
+.
 .\"	******************************************************************
 .\"	**	Some macros and the page setup used by the examples	**
 .\"	******************************************************************
@@ -50,7 +52,7 @@
        tal=c \
        "width=(\\n[*w*]+4n)<?\n[.l]"
 .  TR .TD
-.  P1 \\$*
+.  t*P1 \\$*
 .  ETB
 .  SP
 ..
@@ -101,7 +103,7 @@
 .  shift
 .
 .  while \\n-[PN\\n[*pn]] \
-.    P1 \\$@
+.    t*P1 \\$@
 .
 .  nr *pn -1
 ..
@@ -282,9 +284,11 @@
 .
 .nr s \n[.ps]
 .nr v \n[.v]
+.nr p \n[.p]
+.nr o \n[.o]
 .pv 1.2 1.2 "" X
 .nr l 6.6i				\"	set text width
-.ll \n[l]u
+.ll \n[t*l]u
 .nr o 2c				\"	set offset
 .po \n[o]u
 .nr p 29.7c				\"	set paper length (A4)
@@ -292,8 +296,11 @@
 .nr tH 1i				\"	set top margin
 .sp |\n[tH]u
 .
+.ds t*HM //arbitrary text for page header, except on the first page//\"
+.ds t*BM //arbitrary text for page footer, except on the last page/\\n[%]/\"
+.
 .ev 99
-.lt \n[l]u
+.lt \n[t*l]u
 .ev
 .
 .
@@ -315,27 +322,21 @@
 .
 .de EM
 .  rm BM			\"	no page number at bottom of last page
-.
-.  if !"\\*[t*kept]"" \{\
-.    tm1 "hdtbl: Not all tables have been printed.
-.    tm1 "       Add `.bp' at the end of your document.
-.  \}
-.  if !"\\*[t*held]"" \{\
-.    tm1 "hdtbl: There are held tables which haven't been printed.
-.    tm1 "       Add `.t*free' at the end of your document.
-.  \}
-.  if \\n[t*#] \
-.    tm hdtbl: Missing `.ETB' macro at end of document.
+.  t*EM
 ..
 .
 .
+.wh 0 HM
+.wh 0-1.5i BM
 .em EM
 .
+.\" Some packages (-mm) define their own .SP macro.
+.\" Use ours if another one isn't already available.
+.if !d SP .als SP t*SP
+.
 .if "\n[.m]"" \
 .  gcolor black
 .if "\n[.M]"" \
 .  fcolor white
 .
-.mso hdtbl.tmac\"			load table macros
-.
 .\" EOF
Index: examples/fonts_n.in
===================================================================
RCS file: /sources/groff/groff/contrib/hdtbl/examples/fonts_n.in,v
retrieving revision 1.4
diff -u -r1.4 fonts_n.in
--- examples/fonts_n.in	5 Jan 2009 20:10:42 -0000	1.4
+++ examples/fonts_n.in	4 Feb 2010 17:13:44 -0000
@@ -34,6 +34,7 @@
 .\"	**		without arg: glyphs and codes of active font.	**
 .\"	******************************************************************
 .
+.so examples/common.roff
 .time start
 .
 .if !d fontpath \
@@ -67,7 +68,7 @@
 .        continue 
 .    \}
 .
-.    index "\\*[*f]" \\*[*$1]
+.    t*index "\\*[*f]" \\*[*$1]
 .
 .    ie (\\n[.y] > 18) \
 .      if !F \\*[*$1] \{\
@@ -75,7 +76,7 @@
 .        continue 
 .      \}
 .    el \{\
-.      if !\\n[index] \{\
+.      if !\\n[t*index] \{\
 .        tm \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
 .        continue 
 .      \}
Index: examples/fonts_x.in
===================================================================
RCS file: /sources/groff/groff/contrib/hdtbl/examples/fonts_x.in,v
retrieving revision 1.4
diff -u -r1.4 fonts_x.in
--- examples/fonts_x.in	5 Jan 2009 20:10:42 -0000	1.4
+++ examples/fonts_x.in	4 Feb 2010 17:13:44 -0000
@@ -34,6 +34,7 @@
 .\"	**		without arg: glyphs and codes of active font.	**
 .\"	******************************************************************
 .
+.so examples/common.roff
 .time start
 .
 .if !d fontpath \
@@ -67,7 +68,7 @@
 .        continue
 .    \}
 .
-.    index "\\*[*f]" \\*[*$1]
+.    t*index "\\*[*f]" \\*[*$1]
 .
 .    ie (\\n[.y] > 18) \
 .      if !F \\*[*$1] \{\
@@ -75,7 +76,7 @@
 .        continue
 .      \}
 .    el \{\
-.      if !\\n[index] \{\
+.      if !\\n[t*index] \{\
 .        tm \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
 .        continue
 .      \}
Index: examples/rainbow.roff
===================================================================
RCS file: /sources/groff/groff/contrib/hdtbl/examples/rainbow.roff,v
retrieving revision 1.6
diff -u -r1.6 rainbow.roff
--- examples/rainbow.roff	23 Jan 2010 07:47:40 -0000	1.6
+++ examples/rainbow.roff	4 Feb 2010 17:13:44 -0000
@@ -34,7 +34,7 @@
 .  PN \\$1 \
      ".nr #cc +(1f / \\$1)" \
      ".defcolor \En[t*#] rgb \\$2 \\$3 \\$4" \
-     ".TBL csp=\n[l]/(12*\\$1+2) border= cpd=0 bgc=\\\\n[t*#] bc=" \
+     ".TBL csp=\n[t*l]/(12*\\$1+2) border= cpd=0 bgc=\\\\n[t*#] bc=" \
        ".if (\\\\n+[*#] == 1) \
           .CPTN Rainbow Colors \[em] Nested Tables with Colored Backgrounds \
                 val=b" \
@@ -65,7 +65,7 @@
 .  PN \\$1 \
      ".nr #cc +(1f / \\$1)" \
      ".defcolor \En[t*#] rgb \\$2 \\$3 \\$4" \
-     ".TBL border=\n[l]/(12*\\$1+2) csp=0 cpd=0 bc=\\\\n[t*#] bgc=" \
+     ".TBL border=\n[t*l]/(12*\\$1+2) csp=0 cpd=0 bc=\\\\n[t*#] bgc=" \
        ".if (\\\\n+[*#] == 1) \
           .CPTN Rainbow Colors \[em] Nested Tables with Colored Borders \
                 val=b" \
