# How to simplify path?

I have the following MWE:

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

\begin{document}
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (1,-1);
\newlength{\vsep}
\setlength{\vsep}{0.5cm}
\coordinate (abovea) at ($(a) + (0,\vsep)$);
\coordinate (aboveb) at (b |- abovea);
\node[fill=black,circle,inner sep=2pt] at (a) {};
\node[fill=black,circle,inner sep=2pt] at (b) {};
\draw (a) -- (abovea) -- (aboveb) -- (b);
\end{tikzpicture}
\end{document}


It's quit verbose just to connect the points A and B and I am wondering how I can simplify it ?

-

In addition to the methods mentioned in Is there a TikZ equivalent to the PSTricks \ncbar command?, you could simplify your code to

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

\begin{document}
\begin{tikzpicture}
\node[fill=black,circle,inner sep=2pt] (a) at (0,0) {};
\node[fill=black,circle,inner sep=2pt] (b) at (1,-1) {};
\draw (a) |- ($(a-|b) + (0,0.5cm)$) -- (b);
\end{tikzpicture}
\end{document}


Here, (a-|b) is the point that has the y-coordinate of a and the x-coordinate of b. Using |- instead of -- means, first move vertically to the y-coord of the second point, then horizontally to the point.

-
Two more options without using calc library: \draw (a) --++(90:.5)-|(b); or \draw(a) --([yshift=.5cm]a.center)-|(b);. –  Ignasi Jul 23 at 10:33