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 Span Heading 2 Heading 3 Heading 4
Data11 Data12 Data13 Data14 Data15
Data21 Data22 Data23 Data24 Vertical Span
Data31 Double Span Data34
Data41 Data44 Data45
Footing 1 Footing 2 Footing 3 Footing 4 Footing 5