Next: , Previous: , Up: Traps   [Contents][Index]

5.24.3 Input Line Traps

Request: .it n macro
Request: .itc n macro

Set an input line trap. n is the number of lines of input that may be read before springing the trap, macro is the macro to be invoked. Request lines are not counted as input lines.

For example, one possible use is to have a macro that prints the next n lines in a bold font.

.de B
.  it \\$1 B-end
.  ft B
.de B-end
.  ft R

The itc request is identical except that an interrupted text line (ending with \c) is not counted as a separate line.

Both requests are associated with the current environment (see Environments); switching to another environment disables the current input trap, and going back reactivates it, restoring the number of already processed lines.