Customize the Title Label
When you add a title to a table, the processor automatically prefixes it with the label Table <n>., where <n> is the 1-based index of all of the titled tables in the document. This label can be modified at the document level or per table. It can also be deactivated.
Modify the label using table-caption
You can change the label for all titled tables using the document attribute table-caption
.
(Don’t let the attribute’s name mislead you.
It’s the attribute that controls the table title labels at the document level.)
In the document header, set the table-caption
attribute and assign it your custom label text.
= Document Title
:table-caption: Data Set (1) (2)
1 | Set the document attribute table-caption and assign it the text you want to precede each table title. |
2 | Don’t enter a number after the label text. The processor will automatically insert and increment the number. |
In Example 1, the first and third tables have a title, but the second table doesn’t have a title.
= Document Title
:table-caption: Data Set
.A table with a title
[cols="2,1"]
|===
|Lots and lots of data |A little data
|834,734 |3
|3,999,271.5601 |5
|===
|===
|Group |Climate |Example
|A
|Tropical
|Suva, Fiji
|B
|Arid
|Lima, Peru
|===
.Another table with a title
|===
|Value |Result |Notes
|Null |A mystery |See Appendix R
|===
Since table-caption
is assigned the value Data Set
, any table title should be preceded with the label Data Set <n>.
The three tables from Example 1 are displayed below.
Lots and lots of data | A little data |
---|---|
834,734 |
3 |
3,999,271.5601 |
5 |
Group | Climate | Example |
---|---|---|
A |
Tropical |
Suva, Fiji |
B |
Arid |
Lima, Peru |
Value | Result | Notes |
---|---|---|
Null |
A mystery |
See Appendix R |
Notice that the table that doesn’t have a title didn’t get a label nor was it counted when the processor incremented the label number. Therefore, the third table is assigned the label Data Set 2.
Modify the label of an individual table using caption
You can customize the label on an individual table by setting the caption
attribute.
(Don’t let the name of the attribute mislead you.
The caption attribute only sets the caption’s label, not the whole caption line).
When using caption
, assign it the exact value you want displayed (including trailing spaces).
Labels assigned using caption
don’t get an automatically incremented number and only apply to the table they are set on.
If you want a space between the label and the title, you must add a trailing space to the value of the caption attribute. |
1 | Create an attribute list directly above the table’s title and set the named attribute caption , followed by an equals sign (= ), and then a value. |
2 | Enclose the value in double quotation marks (" ).
Otherwise the processor will remove any trailing whitespaces, and the title text will start directly after the last character of the label. |
The table from Example 2 is displayed below.
Null |
A mystery |
See Appendix R |
If you create any subsequent tables in your document and don’t set caption
on them, the title labels will revert to the value assigned to table-caption
.
If you want the caption of the table to only consist of the caption label, use the following syntax:
[caption=,title="{table-caption} {counter:table-number}"]
[%header,cols=2*]
|===
|Name of Column 1
|Name of Column 2
|Cell in column 1, row 1
|Cell in column 2, row 1
|Cell in column 1, row 2
|Cell in column 2, row 2
|===
Alternately, you can write is as follows:
.{empty}
[caption="{table-caption} {counter:table-number}"]
[%header,cols=2*]
|===
|Name of Column 1
|Name of Column 2
|Cell in column 1, row 1
|Cell in column 2, row 1
|Cell in column 1, row 2
|Cell in column 2, row 2
|===