consider the following MWE


  |-|/.style = {
  to path={
      (\tikztostart) |- ($(\tikztostart)!0.5!(\tikztotarget)$) -| (\tikztotarget)

    \node (a) at (0,0) [rectangle, draw, minimum width=1cm, minimum height=1cm] {a};
    \node (b) at (2,1.5) [circle, draw, minimum width=1cm, minimum height=1cm] {b};

    \draw[thick, red, ->] (a) |- ($(a)!0.5!(b)$) -| (b);

    \draw[->] (a) to[|-|] (b);

which I made based on this answer:


Is it somehow possible to modify the style definition, such that I can write

\draw[->] (a) |-| (b);

without the to[] operator? I have seen that there is the tikzlibrarypaths.ortho.tex but is it really necessary to use a complete library only for this kind of path operation?

Further, I would also like to have a -/ path style, which connects two nodes first horizontal, then with an adjustable angle (default 45°). I tried using the calc library and projection coordinates, but I struggled, so how can this be done?

Your Answer

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

Browse other questions tagged or ask your own question.