Use and redistribution is subject to the Berkeley Software License
Agreement and your Software Agreement with AT&T (Western Electric).
@(#)tt13 8.1 (Berkeley) 6/8/93
$FreeBSD: head/share/doc/usd/22.trofftut/tt13 96896 2002-05-19 03:33:24Z grog $
Environments
As we mentioned, there is a potential problem when going across a page boundary: parameters like size and font for a page title may well be different from those in effect in the text when the page boundary occurs. troff provides a very general way to deal with this and similar situations. There are three `environments', each of which has independently settable versions of many of the parameters associated with processing, including size, font, line and title lengths, fill/nofill mode, tab stops, and even partially collected lines. Thus the titling problem may be readily solved by processing the main text in one environment and titles in a separate one with its own suitable parameters.
The command .ev n shifts to environment n ; n must be 0, 1 or 2. The command .ev with no argument returns to the previous environment. Environment names are maintained in a stack, so calls for different environments may be nested and unwound consistently.
Suppose we say that the main text is processed in environment 0, which is where troff begins by default. Then we can modify the new page macro .NP to process titles in environment 1 like this:
1 2 ^de NP ^ev 1 \e" shift to new environment ^lt 6i \e" set parameters here ^ft R ^ps 10 ... any other processing ... ^ev \e" return to previous environment ^^
2 It is also possible to initialize the parameters for an environment outside the .NP macro, but the version shown keeps all the processing in one place and is thus easier to understand and change.