1

The following code produces an image like this:

enter image description here

\newcommand{\mywidth}{1.4cm}
\newcommand{\myheight}{7mm}

\begin{tikzpicture}
    \node[draw, rectangle, minimum height=\myheight, minimum width=\mywidth, 
        font=\tiny, xshift=0*\mywidth, label={[shift={(-0.6,0)}, font=\tiny]0}, 
        fill=red!20] (n1) {foo};
    \node[draw, rectangle, minimum height=\myheight, minimum width=\mywidth,
        font=\tiny, xshift=1*\mywidth, label={[shift={(-0.6,0)}, font=\tiny]1}, 
        fill=blue!20] (n2) {bar};

    \node [tape, draw, rotate=90, minimum height=\mywidth/2,
        minimum width=\myheight, tape bend top=none, tape bend height=0.1cm,
        label={[shift={(0.35,0.55)}, font=\tiny]2}] at (2*\mywidth-4mm,0) (n3) {};
    \node [tape, draw, rotate=90, minimum height=\mywidth/2, 
        minimum width=\myheight, tape bend bottom=none, tape bend height=0.1cm,] 
        at (2*\mywidth + 4mm,0) (n4) {};
\end{tikzpicture}

I found inspiration for drawing the wiggly lines in this awesome answer.

However, it is really tedious to position the elements with the wiggly lines. Since they are rotated, minimum height=... actually sets their width. The same is true for the label, since the anchor was of course rotated too. I had to try around for quite a while to position the label more or less correctly (it is still a little bit off).

Is there a way to make the last two nodes behave like the first node? Ideally, I'd like to behave these two nodes together in the same way as the "foo" or "bar"-node. If that is not possible, I'd at least like to avoid this very confusing and tricky way of position the label, the node and setting the node height and width.

mort
  • 1,671
  • 1
    You could just draw a regular node and then draw a path afterwards. If you use \draw [double] (my node.south) <curvy specification> (my node.north); then it should look right, though you'll probably need to specify inner sep=0pt for the nodes. Might be easier, though. – cfr Jul 13 '15 at 13:54
  • @cfr That's a good solution, but why inner sep to 0? – Alenanno Jul 13 '15 at 16:12
  • @Alenanno Because the path may otherwise start below and finish above the drawn node border. (But I didn't test this.) – cfr Jul 13 '15 at 16:46

0 Answers0