# Combine to[short,*-] with |- for orthogonal wiring

I want to combine the perpendicular drawing of Tikz (|-) with the wire ending shapes of Circuitikz (*-) that is use inside the to operand. I want to do something like the last line of code where the |- has no effect.

\begin{circuitikz}[x=10mm,y=10mm]
\draw   (0,0) to[inline not] ++(2,0) coordinate (A) to[inline not] ++(2,0) coordinate (B) to[inline not] ++(2,0) coordinate (C) to[inline not] ++(2,0) coordinate (D);
\tikzset{mux/.style={muxdemux, muxdemux def={Lh=6, Rh=4, NL=4, NB=2, NR=1}}}
\draw (5,-4) node[mux,rotate=-90] (sel) {A};

\draw (D) |- ($(D)!0.5!(sel.lpin 1)$) -| (sel.lpin 1);
\draw (C) |- ($(C)!0.5!(sel.lpin 2)$) -| (sel.lpin 2);
\draw (B) |- ($(B)!0.5!(sel.lpin 3)$) -| (sel.lpin 3);
\draw (A) to[short,*-,|-] ($(A)!0.5!(sel.lpin 4)$) -| (sel.lpin 4);
\end{circuitikz} Thank you

• to path={ |- (\tikztotarget)}?
– user240002
Apr 20, 2021 at 20:21
• @user240002 maybe it would be possible but the to path macro of circuitikz is already a mess as it is, not sure if I want to do that... ;-) Apr 20, 2021 at 20:25

You can't chain the to syntax with the |- because the syntax is (coord) to[] (coord) to draw an element. It will not work because |- is already a path element; it would be like saying (coord) to[element] to[vertical and horizontal wire] (coord) so Tikz does not know the intermediate point.

The easier solution here is to use this for your last line:

\draw (A)  node[circ]{} |- ($(A)!0.5!(sel.lpin 4)$) -| (sel.lpin 4);

• I am on a tablet now, sorry if the answer is not so well organized... Apr 20, 2021 at 20:26
• No problem, it works fine to me, so Ill take it. It's rare that you can't do both thing together in one step. Maybe I can build a macro that uses the calc library for more compact solution. Thanks Apr 20, 2021 at 20:56

You can also use (A |- B) for the point below or above A and left or right of B.

\documentclass{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[x=10mm,y=10mm]
\draw   (0,0) to[inline not] ++(2,0) coordinate (A) to[inline not] ++(2,0) coordinate (B) to[inline not] ++(2,0) coordinate (C) to[inline not] ++(2,0) coordinate (D);
\tikzset{mux/.style={muxdemux, muxdemux def={Lh=6, Rh=4, NL=4, NB=2, NR=1}}}
\draw (5,-4) node[mux,rotate=-90] (sel) {A};

\coordinate (E) at ($(A)!0.5!(sel.lpin 4)$);% common north/south midpoint

\draw (D) -- (D |- E) -| (sel.lpin 1);
\draw (C) -- (C |- E) -| (sel.lpin 2);
\draw (B) -- (B |- E) -| (sel.lpin 3);
\draw (A) to[short,*-] (A |- E) -| (sel.lpin 4);
\end{circuitikz}
\end{document}