home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / 1_1_contri / usd / 25_trofftu / tt13 < prev    next >
Encoding:
Text File  |  1986-05-23  |  1.6 KB  |  59 lines

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