节点之间的多个箭头

节点之间的多个箭头

这是我的代码:

\documentclass[a4paper,10pt]{article}
%\documentclass[a4paper,10pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,fit,calc,positioning,automata}

\usepackage[utf8x]{inputenc}

\title{}
\author{}
\date{}



\begin{document}
\maketitle

\begin{figure*}
\centering

\begin{tikzpicture}[scale=0.7,transform shape]

  \tikzset{input/.style={}} % <= this can be avoided but then use simply \node[name=input]{};
  \tikzset{block/.style={rectangle,draw}}
  \tikzstyle{pinstyle} = [pin edge={to-,thick,black}]

  \node [input, name=input] {};
  \node [block, rounded corners, right=0.5cm of input,minimum width=2.4cm, minimum height=2cm] (a) {E};
  \node [block, right = 1 cm of a,minimum width=3cm, minimum height=4cm] (b) {B};
\node [block, right = 2.5 cm of b,minimum width=1.75cm, minimum height=2cm,align=center] (c) {$1$};
\node [block, right = 2.5 cm of c,minimum width=1.75cm, minimum height=2cm,align=center] (d) {$2$};
\node [block, right = 2.5 cm of d,minimum width=1.75cm, minimum height=2cm,align=center] (e) {$k$};

  \node [below =0.25cm of b] (output1) {$R$};


\begin{scope}[->,>=latex]

\draw[->] (input) node[left]{{M}} -- (a);



\foreach \i [count=\xi from 0] in {2,...,-2}{%
  \draw[->] ([yshift=\i * 0.4 cm]a.east) -- ([yshift=\i * 0.8 cm]b.west) node[right] (o\xi) {} ;}


\node [right =0.01mm of o0] (d0) {$x_0$};
\node [right =0.01mm of o1] (d1) {$x_1$};
\node [right =0.01mm of o2] (d2) {$x_2$};
\node [right =0.01mm of o3] (d3) {$\vdots$};
\node [right =0.01mm of o4] (d4) {$x_k$};


\foreach \i [count=\xi from 0] in {2,...,-2}{%
  \draw[] ([yshift=\i * 0.8 cm]b.east) node[left]{$x_{\xi}$} -- ([yshift=\i * 0.8 cm]c.west) ;}

\end{scope}
\end{tikzpicture}

\caption{x}
\label{fig:bounded-sender}
\end{figure*}


\end{document}

这是输出:

在此处输入图片描述

我想要画这样的东西:

在此处输入图片描述

其余的箭头怎样画?

答案1

使用垂直坐标系的一种可能性:

\documentclass[a4paper,10pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,fit,calc,positioning,automata}
\usepackage[utf8x]{inputenc}

\begin{document}

\begin{figure*}
\centering

\begin{tikzpicture}[scale=0.7,transform shape]

\tikzset{input/.style={}} % <= this can be avoided but then use simply \node[name=input]{};
\tikzset{block/.style={rectangle,draw}}
\tikzset{pinstyle/.style={pin edge={to-,thick,black}}}

  \node [input, name=input] (input) {};
  \node [block, rounded corners, right=0.5cm of input,minimum width=2.4cm, minimum height=2cm] (a) {E};
  \node [block, right = 1 cm of a,minimum width=3cm, minimum height=4cm] (b) {B};
\node [block, right = 2.5 cm of b,minimum width=1.75cm, minimum height=2cm,align=center] (c) {$1$};
\node [block, right = 2.5 cm of c,minimum width=1.75cm, minimum height=2cm,align=center] (d) {$2$};
\node [block, right = 2.5 cm of d,minimum width=1.75cm, minimum height=2cm,align=center] (e) {$k$};

\node [below =0.25cm of b] (output1) {$R$};


\begin{scope}[->,>=latex]
\foreach \i [count=\xi from 0] in {2,...,-2}{%
  \draw[->] ([yshift=\i * 0.4 cm]a.east) -- ([yshift=\i * 0.8 cm]b.west) node[right] (o\xi) {} ;}


\node [right =0.01mm of o0] (d0) {$x_0$};
\node [right =0.01mm of o1] (d1) {$x_1$};
\node [right =0.01mm of o2] (d2) {$x_2$};
\node [right =0.01mm of o3] (d3) {$\vdots$};
\node [right =0.01mm of o4] (d4) {$x_k$};


\foreach \i [count=\xi from 0] in {2,...,-2}{%
  \node[left] at ([yshift=\i * 0.8 cm]b.east) (a\i) {$x_{\xi}$} ;}

\draw[->] 
  (a2) -| 
  coordinate[pos=.065] (aux1) 
  coordinate[pos=.265] (aux2) 
  ([xshift=-25pt]e.160|-e.160) -- 
  (e.160) ;
\draw (aux1) |- (c.160);
\draw (aux2) |- (d.160);
\draw (a1) -| 
  ([xshift=-45pt]c.200|-c.200) -- 
  (c.200);
\draw (a-1) -| 
  ([xshift=-45pt,yshift=-28pt]c.200|-c.200) -|  
  ([xshift=-40pt]d.200|-d.200) -- 
  (d.200);
\draw (a-2) -| 
  ([xshift=-25pt]e.200|-e.200) -- 
  (e.200);
\end{scope}

\end{tikzpicture}
\caption{x}
\label{fig:bounded-sender}
\end{figure*}

\end{document}

在此处输入图片描述

相关内容