BSD 4_3_Reno release
[unix-history] / usr / src / share / doc / usd / 25.trofftut / tt13
CommitLineData
95f51977 1.\" @(#)tt13 6.1 (Berkeley) 5/23/86
f9b4797c
KD
2.\"
3.NH
4Environments
5.PP
6As we mentioned, there is a potential problem
7when going across a page boundary:
8parameters like size and font
9for a page title may well be different from those
10in effect in the text when the page boundary occurs.
11.UL troff
12provides a very general way to deal with this and
13similar situations.
14There are three `environments',
15each of which has independently settable versions of
16many of the parameters associated with processing,
17including size, font, line and title lengths,
18fill/nofill mode, tab stops, and even partially collected lines.
19Thus the titling problem may be readily solved by processing the main text
20in one environment and titles in a separate one
21with its own suitable parameters.
22.PP
23The command
24.BD .ev\ n
25shifts to environment
26.BD n ;
27.BD n
28must be 0, 1 or 2.
29The command
30.BD .ev
31with no argument returns to the
32previous environment.
33Environment names are maintained in a stack, so calls
34for different environments may be nested and unwound consistently.
35.PP
36Suppose we say that the main text is processed in environment 0,
37which is where
38.UL troff
39begins by default.
40Then we can modify the new page macro
41.BD .NP
42to process titles in environment 1 like this:
43.P1 2
44^de NP
45^ev 1 \e" shift to new environment
46^lt 6i \e" set parameters here
47^ft R
48^ps 10
49\&... any other processing ...
50^ev \e" return to previous environment
51^^
52.P2
53It is also possible to initialize the parameters for an environment
54outside the
55.BD .NP
56macro,
57but the version shown keeps all the processing in one place
58and is thus easier to understand and change.