# Use circuitikz voltage source icon as a node

I'm using circuitikz to draw a single line diagram:

But I have no idea how to get rid of the line on top of the voltage source. Is there a simple way to do it?

Here's my current code:

\documentclass[a4paper]{report}
\usepackage{circuitikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{circuitikz}
\draw [help lines] (0,0) grid (15,20);
\draw (2,18) to [sV] (2,16); %voltage source
\draw [ultra thick] (1,16) node[anchor=south]{b1} -- (3,16);
\draw (1.5,16) -- (1.5,13);
\draw [ultra thick] (1,13) node[anchor=south]{b3} -- (3,13);
\draw(2.5,13) |- +(0,0.5) -- +(4,0.5) |- +(4,0);
\draw [ultra thick] (6,13) node[anchor=south]{b4} -- +(2,0);
\draw (7.5,13) -- (7.5,16);
\draw [ultra thick] (6,16) node[anchor=south]{b2} -- +(2,0);
\draw(6.5,16) |- +(0,-0.5) -- +(-4,-0.5) |- +(-4,-0);
\draw (2,16) -- +(0,-0.5) node[fill=white,shape=regular polygon, rotate=180, regular polygon sides=3,minimum size=0.8,draw]{};
\draw (2,13) -- +(0,-0.5) node[fill=white,shape=regular polygon, rotate=180, regular polygon sides=3,minimum size=0.8,draw]{};
\draw (7,16) -- +(0,-0.5) node[fill=white,shape=regular polygon, rotate=180, regular polygon sides=3,minimum size=0.8,draw]{};
\draw (7,13) -- +(0,-0.5) node[fill=white,shape=regular polygon, rotate=180, regular polygon sides=3,minimum size=0.8,draw]{};

\draw (2.3,17.4)--(3,18) [anchor= west] node{\emph{Fixed voltage}};
\end{circuitikz}
\end{document}

• Voltage source is a bipole component. It will have two connections generally. Are you sure that you want only one connection? – user11232 Dec 16 '12 at 23:11
• yep. That's definitely the way I'd draw it for most cases, but for a HV distribution network, I'm simply using it to represent a fixed voltage. A quick google image search indicates that either practice is acceptable. – Fabian Tamp Dec 16 '12 at 23:19

Draw the voltage source for a length that is equal to the diameter of the circle! And connect it separately.

\documentclass[a4paper]{report}
\usepackage{circuitikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{circuitikz}
%\draw [help lines] (0,0) grid (15,20);
\draw (2,17.85) to [sV] (2,17); %voltage source
\draw (2,17) -- (2,16); %% Connecting the voltage source.
\draw [ultra thick] (1,16) node[anchor=south]{b1} -- (3,16);
\draw (1.5,16) -- (1.5,13);
\draw [ultra thick] (1,13) node[anchor=south]{b3} -- (3,13);
\draw(2.5,13) |- +(0,0.5) -- +(4,0.5) |- +(4,0);
\draw [ultra thick] (6,13) node[anchor=south]{b4} -- +(2,0);
\draw (7.5,13) -- (7.5,16);
\draw [ultra thick] (6,16) node[anchor=south]{b2} -- +(2,0);
\draw(6.5,16) |- +(0,-0.5) -- +(-4,-0.5) |- +(-4,-0);
\draw (2,16) -- +(0,-0.5) node[fill=white,shape=regular polygon, rotate=180, regular polygon sides=3,minimum size=0.8,draw]{};
\draw (2,13) -- +(0,-0.5) node[fill=white,shape=regular polygon, rotate=180, regular polygon sides=3,minimum size=0.8,draw]{};
\draw (7,16) -- +(0,-0.5) node[fill=white,shape=regular polygon, rotate=180, regular polygon sides=3,minimum size=0.8,draw]{};
\draw (7,13) -- +(0,-0.5) node[fill=white,shape=regular polygon, rotate=180, regular polygon sides=3,minimum size=0.8,draw]{};

\draw (2.3,17.4)--(3,18) [anchor= west] node{\emph{Fixed voltage}};
\end{circuitikz}
\end{document}


• Hmmm... I was having trouble with that approach before, but the problem was that I was using \draw (2,17.1) to [sV] (2,17);, which was too short a distance. Thanks! – Fabian Tamp Dec 16 '12 at 23:35

Another solution, less hacky :)

Every bipole has an underlying node shape, whose name is something like xxxshape. Most are easy to infer (resistorshape, for instance), but the rest must be looked up in pgfcircbipoles.sty. In this case, it is vsourcesinshape.

If you update to the new version of the package (I just posted it a few days ago), you can also use the new ground, sground.

\begin{circuitikz}
\draw (2,17) node[vsourcesinshape, rotate=90] (V1) {}
(V1.left) -- (2,15.5) node[sground]{};
\draw [ultra thick] (1,16) node[anchor=south]{b1} -- (3,16);
\draw (1.5,16) -- (1.5,13);
\draw [ultra thick] (1,13) node[anchor=south]{b3} -- (3,13);
\draw(2.5,13) |- +(0,0.5) -- +(4,0.5) |- +(4,0);
\draw [ultra thick] (6,13) node[anchor=south]{b4} -- +(2,0);
\draw (7.5,13) -- (7.5,16);
\draw [ultra thick] (6,16) node[anchor=south]{b2} -- +(2,0);
\draw(6.5,16) |- +(0,-0.5) -- +(-4,-0.5) |- +(-4,-0);
\draw (0,-0.5) ;
\draw (2,13) -- +(0,-0.5) node[sground]{};
\draw (7,16) -- +(0,-0.5) node[sground]{};
\draw (7,13) -- +(0,-0.5) node[sground]{};

\draw (2.3,17.4)--(3,18) [anchor= west] node{\emph{Fixed voltage}};

\end{circuitikz}


A simple solution would be to simply add this to your code



\draw [white,thick](2,17.997)--(2,17.434)       ;   % covers unwanted line
\draw[gray,very thin](2,17.997)--(2,17.434)     ;   % matches with background