Is it possible in Heirloom troff to invoke a macro from a string?
There is an escape sequence:
\R'R ±N' => Set number register R to ±N
This is useful, but the expression is too limiting in some cases. For
example, is it possible to increase register R by 1 only if it hasn't
reached a maximum va
You can invoke a macro with name xxx with
\*[xxx]
instead of
.xxx
You can even provide arguments for the macro in the form
\*[xxx arg1 ...]
as explained in
http://n-t-roff.github.io/heirloom/doctools/troff.pdf
§7.1. Does this answer your question or did you mean something else?
I didn't know that was possible. Yes, it would indeed solve my
problem. But, after a quick experiment, it seems to not behave this
way. The macro body gets expanded instead of executing:
.do xflag 3
.papersize a4
.mediasize a4
.ps 14p
.vs 24p
.
.nr x 0 1
.de m
.nr x +1
..
.ds s \\n+x
.ds t \\*m\\n
> 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 o