On 03-Nov-05 Amber Hassaan wrote:
> Hi everyone,
> Please tell me, if I can use variables or
> positions from one pic diagram in another pic
> diagram.I think I might be able to use self-defined
> registers or strings perhaps but I can't figure out
> how.
>
> best regards
> amber
Hi Amber,
Anything defined or given a value in one .PS ... .PE block
is available to all subsequent blocks, unless subsequently
changed.
So you can give a particular variable a value once, and it
will have that same value in all later blocks (unless you
change its value along the line).
Similarly, pic macros defined in one block remain available
in later blocks (unless undefined by "undef"), and so do
named "objects" defined like
A: [....]
and so on (actually pic calls [....] a "block", which is
obviously not what I meant by "block above!).
For example:
.PS
k = 10
define circles {
circrad=$1 ; n=$2 ;
for i = 1 to n do {
circle rad circrad*(1 - i/n) at (0 + i*circrad/n,0) fill i/n
}
sprintf(" %.0f Circles",k) at last circle .e ljust
}
.PE
and then, after some text,
.PS
circles(0.5,20)
.PE
which is clearly incorrect, so correct it with
.PS
k = 20
circles(0.5,20)
.PE
Best wishes,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 03-Nov-05 Time: 18:00:55
------------------------------ XFMail ------------------------------
_______________________________________________
Groff mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/groff