<col>
<col> is a Sectional
component that sets the width, alignment, and borders of one column of a
<tabular>. It holds no content of its own — the content
still lives in the <row> and <cell>
components — and it is written before the rows, one <col> per column,
left to right.
Attributes and Properties
Attributes for <col>
Highlighted (4)
keyword. Border style for the trailing edge of this column: its right edge in a left-to-right document, its left edge in a right-to-left one.
| Value | Description |
|---|---|
none | Do not render a border. |
minor | Render a thin border line. |
medium | Render a medium-weight border line. |
major | Render a thick border line. |
keyword. Horizontal alignment for cells in this column.
| Value | Description |
|---|---|
start | Align cell content to the leading edge: the left in a left-to-right document, the right in a right-to-left one. |
center | Center cell content horizontally. |
end | Align cell content to the trailing edge: the right in a left-to-right document, the left in a right-to-left one. |
justify | Justify cell content across the full cell width. |
keyword. Border style for the top edge of this column.
| Value | Description |
|---|---|
none | Do not render a border. |
minor | Render a thin border line. |
medium | Render a medium-weight border line. |
major | Render a thick border line. |
componentSize. Display width of this column. Expressed as a percentage of the width of the tabular layout so that it survives conversion to PreTeXt.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <col name="c">
Highlighted (4)
$c.endBordertext. Border style for the trailing edge of this column: its right edge in a left-to-right document, its left edge in a right-to-left one.
$c.haligntext. Horizontal alignment for cells in this column.
$c.topBordertext. Border style for the top edge of this column.
$c.widthcomponentSize. Display width of this column. Expressed as a percentage of the width of the tabular layout so that it survives conversion to PreTeXt.
Other (4)
$c.disabledboolean. Whether this component is disabled and cannot be interacted with.
$c.fixedboolean. Whether this component's value is fixed and cannot be modified.
$c.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
Common to all components (4)
$c.doenetMLtext. The DoenetML source code that produced this component.
$c.hideboolean. Whether to hide this component from the rendered output.
$c.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$c.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: giving each column its own width
Without any <col>, the columns of a <tabular> divide its width
evenly, so a column of two-digit numbers is drawn as wide as a column of
sentences. One <col width="…"> per column fixes that.
Example: fewer <col> than columns
The <col> components apply to the leftmost columns. Any column past the
last <col> is left alone, and the columns with no width of their own
share out whatever width remains.
Attribute Examples
Attribute Example: width
The width attribute sets the width of the column as a percentage of the
width of the <tabular>. Express it as a percentage rather than as a
number of pixels: a percentage is what survives conversion of the document to
PreTeXt.
Attribute Example: halign
The halign attribute sets the horizontal alignment of every <cell> in
the column, which is the usual way to right-align a column of numbers. The
available options are start, center, end, and justify; start and
end follow the writing direction, so end is the right edge in a
left-to-right document and the left edge in a right-to-left one. An empty
<col /> is a placeholder that leaves its column alone — here it holds
the first column’s place so that halign="end" lands on the second.
A <col> is the third of four places an alignment can come from. A
<cell> uses its own halign if it has one, then its <row>’s,
then its column’s, then the <tabular>’s — so the <cell halign="center">
in the last row above outranks the column, and a <row halign="…"> would
too.
Attribute Example: topBorder/endBorder
endBorder draws a dividing line down the trailing edge of the column — its
right edge in a left-to-right document — and topBorder draws one across the
top of it. Both accept none (default), minor, medium, and major. As
with halign, a <cell endBorder="…"> of its own takes precedence over
the column’s, including endBorder="none" to leave a gap in the line.
A <cell colSpan="…"> covers more than one column, so it follows two of
them: it aligns with the first column it covers, where its content begins, and
takes its endBorder from the last, where its trailing edge falls. The
endBorder of a column that the cell swallows whole is not drawn, because
there is no cell edge in the middle of the span to draw it on.
Property Examples
Property Example: Attributes as properties
The attributes of the <col> component are also accessible as
properties.