Previous: , Up: Formatter Instructions   [Contents][Index]


5.6.5 Delimiters

Some escape sequences that require parameters use delimiters. The neutral apostrophe ' is a popular choice and shown in this document. The neutral double quote " is also commonly seen. Letters, numerals, and leaders can be used. Punctuation characters are likely better choices, except for those defined as infix operators in numeric expressions; see below.

\l'1.5i\[bu]' \" draw 1.5 inches of bullet glyphs

The following escape sequences don’t take arguments and thus are allowed as delimiters: \SP, \%, \|, \^, \{, \}, \', \`, \-, \_, \!, \?, \), \/, \,, \&, \:, \~, \0, \a, \c, \d, \e, \E, \p, \r, \t, and \u. However, using them this way is discouraged; they can make the input confusing to read.

A few escape sequences, \A, \b, \o, \w, \X, and \Z, accept a newline as a delimiter. Newlines that serve as delimiters continue to be recognized as input line terminators.

A caf\o
e\(aa
in Paris
    ⇒ A café in Paris

Use of newlines as delimiters in escape sequences is also discouraged.

Finally, the escape sequences \D, \h, \H, \l, \L, \N, \R, \s, \S, \v, and \x prohibit many delimiters.

Delimiter syntax is complex and flexible primarily for historical reasons; the foregoing restrictions need be kept in mind mainly when using groff in AT&T compatibility mode. GNU troff keeps track of the nesting depth of escape sequence interpolations, so the only characters you need to avoid using as delimiters are those that appear in the arguments you input, not any that result from interpolation. Typically, ' works fine. See Implementation Differences.

$ groff -Tps
.de Mw
.  nr wd \w'\\$1'
.  tm "\\$1" is \\n(wd units wide.
..
.Mw Wet'suwet'en
.Mw Wet+200i
.cp 1 \" turn on compatibility mode
.Mw Wet'suwet'en
.Mw Wet'
.Mw Wet+200i
    error→ "Wet'suwet'en" is 54740 units wide.
    error→ "Wet'+200i" is 42610 units wide.
    error→ "Wet'suwet'en" is 15860 units wide.
    error→ "Wet'" is 15860 units wide.
    error→ "Wet'+200i" is 14415860 units wide.

We see here that in compatibility mode, the part of the argument after the ' delimiter escapes from its context and, if nefariously crafted, influences the computation of the wd register’s value in a surprising way.


Previous: , Up: Formatter Instructions   [Contents][Index]