Try this:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[>=latex,scale=2]
\foreach \x in {-1, 0, 1} {
\foreach \y in {0, 1, 2} {
\path node (\x-\y) at (\x+\y-1, \y-\x) {};
}
}
\path[->] (0-0) edge [bend right = 30] (0-1);
\end{tikzpicture}
\end{document}
From the pgf
documentation (Section 3.7 Naming Nodes ):
Names for nodes can be pretty arbitrary, but they should not contain
commas, periods, parentheses, colons, and some other special
characters. However, they can contain underscores and hyphens.
This solution builds on Altermundus answer; I only used the shapes
library to add two "tapes" to get the desired aspect for the interrupted band:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,shapes}
\begin{document}
\begin{tikzpicture}
\foreach \c/\i [count=\n] in
{blue!20/0001,red!20/0001,red!20/0010,red!20/0100}
\node[draw,fill=\c,minimum height=1cm,minimum width = 2cm,xshift=\n*2cm,font=\ttfamily](N\n){\i} ;
\draw [decoration={brace,mirror,raise=5pt},decorate] (N1.south west) -- node[below=10pt]{$M_0$}(N1.south east);
\draw [decoration={brace,mirror,raise=5pt},decorate] (N1.south east) -- node[below=10pt]{$M_1$}(N4.south east);
\node [tape, draw,minimum size=1cm,tape bend top=none,
tape bend height=0.4cm,rotate=90] at (9.3,0) (t) {};
\node [tape, draw,minimum size=1cm,tape bend top=none,
tape bend height=0.4cm,rotate=270] at (11.3,0) (t) {};
\node at (10.3,0.5) {\dots};
\node at (10.3,-0.5) {\dots};
\foreach \c/\i [count=\m] in
{olive!20/0111,green!20/1111}
\node[draw,fill=\c,minimum height=1cm,minimum width = 2cm,xshift=10.6cm+\m*2cm](N\m){\i} ;
\draw [decoration={brace,mirror,raise=5pt},decorate] (N2.south west) -- node[below=10pt]{$M_d$}(N2.south east);
\end{tikzpicture}
\end{document}
Best Answer
I think I have an answer that should work, but it does not, apparently as something does not work correctly with the \pgfmathparse{} and \pgfmathresult macros. Here's what I have done:
I defined a command to take start and stop value, the stepping and the expression. First the expression is evaluated by tikz, then it should be drawn in a node. But ehat really happens is that \pgfmathresult always returns zero. What's even more weird is that it's conditionally changed to the x-coordinate of the node. To make sure it is not my definition of \listgen, I also did the same thing manually, but still the same strange result.
Could you please run this to check wheater the error is reproducable?
Edit: Hmm, thats odd. I already used \pgfmathresult successfully, like this:
Which should give a green staicase like thing, where the color changes with the variable through \pgfmathparse. Probably it is a bug in tikz?
Edit 2: Wohoo, it works. Thanks to Jake :D
Edit 3: Thanks to Andrey Vihrov and Jake in this post, I was able to let it return lists as strings with brackets:
which returns
(1.0, 4.0, 9.0, 16.0, 25.0)
It uses
TikZ
for math calculations, so it can be used inside or outside of aTikZ
environment. However it crashes if I try to put the list in{}
via\{ \}
in the commands. Does anyone know why?