[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Groff] pic - drawing a line back to the beginning

**From**: |
Werner LEMBERG |

**Subject**: |
Re: [Groff] pic - drawing a line back to the beginning |

**Date**: |
Tue, 17 Oct 2006 09:05:02 +0200 (CEST) |

>* # here's the part I'm interested in*
>* line left from last box .w;*
>* line up to 1st box .w + (-0.5,0);*
>* arrow to 1st box .w;*
>* .PE*
>* *
>* One can get a straight line by adjusting the coordinates in the next- *
>* to-last line, although for a more complex chart (like the real one *
>* was), it might take several iterations. On my computer, I get a left, *
>* up, then a diagonal instead of just left & diagonal. (PS file attached.)*
>* *
>* I was wondering if anyone could: 1) explain why the dogleg appears; *
This is caused by the `up' keyword. Your code is equivalent to
line up then to 1st box .w + (-0.5,0);
Just say
line to 1st box .w + (-0.5,0);
>* 2) provide a more elegant method of drawing a line back up to the *
>* first box that doesn't require guesswork.*
What about this:
.PS
# Left_Arrow(start, end, distance)
define Left_Arrow {
x1 = $1.w.x;
x2 = $2.w.x;
xoff = min(x1, x2) - $3;
line from $1.w to (xoff, $1.y);
line to (xoff, $2.y);
arrow to $2.w
}
down;
A: box wid 1 "xyzzy";
arrow;
box "plugh";
arrow;
B: box "plove";
Left_Arrow(B, A, 0.2);
.PE
Werner