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


5.6.1 Control Characters

The mechanism of using roff’s control characters to invoke requests and call macros was introduced in Requests and Macros. The formatter recognizes a control character only at the beginning of an input line, or at the beginning of a branch of a control structure request; see Conditionals and Loops.

A few requests cause a break implicitly; use the no-break control character to prevent the break. Break suppression is its sole behavioral distinction. Employing the no-break control character to invoke requests that don’t cause breaks is harmless but poor style. See Manipulating Filling and Adjustment.

The control ‘.’ and no-break control ‘'’ characters can each be changed to any ordinary character55 with the cc and c2 requests, respectively.

Request: .cc [o]

Recognize the ordinary character o as the control character. If o is absent or invalid, the default control character ‘.’ is selected. If o (or ‘.’ if o is invalid) is already the escape or no-break control character, an error is diagnosed and the request ignored. The identity of the control character is associated with the environment (see Environments).

Request: .c2 [o]

Recognize the ordinary character o as the no-break control character. If o is absent or invalid, the default no-break control character ‘'’ is selected. If o (or ‘'’ if o is invalid) is already the escape or control character, an error is diagnosed and the request ignored. The identity of the no-break control character is associated with the environment (see Environments).

When writing a macro, you might wish to know which control character was used to call it.

Register: \n[.br]

This read-only register interpolates 1 if the currently executing macro was called using the normal control character and 0 otherwise. If a macro is interpolated as a string, the .br register’s value is inherited from the context of the string interpolation. See Strings.

Use this register to reliably intercept requests that imply breaks.

.als bp*orig bp
.de bp
.  ie \\n[.br] .bp*orig
.  el          'bp*orig
..

Testing the .br register outside of a macro definition makes no sense.


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