-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Description
Migrated from SourceForge
Author: nzeh
Timestamp: 2015-05-14 14:29:46.942000
In the following code example, two curves from (a) to (v2) and from (a) to (v3) are created, but a single curve from (a) to (v3) through (v2) should be drawn.
:::LaTeX
\begin{tikzpicture}
\coordinate (v1) at (0,0);
\coordinate (c21) at (1,0);
\coordinate (c22) at (2,0);
\coordinate (v2) at (2,1);
\coordinate (c31) at (2,2);
\coordinate (c32) at (3,2);
\coordinate (v3) at (4,2);
\node[draw,inner sep=0pt,minimum size=6pt,circle] (a) at (v1) {};
\draw (a) \foreach \i in {2,3} {.. controls (c\i1) and (c\i2) .. (v\i)};
\end{tikzpicture}
The correct path is drawn if the \foreach loop is manually expanded to
:::LaTeX
\draw (a) .. controls (c21) and (c22) .. (v2) .. controls (c31) and (c32) .. (v3);
The path is also drawn correctly using
:::LaTeX
\draw (v1) \foreach \i in {2,3} {.. controls (c\i1) and (c\i2) .. (v\i)};
but it is of course not shortened to start only at the node's boundary. This suggests that \foreach gets confused when the starting point of a path is a node rather than a coordinate.