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


5.6.5 Delimiters

Some escape sequences that require parameters delimit them. The neutral apostrophe ' is a popular delimiter choice and shown in this document. The neutral double quote " is also commonly seen. Punctuation characters are the best choice (and most portable to other troffs), except for those meaningful in numeric expressions; see below.

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

The following escape sequences are not themselves delimited, and thus are allowed as delimiters: \SPC, \%, \|, \^, \{, \}, \', \`, \-, \_, \!, \?, \), \/, \,, \&, \:, \~, \0, \a, \c, \d, \e, \E, \p, \r, \t, and \u. However, we discourage using them this way; they can make the input confusing to read.63 An invalid escape sequence is valid as a delimiter if the character after the escape character would be valid.

The escape sequences \D, \h, \H, \l, \L, \N, \R, \s, \S, \v, and \x prohibit delimiters that are meaningful in numeric expressions, because they accept numeric expressions as (or within) their arguments. For consistency, GNU troff prohibits the same delimiters in the argument to the tl request.64 The if, ie, and while requests each interpret their first argument as a conditional expression;65 only characters that are not meaningful as operators in that context can be used as output comparison delimiters. The following inputs are therefore invalid as delimiters in GNU troff.

Delimiter syntax is flexible (and laborious to describe) primarily for historical reasons; the foregoing restrictions need be kept in mind mainly when using GNU troff in AT&T compatibility mode. Normally, 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 those that result from interpolation. Typically, ' works fine.66

$ 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, if you will, 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]