Previous: Assigning Formats, Up: Registers


5.6.5 Built-in Registers

The following lists some built-in registers which are not described elsewhere in this manual. Any register which begins with a ‘.’ is read-only. A complete listing of all built-in registers can be found in Register Index.

\n[.F]
This string-valued register returns the current input file name.
\n[.H]
Horizontal resolution in basic units.
\n[.R]
The number of number registers available. This is always 10000 in GNU troff; it exists for backward compatibility.
\n[.U]
If gtroff is called with the -U command line option to activate unsafe mode, the number register .U is set to 1, and to zero otherwise. See Groff Options.
\n[.V]
Vertical resolution in basic units.
\n[seconds]
The number of seconds after the minute, normally in the range 0 to 59, but can be up to 61 to allow for leap seconds. Initialized at start-up of gtroff.
\n[minutes]
The number of minutes after the hour, in the range 0 to 59. Initialized at start-up of gtroff.
\n[hours]
The number of hours past midnight, in the range 0 to 23. Initialized at start-up of gtroff.
\n[dw]
Day of the week (1-7).
\n[dy]
Day of the month (1-31).
\n[mo]
Current month (1-12).
\n[year]
The current year.
\n[yr]
The current year minus 1900. Unfortunately, the documentation of UNIX Version 7's troff had a year 2000 bug: It incorrectly claimed that yr contains the last two digits of the year. That claim has never been true of either AT&T troff or GNU troff. Old troff input that looks like this:
          
          '\" The following line stopped working after 1999
          This document was formatted in 19\n(yr.

can be corrected as follows:

          
          This document was formatted in \n[year].

or, to be portable to older troff versions, as follows:

          
          .nr y4 1900+\n(yr
          This document was formatted in \n(y4.

\n[.c]
\n[c.]
The current input line number. Register ‘.c’ is read-only, whereas ‘c.’ (a gtroff extension) is writable also, affecting both ‘.c’ and ‘c.’.
\n[ln]
The current output line number after a call to the nm request to activate line numbering.

See Miscellaneous, for more information about line numbering.

\n[.x]
The major version number. For example, if the version number is 1.03 then .x contains ‘1’.
\n[.y]
The minor version number. For example, if the version number is 1.03 then .y contains ‘03’.
\n[.Y]
The revision number of groff.
\n[$$]
The process ID of gtroff.
\n[.g]
Always 1. Macros should use this to determine whether they are running under GNU troff.
\n[.A]
If the command line option -a is used to produce an ASCII approximation of the output, this is set to 1, zero otherwise. See Groff Options.
\n[.O]
This read-only register is set to the suppression nesting level (see escapes \O). See Suppressing output.
\n[.P]
This register is set to 1 (and to 0 otherwise) if the current page is actually being printed, i.e., if the -o option is being used to only print selected pages. See Groff Options, for more information.
\n[.T]
If gtroff is called with the -T command line option, the number register .T is set to 1, and zero otherwise. See Groff Options.
\*[.T]
A single read-write string register which contains the current output device (for example, ‘latin1’ or ‘ps’). This is the only string register defined by gtroff.