| 1 |
.ig |
| 2 |
Copyright 2006 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
Written by Joachim Walsdorff <[email protected]> |
| 5 |
|
| 6 |
This file is part of hdtbl. |
| 7 |
|
| 8 |
hdtbl is distributed with groff, the GNU roff typesetting system. |
| 9 |
|
| 10 |
groff is free software; you can redistribute it and/or modify it under |
| 11 |
the terms of the GNU General Public License as published by the Free |
| 12 |
Software Foundation, either version 3 of the License, or |
| 13 |
(at your option) any later version. |
| 14 |
|
| 15 |
groff is distributed in the hope that it will be useful, but WITHOUT |
| 16 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 17 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 18 |
for more details. |
| 19 |
|
| 20 |
You should have received a copy of the GNU General Public License |
| 21 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 |
.. |
| 23 |
. |
| 24 |
.if !d sopath \ |
| 25 |
. ds sopath |
| 26 |
. |
| 27 |
.ds lib examples/common.roff |
| 28 |
.soquiet \*[sopath]\*[lib] |
| 29 |
.if !d common \{\ |
| 30 |
. tmc \n[.F]: cannot find "\*[lib]"; specify its location |
| 31 |
. tm1 " with groff '-I' or '-d sopath=' option |
| 32 |
.\} |
| 33 |
. |
| 34 |
. |
| 35 |
.\" Seed the random number generator for reproducible builds. |
| 36 |
.random-seed 131545532 19201711 |
| 37 |
.de color# |
| 38 |
.nr # +1 |
| 39 |
.random# |
| 40 |
.defcolor c\\n# rgb \\*[#random] |
| 41 |
.. |
| 42 |
. |
| 43 |
.de brt |
| 44 |
.nr # 0 |
| 45 |
.color# |
| 46 |
.if \\n[t*cols\\n[t*#]]/2*2=\\n[t*cols\\n[t*#]] \{ . |
| 47 |
. tmc \\n(.F:\\n(.c: cols was even (\\n[t*cols\\n[t*#]]), |
| 48 |
. nr t*cols\\n[t*#] +1 |
| 49 |
. tm1 " increased by one col to \\n[t*cols\\n[t*#]]. |
| 50 |
. t*cl \\*[width] |
| 51 |
. ie "\\*[tal]"r" .nr in\\n[t*#] -\\*[width]\" recalculate cell widths etc. |
| 52 |
. el .if "\\*[tal]"c" .nr in\\n[t*#] -\\*[width]/2 |
| 53 |
.\} |
| 54 |
.nr N \\n[t*cols\\n[t*#]]-1 \" N must be even |
| 55 |
.nr W 1c\"\\*[width] |
| 56 |
.ds html "".TR height=\\nW" ".TD bgc=c\\n#" |
| 57 |
.nr I 0 2 |
| 58 |
.while \\nN>=\\n+I \{ . |
| 59 |
. ds help "\\*[html] |
| 60 |
. pops * help |
| 61 |
. color# |
| 62 |
. ds html "".TR height=\\nW" ".TD colspan=\\nI bgc=c\\n#" |
| 63 |
. color# |
| 64 |
. as html " ".TD rowspan=\\nI bgc=c\\n#" |
| 65 |
. color# |
| 66 |
. as html " ".TR height=\\nW" ".TD rowspan=\\nI bgc=c\\n#" |
| 67 |
. color# |
| 68 |
. as html " \\*[help] ".TR height=\\nW" ".TD colspan=\\nI bgc=c\\n#" |
| 69 |
.\} |
| 70 |
.t*P1 \\*[html] |
| 71 |
.. |
| 72 |
. |
| 73 |
.t*pv 1.2 1.2 "" x |
| 74 |
.PN 10 Text before table. |
| 75 |
.in 1c |
| 76 |
.PN 8 Indented text before table. |
| 77 |
*** *** *** |
| 78 |
.TBL width=90% border=1n csp=1n cpd=1n bgc=wheat tal=c .TR .TD |
| 79 |
.TBL border= cols=11 width=1c tal=c csp=0 cpd=0 \"cols must be odd |
| 80 |
.CPTN val=b Randomly Colored Table Cells with Colspan/\%Rowspan |
| 81 |
.brt |
| 82 |
.ETB .ETB |
| 83 |
.PN 15 Text after table. |
| 84 |
. |
| 85 |
.\" Local Variables: |
| 86 |
.\" mode: nroff |
| 87 |
.\" fill-column: 72 |
| 88 |
.\" End: |
| 89 |
.\" vim: set filetype=groff textwidth=72: |