3

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.

11
  • Seems legit, but isn't there any other way to do this with the own tools CircuiTikz provides? It looks so simple and easy to implement that I think I am missing something...
    – ElSabio
    Dec 29 '19 at 13:28
  • 2
    The manual that @jsbibra linked states that the crossing jumper will be put in the center of the subpath where the to[crossing] is issued, so sometime a bit of trial and error is needed to position it. As I understand it this means that you cannot use this kind of crossing if you don't know (or don't want to try out) where the crossing is, in case it is not in the center of a line. The same goes for explicit crossing nodes described below in the manual.
    – Marijn
    Dec 29 '19 at 13:58
6

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]{};
4
  • What if C is at (1,1)?
    – ElSabio
    Dec 29 '19 at 17:01
  • That edit does not provide the wire jumping on the intersection!
    – ElSabio
    Dec 30 '19 at 14:59
  • Ah, it uses the midpoint. I've never actually used to[crossing] before. Dec 30 '19 at 15:04
  • Any idea how it could be accomplished?
    – ElSabio
    Dec 30 '19 at 15:26
3

As circuitikz is basically a (very good) extension of TikZ, I see absolutely no reasons why I should not use standard TikZ syntaxes for this.

\documentclass[a4paper,12pt]{article}
\usepackage[a4paper, margin=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{circuitikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{circuitikz}
  \draw[name path=ab] (0,0)node[circ]{a} -- (4,0)node[circ]{b};
  \draw[name path=cd] (1,2)node[circ]{c} |- (3,-2)node[circ]{d};
  \path[name intersections={of=ab and cd,by=e}] (e) node[circ] {e};
\end{circuitikz}
\end{document}

enter image description here

2
  • This does not provide any kind of jump crossing in the intersection. Also if you replace the \node[circ](e){} by \node[jump crossing](){} you wont get a proper wire jumping because there will be still a line below it.
    – ElSabio
    Dec 30 '19 at 16:34
  • 1
    @ElSabio Fair enough, I didn’t understand your question.
    – fractal
    Dec 30 '19 at 23:48

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.