Next: , Previous: , Up: Registers   [Contents][Index]


5.6.2 Interpolating Registers

Numeric registers can be accessed via the \n escape.

Escape: \ni
Escape: \n(id
Escape: \n[ident]

Interpolate number register with name ident (one-character name i, two-character name id). This means that the value of the register is expanded in-place while gtroff is parsing the input line. Nested assignments (also called indirect assignments) are possible.

.nr a 5
.nr as \na+\na
\n(as
    ⇒ 10
.nr a1 5
.nr ab 6
.ds str b
.ds num 1
\n[a\n[num]]
    ⇒ 5
\n[a\*[str]]
    ⇒ 6