45
AsciiDoc User Guide
49 / 88
• If cols is present it must specify all columns.
• If the cols attribute is not specified the number of columns is calculated as the number of data items in the first line of
the table.
• The degenerate form for the cols attribute is an integer specifying the number of columns e.g. cols=4.
width
The width attribute is expressed as a percentage value ("1%"... "99%"). The width specifies the table width relative to the
available width. HTML backends use this value to set the table widthattribute. It’s a bit more complicated with DocBook,
see theDocBooktablewidthssidebar.
filter
The filter attribute defines an external shell command that is invoked for each cell. The built-in asciidoc table style is
implementedusing a filter.
DocBook table widths
The AsciiDoc docbookbackend generates CALS tables. CALS tables do not support a table widthattribute—table width
can only be controlled by specifying absolute column widths.
Specifying absolute column widths is not media independent because different presentation media have different physical
dimensions. To get round this limitation bothDocBookXSLStylesheetsanddblatex have implemented table width
processing instructions for setting the table width as a percentage of the available width. AsciiDoc emits these processing
instructions if the width attribute is set along with proportional column widths (the AsciiDoc docbook backend pageunits
attribute defaults to *).
To generate DocBook tables with absolute column widths set the pageunits attribute to a CALS absolute unit such as pt
and set the pagewidth attribute to match the widthof the presentation media.
23.4 Column Specifiers
Column specifiers define how columns are rendered and appear in the tablecolsattribute. A column specifier consists of an
optional column multiplier followed by optional alignment, width and style values and is formatted like:
[<multiplier>
*
][<align>][<width>][<style>]
• All components are optional. The multiplier must be first and the style last. The order of <align> or <width> is not
important.
• Column <width> can be either an integer proportional value (1... ) or a percentage (1%...100%). The default value is 1. To
ensure portability across different backends, there is no provision for absolute column widths (not to be confused with output
column widthmarkupattributeswhich are available in both percentage and absolute units).
• The <align> column alignment specifier is formatted like:
[<horizontal>][.<vertical>]
Where <horizontal> and <vertical> are one of the following characters: <, ˆ or > which represent left, center and
right horizontal alignment or top, middle and bottom vertical alignment respectively.
• A <multiplier> can be used to specify repeated columns e.g. cols="4
*
<" specifies four left-justified columns. The
default multiplier value is 1.
• The <style> name specifies atablestyle to used to markup column cells (you can use the full style names if you wish but
the first letter is normally sufficient).
• Column specific styles are not applied to header rows.