Next: , Previous: , Up: Tabs and Fields   [Contents][Index]


5.12.1 Leaders

Sometimes it is desirable to fill a tab stop with a given glyph, but also use tab stops normally on the same output line. An example is a table of contents entry that uses dots to bridge the entry name with its page number, which is itself aligned between tab stops. The roff language provides leaders for this purpose.67

A leader character (ISO and EBCDIC code point 1, also known as SOH or “start of heading”), behaves similarly to a tab character: it moves to the next tab stop. The difference is that for this movement, the default fill character is a period ‘.’.

Escape sequence: \a

Interpolate a leader in copy mode; see Copy Mode.

Request: .lc [c]

Set the leader repetition character to the ordinary or special character c. Recall Tabs and Leaders: when encountering a leader character in the input, the formatter writes as many dots ‘.’ as are necessary until reaching the next tab stop; this is the leader definition character. Omitting c unsets the leader character. With no argument, GNU troff treats leaders the same as tabs. The leader repetition character is associated with the environment (see Environments). Only a single c is recognized; any excess is ignored.

A table of contents, for example, may define tab stops after a section number, a title, and a gap to be filled with leader dots. The page number follows the leader, after a right-aligned final tab stop wide enough to house the largest page number occurring in the document.

.ds entry1 19.\tThe Prophet\a\t98
.ds entry2 20.\tAll Astir\a\t101
.ta .5i 4.5i +.5iR
.nf
\*[entry1]
\*[entry2]
    ⇒ 19.  The Prophet.............................   98
    ⇒ 20.  All Astir...............................  101

Next: , Previous: , Up: Tabs and Fields   [Contents][Index]