troff/nroff, numbers and units


Numbers can have scale indicators suffixed to them. The suffixes mean:

                                    Basic units in
                                  troff         nroff

i       Inch                      432            240
c       Centimeter                170             94
p       Pica (1/6 inch)           72              40
m       Em (S points)             6 S              C
n       En (1/2 Em)               3 S              C
p       Point (1/72 inch)         6                3
u       Basic unit                1                1
v       Vertical line space       V                V
none    Default, see below
is the current type size in points,
is the width of a (monospaced) nroff character in basic units,
is the current vertical line spacing in basic units.

default scales

Certain requests have default scales; all others ignore scale entirely. If a number argument to a request that expects a scaled number doesn't have a suffix, it is multiplied by the default scale. That holds for number register accesses as well; if they already are in basic units, they should be suffixed with a u.

.ll .in .ti .ta .lt .po .mc \h \l
.nr .if .ie
.pl .wh .ch .dt .sp .sv .ne .rt \v \x \L


| position
is the distance between the current position and the given position, vertically (when used in a vertical request) or horizontally (for all others.) The result is in basic units.


In numerical expressions, troff understands +, -, *, /, %, <, >, <=, >=, = or ==; additionally, & is and and : is or. There is no operator precedence; evaluation proceeds strictly left-to-right. Use parentheses.

The multiplication implied by default scales applies to every single number in an expression; if you don't want it multiplied, suffix a u.