# How to draw a rectangle with arrows?

I want to draw an image given in the picture. Till now I have been able to draw only

\documentclass{beamer}
\usepackage{mathtools}
\usepackage{array}
\usepackage{amsmath}
\usepackage{bibentry}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\setbeamertemplate{theorems}[numbered]
\usepackage{tikz}

\usepackage{graphicx}
\usepackage[section]{placeins}
\usepackage[utf8]{inputenc}

\begin{document}
\begin{frame}
\begin{tikzpicture}
\draw (0,0) -- (3,0) -- (3,4) -- (0,4) -- (0,0);
\end{tikzpicture}
\end{frame}

\end{document}


Question : How to draw the image given below?

• All you need for this are nodes and edges, all single elements (m, text, k) are nodes, all arrows are edges. See for example coga.tu-berlin.de/fileadmin/i26/download/AG_DiskAlg/… for a tutorial, e.g., page 8 (6/38 as numbered on the slide). – Marijn Jul 31 at 11:12
• – Marijn Jul 31 at 11:22
• \begin{tikzpicture}[bullet/.style={fill,circle,inner sep=1.5pt}] \draw (0,0) rectangle (3,4) ; \path foreach \X [count=\Y]in {0.3,0.7,1.1,1.5,2.9,3.3,3.7} {(1.5,\X) node[bullet] (b\Y) {} }; \node (m) at (-1.5,2) {$m$}; \foreach \X in {1,...,7} {\draw[-stealth] (m) to[out=0,in=180] (b\X);} \end{tikzpicture} – user121799 Jul 31 at 11:33

Wishing to be a starting point for TiKz.

\documentclass{beamer}
\usepackage{mathtools}
\usepackage{array}
\usepackage{amsmath}
\usepackage{bibentry}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\setbeamertemplate{theorems}[numbered]
\usepackage{tikz}

\usepackage{graphicx}

\usepackage[section]{placeins}
\usepackage[utf8]{inputenc}

\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}[dot/.style={
draw,
fill,
circle,
minimum size=4pt,
inner sep=0pt, outer sep=0pt,
},
>=stealth]
\node [draw,cyan,ultra thick,rectangle,minimum height=4cm,minimum width=3cm](rect){};
\draw[<->] ([xshift=3mm] rect.north east) -- ([xshift=3mm] rect.south east)node[fill=white,midway]{K};
\draw[ultra thick,<-] ([xshift=3mm] rect.north)--++(90:1)node[right]{text};
\begin{scope}[xshift={-4mm}]
\foreach \y/\k in {1.5/a,1/b,0.5/c}
\node [dot] at (0,\y) (\k) {};
\node at(0,0){\vdots};
\foreach \y/\k in {1.5/d,1/e,0.5/f}
\node [dot] at (0,-\y) (\k) {};
\end{scope}
\node at ([xshift=-10mm] rect.west)(m){m};
\draw [->](m) to[bend left](a);
\draw [->](m) to[bend left](b);
\draw [->](m) to[bend right](d);

\end{tikzpicture}
\end{center}
\end{frame}

\end{document}


• Very nice and my compliments. But for the label, what is the font that have you used? – Sebastiano Aug 3 at 22:11
• @Sebastiano, thank you. As you seen, I did not change anything in OP code. It is from bemaer Madrid theme. – ferahfeza Aug 3 at 22:16
• Oh, I get it. In your opinion, what font is the one used if you remember. If you don't remember it, it doesn't do anything. Thank you for your answer. – Sebastiano Aug 3 at 22:18