> But, after a quick experiment, it seems to not behave this
> way. The macro body gets expanded instead of executing:

In groff it works with the following change:

  .de m
  \c
  .nr x +1
  ..

Be aware that this is only a trick.  It works in the running
text, but can go wrong unexpectedly in other situations
(such as in titles).  See the discussion starting at
https://lists.gnu.org/archive/html/groff/2018-01/msg00033.html
for an explanation.

You can do more complex processing, for example like this:

  .de o
  \c
  .ie \\nx%2 .nr x \\nx*3+1
  .el        .nr x \\nx/2
  \\nx\c
  ..
  .nr x 27
  \nx
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o
  \*o \*o \*o \*o \*o \*o \*o \*o \*o \*o



Reply via email to