Next: , Previous: , Up: gtroff Reference   [Contents][Index]

5.14 Line Control

It is important to understand how gtroff handles input and output lines.

Many escapes use positioning relative to the input line. For example, this

This is a \h'|1.2i'test.

This is a


This is a   test.

This is a             test.

The main usage of this feature is to define macros that act exactly at the place where called.

.\" A simple macro to underline a word
.de underline
.  nop \\$1\l'|0\[ul]'

In the above example, ‘|0’ specifies a negative distance from the current position (at the end of the just emitted argument \$1) back to the beginning of the input line. Thus, the ‘\l’ escape draws a line from right to left.

gtroff makes a difference between input and output line continuation; the latter is also called interrupting a line.

Escape: \RET
Escape: \c
Register: \n[.int]

Continue a line. \RET (this is a backslash at the end of a line immediately followed by a newline) works on the input level, suppressing the effects of the following newline in the input.

This is a \
    ⇒ This is a .test

The ‘|’ operator is also affected.

\c works on the output level. Anything after this escape on the same line is ignored except \R, which works as usual. Anything before \c on the same line is appended to the current partial output line. The next non-command line after an interrupted line counts as a new input line.

The visual results depend on whether no-fill mode is active.

Note that an intervening control line that causes a break is stronger than \c, flushing out the current partial line in the usual way.

The .int register contains a positive value if the last output line was interrupted with \c; this is associated with the current environment (see Environments).

Next: , Previous: , Up: gtroff Reference   [Contents][Index]