groff
[Top][All Lists]
Advanced

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

Re: [Groff] Inline evaluation of calculations?


From: Werner LEMBERG
Subject: Re: [Groff] Inline evaluation of calculations?
Date: Sat, 13 May 2006 08:46:43 +0200 (CEST)

> > I was wondering if there was a way to, for example, print the
> > result of \n%+1 without using a junk variable. I didn't see a
> > request equivalent to "eval" in the manpages or the texinfo thing.
>
> I'm not aware of one either (though of course the "junk variable"
> method works fine).

I think so too.

> You could of course define a macro/parametrised string on the
> lines of
>
> .de eval
> .nr Neval \\$*
> \\n[Neval]
> ..
>
> The value of \en%+1 is
> .eval \n%+1
> (correct since this is page 1).
>
> which produces the output
>
>   The value of \n%+1 is 2 (correct since this is page 1).

A very good entry for the groff wiki...

Please add!


    Werner




reply via email to

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