Commit | Line | Data |
---|---|---|
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 | |
8 | Environments | |
9 | .PP | |
10 | As we mentioned, there is a potential problem | |
11 | when going across a page boundary: | |
12 | parameters like size and font | |
13 | for a page title may well be different from those | |
14 | in effect in the text when the page boundary occurs. | |
15 | .UL troff | |
16 | provides a very general way to deal with this and | |
17 | similar situations. | |
18 | There are three `environments', | |
19 | each of which has independently settable versions of | |
20 | many of the parameters associated with processing, | |
21 | including size, font, line and title lengths, | |
22 | fill/nofill mode, tab stops, and even partially collected lines. | |
23 | Thus the titling problem may be readily solved by processing the main text | |
24 | in one environment and titles in a separate one | |
25 | with its own suitable parameters. | |
26 | .PP | |
27 | The command | |
28 | .BD .ev\ n | |
29 | shifts to environment | |
30 | .BD n ; | |
31 | .BD n | |
32 | must be 0, 1 or 2. | |
33 | The command | |
34 | .BD .ev | |
35 | with no argument returns to the | |
36 | previous environment. | |
37 | Environment names are maintained in a stack, so calls | |
38 | for different environments may be nested and unwound consistently. | |
39 | .PP | |
40 | Suppose we say that the main text is processed in environment 0, | |
41 | which is where | |
42 | .UL troff | |
43 | begins by default. | |
44 | Then we can modify the new page macro | |
45 | .BD .NP | |
46 | to 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 | |
57 | It is also possible to initialize the parameters for an environment | |
58 | outside the | |
59 | .BD .NP | |
60 | macro, | |
61 | but the version shown keeps all the processing in one place | |
62 | and is thus easier to understand and change. |