GNU Info

Info Node: (groff)Setting Registers

(groff)Setting Registers


Next: Interpolating Registers Prev: Registers Up: Registers
Enter node , (file) or (file)node

Setting Registers
-----------------

   Define or set registers using the `nr' request or the `\R' escape.

 - Request: .nr ident value
 - Escape: \R'IDENT VALUE'
     Set number register IDENT to VALUE.  If IDENT doesn't exist,
     `gtroff' creates it.

     The argument to `\R' usually has to be enclosed in quotes.  Note:
     Escapes, for details on parameter delimiting characters.

   For example, the following two lines are equivalent:


     .nr a 1
     \R'a 1'

   Both `nr' and `\R' have two additional special forms to increment or
decrement a register.

 - Request: .nr ident +value
 - Request: .nr ident -value
 - Escape: \R'IDENT +VALUE'
 - Escape: \R'IDENT -VALUE'
     Increment (decrement) register IDENT by VALUE.


          .nr a 1
          .nr a +1
          \na
              => 2

     To assign the negated value of a register to another register,
     some care must be taken to get the desired result:


          .nr a 7
          .nr b 3
          .nr a -\nb
          \na
              => 4
          .nr a (-\nb)
          \na
              => -3

     The surrounding parentheses prevent the interpretation of the
     minus sign as a decrementing operator.  An alternative is to start
     the assignment with a `0':


          .nr a 7
          .nr b -3
          .nr a \nb
          \na
              => 4
          .nr a 0\nb
          \na
              => -3


 - Request: .rr ident
     Remove number register IDENT.  If IDENT doesn't exist, the request
     is ignored.

 - Request: .rnn ident1 ident2
     Rename number register IDENT1 to IDENT2.  If either IDENT1 or
     IDENT2 doesn't exist, the request is ignored.

 - Request: .aln ident1 ident2
     Create an alias IDENT1 for a number register IDENT2.  The new name
     and the old name are exactly equivalent.  If IDENT1 is undefined,
     a warning of type `reg' is generated, and the request is ignored.
     Note: Debugging, for information about warnings.


automatically generated by info2www version 1.2.2.9