<table>

The <table> tag is similar to the <figure> tag, but is made to be wrapper for a <tabular>. Using the <table> tag allows the contained <tabular> to be referenced by name. That is, a <table> will result in a label like “Table 1.2.3” appearing in your document.

Syntax

Attributes

Attributes for <table>
AttributeRequired?Values
component = "…"optionalstring
label = "…"optionalstring
landscape = "…"optional"yes""no"
xml:base = "…"optionalstring
xml:id = "…"optionalstring
xml:lang = "…"optionalstring

Children

The following may appear as children:<idx> <plaintitle> <shorttitle> <tabular> <title>

Parents

This element may appear as an immediate child of the following elements: <activity> <algorithm> <answer> <appendix> <article> <case> <chapter> <claim> <computation> <conclusion> <convention> <corollary> <data> <example> <exercise> <exploration> <fact> <hint> <identity> <insight> <introduction> <investigation> <lemma> <li> <note> <observation> <paragraphs> <problem> <project> <proof> <proposition> <question> <remark> <section> <sidebyside> <solution> <statement> <subsection> <subsubsection> <task> <technology> <theorem> <warning>

Notes

A note about table borders

Placing borders in tables exactly where you want them requires that you understand in which elements the attributes top, left, bottom, and right may be applied. Note that while horizontal borders (rules) are easy, vertical rules have been made intentionally more work “to gently guide authors towards good choices” in document design. The section of the PreTeXt Guide on Tables and Tabulars is the definitive source.

Examples

A simple table

In this example, all cell entries are right-justified; the table has a header row and some cells have borders.

A slightly more complicated table.

In this example, we use the <col> tag to set the horizontal alignment of <cell> entries in different columns as well as a colspan option in one of the header cells.

A table with paragraphs and alignment variations