groff: Environments

 
 5.26 Environments
 =================
 
 It happens frequently that some text should be printed in a certain
 format regardless of what may be in effect at the time, for example, in
 a trap invoked macro to print headers and footers.  To solve this
 'gtroff' processes text in "environments".  An environment contains most
 of the parameters that control text processing.  It is possible to
 switch amongst these environments; by default 'gtroff' processes text in
 environment 0.  The following is the information kept in an environment.
 
    * font parameters (size, family, style, glyph height and slant, space
      and sentence space size)
 
    * page parameters (line length, title length, vertical spacing, line
      spacing, indentation, line numbering, centering, right-justifying,
      underlining, hyphenation data)
 
    * fill and adjust mode
 
    * tab stops, tab and leader characters, escape character, no-break
      and hyphen indicators, margin character data
 
    * partially collected lines
 
    * input traps
 
    * drawing and fill colours
 
    These environments may be given arbitrary names (see See
 Identifiers, for more info).  Old versions of 'troff' only had
 environments named '0', '1', and '2'.
 
  -- Request: .ev [env]
  -- Register: \n[.ev]
      Switch to another environment.  The argument ENV is the name of the
      environment to switch to.  With no argument, 'gtroff' switches back
      to the previous environment.  There is no limit on the number of
      named environments; they are created the first time that they are
      referenced.  The '.ev' read-only register contains the name or
      number of the current environment.  This is a string-valued
      register.
 
      Note that a call to 'ev' (with argument) pushes the previously
      active environment onto a stack.  If, say, environments 'foo',
      'bar', and 'zap' are called (in that order), the first 'ev' request
      without parameter switches back to environment 'bar' (which is
      popped off the stack), and a second call switches back to
      environment 'foo'.
 
      Here is an example:
 
           .ev footnote-env
           .fam N
           .ps 6
           .vs 8
           .ll -.5i
           .ev
 
           ...
 
           .ev footnote-env
           \(dg Note the large, friendly letters.
           .ev
 
  -- Request: .evc env
      Copy the environment ENV into the current environment.
 
      The following environment data is not copied:
 
         * Partially filled lines.
 
         * The status whether the previous line was interrupted.
 
         * The number of lines still to center, or to right-justify, or
           to underline (with or without underlined spaces); they are set
           to zero.
 
         * The status whether a temporary indentation is active.
 
         * Input traps and its associated data.
 
         * Line numbering mode is disabled; it can be reactivated with
           '.nm +0'.
 
         * The number of consecutive hyphenated lines (set to zero).
 
  -- Register: \n[.w]
  -- Register: \n[.cht]
  -- Register: \n[.cdp]
  -- Register: \n[.csk]
      The '\n[.w]' register contains the width of the last glyph added to
      the current environment.
 
      The '\n[.cht]' register contains the height of the last glyph added
      to the current environment.
 
      The '\n[.cdp]' register contains the depth of the last glyph added
      to the current environment.  It is positive for glyphs extending
      below the baseline.
 
      The '\n[.csk]' register contains the "skew" (how far to the right
      of the glyph's center that 'gtroff' should place an accent) of the
      last glyph added to the current environment.
 
  -- Register: \n[.n]
      The '\n[.n]' register contains the length of the previous output
      line in the current environment.