Blob Blame History Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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.76.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" title="Creating Tables"><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><dt><span class="section"><a href="sec-table.html#idp2770512">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#idm994800">Tables without colwidth</a></span></dt><dt><span class="section"><a href="sec-table.html#idp3224608">Tables with mixed colspec</a></span></dt><dt><span class="section"><a href="sec-table.html#idp3441080">Tables with proportional and fixed colwidth</a></span></dt><dt><span class="section"><a href="sec-table.html#idp4718824">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#idm1494512">Tables with morerows</a></span></dt><dt><span class="section"><a href="sec-table.html#idm1495184">Landscape tables</a></span></dt><dt><span class="section"><a href="sec-table.html#idp12652136">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>
should be able to drive most of cases thanks to the excellent newtbl
implementation by David Hedley completely written in XSL.</p><p>Here is what is supported:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Columns without specified widths (<code class="sgmltag-element">colspec</code> without
<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
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
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*”).
Combination of fixed and proportional width is supported too (e.g.
colwidth=“5*+10cm”).</p></li><li class="listitem"><p>The <code class="sgmltag-element">morerows</code> attribute of a table entry
(<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
of a table entry (<code class="sgmltag-element">entry</code> element) are supported. It is
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
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" title="Limitations"><div class="titlepage"><div><div><h3 class="title"><a id="idp2770512"></a>Limitations</h3></div></div></div><p>Currently the following things are known to fail with tables:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Program listings and screens cannot be embedded in tables. Some other
verbatim environments like litterallayout are allowed.</p></li></ul></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Footnotes in table cells can fail, especially if the footnote contains
several paragraphs. Moreover they are lost is a float like a table.</p></li></ul></div></div><div class="section" title="Table Width"><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
this case it is the sum of the colum widths. In the other cases (columns with
no colwidth or proportional columns widths) the total table width is deduced
by dblatex as follow: it looks for the Processing Instruction
<code class="literal">&lt;?dblatex table-with="<em class="replaceable"><code>width</code></em>"
?&gt;</code> first, then the @width attribute, the
<em class="parameter"><code>default.table.width</code></em> parameter, and finally use the page
width.</p><p>A table width can be expressed as:</p><div class="itemizedlist"><a id="table-width-format"></a><ul class="itemizedlist" 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.
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" title="Tables without colwidth"><div class="titlepage"><div><div><h3 class="title"><a id="idm994800"></a>Tables without colwidth</h3></div></div></div><p>When none of the <code class="sgmltag-element">colspec</code> elements contains the
<code class="sgmltag-element">colwidth</code> attribute, all the columns have the same size, and
the table width is fixed to the maximum available size. Several examples of
these tables are given<span> in the PDF version of this
manual</span>.</p></div><div class="section" title="Tables with mixed colspec"><div class="titlepage"><div><div><h3 class="title"><a id="idp3224608"></a>Tables with mixed colspec</h3></div></div></div><p>A table can have <code class="sgmltag-element">colspec</code> elements containing
<code class="sgmltag-element">colwidth</code> attribute mixed with <code class="sgmltag-element">colspec</code>
elements without <code class="sgmltag-element">colwidth</code>. Here is an XML source
example:</p><pre class="programlisting">
&lt;informaltable&gt;
  &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt;
    &lt;colspec colname="c1"/&gt;
    &lt;colspec align="left" colwidth="4cm"/&gt;
    &lt;colspec align="right" colwidth="5cm"/&gt;
    &lt;colspec align="center"/&gt;
    &lt;colspec align="center" colwidth="3cm"/&gt;
    &lt;tbody&gt;
    ...
    &lt;/tbody&gt;
  &lt;/tgroup&gt;
&lt;/informaltable&gt;
   </pre><p>See the PDF version of this manual to see how it is
rendered.</p></div><div class="section" title="Tables with proportional and fixed colwidth"><div class="titlepage"><div><div><h3 class="title"><a id="idp3441080"></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">
&lt;informaltable&gt;
  &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt; 
    &lt;colspec colname="c1" colwidth="*"/&gt; 
    &lt;colspec align="left" colwidth="2*"/&gt; 
    &lt;colspec align="right" colwidth="3*"/&gt; 
    &lt;colspec align="center"/&gt;
    &lt;colspec align="center" colwidth="3cm"/&gt;
    &lt;tbody&gt;
    ...
    &lt;/tbody&gt;
  &lt;/tgroup&gt;
&lt;/informaltable&gt;
   </pre></div><div class="section" title="Tables with fixed colwidths"><div class="titlepage"><div><div><h3 class="title"><a id="idp4718824"></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;
  &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt; 
    &lt;colspec colname="c1" colwidth="2cm"/&gt; 
    &lt;colspec align="left" colwidth="2.5cm"/&gt; 
    &lt;colspec align="right" colwidth="5cm"/&gt; 
    &lt;colspec align="center" colwidth="3cm"/&gt;
    &lt;tbody&gt;
    ...
    &lt;/tbody&gt;
  &lt;/tgroup&gt;
&lt;/informaltable&gt;
</pre></div><div class="section" title="Automatic Column Width"><div class="titlepage"><div><div><h3 class="title"><a id="sec-autowidth"></a>Automatic Column Width</h3></div></div></div><div class="toc"><dl><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" title="Global Setting"><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
proportional basis, when no colwidth is specified or when the colwidths
contain a star ("*"). Of course, a colwidth containing a fixed width
incidently sets the column width with this size.</p><p>It is possible to change this sizing policy of not-fixed-width columns
by playing with the <em class="parameter"><code>newtbl.autowidth</code></em> parameter. The
parameter can take the following values:

</p><div class="variablelist"><a id="autowidth-items"></a><dl><dt><span class="term">default</span></dt><dd><p>The automatic width (that is, latex is in charge to size the column
width) is applied only to columns not having a specified
<code class="sgmltag-element">colspec</code> colwidth. It includes both undefined
<code class="sgmltag-element">colspec</code>, and <code class="sgmltag-element">colspec</code> without the
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
provided or not.</p></dd></dl></div><p>By default the parameter is unset, and no automatic width is applied.
Using automatic width is handy in some situations but there is no more control
if the tables fit in the page or not, since in this case the column is as wide
as its content, with no more paragraph breaking. The parameter is global for
all the tables in the document.</p><p>You can also perform the same thing by setting the
<em class="parameter"><code>default.table.width</code></em> parameter to
<code class="literal">autowidth.default</code> or <code class="literal">autowidth.all</code>
instead of using <em class="parameter"><code>newtbl.autowidth</code></em>.</p></div><div class="section" title="Local Setting"><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
specific tables you can put the Processing Instruction <code class="literal">&lt;?dblatex
table-with="autowidth.<em class="replaceable"><code>scope</code></em>" ?&gt;</code> in the
related tables. The PI has precedence over the
<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
the same effects than for the <em class="parameter"><code>newtbl.autowidth</code></em>
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> 
can also take for its value keywords of the form 
<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 
column (counting from 1) which is to have its width automatically sized.</p><p>See the following example:</p><p>
<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>
  &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
  &lt;colspec colname="c1"/&gt;                 &lt;!-- automatic width is applied to column #1 --&gt;
  &lt;colspec align="left" colwidth="*"/&gt;
  &lt;colspec align="right" colwidth="5cm"/&gt; &lt;!-- automatic width is applied to column #3 --&gt;
  &lt;colspec align="center" colwidth="3cm"/&gt;
  ...
&lt;/informaltable&gt;
</pre><p>
</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
autowidth.all:</p><div class="informaltable"><table 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
</td><td align="left">simple cell
</td><td rowspan="2" align="right">cell on 2 lines
</td><td align="center">cell without morerow attribute
</td></tr><tr><td align="left">cell in column 2
</td><td rowspan="2" align="center">cell on 2
lines
</td></tr><tr><td rowspan="2" align="left">left aligned on 2 lines
</td><td align="right">cell in line 3, column 3
</td></tr><tr><td align="right">4 cm column width
</td><td align="center">last cell in column 4
</td></tr></tbody></table></div><p>It is written as follow:</p><p>
</p><pre class="programlisting">&lt;informaltable&gt;<span class="bold"><strong>&lt;?dblatex table-width="autowidth.all"?&gt;</strong></span>
  &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
  &lt;colspec colname="c1"/&gt; &lt;!-- 'default' and 'all' apply on this column --&gt;
  &lt;colspec align="left" colwidth="*"/&gt; &lt;!-- only 'all' applies on this column --&gt;
  &lt;colspec align="right" colwidth="5cm"/&gt;
  &lt;colspec align="center" colwidth="3cm"/&gt;
  ...
&lt;/informaltable&gt;
</pre><p>
</p><p>The following table has only columns 1 sized by latex with
autowidth.default:</p><div class="informaltable"><table 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
</td><td align="left">simple cell
</td><td rowspan="2" align="right">cell on 2 lines
</td><td align="center">cell without morerow attribute
</td></tr><tr><td align="left">cell in column 2
</td><td rowspan="2" align="center">cell on 2
lines
</td></tr><tr><td rowspan="2" align="left">left aligned on 2 lines
</td><td align="right">cell in line 3, column 3
</td></tr><tr><td align="right">4 cm column width
</td><td align="center">last cell in column 4
</td></tr></tbody></table></div><p>The only difference is that the PI attribute value is
autowidth.default:</p><pre class="programlisting">&lt;informaltable&gt;<span class="bold"><strong>&lt;?dblatex table-width="autowidth.default"?&gt;</strong></span>
  &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
  &lt;colspec colname="c1"/&gt; &lt;!-- 'default' and 'all' apply on this column --&gt;
  &lt;colspec align="left" colwidth="*"/&gt; &lt;!-- only 'all' applies on this column --&gt;
  &lt;colspec align="right" colwidth="5cm"/&gt;
  &lt;colspec align="center" colwidth="3cm"/&gt;
  ...
&lt;/informaltable&gt;
</pre></div></div><div class="section" title="Informal Table LaTeX Styles"><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
the LaTeX environment specified by the
<em class="parameter"><code>table.default.tabstyle</code></em> parameter (usually
<code class="literal">longtable</code>), but you can specify which Latex tabular
environment to use, globally through the parameter, or per table through the
<code class="sgmltag-element">tabstyle</code> attribute. Of course the
<code class="sgmltag-element">tabstyle</code> attribute value is specific to dblatex. The
supported values are:</p><p>
</p><div class="variablelist"><dl><dt><span class="term">longtable</span></dt><dd><p>The default table type used by dblatex when
<em class="parameter"><code>table.default.tabstyle</code></em> is empty, in order to be able to
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
page.</p></dd><dt><span class="term">tabularx</span></dt><dd><p>An advanced table type that allows to stretch column widths to the
available remained page width. Such table can only be on a single page like
for "tabular".</p></dd></dl></div><p>
</p><p>The two following examples show how tabular and tabularx rendering
differ when the automatic width feature is used. Here is the XML source
code:</p><pre class="programlisting">&lt;informaltable tabstyle="<span class="bold"><strong>tabular</strong></span>"&gt;
  &lt;?dblatex table-width="autowitdh.column: 1 3"?&gt;
  &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt; 
    &lt;colspec colname="c1"/&gt;
    &lt;colspec align="left"/&gt;
    &lt;colspec align="right"/&gt;
    &lt;colspec align="center"/&gt;
    ...
  &lt;/tgroup&gt;
&lt;/informaltable&gt;

&lt;informaltable tabstyle="<span class="bold"><strong>tabularx</strong></span>"&gt;
  &lt;?dblatex table-width="autowitdh.column: 1 3"?&gt;
  &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt; 
    &lt;colspec colname="c1"/&gt;
    &lt;colspec align="left"/&gt;
    &lt;colspec align="right"/&gt;
    &lt;colspec align="center"/&gt;
    ...
  &lt;/tgroup&gt;
&lt;/informaltable&gt;
</pre><p>It is rendered as follow:</p></div><div class="section" title="Tables with morerows"><div class="titlepage"><div><div><h3 class="title"><a id="idm1494512"></a>Tables with morerows</h3></div></div></div><p>A table can contain entries that cover several lines. The following XML
source contains an entry covering 4 lines:</p><pre class="programlisting">&lt;informaltable&gt;
  &lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt; 
    &lt;colspec colname="c1" colwidth="*"/&gt;
    ...
    &lt;tbody&gt;
    &lt;entry morerows="3"&gt;it covers 4 lines&lt;/entry&gt;
    ...
    &lt;/tbody&gt;
  &lt;/tgroup&gt;
&lt;/informaltable&gt;
</pre></div><div class="section" title="Landscape tables"><div class="titlepage"><div><div><h3 class="title"><a id="idm1495184"></a>Landscape tables</h3></div></div></div><p>A table can be displayed in a lanscape format by using the
<code class="sgmltag-element">orient</code> attribute. Here is an XML source example:</p><pre class="programlisting">&lt;informaltable orient="land"&gt;
  &lt;tgroup cols="5" colsep="1" rowsep="1" align="left"&gt; 
    &lt;colspec colname="c1" colwidth="*"/&gt;
    ...
    &lt;tbody&gt;
    ...
    &lt;/tbody&gt;
  &lt;/tgroup&gt;
&lt;/informaltable&gt;
</pre></div><div class="section" title="Smaller tables"><div class="titlepage"><div><div><h3 class="title"><a id="idp12652136"></a>Smaller tables</h3></div></div></div><p>For big tables it can be usefull to have smaller text, so that the table
is not too large or too long and it can be displayed within a page. It is
possible to specify smaller table text by using the <code class="sgmltag-element">role</code>
attribute of the elements <code class="sgmltag-element">table</code> or
<code class="sgmltag-element">informaltable</code>.</p><p>The values and the “role” dedicated to this attribute are specific to
dblatex, but it is compliant with the DocBook specification because in general
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>
are directly taken from LaTeX:</p><div class="itemizedlist"><ul class="itemizedlist" 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" title="Coloured tables"><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>
attribute.</p><p>You can also color only some cells by using the Processing Instruction
<code class="literal">&lt;?dblatex bgcolor="color"?&gt;</code>. The PI can apply to
columns when put in a <code class="sgmltag-element">colspec</code>, to rows when put at the
beginning of a <code class="sgmltag-element">row</code>, or to cells when put in a
<code class="sgmltag-element">entry</code>.</p><p>The entry colour has precedence over the row colour, that has precedence
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
notation like for HTML (e.g. <code class="literal">#C0C0C0</code>) or in a syntax
understood by the <code class="filename">colortbl</code> latex package.</p><p>Here is a<span> PDF
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;
&lt;tgroup cols="4" colsep="1" rowsep="1" align="left"&gt;
  &lt;colspec colname="c1" colwidth="2cm"/&gt;
  &lt;colspec align="left" colwidth="2.5cm"&gt;&lt;?dblatex bgcolor="#00FF00"?&gt;&lt;/colspec&gt;
  &lt;colspec align="right" colwidth="5cm"/&gt;
  &lt;colspec align="center" colwidth="3cm"/&gt;
  &lt;thead&gt;
    &lt;row&gt;
      &lt;entry&gt;Column 1&lt;/entry&gt;&lt;entry&gt;Column 2&lt;/entry&gt;
      &lt;entry&gt;Column 3&lt;/entry&gt;&lt;entry&gt;Column 4&lt;/entry&gt;
    &lt;/row&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  &lt;row&gt;
    &lt;entry&gt;yellow&lt;/entry&gt;&lt;entry&gt;green column&lt;/entry&gt;
    &lt;entry&gt;yellow&lt;/entry&gt;&lt;entry&gt;yellow&lt;/entry&gt;
  &lt;/row&gt;
  &lt;row&gt;
  &lt;?dblatex bgcolor="{blue}"?&gt;
    &lt;entry&gt;blue row&lt;/entry&gt;
    &lt;entry&gt;&lt;?dblatex bgcolor="{red}"?&gt;red cell&lt;/entry&gt;
    &lt;entry&gt;blue row&lt;/entry&gt;&lt;entry&gt;blue row&lt;/entry&gt;
  &lt;/row&gt;
  &lt;row&gt;
    &lt;entry&gt;yellow&lt;/entry&gt;&lt;entry&gt;green column&lt;/entry&gt;
    &lt;entry&gt;yellow&lt;/entry&gt;
    &lt;entry&gt;&lt;?dblatex bgcolor="[gray]{0.8}"?&gt;gray&lt;/entry&gt;
  &lt;/row&gt;
  &lt;/tbody&gt;
&lt;/tgroup&gt;
&lt;/informaltable&gt;
</pre></div><div class="section" title="HTML Tables"><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
handled differently from CALS tables as illustrated by the following HTML
table source example:</p><pre class="programlisting">&lt;table border="1" width="100%" rules="all"<a id="co-htmltbl-rules"></a><img src="images/callouts/1.png" alt="1" border="0" />&gt;
  &lt;caption&gt;An HTML Table&lt;/caption&gt;<a id="co-htmltbl-title"></a><img src="images/callouts/2.png" alt="2" border="0" />
  &lt;colgroup span="2" valign="top" align="right"/&gt;
    &lt;?dblatex bgcolor="red"?&gt;<a id="co-htmltbl-bgcolor1"></a><img src="images/callouts/3.png" alt="3" border="0" />
  &lt;/colgroup&gt;
  &lt;colgroup valign="bottom" align="left" width="5%"<a id="co-htmltbl-widthpct"></a><img src="images/callouts/4.png" alt="4" border="0" />&gt;
    &lt;col align="right" span="2"/&gt;
    &lt;col valign="top"/&gt;
  &lt;/colgroup&gt;
  &lt;colgroup bgcolor="yellow" width="0*"<a id="co-htmltbl-autowidth"></a><img src="images/callouts/5.png" alt="5" border="0" />&gt;&lt;?dblatex bgcolor="yellow"?&gt;&lt;/colgroup&gt;
  &lt;colgroup valign="bottom" align="left" width="15%"/&gt;
  &lt;colgroup valign="bottom" align="left" width="10%"/&gt;
  &lt;thead&gt;
    &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;
  &lt;/thead&gt;
  &lt;tfoot&gt;
    &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;
  &lt;/tfoot&gt;

  &lt;tr&gt;
    &lt;td width="10%"&gt;A1&lt;/td&gt;&lt;td&gt;B1&lt;/td&gt;&lt;td&gt;C1&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &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;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;A3&lt;/td&gt;&lt;td width="25.3"<a id="co-htmltbl-widthfix"></a><img src="images/callouts/6.png" alt="6" border="0" />&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;
  &lt;/tr&gt;
  &lt;tr&gt;
    &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;
  &lt;/tr&gt;
  &lt;tr&gt;
    &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;
  &lt;/tr&gt;
  &lt;tr bgcolor="blue"<a id="co-htmltbl-bgcolorp"></a><img src="images/callouts/7.png" alt="7" border="0" />&gt;
    &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><img src="images/callouts/7.png" alt="7" border="0" />&gt;F6&lt;/td&gt;
  &lt;/tr&gt;
&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"><img src="images/callouts/1.png" alt="1" border="0" /></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
<code class="sgmltag-element">rowsep</code> and <code class="sgmltag-element">colsep</code> attributes. Therefore
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
defined by <em class="parameter"><code>default.table.rules</code></em> parameter is
used.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-title"><img src="images/callouts/2.png" alt="2" border="0" /></a> </p></td><td valign="top" align="left"><p>The title of a formal HTML table is set through the
<code class="sgmltag-element">caption</code> element, because the <code class="sgmltag-element">title</code>
element is not available.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-bgcolor1"><img src="images/callouts/3.png" alt="3" border="0" /></a> </p></td><td valign="top" align="left"><p>The cell background colors can be set directly with the bgcolor
attribute in <code class="sgmltag-element">row</code> (for an entire row color setting),
<code class="sgmltag-element">th</code>, or <code class="sgmltag-element">td</code>, but the dblatex bgcolor
Processing Instruction is required in <code class="sgmltag-element">colgroup</code> or
<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"><img src="images/callouts/4.png" alt="4" border="0" /></a> </p></td><td valign="top" align="left"><p>The relative widths can be expressed as a percentage. The proportional
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"><img src="images/callouts/5.png" alt="5" border="0" /></a> </p></td><td valign="top" align="left"><p>To specify that a column must be as wide as its content, there is no
need to use the dblatex autowidth Processing Instruction. You just need to set
the related colgroup width attribute to "0*".</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-widthfix"><img src="images/callouts/6.png" alt="6" border="0" /></a> </p></td><td valign="top" align="left"><p>The fixed widths must be expressed as numbers, and the implicit unit is
the point ("pt"). You cannot set a width expressed in a unit like inchs
("in"), centimeters ("cm") and so on.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#co-htmltbl-bgcolorp"><img src="images/callouts/7.png" alt="7" border="0" /></a> </p></td><td valign="top" align="left"><p>The closest enclosing element attribute has precedence over ancestor
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">
   Figure Inclusion
   </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>