# Battery symbol in circuitikz

Is it possible to make circuitikz draw battery-symbols like this:

-
I know nothing about circutikz, but you can have a look at the battery symbol in the tikz circuits library. –  cjorssen Nov 4 '11 at 13:08
Which "tikz circuits library"? How to use it? Could you give an example please? –  student Nov 4 '11 at 13:16
See the pgfmanual mirror.ctan.org/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf p.311 –  cjorssen Nov 4 '11 at 13:35
@cjorssen: Thanks, I have found it in the manual. This led me to post another wuestion: tex.stackexchange.com/questions/33660/… –  student Nov 4 '11 at 15:04
@cjorssen: You should compose a MWE as answer so this question can be marked as answered. –  Peter Grill Nov 12 '11 at 5:19

Sorry, I cannot provide any circuitikz solution. The following uses the tikz circuits library introduced in pgf 2.1 (and 2.0-cvs).

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}

\begin{document}

\begin{tikzpicture}[circuit ee IEC]
\draw (0,0) to [battery={info={$e_1$}}] ++(2,0) to
[current direction' = {info = {$i$}, near start},
resistor = {info = {$R$}, near end}] ++(0,3) to
[bulb] ++(-2,0) to[current direction' = {info = {$i$}}] (0,0);
\end{tikzpicture}

\end{document}

-

I did it in such way:

\makeatletter
\ctikzset{bipoles/battery/width/.initial=.1}
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/battery/height}}{battery}{\ctikzvalof{bipoles/battery/height}}{\ctikzvalof{bipoles/battery/width}}{
\pgf@circ@res@step = -\ctikzvalof{bipoles/battery/width}
\pgf@circ@Rlen \divide \pgf@circ@res@step by 2

\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}

\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}

\pgfusepath{draw}
}
\makeatother

-

Use battery1:

\documentclass{standalone}
\usepackage{circuitikz}
\begin{document}

\tikz{
\draw (0,0) to [battery1] (1,0);
}

\end{document}


-
Welcome to TeX.SX! Perhaps you could turn this into a complete minimal working example (MWE)? –  Adam Liter Feb 10 at 3:43
Thank you for completing the MWE! Can you upload an image to the StackExchange servers, instead of using the PDF from dropbox? As you can see, the PDF is not able to be displayed as an image. If you need some help on getting an image, you can see this post: meta.tex.stackexchange.com/questions/5954/… You may also want to email the StackExchange staff via the "Contact Us" link to have your accounts here combined. Welcome to TeX.SX! –  darthbith Feb 11 at 12:42