reading number registers
\nY or \n(XX.interpolates the value of number registers Y and XX. The following are predefined:
- %
- page number
- .$
- (r/o) number of macro arguments
- .A
- (r/o) nroff or troff -a
- .H
- (r/o) horizontal resultion, in units
- .L
- (r/o) current line spacing parameter (.ls)
- .P
- (r/o) 1 if current page is printed, else 0
- .T
- (r/o) nroff -T
- .V
- (r/o) vertical resolution, in units
- .a
- (r/o) most recently used post-line space from \x'N'
- .c
- (r/o) input line
- .d
- (r/o) vertical position in diversion, or nl if no diversion
- .f
- (r/o) font as physical quadrant (1-4) (huh?)
- .h
- (r/o) text baseline high-water mark (huh?)
- .i
- (r/o) indent
- .j
- (r/o) adjustment mode and type
- .k
- (r/o) horizontal text portion size of current output line
- .l
- (r/o) line length
- .n
- (r/o) length of text portion on previous output line
- .o
- (r/o) page offset
- .p
- (r/o) page length
- .s
- (r/o) point size
- .t
- (r/o) distance to next trap
- .u
- (r/o) fill mode? 1=yes, 0=no
- .v
- (r/o) vertical line spacing
- .w
- (r/o) width of previous character
- .x
- (r/o) (reserved)
- .y
- (r/o) (reserved)
- .z
- (r/o) name of current diversion (string)
- c.
- input line
- ct
- character type (set by width function) (huh?)
- dl
- maximum width of last completed diversion
- dn
- height of last completed diversion
- dw
- weekday (1-7)
- dy
- day of month (1-31)
- hp
- input column
- ln
- output line number
- mo
- month (1-12)
- nl
- vertical position of last printed text baseline
- sb
- depth of string below baseline, generated by width function
- st
- height of string above baseline, generated by width function
- yr
- year % 100 or year - 1900 [differs between implementations]
defining number registers
.nr XX valuesets the number register XX and Y to value.
.nr Y value
autoincrement and -decrement
.nr name value auto-incrementThe auto-increment is added (or subtracted) to the register on every access where a + (or -) follows the n, as in
\n+Y or \n-(XX.The parameter value, when prefixed with - or +, refers to the previous value of the register (if any).
formatting number registers
.af name format-charmakes the number-register name be formatted according to format-char. Possible formats are:
- 1
- decimal
- 001
- ... with leading zeroes
- i
- i, ii, iii, iv, v ...
- I
- I, II, III, IV, V ...
- a
- 0, a, b, c, .. aa, ab, ...
- A
- 0, A, B, C, .. AA, AB, ...
removing number registers
.rr nameremoves name from circulation. (It's a storage thing.)