# Tag Info

4

You need to remove the parentheses from the inner loop. Namely, instead of passing {\targets} to the \foreach loop, you should be passing \targets. \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node (a) at (0, 1) {}; \node (b) at (0, -1) {}; \node (c) at (1, 0) {}; \node (d) at (-1, 0) {}; \foreach ...

4

Problems with \foreach aside, I think the syntax \path (b) edge (d) (a) edge (b) edge (c) edge (d); comes much more natural. It is also much easier to change edge options on an edge-to-edge basis (or for more than one edge, too): \path (b) edge (d) {[thick] (a) edge (b) edge[green] (c) edge[red,->] (d)}; Though, a similar thing can still ...

2

The important thing is to be consistent in the way you specify elements in a list to be processed by \foreach. In the approach below, which I find more intuitive, \targets gets expanded to {b} at the first iteration of the outer loop, and to {b,c,d} at the second one. Therefore, specifying \foreach \to in \targets for the inner loop works as expected. ...

Only top voted, non community-wiki answers of a minimum length are eligible