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