Horizontal Tabs
Permitted Context: %text
Content Model: Empty!
The TAB element can be used when you want fine control over the
horizontal positioning. The TAB element is used with the <tab
id=name> attribute to define named tab stops.
Subsequently, you can use the TAB element with the <tab
to=name> attribute to move to the previously defined tab
stop. This approach avoids the need to know the font metrics in
advance. The TAB element, together with style sheets, allows conversion
software to preserve layout information when importing documents
created with conventional word processing software.
For example:
<p><b>noct<tab id=t1>ambulant</b> - walking at night<br>
<tab to=t1>(from Latin: <i>nox noctis</i> night + <i>ambulare</i> walk)
which is rendered as:
noctambulant - walking at night
(from Latin: nox noctis night + ambulare walk)
The tab stop name (t1 in the example) should be unique within the
current document and composed from an initial letter followed by
letters, digits or hyphens.
Sometimes, you want to make the remainder of the line flush right while
leaving the earlier words unmoved. This is possible with the align
attribute. For example:
Left part of line<tab align=right>and right part of line.
which is rendered as:
Left part of line and right part of line.
Permitted Attributes
- ID
- An SGML identifier used to name a new tab stop at the current position.
The scope of the tab stop is the rest of the document.
- INDENT
- Specifies the number of en units before the tab stop.
The en is a typographical unit equal to half the point size. It allows
authors to control the leading indent before text, e.g. in poetry, one
might use: <TAB INDENT=6> to indent six en units at the start of
a line. The INDENT attribute is not meaningful when combined with the
TO attribute.
- TO
- Specifies a previously defined tab stop (see ID attribute).
- ALIGN
- Lines are usually rendered according to the alignment
option for the enclosing paragraph element. The ALIGN attribute can be
used to explicitly specify the horizontal alignment:
- align=left
- Following text starts immediately after the
designated tab stop (the default).
- align=center
- Following text up to next tab or line break is
centered on the designated tab stop. If the TO attribute is missing, it
centers the text between the current left and right margins.
- align=right
- Following text up to the next tab or line break is
rendered flush right to the designated tab stop. If the TO attribute is
missing, it renders the text flush right against the current right
margin.
- align=decimal
- The following text is searched for the first
occurrence of the character representing the decimal point. The text up
to the next tab or line break is then aligned such that the decimal point
starts at the designated tab stop. If the TO attribute is missing, the
tab element is treated as a single space character.
- DP
- This specifies the character to be used for the decimal
point with the ALIGN attribute, e.g. dp="." (the default) or dp=",".
The default may be altered by the language context, as set by the LANG
attribute on enclosing elements.
Note: if the specified alignment and tab stop would cause text
to overlap preceding text, then the tab element may be treated as a
single space character.
How should the above be rewritten to work with languages which are
rendered from right to left? What about lines with mixed directions?