Tabular Components
The contents of a tabular are specified using four basic commands within the environment body. Some of the specialized tables may define additional row specifiers as well.
\headers{col1-head}{col2-head} ... {colN-head}
The headers tabular child command is used to include column headers in the next row of the table. The header columns are added using <th> HTML elements. If more column headers are provided than there are columns in the table, the extras are ignored. If fewer column headers are provided, no headers will be included in the columns with missing values.
\row{col1-value}{col2-value} ... {colN-value}
The row tabular child command is used to include column data in the next row of the table. The data columns are added using <td> HTML elements. If more column values are provided than there are columns in the table, the extra values are ignored. If fewer column values are provided, only the first n columns will contain values.
\rule
\rule{width}
Adds a horizontal rule that expands the entire width of the table. If the width is not provided, the rule will have a 1px width.
Argument:
- width
-
The width of the horizontal rule
\span[align=l|c|r]{col-content}
Adds multi-column content that expands the entire width of the table.
Key:
- align
-
Indicates how the full-width content is aligned within the row: left (l), center (c), or right (r).
Examples
Basic Tabular Style
Example
source
- \begin{tabular}[ncols=2
- width=50%
- colclass='fnct|'
- colalign='l|c'
- colwidth='40%|60%']
- \headers{Column A}{Column B}
- \row{a}{b}
- \row{c}{d}
- \rule
- \row{e|f}{x}
- \row{g}{h}
- \span[align=c]{This is a multicolumn row.}
- \end{tabular}
| Column A | Column B |
|---|---|
| a | b |
| c | d |
| e|f | x |
| g | h |
| This is a multicolumn row. | |
results
Modified Table Style
Example
source
- \begin{tabular}[ncols=2 style=ruled]
- \headers{Id #}{Name}
- \row{100}{John Smith}
- \row{185}{Jane Roberts}
- \row{232}{Sally Green}
- \row{289}{Jason Samuel}
- \end{tabular}
| Id # | Name |
|---|---|
| 100 | John Smith |
| 185 | Jane Roberts |
| 232 | Sally Green |
| 289 | Jason Samuel |
results
Single-Ruled Zebra Stripped
Example
source
- \begin{tabular}[ncols=2 style='ruled zebra']
- \headers{Id #}{Name}
- \row{100}{John Smith}
- \row{185}{Jane Roberts}
- \row{232}{Sally Green}
- \row{289}{Jason Samuel}
- \end{tabular}
| Id # | Name |
|---|---|
| 100 | John Smith |
| 185 | Jane Roberts |
| 232 | Sally Green |
| 289 | Jason Samuel |
results