Hi Keith,

thank you very much!

I should definitely write more macros in order to better understand the subtleties of macro definition and execution.

Best,

Oliver.


On 10/05/2025 12:20, Keith Marshall wrote:
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.

--

Dr. Oliver Corff
Wittelsbacherstr. 5A
10707 Berlin
G E R M A N Y
Tel.: +49-30-85727260
Mail:oliver.co...@email.de
  • Register not set? Oliver Corff via GNU roff typesetting system discussion
    • Re: Register ... Keith Marshall
      • Re: Regis... Oliver Corff via GNU roff typesetting system discussion

Reply via email to