Predefined registers whose identifiers start with a dot are read-only.
Many are Boolean-valued, interpolating a true or false value testable
with the if
, ie
, or while
requests. Some read-only
registers are string-valued, meaning that they interpolate text.
Caution: Built-in registers are subject to removal like others; once removed, they can be recreated only as normal writable registers and will not reflect formatter state.
A register name (without the dot) is often associated with a request of the same name. A complete listing of all built-in registers can be found in Register Index.
We present here a few built-in registers that are not described
elsewhere in this manual; they have to do with invariant properties of
GNU troff
, or obtain information about the formatter’s
command-line options, processing progress, or the operating environment.
\n[.A]
¶Approximate output is being formatted (Boolean-valued); see
groff
-a option (Options).
\n[.c]
¶\n[c.]
Input line number. ‘c.’ is a writable synonym, affecting subsequent interpolations of both ‘.c’ and ‘c.’.
\n[.F]
¶Name of input file (string-valued).
\n[.g]
¶Always true in GNU troff
(Boolean-valued). Documents can use
this to ask the formatter if it claims groff
compatibility.
\n[.P]
¶Output page selection status (Boolean-valued); see groff
-o option (Options).
\n[.R]
¶Count of available unused registers; always 10,000 in GNU
troff
.52
\n[.T]
¶Indicator of output device selection (Boolean-valued); see
groff
-T option (Options).
\n[.U]
¶Unsafe mode enablement status (Boolean-valued); see groff
-U option (Options).
\n[.x]
¶Major version number of the running GNU troff
formatter. For
example, if the version number is 1.23.0, then .x
contains ‘1’.
\n[.y]
¶Minor version number of the running GNU troff
formatter. For
example, if the version number is 1.23.0, then .y
contains ‘23’.
\n[.Y]
¶Revision number of the running GNU troff
formatter. For example,
if the version number is 1.23.0, then .Y
contains ‘0’.
\n[$$]
¶Process identifier (PID) of the GNU troff
program in its
operating environment.
Date- and time-related registers are set per the local time as
determined by localtime(3) when the formatter launches. This
initialization can be overridden by SOURCE_DATE_EPOCH
and
TZ
; see Environment.
\n[seconds]
¶Count of seconds elapsed in the minute (0–60).
\n[minutes]
¶Count of minutes elapsed in the hour (0–59).
\n[hours]
¶Count of hours elapsed since midnight (0–23).
\n[dw]
¶Day of the week (1–7; 1 is Sunday).
\n[dy]
¶Day of the month (1–31).
\n[mo]
¶Month of the year (1–12).
\n[year]
¶Gregorian year.
\n[yr]
¶Gregorian year minus 1900. This register is incorrectly documented
in the AT&T troff
manual as storing the last two digits
of the current year. That claim stopped being true in 2000. Old
troff
input that looks like:
'\" The year number is a surprise after 1999. This document was formatted in 19\n(yr.
can be corrected to:
This document was formatted in \n[year].
or, for portability across many roff
programs, to the following.
.nr y4 1900+\n(yr This document was formatted in \n(y4.