How to Draw a Wire Kink Over Vertical Wires in CircuitikZ
At a glance
- 1. Draw vertical wires
Draw the vertical wires first so the crossing wire can be layered over them.
- 2. Add a raised arc
Replace a short horizontal section at each crossing with an upward semicircular arc.
- 3. Mask the crossing
Draw the kink in the background color, then redraw it in the wire color to hide the wire beneath.
- 4. Adjust the shape
Change the arc radius and masking width to suit the scale and line thickness of your diagram.
To show one wire crossing over vertical wires in CircuitikZ, draw the vertical wires first and route the other wire through a small raised arc at each crossing. The arc alone is not enough: the vertical wire may still appear to connect to it. A wider background-colored stroke beneath the arc hides that part of the vertical wire and makes the crossing clear.
Complete example
This example uses two vertical wires and a horizontal wire that jumps over both. It is a complete LaTeX document; compile it with pdflatex or another standard LaTeX engine.
\documentclass[tikz,border=5pt]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
% Draw the vertical wires first.
\draw[line width=0.8pt] (0,-1) -- (0,1);
\draw[line width=0.8pt] (2,-1) -- (2,1);
% Draw a wide white underlay to hide the vertical wires at the bridges.
\draw[white, line width=3pt]
(-2,0) -- (-0.18,0)
arc (180:0:0.18cm)
-- (1.82,0)
arc (180:0:0.18cm)
-- (3,0);
% Draw the visible wire over the underlay.
\draw[line width=0.8pt]
(-2,0) -- (-0.18,0)
arc (180:0:0.18cm)
-- (1.82,0)
arc (180:0:0.18cm)
-- (3,0);
\end{circuitikz}
\end{document}
The arc (180:0:0.18cm) command draws an upper semicircle from the left end of the kink to the right. The straight sections stop at the arc endpoints, then resume after each arc. The white stroke is wider than the black wire, so it covers the vertical wire near the top of each bridge; the final black stroke draws the crossing wire on top.
Adjust the kink
The arc radius controls how high and wide each bridge is. In this example, 0.18cm sets the radius. Increase it for a more pronounced kink, and move the straight-line endpoints to match. For example, with a radius of 0.25cm, the first arc should start at (-0.25,0) and the next straight section should begin at the arc’s endpoint, (0.25,0).
The underlay width must be greater than the wire width to cover the wire underneath. Here, the wires are 0.8pt wide and the underlay is 3pt wide. If you change the wire thickness, adjust the underlay too. Keep the underlay as narrow as practical: an overly wide stroke can erase nearby marks or labels.
For a diagram on a nonwhite background, replace white with the background color. The method relies on the underlay matching the background; it may not work cleanly over a patterned or transparent background.
Common mistakes
- Drawing the kink before the vertical wire: The later vertical stroke can show through the bridge. Draw the vertical wire first, then the underlay and kink.
- Skipping the underlay: The wires can look joined at the crossing. The wider background-colored stroke creates the visible gap.
- Using an underlay that is too thin: The vertical wire may remain visible beside the bridge. Make the underlay noticeably wider than the wire.
- Using the wrong arc direction:
arc (180:0:...)bends upward here. To keep the same left and right endpoints but bend downward, usearc (180:360:...)instead. - Forgetting the background color: A white underlay stands out on a colored page or panel. Match the underlay to the area behind the wires.
Applying the method to more crossings
For each additional vertical wire, break the horizontal path at that wire and insert another arc with a matching underlay. Keep the two paths—the underlay and the visible wire—identical apart from their colors and line widths. That way the masking stays aligned with the kink.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.