Ulrich Lauther <ulrich.laut...@t-online.de> wrote:

> >   .de Pos
> >   \R'foo (\\n[.d]-\\n[.v]*254+1)/72000'\\n[foo]mm/10
> >   ..
> >
> > which allows you to enter
> >
> >   position: \n[.d] units, \*[Pos].
> >
>
> Wow! Works nicely.
>
> But why is "R" escaped only once? \\R works too.
> And I had to add a line ".sp -1v" at the end of the  macro; otherwise I get a
> blank line after position: ...
>
>         ulrich
>

Hi Ulrich,

I think I know why, if I'm mistaken, please correct me.

To be executed, macros are effectively executed twice by groff.  Once to
be defined and once more at execution.  Backslashes are needed to
distinguish between definition and execution.

\\n[.d] is escaped twice because we need the number register .d at the
time of execution not at the time of definition.  As for \R foo, it is
equivalent to .nr foo so it is OK if it is executed at the time of
definition.

--
Regards,
Thomas


Reply via email to