groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [groff] Heirloom troff invoke macro from string


From: Tadziu Hoffmann
Subject: Re: [groff] Heirloom troff invoke macro from string
Date: Sat, 5 Jan 2019 00:04:37 +0100
User-agent: Mutt/1.9.1 (2017-09-22)

> 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

[Prev in Thread] Current Thread [Next in Thread]