There are still known unfixed defects in the HDTBL software. Patches already exist for them and also additional files to extend the already existing examples.
What is missing, is to apply them to the master branch. The first rewritten patch for the '*.roff' examples is in the attachment.
>From e7798b2ce409be81cabedee27e566046b317d19a Mon Sep 17 00:00:00 2001 From: Bjarni Ingi Gislason <bjarn...@simnet.is> Date: Sat, 26 Apr 2025 19:03:18 +0000 Subject: [PATCH] Subject: fix bugs and some tiding in the hdtbl/examples/*.roff files Add a break (.br) to output all text, that belongs in front of a table. Reduce the width of some items to fit on a A4 sized (paper) page. Remove whitespace in front of a comment escape sequence. Otherwise the software (processor) has to deal with it every time it is processed. Define some registers before use, if not already defined. Add some comments. Only read "hdtbl.tmac" if not alredy done so. common.roff: Macro "EM": define macro "BM" as empty instead of removing it. mixed_pickles.roff: * show in the picture that option '-U' is also used. * Add code for creating also a PDF file. That uses a "gnu.pdf" file similar to "gnu.eps" one. * Add the warning for "file" in the picture. rainbow.roff: * avoid invalid values of colors. short_reference.roff: * remove undefined macros "xig" and "x.". Signed-off-by: Bjarni Ingi Gislason <bjarn...@simnet.is> --- contrib/hdtbl/examples/chess_board.roff | 3 +- .../hdtbl/examples/col_rowspan_colors.roff | 6 ++- contrib/hdtbl/examples/color_boxes.roff | 3 ++ .../hdtbl/examples/color_nested_tables.roff | 2 + contrib/hdtbl/examples/color_table_cells.roff | 3 ++ contrib/hdtbl/examples/color_transitions.roff | 21 +++++---- contrib/hdtbl/examples/common.roff | 24 ++++++---- contrib/hdtbl/examples/mixed_pickles.roff | 46 +++++++++++-------- contrib/hdtbl/examples/rainbow.roff | 21 +++++++-- contrib/hdtbl/examples/short_reference.roff | 4 +- 10 files changed, 87 insertions(+), 46 deletions(-) diff --git a/contrib/hdtbl/examples/chess_board.roff b/contrib/hdtbl/examples/chess_board.roff index 5262ff941..9ba1f9420 100644 --- a/contrib/hdtbl/examples/chess_board.roff +++ b/contrib/hdtbl/examples/chess_board.roff @@ -46,7 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .. .af *y a .H Chessboard -.TBL border=0 csp=.05n bgc= cols=10 width=1.6c tal=c +.\" let the chessboard fit on an A4 and letter sized papers +.TBL border=0 csp=.05n bgc= cols=10 width=1.5c tal=c .TR vl= hal=c\" height=1c .TD hl= .nr *y 0 diff --git a/contrib/hdtbl/examples/col_rowspan_colors.roff b/contrib/hdtbl/examples/col_rowspan_colors.roff index 6c74af04e..2b0127e22 100644 --- a/contrib/hdtbl/examples/col_rowspan_colors.roff +++ b/contrib/hdtbl/examples/col_rowspan_colors.roff @@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .de color# .nr # +1 .random# +.\".tm col_rowspan_colors.roff: color_component is \\*[#random] .defcolor c\\n# rgb \\*[#random] .. . @@ -48,7 +49,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . ie "\\*[tal]"r" .nr in\\n[t*#] -\\*[width]\" recalculate cell widths etc. . el .if "\\*[tal]"c" .nr in\\n[t*#] -\\*[width]/2 .\} -.nr N \\n[t*cols\\n[t*#]]-1 \" N must be even +.nr N \\n[t*cols\\n[t*#]]-1\" N must be even .nr W 1c\"\\*[width] .ds html "".TR height=\\nW" ".TD bgc=c\\n#" .nr I 0 2 @@ -72,8 +73,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .in 1c .PN 8 Indented text before table. *** *** *** +.br\" Separate the text from the table .TBL width=90% border=1n csp=1n cpd=1n bgc=wheat tal=c .TR .TD -.TBL border= cols=11 width=1c tal=c csp=0 cpd=0 \"cols must be odd +.TBL border= cols=11 width=1c tal=c csp=0 cpd=0\"cols must be odd .CPTN val=b Randomly Colored Table Cells with Colspan/\%Rowspan .brt .ETB .ETB diff --git a/contrib/hdtbl/examples/color_boxes.roff b/contrib/hdtbl/examples/color_boxes.roff index 85dc513b6..5f3ab9844 100644 --- a/contrib/hdtbl/examples/color_boxes.roff +++ b/contrib/hdtbl/examples/color_boxes.roff @@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . .H Horizontal Rules and Boxes .br with Randomly Colored Border and Background .PN 25 Text before horizontal rule. +.br\" Separate the text in ".PN 25" from the table .TBL border=.5n bc=green bgc=red width=7c tal=c csp=.2n cpd=.3n .TR .TD .ETB .PN 10 Text after horizontal rule and before table. .de ctab @@ -41,10 +42,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .TD ".TBL border=1c bc=color1 csp=0 cpd=0 height=3c bgc=color2" .TR .TD .ETB .. . +.br\" Separate the text in ".PN 10" from the table .TBL tal=c border= csp=0 cpd=0 cols=5 width=3c .PN 2 .TR ".PN 5 .ctab" .ETB .PN 15 Text after table. +.br\" Separate the text in ".PN 15" from the table .TBL border=.5n bc=color1 bgc=color2 width=15c tal=c csp=.2n cpd=.3n .TR .TD .ETB .PN 25 Text after horizontal rule. . diff --git a/contrib/hdtbl/examples/color_nested_tables.roff b/contrib/hdtbl/examples/color_nested_tables.roff index a5aecafe0..48b275144 100644 --- a/contrib/hdtbl/examples/color_nested_tables.roff +++ b/contrib/hdtbl/examples/color_nested_tables.roff @@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .PN 15 Text before first table. .nr # 0 1 ***** +.br\" Separate the text from the table .PN 39 .random# ".defcolor c\\n[#] rgb \\\\*[#random] " \ ".TBL csp=0 cpd=0 border=1n bc=c\\n[#]" \ ".if \\\\n+#=1 .CPTN val=b Nested Tables with Randomly Colored Border" \ @@ -46,6 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . .PN 15 Text before second table. ***** +.br\" Separate the text from the table .nr # 0 1 .PN 39 .random# ".defcolor c\\n[#] rgb \\\\*[#random] " \ ".TBL csp=0 cpd=1n border= bgc=c\\n[#]" \ diff --git a/contrib/hdtbl/examples/color_table_cells.roff b/contrib/hdtbl/examples/color_table_cells.roff index 8026fb0f7..3ba523670 100644 --- a/contrib/hdtbl/examples/color_table_cells.roff +++ b/contrib/hdtbl/examples/color_table_cells.roff @@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . .H Horizontal Rules and Randomly Colored Table Cells .PN 15 Text before HR. +.br\" Separate the text from the table .TBL border=.5n bc=green bgc=red width=7c tal=c csp=.2n cpd=.3n .TR .TD .ETB .PN 10 Text after HR and before Table. . @@ -42,10 +43,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .TR height=\nl/10 .PN 8 .random# ".defcolor c\\\\n+? rgb \E*[#random]" ".TD bgc=c\\\\n?" .. +.br\" Separate the text from the table .TBL tal=c border= csp=0 cpd=0 cols=8 width=\nl/10 .PN 8 .ctab .ETB .PN 10 Text after table. +.br\" Separate the text from the table .TBL border=.5n bc=c1 bgc=c2 width=15c tal=c csp=.2n cpd=.3n .TR .TD .ETB .PN 15 Text after HR. . diff --git a/contrib/hdtbl/examples/color_transitions.roff b/contrib/hdtbl/examples/color_transitions.roff index d465864de..5faefb7e7 100644 --- a/contrib/hdtbl/examples/color_transitions.roff +++ b/contrib/hdtbl/examples/color_transitions.roff @@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .\} . . +.nr #cc 0\" is used as a argument to the macro ctab .de ctab .nr #cc 0 .PN 21 ".nr #cc +.05f" \ @@ -40,21 +41,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .PN 21 .ETB .. .PN 30 Before table. +.br\" Separate the text from the table .TBL cols=3 width=33% border= csp=0 cpd=0 bgc= .CPTN val=b Color Transitions .TR -.TD ".ctab 0+\En[#cc]u \En[#cc]u \En[#cc]u" \" black -> white +.TD ".ctab 0+\En[#cc]u \En[#cc]u \En[#cc]u"\" black -> white .TD ".ctab 1f-\En[#cc]u 1f-\En[#cc]u 1f-\En[#cc]u"\" white -> black -.TD ".ctab 1f \En[#cc]u \En[#cc]u" \" red -> white +.TD ".ctab 1f \En[#cc]u \En[#cc]u"\" red -> white .TR -.TD ".ctab 0 1f-\En[#cc]u \En[#cc]u" \" green -> blue -.TD ".ctab 1f 1f-\En[#cc]u 1f" \" white -> magenta -.TD ".ctab 1f \En[#cc]u 1f" \" magenta -> white +.TD ".ctab 0 1f-\En[#cc]u \En[#cc]u"\" green -> blue +.TD ".ctab 1f 1f-\En[#cc]u 1f"\" white -> magenta +.TD ".ctab 1f \En[#cc]u 1f"\" magenta -> white .TR -.TD ".ctab 0+\En[#cc]u \En[#cc]u 1f-\En[#cc]u" \" blue -> yellow -.TD ".ctab 1f-\En[#cc]u 1f-\En[#cc]u \En[#cc]u" \" yellow -> blue -.TD ".ctab 1f 0+\En[#cc]u 0" \" red -> yellow -.xTD ".ctab 0+\En[#cc]u 1f-\En[#cc]u 1f-\En[#cc]u"\" cyan -> red +.TD ".ctab 0+\En[#cc]u \En[#cc]u 1f-\En[#cc]u"\" blue -> yellow +.TD ".ctab 1f-\En[#cc]u 1f-\En[#cc]u \En[#cc]u"\" yellow -> blue +.TD ".ctab 1f 0+\En[#cc]u 0"\" red -> yellow +.\" Next color change is not used +.\".TD ".ctab 0+\En[#cc]u 1f-\En[#cc]u 1f-\En[#cc]u"\" cyan -> red .ETB .PN 30 After table. . diff --git a/contrib/hdtbl/examples/common.roff b/contrib/hdtbl/examples/common.roff index 047754386..ce8186dae 100644 --- a/contrib/hdtbl/examples/common.roff +++ b/contrib/hdtbl/examples/common.roff @@ -20,7 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . . .ds common common.roff\" name for diagnostic messages -.mso hdtbl.tmac\" load table macros +.if !d TBL \{\ +. mso hdtbl.tmac\" load table macros +.\} . .\" ****************************************************************** .\" ** Some macros and the page setup used by the examples ** @@ -144,7 +146,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . \} . \} . -. \" strip leading zero, if any +.\" strip leading zero, if any . ds * \\*[hex#]\" . substring * 0 0 . length len# \\*[hex#] @@ -216,7 +218,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . if (\\n[*] < 1) \ . nr * +2147483562 . -. \" reduce the result to the leftmost 24 bits +.\" reduce the result to the leftmost 24 bits . nr * (\\n[*] / 128) . . d2x \\n[*] @@ -234,13 +236,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .nr v \n[.v] .nr p \n[.p] .nr o \n[.o] -.nr l 6.6i \" set text width +.nr l 6.6i\" set text width .ll \n[t*l]u -.nr o 2c \" set offset +.nr o 2c\" set offset .po \n[o]u -.nr p 29.7c \" set paper length (A4) +.nr p 29.7c\" set paper length (A4) .pl \n[p]u -.nr tH 1i \" set top margin +.nr tH 1i\" set top margin .sp |\n[tH]u . .ds t*HM //arbitrary text for page header, except on the first page//\" @@ -252,23 +254,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . . .de HM -. sp |.5i \" print header in top margin +. sp |.5i\" print header in top margin . tl \\*[t*HM] . sp |\\n[tH]u +. if !r M# .nr M# 0\" used in hdmisc.tmac, macro t*SP (SP) . ev .. . . .de BM . ev 99 -. sp |(\\n[p]u - .5i) \" print footer in bottom margin +. sp |(\\n[p]u - .5i)\" print footer in bottom margin . tl \\*[t*BM] . bp .. . . .de EM -. rm BM \" no page number at bottom of last page +.\" Avoid warning about undefined macro BM +. ds BM \" instead of .rm BM; no page number at bottom of last page . t*EM .. . diff --git a/contrib/hdtbl/examples/mixed_pickles.roff b/contrib/hdtbl/examples/mixed_pickles.roff index dfbd9194b..280978887 100644 --- a/contrib/hdtbl/examples/mixed_pickles.roff +++ b/contrib/hdtbl/examples/mixed_pickles.roff @@ -37,7 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .br \ EPS Image, eqn Equation, tbl Table, and pic Picture . -Call groff with options \-t, \-e, and \-p! +Call groff with options \-t, \-e, \-p, and \-U! +.br\" Separate the text from the table . .TBL width=90% tal=c csp=.2n cpd=0 . TR @@ -45,9 +46,16 @@ Call groff with options \-t, \-e, and \-p! . TBL width='25% 75%' csp=.5n cpd=.5n hal=c . TR . TD hl=d vl=d rowspan=2 bgc=red4 fgc=linen fsz=1.2 fst=HB val=m -. PSPIC -I -\\n[.l]u gnu.eps -. sp .5 -. nop eps image with \fI.PSPIC\fP +. if '\*[.T]'ps' \{\ +. PSPIC -I -\\n[.l]u gnu.eps +. sp .5 +. nop eps image with \fI.PSPIC\fP +. \} +. if '\*[.T]'pdf' \{\ +. PDFPIC -I -\\n[.l]u ../doc/gnu.pdf +. sp .5 +. nop pdf image with \fI.PDFPIC\fP +. \} . TD bgc=linen . .EQ @@ -65,16 +73,17 @@ c c c | c c c r rI lB | r rI lB. Bit @ Code @ Warning @ Bit @ Code @ Warning = -0 @ 1 @ char @ 10 @ 1024 @ reg -1 @ 2 @ number @ 11 @ 2048 @ tab -2 @ 4 @ break @ 12 @ 4096 @ right-brace -3 @ 8 @ delim @ 13 @ 8192 @ missing -4 @ 16 @ el @ 14 @ 16384 @ input -5 @ 32 @ scale @ 15 @ 32768 @ escape -6 @ 64 @ range @ 16 @ 65536 @ space -7 @ 128 @ syntax @ 17 @ 131072 @ font -8 @ 256 @ di @ 18 @ 262144 @ ig -9 @ 512 @ mac @ 19 @ 524288 @ color +0 @ 1 @ char @ 11 @ 2048 @ tab +1 @ 2 @ number @ 12 @ 4096 @ right-brace +2 @ 4 @ break @ 13 @ 8192 @ missing +3 @ 8 @ delim @ 14 @ 16384 @ input +4 @ 16 @ el @ 15 @ 32768 @ escape +5 @ 32 @ scale @ 16 @ 65536 @ space +6 @ 64 @ range @ 17 @ 131072 @ font +7 @ 128 @ syntax @ 18 @ 262144 @ ig +8 @ 256 @ di @ 19 @ 524288 @ color +9 @ 512 @ mac @ 20 @ 1048576 @ file +10 @1024 @ reg @ .TE . . sp .5 @@ -83,14 +92,15 @@ Bit @ Code @ Warning @ Bit @ Code @ Warning . TD colspan=2 bgc=azure2 fgc=blue4 . .PS +.\" change length of arrow from 0.42 inches to 0.36 in to fit in a A4 sized page ellipse "document"; -arrow 0.42; +arrow 0.36; box width 0.6 "\fIgpic\/\fP(1)" -arrow 0.42; +arrow 0.36; box width 1.25 "\fIgtbl\/\fP(1) or \fIgeqn\/\fP(1)" "(optional)" dashed; -arrow 0.42; +arrow 0.36; box width 0.65 "\fIgtroff\/\fP(1)"; -arrow 0.42; +arrow 0.36; ellipse "PostScript" .PE . diff --git a/contrib/hdtbl/examples/rainbow.roff b/contrib/hdtbl/examples/rainbow.roff index cc99a1c25..a8098d48f 100644 --- a/contrib/hdtbl/examples/rainbow.roff +++ b/contrib/hdtbl/examples/rainbow.roff @@ -34,7 +34,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. . .de ctab . nr #cc 0 -. PN \\$1 \ +.\" Avoid invalid values of colors (valid 0 to 1) +. nr loopindex (\\$1 - 1) +.\". tm loopindex is \\n[loopindex] +. PN \\n[loopindex] \ ".nr #cc +(1f / \\$1)" \ ".defcolor \En[t*#] rgb \\$2 \\$3 \\$4" \ ".TBL csp=\n[t*l]/(12*\\$1+2) border= cpd=0 bgc=\\\\n[t*#] bc=" \ @@ -52,16 +55,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .ctab \n[*n] \En[#cc]u 1 0 \" green -> yellow .ctab \n[*n] 1 1-\En[#cc]u 0 \" yellow -> red . -.PN 6*\n[*n] .ETB +.\".PN 6*\n[*n] .ETB +.\" No space in first argument of PN or quote it +.PN "6*(\n[*n] - 1)" .ETB . .bp . .nr *n 25 .nr *# 0 1 . +.\" Avoid warnings about undefined variables +.\".nr #cc 0 +. .de ctab . nr #cc 0 -. PN \\$1 \ +.\" Avoid invalid values of colors (valid 0 to 1) +. nr loopindex (\\$1 - 1) +.\". tm loopindex is \\n[loopindex] +. PN \\n[loopindex] \ ".nr #cc +(1f / \\$1)" \ ".defcolor \En[t*#] rgb \\$2 \\$3 \\$4" \ ".TBL border=\n[t*l]/(12*\\$1+2) csp=0 cpd=0 bc=\\\\n[t*#] bgc=" \ @@ -79,7 +90,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. .ctab \n[*n] \En[#cc]u 0 1 \" blue -> magenta .ctab \n[*n] 1 0 1-\En[#cc]u \" magenta -> red . -.PN 6*\n[*n] .ETB +.\".PN 6*\n[*n] .ETB +.PN 6*(\n[*n]-1) .ETB + . .\" Local Variables: .\" mode: nroff diff --git a/contrib/hdtbl/examples/short_reference.roff b/contrib/hdtbl/examples/short_reference.roff index c491e3000..f8d24fd43 100644 --- a/contrib/hdtbl/examples/short_reference.roff +++ b/contrib/hdtbl/examples/short_reference.roff @@ -39,7 +39,7 @@ using the macros themselves. .ds t*ff HN .ds t*val m .ds t*hal l -.xig +. .TBL "width=10% 40% 25% 25%" border= "fsz=1 .8" .CPTN Base- Optional- and Utility-Macros val=b .TR @@ -68,7 +68,7 @@ using the macros themselves. .TD colspan=3 val=t Utility macro to free held tables. Use it outside any table. .ETB .bp -.x. +. .TBL "fsz=1 .8" "width=20% 32% 8% 8% 8% 8% 8% 8%" border= .TR .TH Argument .TH Value .TH \&.TBL .TH \&.CPT .TH \&.TR .TH \&.TH .TH \&.TD .TH \&.ETB -- 2.47.2