Hi Oliver, On 10/05/2025 09:02, Oliver Corff via GNU roff typesetting system discussion wrote:
> I want to write a macro which uses its argument to define a register: > > .mso s.tmac \" Load ms > > .de pageno > \\$1:\c \" displayed as intended > .nr xx \\$1 \" register is not set? > \n[xx] \" register reads zero This is evaluated too early, during macro *definition*, rather than during macro *execution*. You need to write "\\n[xx]", to defer the evaluation until the macro is executed. > .. > .\" > .PP > My page number: > .pageno 123 > > > Unfortunately, while the macro argument is shown properly if written as > \\$1, I fail to set a register to the argument, so I get "123:0" instead > of "123:123". > > Where is my fault? Actually, the macro *is* defining the register, when it is executed, but it then outputs the value (zero) which the register had when defining the macro. -- Regards, Keith.