TikZ block diagram with multiple arrows not from centre of block
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
.
A PSTricks solution:
\documentclass{article}
\usepackage{pstricks-add}
\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
.