Escape Sequences

An escape sequence is any grouping of characters following a backslash \. This may happen anywhere in input. What follows the escape sequence syntactically depends upon the first letter. The following sections describe common escape sequences. The use of any other sequence is strongly discouraged for portable manuals; in fact, the use of any escape beyond \& should be strongly avoided: it makes manuals in different output formats inconsistent depending on their methods of glyph rendering.

Special Characters

Special characters allow the encoding of non-ASCII characters and, in macro lines, the use of reserved characters. Special characters may be invoked anywhere in input.

There are three forms of special character, distinguished by the number of letters in the sequence.

\n one-letter
\(nn two-letter
\[N] n-letter

The n-letter form may be used to express any of the others. For example, \& (a zero-width space) is equivalent to \[&]. The most common escape sequence is in fact \&, a non-printing, zero-width space. When preceding a word, it automatically causes it to be rendered as regular text:

The following flags are also macros:
.Fl \&Ar

If the Ar were not preceded with an escape, it would have be interpreted as the Ar macro instead of the flags Ar. An alternative to this is to quote the argument (see Quotation). The zero-width escape is found more readily in literal contexts beginning with a period, such as

.Bd -literal
\&.Fl Ar

Predefined Strings

An alternative form of special character is the predefined string. These are legacy roff constructs of an escape sequence that may be programmatically set or unset. The syntax for predefined strings follows:

\*n one-letter
\*(nn two-letter
\*[N] n-letter

The use of predefined strings is discouraged in portable manuals, as available strings may differ between implementations and formatters.

Last edited by $Author: kristaps $ on $Date: 2011/12/25 14:52:52 $. Copyright © 2011, Kristaps Dzonsons. CC BY-SA.