home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

12.8 Predefined Registers

There are two types of predefined registers: read-only and read-write. These are all accessed via the \n escape sequence, even though some of them actually return string values.

12.8.1 Read-Only Registers


Number of arguments available at the current macro level.

$$ Process ID of troff process (ditroff only).

Set to 1 in troff , if -a option used; always 1 in nroff .


Name of the current input file (recent ditroff only).

.H Available horizontal resolution in basic units.

Current line spacing (set by .ls ) value (recent ditroff only).


Number of unused number registers (recent ditroff only).


Set to 1 in nroff , if -T option used; always 0 in oroff ; in ditroff , the string \*(.T contains the value of -T .

.V Available vertical resolution in basic units.

Post-line extra line space most recently utilized using \x' n ' .


Emboldening level (recent ditroff only).

.c Number of lines read from current input file.

Current vertical place in current diversion; equal to register nl when there is no diversion.


Current font as number (1 to 4 in otroff ; 1 to 99 in ditroff ).

.h Text baseline high-water mark on current page or diversion.
.i Current indent.
.j Current adjustment mode.

Current output horizontal position.

.l Current line length.
.n Length of text portion on previous output line.
.o Current page offset.
.p Current page length.
.s Current point size.
.t Distance to the next trap.
.u Equal to 1 in fill mode and 0 in no-fill mode.
.v Current vertical line spacing.
.w Width of previous character.
.x Reserved version-dependent register.
.y Reserved version-dependent register.
.z Name of current diversion.

12.8.2 Read-Write Registers

% Current page number.

Character type (set by \w function).

dl Width (maximum) of last completed diversion.
dn Height (vertical size) of last completed diversion.
dw Current day of the week (1 to 7).
dy Current day of the month (1 to 31).

Current horizontal place on input line.

ln Output line number.
mo Current month (1 to 12).
nl Vertical position of last printed text baseline.

Depth of string below baseline (generated by \w function).


Height of string above baseline (generated by \w function).


Years since 1900.[2 ]

[2] Yes, there's a potential Y2K problem here. This will be 100 in 2000.

Previous: 12.7 Escape Sequences UNIX in a Nutshell: System V Edition Next: 12.9 Special Characters
12.7 Escape Sequences Book Index 12.9 Special Characters

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System