Hi Oliver, > .nr number 0 1 > .while (\n[number] < 16) \{\ > .ie (\n[number] < 10) \[u4E0\n[number]] > .el \[u4E0\*[\n[number]]] > .nr number +1 > .\} > > So far, everything works perfectly. > > However, if I wrap this loop in a macro like > > .de myline > .\" material as above > ..
The text after .de is read twice. Once when the macro is defined and again when it is executed. The reading occurs in two different modes. See section 7 of CSTR 54. https://troff.org/54.pdf For example, \nn puts the value of number-register n when the macro is defined into the macro whereas \\nn delays getting the value of n to when the macro is executed. Here's a variation on your test. $ cat oliver.tr .pl 2 . .ds 0 0 .ds 1 1 .ds 2 2 .ds 3 3 .ds 4 4 .ds 5 5 .ds 6 6 .ds 7 7 .ds 8 8 .ds 9 9 .ds 10 A .ds 11 B .ds 12 C .ds 13 D .ds 14 E .ds 15 F . .nr n 0 1 .while (\n[n] < 16) \{\ \[u216\*[\nn]] .nr n +1 .\} .br . .de m .nr n 0 1 .while (\\n[n] < 16) \\{\\ \\[u216\\*[\\nn]] .nr n +1 .\\} .. .m $ troff -Tutf8 oliver.tr | grotty Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ Ⅺ Ⅻ Ⅼ Ⅽ Ⅾ Ⅿ Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ Ⅺ Ⅻ Ⅼ Ⅽ Ⅾ Ⅿ $ -- Cheers, Ralph.