隐藏矩形边框

隐藏矩形边框

我正在尝试绘制几个彼此相邻的矩形,并且队列中的最后一个矩形没有右边框。

\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

请问,我该如何隐藏边框才能得到这个结果?

答案1

定义密钥three sided如下(取自这里):

\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)
        }
    }
}

并将此密钥添加到两个节点。

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}

相关内容