It happens frequently that some text should be printed in a certain
format regardless of what may be in effect at the time, for example, in
a trap invoked macro to print headers and footers. To solve this
gtroff processes text in environments. An environment
contains most of the parameters that control text processing. It is
possible to switch amongst these environments; by default
processes text in environment 0. The following is the information
kept in an environment.
These environments may be given arbitrary names (see Identifiers,
for more info). Old versions of
troff only had environments
named ‘0’, ‘1’, and ‘2’.
Switch to another environment. The argument env is the name of
the environment to switch to. With no argument,
back to the previous environment. There is no limit on the number of
named environments; they are created the first time that they are
.ev read-only register contains the name or
number of the current environment. This is a string-valued register.
Note that a call to
ev (with argument) pushes the previously
active environment onto a stack. If, say, environments ‘foo’,
‘bar’, and ‘zap’ are called (in that order), the first
ev request without parameter switches back to environment
‘bar’ (which is popped off the stack), and a second call switches
back to environment ‘foo’.
Here is an example:
.ev footnote-env .fam N .ps 6 .vs 8 .ll -.5i .ev ... .ev footnote-env \(dg Note the large, friendly letters. .ev
Copy the environment env into the current environment.
The following environment data is not copied:
\n[.w] register contains the width of the last glyph added to
the current environment.
\n[.cht] register contains the height of the last glyph added
to the current environment.
\n[.cdp] register contains the depth of the last glyph added
to the current environment. It is positive for glyphs extending below
\n[.csk] register contains the skew (how far to the
right of the glyph’s center that
gtroff should place an accent)
of the last glyph added to the current environment.
\n[.n] register contains the length of the previous output
line in the current environment.