home *** CD-ROM | disk | FTP | other *** search
- .\" @(#)tt13 6.1 (Berkeley) 5/23/86
- .\"
- .NH
- Environments
- .PP
- 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.
- .UL 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.
- .PP
- The command
- .BD .ev\ n
- shifts to environment
- .BD n ;
- .BD n
- must be 0, 1 or 2.
- The command
- .BD .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.
- .PP
- Suppose we say that the main text is processed in environment 0,
- which is where
- .UL troff
- begins by default.
- Then we can modify the new page macro
- .BD .NP
- to process titles in environment 1 like this:
- .P1 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
- ^^
- .P2
- It is also possible to initialize the parameters for an environment
- outside the
- .BD .NP
- macro,
- but the version shown keeps all the processing in one place
- and is thus easier to understand and change.
-