When a register is used, it is always textually replaced (or
interpolated) with a representation of that number. This output format
can be changed to a variety of formats (numbers, Roman numerals, etc.).
This is done using the
Change the output format of a number register. The first argument ident is the name of the number register to be changed, and the second argument format is the output format. The following output formats are available:
Decimal arabic numbers. This is the default format: 0, 1, 2, 3, ...
Decimal numbers with as many digits as specified. So, ‘00’ would result in printing numbers as 01, 02, 03, ...
In fact, any digit instead of zero does work;
gtroff only counts
how many digits are specified. As a consequence,
format ‘1’ could be specified as ‘0’ also (and exactly this is
returned by the
\g escape, see below).
Upper-case Roman numerals: 0, I, II, III, IV, ...
Lower-case Roman numerals: 0, i, ii, iii, iv, ...
Upper-case letters: 0, A, B, C, …, Z, AA, AB, ...
Lower-case letters: 0, a, b, c, …, z, aa, ab, ...
Omitting the number register format causes a warning of type ‘missing’. See Debugging, for more details. Specifying a nonexistent format causes an error.
The following example produces ‘10, X, j, 010’:
.nr a 10 .af a 1 \" the default format \na, .af a I \na, .af a a \na, .af a 001 \na
The largest number representable for the ‘i’ and ‘I’ formats
is 39999 (or -39999); Unix
troff uses ‘z’ and
‘w’ to represent 10000 and 5000 in Roman numerals, and so does
gtroff. Currently, the correct glyphs of Roman numeral five
thousand and Roman numeral ten thousand (Unicode code points
U+2181, respectively) are not available.
If ident doesn’t exist, it is created.
Changing the output format of a read-only register causes an error. It
is necessary to first copy the register’s value to a writeable register,
then apply the
af request to this other register.
Return the current format of the specified register ident (one-character name i, two-character name id). For example, ‘\ga’ after the previous example would produce the string ‘000’. If the register hasn’t been defined yet, nothing is returned.