I make frequent use of |- and -| with computed points in diagrams, like so:
\coordinate (a) at (0,0);
\foreach \x in (1,...,10) {
\coordinate (b) at ({whateverFunction(\x)},{whateverOtherFunction(\x)});
\draw (a) |- (b); %Straight line segment
\draw (b) -| (a); %Another straight line segment
\coordinate (a) at (b);
}
I would like to be able to label the midpoint of each line segment, but doing something like node[midway,above] {a} does not act like expected:
I want something like:
Why does midway not work, and what is a good workaround here?




\draw (a) |-node{$a$} (b);? – Sigur Jan 26 '17 at 22:59