# [Tex/LaTex] Drawing a polyline between two nodes in tikz

tikz-pgf

I am a beginner with tikz and finding the following really difficult to do.

I have defined and drawn node1 and node2 in tikz. You can figure it out easily from the picture. What I intend to do is

• Draw a dashed line from (node1.south) to P1.

• Draw a dashed line from P1 to P2.

• Draw a pointed dashed line from P2 to (node2.north).

• where the point P1 is (node1.south)+(0,-y). y is a positive integer which I am free to choose depending on y-axis distance between node1 and node2.

• and I define the point P2 as the point where a horizontal left-ward line from P1 meets the vertical upward line from (node2.north).
This thing roughly accomplished in google drawing is shown.

#### Best Answer

Qrrbrbirlbel's great paths.ortho library is perfect for this. Using the library, you don't have to calculate the support points manually, but instead you can simply write

\draw [dashed, -latex] (A) |-| (B);


to get

or

\draw [dashed, -latex, hvvh/ratio=0.7] (A) |-| (B);


to get

Together with Luigi's awesome arrows.new library, which allows you to scale arrow tips without changing the line widths or resorting to decorations, you can write

\draw [dashed, -latex new, arrow head=3mm, hvvh/ratio=0.7] (A) |-| (B);


to get

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{paths.ortho, arrows.new}
\begin{document}
\begin{tikzpicture}
\node [draw] (A) {Node A};
\node [draw] (B) at (-1,-2) {Node B};
\draw [dashed, -latex new, arrow head=3mm, hvvh/ratio=0.7] (A) |-| (B);
\end{tikzpicture}
\end{document}