groff
[Top][All Lists]
Advanced

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

Re: [Groff] looping in Pic


From: Ted Harding
Subject: Re: [Groff] looping in Pic
Date: Thu, 15 Mar 2012 23:45:18 -0000 (GMT)

On 15-Mar-2012 emmanuel chemla wrote:
> A newbie question in Pic:
> Having to draw a ruled paper, I finally succeeded in writing
> this short program :
> ----
> .PS
> lineWidth=3i
> interlineHeight=0.2
> 
> line lineWidth;
> line lineWidth at last line.start +(0i, -interlineHeight)
> line lineWidth at last line.start +(0i, -interlineHeight)
> line lineWidth at last line.start +(0i, -interlineHeight)
> .PE
> 
> ----
> the program is correct but I would like it to work in a loop,
> with the number of lines set in a register or as a variable
> or send as an argument to a recursive macro.
> (and I don't want to output as much as *".PS blabla .PE"*
> blocks as lines needed, I'd like to solve this matter just
> staying in Pic environment).
> 
> Any ideas ?

The following should do what you want:

.PS
nLines=20
lineWidth=3i
interlineHeight=0.2

line lineWidth;
for i=1 to (nLines-1) do {
  line lineWidth at last line.start +(0i, -interlineHeight)
}
.PE

Ted.

-------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Date: 15-Mar-2012  Time: 23:45:12
This message was sent by XFMail
-------------------------------------------------


reply via email to

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