# TikZ block diagram with multiple arrows not from centre of block

I'm trying to create a rather simple diagram but I don't know how to get the multiple arrows on the left not leaving the centre of the node.

Two options; using anchors and some shifts, and using the <name>.<angle > syntax:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[draw,minimum size=2cm] (x) {X};
\draw[->] ([yshift=-10pt]x.west) -- node[fill=white] {a} +(-1cm,0pt);
\draw[->] ([yshift=10pt]x.west) -- node[fill=white] {b} +(-1cm,0pt);
\draw[->] (x.120) -- node[fill=white] {c} +(0pt,1cm);
\draw[->] (x.60) -- node[fill=white] {d} +(0pt,1cm);
\end{tikzpicture}

\end{document}

As Claudio Fiandrino has mentioned in his comment, another option is to use the calc library, so the shifts are not absolute, but can be calculated in terms of anchors:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\node[draw,minimum size=2cm] (x) {X};
\draw[->] ([yshift=-10pt]x.west) -- node[fill=white] {a} +(-1cm,0pt);
\draw[->] ([yshift=10pt]x.west) -- node[fill=white] {b} +(-1cm,0pt);
\draw[->] (x.120) -- node[fill=white] {c} +(0pt,1cm);
\draw[->] (x.60) -- node[fill=white] {d} +(0pt,1cm);
\draw[->]
( $(x.north east)!0.5!(x.east)$ ) --
node[fill=white] {e}
+(1cm,0pt);
\draw[->]
( $(x.east)!0.5!(x.south east)$ ) --
node[fill=white] {f}
+(1cm,0pt);
\end{tikzpicture}

\end{document}

In the above example ( $(x.north east)!0.5!(x.east)$ ) means the point whose coordinate is halfway between x.north east and x.east.

• What about the calc library? – Claudio Fiandrino Mar 18 '14 at 13:39
• @ClaudioFiandrino I wanted to show some options without libraries, but perhaps it's worth also mentioning calc. Do you mean to use calc to calculate the shifts? – Gonzalo Medina Mar 18 '14 at 13:42
• Yes, for example \draw[->]($(x.north west)!0.5!(x.west)$)-- node[fill=white] {b} +(-1cm,0pt); and \draw[->] ($(x.west)!0.5!(x.south west)$) -- node[fill=white] {a} +(-1cm,0pt);. – Claudio Fiandrino Mar 18 '14 at 13:47
• @ClaudioFiandrino I added some example with your suggestion. Thanks. – Gonzalo Medina Mar 18 '14 at 13:52
• @GonzaloMedina Many thanks for that quick and detailed answer! – Jan Mar 18 '14 at 16:11

A PSTricks solution:

\documentclass{article}

\usepackage{xfp}

\newcommand*\Width{\fpeval{2*\arrowLength+\boxLength}}
\newcommand*\Height{\boxLength}

\def\arrowLength{3}
\def\boxLength{3}

\begin{document}

\begin{pspicture}(\Width,\Height)
\psset{arrows = ->}
\psframe(\arrowLength,0)(\fpeval{\arrowLength+\boxLength},\boxLength)
\rput(\fpeval{\arrowLength+0.5*\boxLength},\fpeval{0.5*\boxLength}){X}
\pcline(\arrowLength,\fpeval{\boxLength/3})(0,\fpeval{\boxLength/3})
\ncput*{a}
\pcline(\arrowLength,\fpeval{2/3*\boxLength})(0,\fpeval{2/3*\boxLength})
\ncput*{b}
\pcline(\fpeval{2*\arrowLength+\boxLength},\fpeval{0.5*\boxLength})%
(\fpeval{\arrowLength+\boxLength},\fpeval{0.5*\boxLength})
\ncput*{c}
\end{pspicture}

\end{document}

Note that the drawing is 'automated' and all you have to do is choose the values of \arrowLength and \boxLength.