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