5.19.10 Dummy Characters

As discussed in Requests and Macros, the first character on an input line is treated specially. Further, formatting a glyph has many consequences on formatter state (see Environments). Occasionally, we want to escape this context or embrace some of those consequences without actually rendering a glyph to the output.

Escape sequence: \&

Interpolate a dummy character, which is constitutive of output but invisible.81 Its presence alters the interpretation context of a subsequent input character, and enjoys several applications.

  • Prevent insertion of extra space after an end-of-sentence character.
    Test.
    Test.
        ⇒ Test.  Test.
    Test.\&
    Test.
        ⇒ Test. Test.
    
  • Prevent recognition of a control character.
    .Test
        error→ warning: macro 'Test' not defined
    \&.Test
        ⇒ .Test
    
  • Prevent kerning between two glyphs.
  • Translate a character to “nothing”.
    .tr JIjiK\&k\&UVuv
    Post universitum, alea jacta est, OK?
        ⇒ Post vniversitvm, alea iacta est, O?
    

The dummy character escape sequence sees use in macro definitions as a means of ensuring that arguments are treated as text even if they begin with spaces or control characters.

.de HD \" typeset a simple bold heading
.  sp
.  ft B
\&\\$1 \" exercise: remove the \&
.  ft
.  sp
..
.HD .\|.\|.\|surprised?

One way to think about the dummy character is to imagine placing the symbol ‘&’ in the input at a certain location; if doing so has all the side effects on formatting that you desire except for sticking an ugly ampersand in the midst of your text, the dummy character is what you want in its place.

Escape sequence: \)

Interpolate a transparent dummy character—one that is transparent to end-of-sentence detection. It behaves as \&, except that \& is treated as letters and numerals normally are after ‘.’, ‘?’ and ‘!’; \& cancels end-of-sentence detection, and \) does not.

.de Suffix-&
.  nop \&\\$1
..
.
.de Suffix-)
.  nop \)\\$1
..
.
Here's a sentence.\c
.Suffix-& '
Another one.\c
.Suffix-) '
And a third.
    ⇒ Here's a sentence.' Another one.'  And a third.