One way would be to add a stage at the start of the arrows that goes horizontally for a bit:
\draw[-latex] (A.east) -- ++(1,0) |- (B.west);
(adjust the 1
to get the length you want).
This does mean that the first part of the line would get drawn 4 times. It may not show (I don't know). To avoid that, you could draw it only the once; thus the later lines would be:
\draw[-latex] (A.east) ++(1,0) |- (C.west);
An alternative would be to put a coordinate
node at that point:
\draw (A.east) -- ++(1,0) coordinate (div);
\draw[-latex] (div) |- (B.west);
\draw[-latex] (div) |- (C.west);
I started to create some code which allows you to add more anchors to existing node shapes:
\def\pgfaddtoshape#1#2{%
\begingroup
\def\pgf@sm@shape@name{#1}%
\let\anchor\pgf@sh@anchor
#2%
\endgroup
}
The above code was copied from the definition of \pgfdeclareshape
and only includes the required parts and excludes the shape initialization part.
Using that, more node anchors can be added. This isn't that easy, because it has to be done using the lower level PGF macros and requires knowledge and understanding where the origin of the shape is. For example for the rectangle
shape the origin lies at the left corner of the text baseline, not in the middle of the rectangle.
Here is some code which adds more points of the compass as anchors
as well as some "pseudo-anchors" which return the width and/or height of the node. The latter are useful for the let
syntax of the calc
library, e.g. let \y1 = (somenode.size) in node { width=\x1, height=\y1 };
\def\useanchor#1#2{\csname pgf@anchor@#1@#2\endcsname}
\def\@shiftback#1#2#3#4#5#6{%
\advance\pgf@x by -#5\relax
\advance\pgf@y by -#6\relax
}
\pgfaddtoshape{rectangle}{%
\anchor{west south west}{%
\pgf@process{\northeast}%
\pgf@ya=.5\pgf@y%
\pgf@process{\southwest}%
\pgf@y=1.5\pgf@y%
\advance\pgf@y by \pgf@ya%
\pgf@y=.5\pgf@y%
}%
\anchor{west north west}{%
\pgf@process{\northeast}%
\pgf@ya=1.5\pgf@y%
\pgf@process{\southwest}%
\pgf@y=.5\pgf@y%
\advance\pgf@y by \pgf@ya%
\pgf@y=.5\pgf@y%
}%
\anchor{east north east}{%
\pgf@process{\southwest}%
\pgf@ya=.5\pgf@y%
\pgf@process{\northeast}%
\pgf@y=1.5\pgf@y%
\advance\pgf@y by \pgf@ya%
\pgf@y=.5\pgf@y%
}%
\anchor{east south east}{%
\pgf@process{\southwest}%
\pgf@ya=1.5\pgf@y%
\pgf@process{\northeast}%
\pgf@y=.5\pgf@y%
\advance\pgf@y by \pgf@ya%
\pgf@y=.5\pgf@y%
}%
\anchor{north north west}{%
\pgf@process{\southwest}%
\pgf@xa=1.5\pgf@x%
\pgf@process{\northeast}%
\pgf@x=.5\pgf@x%
\advance\pgf@x by \pgf@xa%
\pgf@x=.5\pgf@x%
}%
\anchor{north north east}{%
\pgf@process{\southwest}%
\pgf@xa=.5\pgf@x%
\pgf@process{\northeast}%
\pgf@x=1.5\pgf@x%
\advance\pgf@x by \pgf@xa%
\pgf@x=.5\pgf@x%
}%
\anchor{south south west}{%
\pgf@process{\northeast}%
\pgf@xa=.5\pgf@x%
\pgf@process{\southwest}%
\pgf@x=1.5\pgf@x%
\advance\pgf@x by \pgf@xa%
\pgf@x=.5\pgf@x%
}%
\anchor{south south east}{%
\pgf@process{\northeast}%
\pgf@xa=1.5\pgf@x%
\pgf@process{\southwest}%
\pgf@x=.5\pgf@x%
\advance\pgf@x by \pgf@xa%
\pgf@x=.5\pgf@x%
}%
\anchor{width}{%
\useanchor{rectangle}{west}%
\pgf@xc=\pgf@x
\useanchor{rectangle}{east}%
\advance\pgf@x by -\pgf@xc
\pgf@y=\z@
\edef\pgf@temp{\csname pgf@sh@nt@\pgfreferencednodename\endcsname}%
\expandafter\@shiftback\pgf@temp
}
\anchor{height}{%
\useanchor{rectangle}{south}%
\pgf@yc=\pgf@y
\useanchor{rectangle}{north}%
\advance\pgf@y by -\pgf@yc
\pgf@x=\z@
\edef\pgf@temp{\csname pgf@sh@nt@\pgfreferencednodename\endcsname}%
\expandafter\@shiftback\pgf@temp
}
\anchor{size}{%
\useanchor{rectangle}{south west}%
\pgf@xc=\pgf@x
\pgf@yc=\pgf@y
\useanchor{rectangle}{north east}%
\advance\pgf@x by -\pgf@xc
\advance\pgf@y by -\pgf@yc
\edef\pgf@temp{\csname pgf@sh@nt@\pgfreferencednodename\endcsname}%
\expandafter\@shiftback\pgf@temp
}
}
I have these both code blocks as pgf-extrect.sty
in my local TEXMF
tree and load it as package if they are required.
Another possible improvement is to define alternative anchor names, i.e. 'nnw' instead of 'north north west'. This can be done using the following macros:
\newcommand{\anchorlet}[2]{%
\global\expandafter
\let\csname pgf@anchor@\pgf@sm@shape@name @#1\expandafter\endcsname
\csname pgf@anchor@\pgf@sm@shape@name @#2\endcsname
}
\newcommand{\anchoralias}[2]{%
\expandafter
\gdef\csname pgf@anchor@\pgf@sm@shape@name @#1\expandafter\endcsname
\expandafter{\csname pgf@anchor@\pgf@sm@shape@name @#2\endcsname}%
}
\pgfaddtoshape{rectangle}{%
\anchorlet{se}{south east}%
\anchorlet{sw}{south west}%
\anchorlet{ne}{north east}%
\anchorlet{nw}{north west}%
\anchorlet{wsw}{west south west}%
\anchorlet{wnw}{west north west}%
\anchorlet{ene}{east north east}%
\anchorlet{ese}{east south east}%
\anchorlet{nnw}{north north west}%
\anchorlet{nne}{north north east}%
\anchorlet{ssw}{south south west}%
\anchorlet{sse}{south south east}%
}
Here \anchorlet
links the alternative name to the current definition of the original name, while \anchoralias
links to the name. This makes a difference if the anchor is not yet defined or might be redefined (unlikely).
Edited 10.12.2017
Updated for the new version of PGF which changed the internal shape name macro used here.
Best Answer
In the newer version of PGF
\shape@name
is now\pgf@sm@shape@name
: