[Tex/LaTex] Wire Crossings problem

circuitikztikz-pgf

I'm trying to understand how wire crossings work with CircuiTikz. I have seen the famous "Kink crossings" but I would like first trying to solve the problem with the crossings CircuiTikz provides.

For instance: How would you draw a crossing on that intersection using the CircuiTikz package?
Without knowing the coordinates nor relative position of the turn from C to D.

enter image description here

This is the code I wrote:

\documentclass[a4paper,12pt]{article}
\usepackage[a4paper, margin=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[]{circuitikzgit}
\begin{document}
    \begin{circuitikz}
       \draw (0,0)node[circ]{a} -- (4,0)node[circ]{b};
       \draw (1,2)node[circ]{c} |- (3,-2)node[circ]{d};
    \end{circuitikz}
\end{document}

It is important for me not to use the node-style format that the manual suggests, because this is for a bigger/more complex circuit I'm drawing and I would like to draw the crossing similar to a path style from one coordinate to another like:

\draw (1,2)node[circ]{c} to[crossing] |- (3,-2)node[circ]{d};

But obviously this does not work.

As you can see I have used the last release of CircuiTikz, this is were you can get it.

Best Answer

The problem is that (a) |- (b) is processed as two separate sections and to[crossing] can only handle one.

\documentclass[border=10pt]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
  \draw (0,0)node[circ]{a} -- (4,0)node[circ]{b};
  \draw (1,2)node[circ]{c} to[crossing] (1,2 |- 3,-2) -- (3,-2)node[circ]{d};

\end{circuitikz}
\end{document}

demo


This version steals shamelessly from Fractal, but replaces the circ with a jump crossing.

\documentclass[border=10pt]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{intersections}

\newlength{\crossing}
\makeatletter
\setlength{\crossing}{\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen}
\makeatother

\begin{document}
\begin{circuitikz}
  \draw[name path=ab] (0,0)node[circ]{a} -- (4,0)node[circ]{b};
  \draw[name path=cd] (1,1)node[circ]{c} |- (3,-2)node[circ]{d};
  \path[name intersections={of=ab and cd,by=e}];
  \fill[color=white] (e) circle[radius=0.5\crossing];% erase plain crossing
  \draw (e) node[jump crossing]{};
\end{circuitikz}
\end{document}

One can also use:

\path [name intersections={of=ab and cd,by=e}]
    [fill=white] (e) circle[radius=0.5\crossing]% erase plain crossing
    node[jump crossing,rotate=90]{};