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 meaningful 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: \SPC, \%, \|, \^, \{, \}, \', \`, \-, \_, \!, \?, \), \/, \,, \&, \:, \~, \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.

Conditional expressions55 prohibit delimiters that are meaningful in numeric expressions, because the latter are a subset of the former. The escape sequences \D, \h, \H, \l, \L, \N, \R, \s, \S, \v, and \x similarly prohibit them because they accept numeric expressions as (or within) their arguments.

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 -T ps
.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]