Traps (The GNU Troff Manual)

### 5.28 Traps

Traps are locations in the output or conditions on the input that, when reached or fulfilled, call a specified macro. These traps can occur at a given location on the page, at a given location in the current diversion (together, these are known as vertical position traps), at a blank line, at a line with leading space characters, after a quantity of input lines, or at the end of input. Macros called by traps are passed no arguments. Setting a trap is also called planting one. It is said that a trap is sprung if its condition is fulfilled.