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 gtroff
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,
gtroffswitches back to the previous environment. There is no limit on the number of named environments; they are created the first time that they are referenced. The.evread-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 firstevrequest 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:
- Partially filled lines.
- The status whether the previous line was interrupted.
- The number of lines still to center, or to right-justify, or to underline (with or without underlined spaces); they are set to zero.
- The status whether a temporary indentation is active.
- Input traps and its associated data.
- Line numbering mode is disabled; it can be reactivated with ‘.nm +0’.
- The number of consecutive hyphenated lines (set to zero).
The
\n[.w]register contains the width of the last glyph added to the current environment.The
\n[.cht]register contains the height of the last glyph added to the current environment.The
\n[.cdp]register contains the depth of the last glyph added to the current environment. It is positive for glyphs extending below the baseline.The
\n[.csk]register contains the skew (how far to the right of the glyph's center thatgtroffshould place an accent) of the last glyph added to the current environment.