4.7. Tables

Some ideas are best shown when formatted as tables.

A primitive way to create tables was already presented in Table 4-1 with the use of <simplelist>. However, DocBook has more sophisticated methods to deal with this information.

Example 4-7. Inserting tables


<table frame="all">
  <title>Sample Table</title>
  <tgroup cols="5">
    <colspec colname="column1">
    <colspec colname="column2">
    <colspec colname="column3">
    <colspec colnum="5" colname="column5">
    <spanspec namest="column1" nameend="column2" spanname="span-horiz" align="center">
    <spanspec namest="column2" nameend="column3" spanname="span-horiz-vert" align="center">
    <thead>
      <row>
        <entry spanname="span-horiz">
           <foreignphrase>Span</foreignphrase> horizontal
        </entry>
        <entry>Heading 2</entry>
        <entry>Heading 3</entry>
        <entry>Heading 4</entry>
      </row>
    </thead>
    <tfoot>
      <row>
        <entry>Footing 1</entry>
        <entry>Footing 2</entry>
        <entry>Footing 3</entry>
        <entry>Footing 4</entry>
        <entry>Footing 5</entry>
      </row>
    </tfoot>
    <tbody>
      <row>
        <entry>Data11</entry>
        <entry>Data12</entry>
        <entry>Data13</entry>
        <entry>Data14</entry>
        <entry>Data15</entry>
      </row>
      <row>
        <entry>Data21</entry>
        <entry>Data22</entry>
        <entry>Data23</entry>
        <entry>Data24</entry>
        <entry morerows="1" valign="middle">
           Vertical <foreignphrase>Span</foreignphrase>
        </entry>
      </row>
      <row>
        <entry>Data31</entry>
        <entry spanname="span-horiz-vert" morerows="1" valign="bottom">
           Double <foreignphrase>Span</foreignphrase>
        </entry>
        <entry>Data34</entry>
      </row>
      <row>
        <entry>Data41</entry>
        <entry>Data44</entry>
        <entry>Data45</entry>
      </row>
    </tbody>
  </tgroup>
</table>

      

Table 4-2. Example Table

Horizontal SpanHeading 2Heading 3Heading 4
Data11Data12Data13Data14Data15
Data21Data22Data23Data24Vertical Span
Data31Double SpanData34
Data41Data44Data45
Footing 1Footing 2Footing 3Footing 4Footing 5