GNU Info

Info Node: (groff)Auto-increment

(groff)Auto-increment


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

Auto-increment
--------------

   Number registers can also be auto-incremented and auto-decremented.
The increment or decrement value can be specified with a third argument
to the `nr' request or `\R' escape.

 - Request: .nr ident value incr
     Set number register IDENT to VALUE; the increment for
     auto-incrementing is set to INCR.  Note that the `\R' escape
     doesn't support this notation.

   To activate auto-incrementing, the escape `\n' has a special syntax
form.

 - Escape: \n+I
 - Escape: \n-I
 - Escape: \n(+ID
 - Escape: \n(-ID
 - Escape: \n+(ID
 - Escape: \n-(ID
 - Escape: \n[+IDENT]
 - Escape: \n[-IDENT]
 - Escape: \n+[IDENT]
 - Escape: \n-[IDENT]
     Before interpolating, increment or decrement IDENT (one-character
     name I, two-character name ID) by the auto-increment value as
     specified with the `nr' request (or the `\R' escape).  If no
     auto-increment value has been specified, these syntax forms are
     identical to `\n'.

   For example,


     .nr a 0 1
     .nr xx 0 5
     .nr foo 0 -2
     \n+a, \n+a, \n+a, \n+a, \n+a
     .br
     \n-(xx, \n-(xx, \n-(xx, \n-(xx, \n-(xx
     .br
     \n+[foo], \n+[foo], \n+[foo], \n+[foo], \n+[foo]

produces


     1, 2, 3, 4, 5
     -5, -10, -15, -20, -25
     -2, -4, -6, -8, -10

   To change the increment value without changing the value of a
register (A in the example), the following can be used:


     .nr a \na 10


automatically generated by info2www version 1.2.2.9