Debian Codegraph @

docs/xhtml/manual/sec-table.html

raw
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Creating Tables</title><link rel="stylesheet" type="text/css" href="manual.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="DocBook to LaTeX Publishing" /><link rel="up" href="ch03.html" title="Chapter 3. Using dblatex" /><link rel="prev" href="sec-figinclude.html" title="Figure Inclusion" /><link rel="next" href="ch03s09.html" title="Correcting Poor Formatting" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Creating Tables</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-figinclude.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using dblatex</th><td width="20%" align="right"> <a accesskey="n" href="ch03s09.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sec-table"></a>Creating Tables</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="sec-table.html#idp1134">Limitations</a></span></dt><dt><span class="section"><a href="sec-table.html#sec-table-width">Table Width</a></span></dt><dt><span class="section"><a href="sec-table.html#idp1159">Tables without colwidth</a></span></dt><dt><span class="section"><a href="sec-table.html#idp1165">Tables with mixed colspec</a></span></dt><dt><span class="section"><a href="sec-table.html#idp1174">Tables with proportional and fixed colwidth</a></span></dt><dt><span class="section"><a href="sec-table.html#idp1178">Tables with fixed colwidths</a></span></dt><dt><span class="section"><a href="sec-table.html#sec-autowidth">Automatic Column Width</a></span></dt><dt><span class="section"><a href="sec-table.html#sec-tabstyle">Informal Table LaTeX Styles</a></span></dt><dt><span class="section"><a href="sec-table.html#idp1320">Tables with morerows</a></span></dt><dt><span class="section"><a href="sec-table.html#idp1324">Landscape tables</a></span></dt><dt><span class="section"><a href="sec-table.html#idp1329">Smaller tables</a></span></dt><dt><span class="section"><a href="sec-table.html#sec-table-color">Coloured tables</a></span></dt><dt><span class="section"><a href="sec-table.html#sec-html-table">HTML Tables</a></span></dt></dl></div><p>DocBook tables can be quite complex, but <span class="command"><strong>dblatex</strong></span>
3 should be able to drive most of cases thanks to the excellent newtbl
4 implementation by David Hedley completely written in XSL.</p><p>Here is what is supported:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Columns without specified widths (<code class="sgmltag-element">colspec</code> without
5 <code class="sgmltag-element">colwidth</code> attribute) have the same size.</p></li><li class="listitem"><p>A table width is always equal to the page width, if at least one column
6 doesn't contain a fixed width attribute (e.g. colwidth=“12cm”).</p></li><li class="listitem"><p>Fixed column widths are supported (e.g. colwidth=“10cm”). The unit can
7 be whatever is understood by latex (e.g. cm, em, in, pt).</p></li><li class="listitem"><p>Proportional column widths are supported (e.g. colwidth= “5*”).
8 Combination of fixed and proportional width is supported too (e.g.
9 colwidth=“5*+10cm”).</p></li><li class="listitem"><p>The <code class="sgmltag-element">morerows</code> attribute of a table entry
10 (<code class="sgmltag-element">entry</code> element) is supported.</p></li><li class="listitem"><p>The <code class="sgmltag-element">namest</code> and <code class="sgmltag-element">nameend</code> attributes
11 of a table entry (<code class="sgmltag-element">entry</code> element) are supported. It is
12 possible to have a cell spanned on several columns.</p></li><li class="listitem"><p>The <code class="sgmltag-element">orient</code> table attribute is supported (portrait and
13 landscape).</p></li><li class="listitem"><p>It is possible to have missing cell entries in a table.</p></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1134"></a>Limitations</h3></div></div></div><p>Currently the following things are known to fail with tables:
14 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Program listings and screens cannot be embedded in tables. Some other
15 verbatim environments like litterallayout are allowed.</p></li></ul></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Footnotes in table cells can fail, especially if the footnote contains
16 several paragraphs. Moreover they are lost is a float like a table.</p></li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sec-table-width"></a>Table Width</h3></div></div></div><p>A table width is explicit when all the columns have a fixed size. In
17 this case it is the sum of the colum widths. In the other cases (columns with
18 no colwidth or proportional columns widths) the total table width is deduced
19 by dblatex as follow: it looks for the Processing Instruction
20 <code class="literal">&lt;?dblatex table-with="<em class="replaceable"><code>width</code></em>"
21 ?&gt;</code> first, then the @width attribute, the
22 <em class="parameter"><code>default.table.width</code></em> parameter, and finally use the page
23 width.</p><p>A table width can be expressed as:</p><div class="itemizedlist"><a id="table-width-format"></a><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>A valid length (e.g. 15cm),</p></li><li class="listitem"><p>A percentage of the page width (e.g. 75%),</p></li><li class="listitem"><p>A keyword telling to apply an automatic column width (e.g.
24 autowidth.all).</p></li></ul></div><p>The automatic column width setup is detailed in <a class="xref" href="sec-table.html#sec-autowidth" title="Automatic Column Width">the section called “Automatic Column Width”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1159"></a>Tables without colwidth</h3></div></div></div><p>When none of the <code class="sgmltag-element">colspec</code> elements contains the
25 <code class="sgmltag-element">colwidth</code> attribute, all the columns have the same size, and
26 the table width is fixed to the maximum available size. Several examples of
27 these tables are given<span class="phrase"> in the PDF version of this
28 manual</span>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1165"></a>Tables with mixed colspec</h3></div></div></div><p>A table can have <code class="sgmltag-element">colspec</code> elements containing
29 <code class="sgmltag-element">colwidth</code> attribute mixed with <code class="sgmltag-element">colspec</code>
30 elements without <code class="sgmltag-element">colwidth</code>. Here is an XML source
31 example:</p><pre class="programlisting">
32 &lt;informaltable&gt;
33 &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt;
34 &lt;colspec colname="c1"/&gt;
35 &lt;colspec align="left" colwidth="4cm"/&gt;
36 &lt;colspec align="right" colwidth="5cm"/&gt;
37 &lt;colspec align="center"/&gt;
38 &lt;colspec align="center" colwidth="3cm"/&gt;
39 &lt;tbody&gt;
40 ...
41 &lt;/tbody&gt;
42 &lt;/tgroup&gt;
43 &lt;/informaltable&gt;
44 </pre><p>See the PDF version of this manual to see how it is
45 rendered.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1174"></a>Tables with proportional and fixed colwidth</h3></div></div></div><p>Proportional column widths are supported. Here is an example:</p><pre class="programlisting">
46 &lt;informaltable&gt;
47 &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt;
48 &lt;colspec colname="c1" colwidth="*"/&gt;
49 &lt;colspec align="left" colwidth="2*"/&gt;
50 &lt;colspec align="right" colwidth="3*"/&gt;
51 &lt;colspec align="center"/&gt;
52 &lt;colspec align="center" colwidth="3cm"/&gt;
53 &lt;tbody&gt;
54 ...
55 &lt;/tbody&gt;
56 &lt;/tgroup&gt;
57 &lt;/informaltable&gt;
58 </pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1178"></a>Tables with fixed colwidths</h3></div></div></div><p>All the columns can have fixed size, like this:</p><pre class="programlisting">&lt;informaltable&gt;
59 &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
60 &lt;colspec colname="c1" colwidth="2cm"/&gt;
61 &lt;colspec align="left" colwidth="2.5cm"/&gt;
62 &lt;colspec align="right" colwidth="5cm"/&gt;
63 &lt;colspec align="center" colwidth="3cm"/&gt;
64 &lt;tbody&gt;
65 ...
66 &lt;/tbody&gt;
67 &lt;/tgroup&gt;
68 &lt;/informaltable&gt;
69 </pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sec-autowidth"></a>Automatic Column Width</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="sec-table.html#sec-newtbl-autowidth">Global Setting</a></span></dt><dt><span class="section"><a href="sec-table.html#sec-newtbl-autowidth2">Local Setting</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="sec-newtbl-autowidth"></a>Global Setting</h4></div></div></div><p>In the previous sections the columns widths are computed from a
70 proportional basis, when no colwidth is specified or when the colwidths
71 contain a star ("*"). Of course, a colwidth containing a fixed width
72 incidently sets the column width with this size.</p><p>It is possible to change this sizing policy of not-fixed-width columns
73 by playing with the <em class="parameter"><code>newtbl.autowidth</code></em> parameter. The
74 parameter can take the following values:
75
76 </p><div class="variablelist"><a id="autowidth-items"></a><dl class="variablelist"><dt><span class="term">default</span></dt><dd><p>The automatic width (that is, latex is in charge to size the column
77 width) is applied only to columns not having a specified
78 <code class="sgmltag-element">colspec</code> colwidth. It includes both undefined
79 <code class="sgmltag-element">colspec</code>, and <code class="sgmltag-element">colspec</code> without the
80 colwidth attribute.</p></dd><dt><span class="term">all</span></dt><dd><p>the automatic width is applied to any column, whether a colspec is
81 provided or not.</p></dd></dl></div><p>By default the parameter is unset, and no automatic width is applied.
82 Using automatic width is handy in some situations but there is no more control
83 if the tables fit in the page or not, since in this case the column is as wide
84 as its content, with no more paragraph breaking. The parameter is global for
85 all the tables in the document.</p><p>You can also perform the same thing by setting the
86 <em class="parameter"><code>default.table.width</code></em> parameter to
87 <code class="literal">autowidth.default</code> or <code class="literal">autowidth.all</code>
88 instead of using <em class="parameter"><code>newtbl.autowidth</code></em>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="sec-newtbl-autowidth2"></a>Local Setting</h4></div></div></div><p><a id="pi-autowidth"></a>If you want to apply an automatic width only to some
89 specific tables you can put the Processing Instruction <code class="literal">&lt;?dblatex
90 table-with="autowidth.<em class="replaceable"><code>scope</code></em>" ?&gt;</code> in the
91 related tables. The PI has precedence over the
92 <em class="parameter"><code>newtbl.autowidth</code></em> parameter.</p><p>The <em class="replaceable"><code>scope</code></em> can take the same values and have
93 the same effects than for the <em class="parameter"><code>newtbl.autowidth</code></em>
94 parameter (<code class="literal">default</code> or <code class="literal">all</code>).</p><p><a id="pi-autowidth-column"></a>In addition to these keywords, <em class="parameter"><code>table.width</code></em>
95 can also take for its value keywords of the form
96 <code class="literal">autowidth.column: <em class="replaceable"><code>N</code></em><em class="replaceable"><code> ...</code></em></code>, where <em class="replaceable"><code>N</code></em> is the number of the
97 column (counting from 1) which is to have its width automatically sized.</p><p>See the following example:</p><p>
98 <a id="lst-table-autowidth"></a></p><pre class="programlisting">&lt;informaltable&gt;<span class="bold"><strong>&lt;?dblatex table-width="autowidth.column: 1 3"?&gt;</strong></span>
99 &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
100 &lt;colspec colname="c1"/&gt; &lt;!-- automatic width is applied to column #1 --&gt;
101 &lt;colspec align="left" colwidth="*"/&gt;
102 &lt;colspec align="right" colwidth="5cm"/&gt; &lt;!-- automatic width is applied to column #3 --&gt;
103 &lt;colspec align="center" colwidth="3cm"/&gt;
104 ...
105 &lt;/informaltable&gt;
106 </pre><p>
107 </p><p>Here are two other examples with the all and default scopes:</p><p>The following table has columns 1 and 2 sized by latex with
108 autowidth.all:</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col align="left" class="c1" /><col align="left" /><col align="right" /><col align="center" /></colgroup><thead><tr><th align="left">Column 1</th><th align="left">Column 2</th><th align="right">Column 3</th><th align="center">Column 4</th></tr></thead><tbody><tr><td rowspan="4" align="left">cell on 4 lines
109 </td><td align="left">simple cell
110 </td><td rowspan="2" align="right">cell on 2 lines
111 </td><td align="center">cell without morerow attribute
112 </td></tr><tr><td align="left">cell in column 2
113 </td><td rowspan="2" align="center">cell on 2
114 lines
115 </td></tr><tr><td rowspan="2" align="left">left aligned on 2 lines
116 </td><td align="right">cell in line 3, column 3
117 </td></tr><tr><td align="right">4 cm column width
118 </td><td align="center">last cell in column 4
119 </td></tr></tbody></table></div><p>It is written as follow:</p><p>
120 </p><pre class="programlisting">&lt;informaltable&gt;<span class="bold"><strong>&lt;?dblatex table-width="autowidth.all"?&gt;</strong></span>
121 &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
122 &lt;colspec colname="c1"/&gt; &lt;!-- 'default' and 'all' apply on this column --&gt;
123 &lt;colspec align="left" colwidth="*"/&gt; &lt;!-- only 'all' applies on this column --&gt;
124 &lt;colspec align="right" colwidth="5cm"/&gt;
125 &lt;colspec align="center" colwidth="3cm"/&gt;
126 ...
127 &lt;/informaltable&gt;
128 </pre><p>
129 </p><p>The following table has only columns 1 sized by latex with
130 autowidth.default:</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col align="left" class="c1" /><col align="left" /><col align="right" /><col align="center" /></colgroup><thead><tr><th align="left">Column 1</th><th align="left">Column 2</th><th align="right">Column 3</th><th align="center">Column 4</th></tr></thead><tbody><tr><td rowspan="4" align="left">cell on 4 lines
131 </td><td align="left">simple cell
132 </td><td rowspan="2" align="right">cell on 2 lines
133 </td><td align="center">cell without morerow attribute
134 </td></tr><tr><td align="left">cell in column 2
135 </td><td rowspan="2" align="center">cell on 2
136 lines
137 </td></tr><tr><td rowspan="2" align="left">left aligned on 2 lines
138 </td><td align="right">cell in line 3, column 3
139 </td></tr><tr><td align="right">4 cm column width
140 </td><td align="center">last cell in column 4
141 </td></tr></tbody></table></div><p>The only difference is that the PI attribute value is
142 autowidth.default:</p><pre class="programlisting">&lt;informaltable&gt;<span class="bold"><strong>&lt;?dblatex table-width="autowidth.default"?&gt;</strong></span>
143 &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
144 &lt;colspec colname="c1"/&gt; &lt;!-- 'default' and 'all' apply on this column --&gt;
145 &lt;colspec align="left" colwidth="*"/&gt; &lt;!-- only 'all' applies on this column --&gt;
146 &lt;colspec align="right" colwidth="5cm"/&gt;
147 &lt;colspec align="center" colwidth="3cm"/&gt;
148 ...
149 &lt;/informaltable&gt;
150 </pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sec-tabstyle"></a>Informal Table LaTeX Styles</h3></div></div></div><p>By default <span class="command"><strong>dblatex</strong></span> translates an informal table to
151 the LaTeX environment specified by the
152 <em class="parameter"><code>table.default.tabstyle</code></em> parameter (usually
153 <code class="literal">longtable</code>), but you can specify which Latex tabular
154 environment to use, globally through the parameter, or per table through the
155 <code class="sgmltag-element">tabstyle</code> attribute. Of course the
156 <code class="sgmltag-element">tabstyle</code> attribute value is specific to dblatex. The
157 supported values are:</p><p>
158 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">longtable</span></dt><dd><p>The default table type used by dblatex when
159 <em class="parameter"><code>table.default.tabstyle</code></em> is empty, in order to be able to
160 split over several pages.</p></dd><dt><span class="term">tabular</span></dt><dd><p>The most usual table type. Such table can only be on a single
161 page.</p></dd><dt><span class="term">tabularx</span></dt><dd><p>An advanced table type that allows to stretch column widths to the
162 available remained page width. Such table can only be on a single page like
163 for "tabular".</p></dd></dl></div><p>
164 </p><p>The two following examples show how tabular and tabularx rendering
165 differ when the automatic width feature is used. Here is the XML source
166 code:</p><pre class="programlisting">&lt;informaltable tabstyle="<span class="bold"><strong>tabular</strong></span>"&gt;
167 &lt;?dblatex table-width="autowitdh.column: 1 3"?&gt;
168 &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt;
169 &lt;colspec colname="c1"/&gt;
170 &lt;colspec align="left"/&gt;
171 &lt;colspec align="right"/&gt;
172 &lt;colspec align="center"/&gt;
173 ...
174 &lt;/tgroup&gt;
175 &lt;/informaltable&gt;
176
177 &lt;informaltable tabstyle="<span class="bold"><strong>tabularx</strong></span>"&gt;
178 &lt;?dblatex table-width="autowitdh.column: 1 3"?&gt;
179 &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt;
180 &lt;colspec colname="c1"/&gt;
181 &lt;colspec align="left"/&gt;
182 &lt;colspec align="right"/&gt;
183 &lt;colspec align="center"/&gt;
184 ...
185 &lt;/tgroup&gt;
186 &lt;/informaltable&gt;
187 </pre><p>It is rendered as follow:</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1320"></a>Tables with morerows</h3></div></div></div><p>A table can contain entries that cover several lines. The following XML
188 source contains an entry covering 4 lines:</p><pre class="programlisting">&lt;informaltable&gt;
189 &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
190 &lt;colspec colname="c1" colwidth="*"/&gt;
191 ...
192 &lt;tbody&gt;
193 &lt;entry morerows="3"&gt;it covers 4 lines&lt;/entry&gt;
194 ...
195 &lt;/tbody&gt;
196 &lt;/tgroup&gt;
197 &lt;/informaltable&gt;
198 </pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1324"></a>Landscape tables</h3></div></div></div><p>A table can be displayed in a lanscape format by using the
199 <code class="sgmltag-element">orient</code> attribute. Here is an XML source example:</p><pre class="programlisting">&lt;informaltable orient="land"&gt;
200 &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt;
201 &lt;colspec colname="c1" colwidth="*"/&gt;
202 ...
203 &lt;tbody&gt;
204 ...
205 &lt;/tbody&gt;
206 &lt;/tgroup&gt;
207 &lt;/informaltable&gt;
208 </pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1329"></a>Smaller tables</h3></div></div></div><p>For big tables it can be usefull to have smaller text, so that the table
209 is not too large or too long and it can be displayed within a page. It is
210 possible to specify smaller table text by using the <code class="sgmltag-element">role</code>
211 attribute of the elements <code class="sgmltag-element">table</code> or
212 <code class="sgmltag-element">informaltable</code>.</p><p>The values and the “role” dedicated to this attribute are specific to
213 dblatex, but it is compliant with the DocBook specification because in general
214 the <code class="sgmltag-element">role</code> attribute purpose is never defined.</p><p>The available text size definitions supported by <code class="sgmltag-element">role</code>
215 are directly taken from LaTeX:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>small,</p></li><li class="listitem"><p>footnotesize,</p></li><li class="listitem"><p>scriptsize,</p></li><li class="listitem"><p>tiny.</p></li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sec-table-color"></a>Coloured tables</h3></div></div></div><p>You can color all the table by setting its <code class="sgmltag-element">bgcolor</code>
216 attribute.</p><p>You can also color only some cells by using the Processing Instruction
217 <code class="literal">&lt;?dblatex bgcolor="color"?&gt;</code>. The PI can apply to
218 columns when put in a <code class="sgmltag-element">colspec</code>, to rows when put at the
219 beginning of a <code class="sgmltag-element">row</code>, or to cells when put in a
220 <code class="sgmltag-element">entry</code>.</p><p>The entry colour has precedence over the row colour, that has precedence
221 over the column colour, that has precedence over the table colour.</p><p><a id="table-color-format"></a>The color can be expressed in hexadecimal
222 notation like for HTML (e.g. <code class="literal">#C0C0C0</code>) or in a syntax
223 understood by the <code class="filename">colortbl</code> latex package.</p><p>Here is a<span class="phrase"> PDF
224 output</span> example.</p><div class="mediaobject" align="center"><img src="img-tbl-color.png" align="middle" /></div><p>This table is coded like this:</p><pre class="programlisting">&lt;informaltable id="tbl-color" bgcolor="{yellow}"&gt;
225 &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
226 &lt;colspec colname="c1" colwidth="2cm"/&gt;
227 &lt;colspec align="left" colwidth="2.5cm"&gt;&lt;?dblatex bgcolor="#00FF00"?&gt;&lt;/colspec&gt;
228 &lt;colspec align="right" colwidth="5cm"/&gt;
229 &lt;colspec align="center" colwidth="3cm"/&gt;
230 &lt;thead&gt;
231 &lt;row&gt;
232 &lt;entry&gt;Column 1&lt;/entry&gt;&lt;entry&gt;Column 2&lt;/entry&gt;
233 &lt;entry&gt;Column 3&lt;/entry&gt;&lt;entry&gt;Column 4&lt;/entry&gt;
234 &lt;/row&gt;
235 &lt;/thead&gt;
236 &lt;tbody&gt;
237 &lt;row&gt;
238 &lt;entry&gt;yellow&lt;/entry&gt;&lt;entry&gt;green column&lt;/entry&gt;
239 &lt;entry&gt;yellow&lt;/entry&gt;&lt;entry&gt;yellow&lt;/entry&gt;
240 &lt;/row&gt;
241 &lt;row&gt;
242 &lt;?dblatex bgcolor="{blue}"?&gt;
243 &lt;entry&gt;blue row&lt;/entry&gt;
244 &lt;entry&gt;&lt;?dblatex bgcolor="{red}"?&gt;red cell&lt;/entry&gt;
245 &lt;entry&gt;blue row&lt;/entry&gt;&lt;entry&gt;blue row&lt;/entry&gt;
246 &lt;/row&gt;
247 &lt;row&gt;
248 &lt;entry&gt;yellow&lt;/entry&gt;&lt;entry&gt;green column&lt;/entry&gt;
249 &lt;entry&gt;yellow&lt;/entry&gt;
250 &lt;entry&gt;&lt;?dblatex bgcolor="[gray]{0.8}"?&gt;gray&lt;/entry&gt;
251 &lt;/row&gt;
252 &lt;/tbody&gt;
253 &lt;/tgroup&gt;
254 &lt;/informaltable&gt;
255 </pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sec-html-table"></a>HTML Tables</h3></div></div></div><p>Since version 0.3.2 dblatex supports HTML tables. Some features are
256 handled differently from CALS tables as illustrated by the following HTML
257 table source example:</p><pre class="programlisting">&lt;table border="1" width="100%" rules="all"<a id="co-htmltbl-rules"></a><span><img src="images/callouts/1.png" alt="1" border="0" /></span>&gt;
258 &lt;caption&gt;An HTML Table&lt;/caption&gt;<a id="co-htmltbl-title"></a><span><img src="images/callouts/2.png" alt="2" border="0" /></span>
259 &lt;colgroup span="2" valign="top" align="right"/&gt;
260 &lt;?dblatex bgcolor="red"?&gt;<a id="co-htmltbl-bgcolor1"></a><span><img src="images/callouts/3.png" alt="3" border="0" /></span>
261 &lt;/colgroup&gt;
262 &lt;colgroup valign="bottom" align="left" width="5%"<a id="co-htmltbl-widthpct"></a><span><img src="images/callouts/4.png" alt="4" border="0" /></span>&gt;
263 &lt;col align="right" span="2"/&gt;
264 &lt;col valign="top"/&gt;
265 &lt;/colgroup&gt;
266 &lt;colgroup bgcolor="yellow" width="0*"<a id="co-htmltbl-autowidth"></a><span><img src="images/callouts/5.png" alt="5" border="0" /></span>&gt;&lt;?dblatex bgcolor="yellow"?&gt;&lt;/colgroup&gt;
267 &lt;colgroup valign="bottom" align="left" width="15%"/&gt;
268 &lt;colgroup valign="bottom" align="left" width="10%"/&gt;
269 &lt;thead&gt;
270 &lt;tr&gt; &lt;td width="10%"&gt;Head A1&lt;/td&gt;&lt;td&gt;Head B1&lt;/td&gt;&lt;td&gt;Head C1&lt;/td&gt; &lt;/tr&gt;
271 &lt;/thead&gt;
272 &lt;tfoot&gt;
273 &lt;tr&gt; &lt;td width="10%"&gt;Foot A1&lt;/td&gt;&lt;td&gt;Foot B1&lt;/td&gt;&lt;td&gt;Foot C1&lt;/td&gt; &lt;/tr&gt;
274 &lt;/tfoot&gt;
275
276 &lt;tr&gt;
277 &lt;td width="10%"&gt;A1&lt;/td&gt;&lt;td&gt;B1&lt;/td&gt;&lt;td&gt;C1&lt;/td&gt;
278 &lt;/tr&gt;
279 &lt;tr&gt;
280 &lt;td&gt;A2&lt;/td&gt;&lt;td bgcolor="yellow"&gt;B2&lt;/td&gt;&lt;td colspan="3" rowspan="3"&gt;C-E2&lt;/td&gt;&lt;td&gt;F2&lt;/td&gt;
281 &lt;/tr&gt;
282 &lt;tr&gt;
283 &lt;td&gt;A3&lt;/td&gt;&lt;td width="25.3"<a id="co-htmltbl-widthfix"></a><span><img src="images/callouts/6.png" alt="6" border="0" /></span>&gt;B3&lt;/td&gt;&lt;td&gt;F3&lt;/td&gt;&lt;td rowspan="2"&gt;G3&lt;/td&gt;&lt;td rowspan="3"&gt;H3&lt;/td&gt;
284 &lt;/tr&gt;
285 &lt;tr&gt;
286 &lt;td&gt;A4&lt;/td&gt;&lt;td&gt;B4&lt;/td&gt;&lt;td&gt;F4&lt;/td&gt;&lt;td&gt;G4&lt;/td&gt;
287 &lt;/tr&gt;
288 &lt;tr&gt;
289 &lt;td&gt;A5&lt;/td&gt;&lt;td&gt;B5&lt;/td&gt;&lt;td width="5%"&gt;C5&lt;/td&gt;&lt;td&gt;D5&lt;/td&gt;
290 &lt;/tr&gt;
291 &lt;tr bgcolor="blue"<a id="co-htmltbl-bgcolorp"></a><span><img src="images/callouts/7.png" alt="7" border="0" /></span>&gt;
292 &lt;td&gt;A6&lt;/td&gt;&lt;td&gt;B6&lt;/td&gt;&lt;td&gt;C6&lt;/td&gt;&lt;td&gt;D6&lt;/td&gt;&lt;td&gt;E6&lt;/td&gt;&lt;td bgcolor="green"<a id="co-htmltbl-bgcolorp"></a><span><img src="images/callouts/7.png" alt="7" border="0" /></span>&gt;F6&lt;/td&gt;
293 &lt;/tr&gt;
294 &lt;/table&gt;</pre><div class="calloutlist"><table border="0" summary="Callout list"><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-rules"><span><img src="images/callouts/1.png" alt="1" border="0" /></span></a> </p></td><td valign="top" align="left"><p>The cell borders are specified through the table <code class="sgmltag-element">rules</code> attribute, and not by any
295 <code class="sgmltag-element">rowsep</code> and <code class="sgmltag-element">colsep</code> attributes. Therefore
296 it is not possible to set the borders of an individual cell. If no <code class="sgmltag-element">rules</code> attribute is provided the default setup
297 defined by <em class="parameter"><code>default.table.rules</code></em> parameter is
298 used.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-title"><span><img src="images/callouts/2.png" alt="2" border="0" /></span></a> </p></td><td valign="top" align="left"><p>The title of a formal HTML table is set through the
299 <code class="sgmltag-element">caption</code> element, because the <code class="sgmltag-element">title</code>
300 element is not available.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-bgcolor1"><span><img src="images/callouts/3.png" alt="3" border="0" /></span></a> </p></td><td valign="top" align="left"><p>The cell background colors can be set directly with the bgcolor
301 attribute in <code class="sgmltag-element">row</code> (for an entire row color setting),
302 <code class="sgmltag-element">th</code>, or <code class="sgmltag-element">td</code>, but the dblatex bgcolor
303 Processing Instruction is required in <code class="sgmltag-element">colgroup</code> or
304 <code class="sgmltag-element">col</code> to set a column color.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-widthpct"><span><img src="images/callouts/4.png" alt="4" border="0" /></span></a> </p></td><td valign="top" align="left"><p>The relative widths can be expressed as a percentage. The proportional
305 syntax (e.g. "3*") is still available in <code class="sgmltag-element">colgroup</code>s.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-autowidth"><span><img src="images/callouts/5.png" alt="5" border="0" /></span></a> </p></td><td valign="top" align="left"><p>To specify that a column must be as wide as its content, there is no
306 need to use the dblatex autowidth Processing Instruction. You just need to set
307 the related colgroup width attribute to "0*".</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-widthfix"><span><img src="images/callouts/6.png" alt="6" border="0" /></span></a> </p></td><td valign="top" align="left"><p>The fixed widths must be expressed as numbers, and the implicit unit is
308 the point ("pt"). You cannot set a width expressed in a unit like inchs
309 ("in"), centimeters ("cm") and so on.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-bgcolorp"><span><img src="images/callouts/7.png" alt="7" border="0" /></span></a> </p></td><td valign="top" align="left"><p>The closest enclosing element attribute has precedence over ancestor
310 attributes. This applies to background color too.</p></td></tr></table></div><p>This source example is rendered as follow:</p><div class="mediaobject" align="center"><img src="img-tbl-html.png" align="middle" /></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-figinclude.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
311 Figure Inclusion
312  </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Correcting Poor Formatting</td></tr></table></div></body></html>