GNU Info

Info Node: (groff)Page Location Traps

(groff)Page Location Traps


Next: Diversion Traps Prev: Traps Up: Traps
Enter node , (file) or (file)node

Page Location Traps
-------------------

   "Page location traps" perform an action when `gtroff' reaches a
certain vertical location on the page.  Page location traps have a
variety of purposes, including:

   * setting headers and footers

   * setting body text in multiple columns

   * setting footnotes

 - Request: .vpt flag
 - Register: \n[.vpt]
     Enables vertical position traps if FLAG is non-zero, or disables
     them otherwise.  Vertical position traps are traps set by the `wh'
     or `dt' requests.  Traps set by the `it' request are not vertical
     position traps.  The parameter that controls whether vertical
     position traps are enabled is global.  Initially vertical position
     traps are enabled.  The current setting of this is available in the
     `.vpt' read-only number register.

 - Request: .wh dist macro
     Sets a page location trap.  Positive values for DIST set the trap
     relative to the top of the page; negative values set the trap
     relative to the bottom of the page.

     MACRO is the name of the macro to execute when the trap is sprung.

     The following is a simple example of how many macro packages set
     headers and footers.


          .de hd                \" Page header
          'sp .5i
          .tl 'Title''date'
          'sp .3i
          ..
          .de fo                \" Page footer
          'sp 1v
          .tl ''%''
          'bp
          ..
          .wh 0   hd            \" trap at top of the page
          .wh -1i fo            \" trap one inch from bottom


 - Register: \n[.t]
     A read-only number register holding the distance to the next trap.

 - Request: .ch dist macro
     Changes the location of a trap.  The first argument is the name of
     the macro to be invoked at the trap, and the second argument is
     the new location for the trap (note that the parameters are
     specified the opposite of the `.wh' request).  This is useful for
     building up footnotes in a diversion to allow more space at the
     bottom of the page for them.


 - Register: \n[.ne]
     The read-only number register `.ne' contains the amount of space
     that was needed in the last `ne' request that caused a trap to be
     sprung.  Useful in conjunction with the `.trunc' register.  Note:
     Page Control, for more information.

 - Register: \n[.trunc]
     A read-only register containing the amount of vertical space
     truncated by the most recently sprung vertical position trap, or,
     if the trap was sprung by an `ne' request, minus the amount of
     vertical motion produced by the `ne' request.  In other words, at
     the point a trap is sprung, it represents the difference of what
     the vertical position would have been but for the trap, and what
     the vertical position actually is.


automatically generated by info2www version 1.2.2.9