Next: , Previous: Writing Macros, Up: Writing Macros


5.21.1 Copy-in Mode

When gtroff reads in the text for a macro, string, or diversion, it copies the text (including request lines, but excluding escapes) into an internal buffer. Escapes are converted into an internal form, except for \n, \$, \*, \\ and \<RET> which are evaluated and inserted into the text where the escape was located. This is known as copy-in mode or copy mode.

What this means is that you can specify when these escapes are to be evaluated (either at copy-in time or at the time of use) by insulating the escapes with an extra backslash. Compare this to the \def and \edef commands in TeX.

The following example prints the numbers 20 and 10:

     
     .nr x 20
     .de y
     .nr x 10
     \&\nx
     \&\\nx
     ..
     .y