5

I'm trying to draw several rectangles next to each other, and the last rectangle on the queue without the right border.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning}
\begin{document}
\begin{tikzpicture}  
  \tikzstyle{t1} = [rectangle, fill=white, draw=black, minimum width=0.7cm, minimum height=0.9cm, inner sep=2pt]
  \tikzstyle{t2} = [rectangle, fill=white, draw=black, minimum width=1.4cm, minimum height=0.9cm, inner sep=2pt]
  \tikzstyle{arrow} = [->, >=stealth', auto, thick, draw=black]
  \node[t1] (q1ax) {AX};
  \node[t2] (q1bx) [right=-0.1mm of q1ax] {BX};
  \node[t1] (q1cx) [right=-0.1mm of q1bx] {CX};
  \node[t1] (q1dx) [right=-0.1mm of q1cx] {DX};
  \node[t2] (q1ex) [right=-0.1mm of q1dx] {EX};
  \node[t1] (q1dots) [right=-0.1mm of q1ex] {...};
  \node[t1] (q2ax) [below right=2cm and 1cm of q1bx] {AX};
  \node[t2] (q2bx) [right=-0.1mm of q2ax] {BX};
  \node[t1] (q2cx) [right=-0.1mm of q2bx] {CX};
  \node[t1] (q2dx) [right=-0.1mm of q2cx] {DX};
  \node[t2] (q2ex) [right=-0.1mm of q2dx] {EX};
  \node[t1] (q2dots) [right=-0.1mm of q2ex] {..};  
  \draw[arrow] (q1bx.south) -- (q2cx.north);
  \draw[arrow] (q1dx.south) -- (q2ax.north);
\end{tikzpicture}
\end{document}

enter image description here

Please, how can I hide the border to get this result?

| improve this question | | | | |
  • 2
    Welcome to the site! This is a duplicate somewhere but I don't know what to search for :) – percusse Jan 3 '17 at 12:08
  • 5
    quick hack: draw a white line over the rectangle border you don't want, e.g.: \draw[white,line width=.8pt] (q2dots.north east) -- (q2dots.south east); – Nico Vecchio Jan 3 '17 at 12:13
5

Define the key three sided as follows (taken from here):

\tikzset{three sided/.style={
        draw=none,
        append after command={
            [shorten <= -0.5\pgflinewidth]
            ([shift={(-1.5\pgflinewidth,-0.5\pgflinewidth)}]\tikzlastnode.north east)
        edge([shift={( 0.5\pgflinewidth,-0.5\pgflinewidth)}]\tikzlastnode.north west) 
            ([shift={( 0.5\pgflinewidth,-0.5\pgflinewidth)}]\tikzlastnode.north west)
        edge([shift={( 0.5\pgflinewidth,+0.5\pgflinewidth)}]\tikzlastnode.south west)            
            ([shift={( 0.5\pgflinewidth,+0.5\pgflinewidth)}]\tikzlastnode.south west)
        edge([shift={(-1.0\pgflinewidth,+0.5\pgflinewidth)}]\tikzlastnode.south east)
        }
    }
}

and add this key to the two nodes.

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning}
% https://tex.stackexchange.com/a/82282/110998
\tikzset{three sided/.style={
        draw=none,
        append after command={
            [shorten <= -0.5\pgflinewidth]
            ([shift={(-1.5\pgflinewidth,-0.5\pgflinewidth)}]\tikzlastnode.north east)
        edge([shift={( 0.5\pgflinewidth,-0.5\pgflinewidth)}]\tikzlastnode.north west) 
            ([shift={( 0.5\pgflinewidth,-0.5\pgflinewidth)}]\tikzlastnode.north west)
        edge([shift={( 0.5\pgflinewidth,+0.5\pgflinewidth)}]\tikzlastnode.south west)            
            ([shift={( 0.5\pgflinewidth,+0.5\pgflinewidth)}]\tikzlastnode.south west)
        edge([shift={(-1.0\pgflinewidth,+0.5\pgflinewidth)}]\tikzlastnode.south east)
        }
    }
}
\begin{document}
\begin{tikzpicture}  
  \tikzstyle{t1} = [rectangle, fill=white, draw=black, minimum width=0.7cm, minimum height=0.9cm, inner sep=2pt]
  \tikzstyle{t2} = [rectangle, fill=white, draw=black, minimum width=1.4cm, minimum height=0.9cm, inner sep=2pt]
  \tikzstyle{arrow} = [->, >=stealth', auto, thick, draw=black]
  \node[t1] (q1ax) {AX};
  \node[t2] (q1bx) [right=-0.1mm of q1ax] {BX};
  \node[t1] (q1cx) [right=-0.1mm of q1bx] {CX};
  \node[t1] (q1dx) [right=-0.1mm of q1cx] {DX};
  \node[t2] (q1ex) [right=-0.1mm of q1dx] {EX};
  \node[t1] (q1dots) [right=-0.1mm of q1ex,three sided] {...};
  \node[t1] (q2ax) [below right=2cm and 1cm of q1bx] {AX};
  \node[t2] (q2bx) [right=-0.1mm of q2ax] {BX};
  \node[t1] (q2cx) [right=-0.1mm of q2bx] {CX};
  \node[t1] (q2dx) [right=-0.1mm of q2cx] {DX};
  \node[t2] (q2ex) [right=-0.1mm of q2dx] {EX};
  \node[t1] (q2dots) [right=-0.1mm of q2ex,three sided] {..};  
  \draw[arrow] (q1bx.south) -- (q2cx.north);
  \draw[arrow] (q1dx.south) -- (q2ax.north);
\end{tikzpicture}
\end{document}
| improve this answer | | | | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.