I'm looking for a way to cross wires in Circuitikz.

Wire Crossing

1B in the above picture shows what I'm after.


Example has been taken from the circuitikz manual.



    declare function={% in case of CVS which switches the arguments of atan2
        atan3(\a,\b)=ifthenelse(atan2(0,1)==90, atan2(\a,\b), atan2(\b,\a));
    kinky cross radius/.initial=+.125cm,
    @kinky cross/.initial=+,
    kinky crosses/.is choice,
    kinky crosses/left/.style={@kinky cross=-},
    kinky crosses/right/.style={@kinky cross=+},
    kinky cross/.style args={(#1)--(#2)}{
        to path={
            let \p{@kc@}=($(\tikztotarget)-(\tikztostart)$),
            \n{@kc@}={atan3(\p{@kc@})+180} in
            -- ($(intersection of \tikztostart--{\tikztotarget} and #1--#2)!%
            \pgfkeysvalueof{/tikz/kinky cross radius}!(\tikztostart)$)
            arc [ radius     =\pgfkeysvalueof{/tikz/kinky cross radius},
            start angle=\n{@kc@},
            delta angle=\pgfkeysvalueof{/tikz/@kinky cross}180 ]
            -- (\tikztotarget)

\begin{circuitikz}[thick, line cap=rect, nodes={line cap=butt}]
\draw [x=+.8cm, y=+1.1cm]
  (2,4.5) --               (0,4.5)
          to [Tpmos, n=p1] (0,3  ) coordinate (a-a)
          to [Tnmos, n=n1] (0,1.5)
          to [Tnmos, n=n2] (0,0  ) node[ground] {}
  (2,4.5) to [Tpmos, n=p2] (2,3  ) coordinate (a-b)
          to [short, -*]   (a-a)
  (p1.G)  to [kinky cross=(a-a)--(a-b), kinky crosses=left] (n1.G)
          to [short, *-o]  ([shift=(right:3)]n1.G) coordinate (b-b)
  ([shift=(right:2)] n2.G) node[circ] {}
          -- (n2.G-|p2.G)
          to [kinky cross=(n1.G)--(b-b)] (p2.G)
  (n2.G)  to [short, -o]   ([shift=(right:3)] n2.G)
  (a-a)   to [short, -o]   (-1,3  );


enter image description here

  • Hi! Could you please elaborate a bit in how to create a kinky cross 'above'? This would be the case were there I already have a vertical wire and I wish to pass a horizontal one, skipping above the vertical.
    – Isma
    Oct 10 '17 at 15:01
  • I posted as another question here: tex.stackexchange.com/questions/395493/…
    – Isma
    Oct 10 '17 at 15:43

A to[crossing] connection works too. This is less adaptive than Qrrbrbirlbel's answer, however: compare the result of the two snippets below.

    \draw (0,0)
        to[short] ++(2,-1)  % \
    \draw (0,-1)
        to[kinky cross=(A)--(B), kinky crosses=left] ++(1,1);  % /


    \draw (0,0)
        to[short] ++(2,-1)  % \
    \draw (0,-1)
        to[crossing] ++(1,1);  % /

You'll see that by using the in-built to[crossing], you miss the actual crossing. Also, that kink is smaller than Qrrbrbirlbel's kink, which is perhaps less desirable too.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.