groff
[Top][All Lists]
Advanced

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

macro returning a value?


From: Ulrich Lauther
Subject: macro returning a value?
Date: Sat, 13 Nov 2021 12:22:05 +0100

Is there a trick to make a macro or string return a value?

Motivation:

I can write 

        position: \n[.d]

and get the current position in units.

But I want millimeters, \n[.d]*25.4/72000
or, as arithmetic is in integer, \n[.d]*254/720000 

The only solution I found looks like this:

        .de Pos END
        .nr foo (\\n[.d]u-\\[.v]u)*254+1)/72000
        \\n[foo] mm/10
        .END

        .fi
        position: \n[.d] units,
        .Pos

But this solution doesn’t make me happy.

Help a poor struggler!

        ulrich



reply via email to

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