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.71

A few requests cause a break implicitly; invoke them with 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.72

The cc and c2 requests respectively change the control ‘.’ and no-break control ‘'’ characters to any desired ordinary character (recall Identifiers), but must be distinct.

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.73

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.74

While a macro definition is interpreted, GNU troff’s .br register permits discovery of the control character used in its call.

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 inherits its value from the context of the string interpolation.75

Use the .br register to reliably wrap or 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]