Next: , Previous: Setting Registers, Up: Registers

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
              ⇒ 10
          .nr a1 5
          .nr ab 6
          .ds str b
          .ds num 1
              ⇒ 5
              ⇒ 6