3

This is my code:

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

This is the output:

enter image description here

I want to draw something like this:

enter image description here

How to draw rest of the arrows?

  • 1
    Your tikz code shows five arrows leaving from the "B" block. Your intended result shows only four and some vertical lines are disconnected. Is this there something missing? – Gonzalo Medina Jul 11 '13 at 16:16
  • I want to have only four outgoing arrows from the "B". Those vertical lines can be ignored. – tikzlearner Jul 11 '13 at 16:24
  • This question is perhaps of interest: tex.stackexchange.com/questions/45347/… – Torbjørn T. Jul 11 '13 at 16:32
4

One possibility using the perpendicular coordinate system:

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

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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