# Battery symbol in circuitikz [duplicate]

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

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}


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 '15 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 '15 at 12:42

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


# Source

Complementing what @RichardHDowney answered. The circuitikz manual contains all the information about the circuit elements that can be used with circuitikz, in section 3.2.4 Stationary sources of this manual two batteries will appear battery and battery1.

# MWE with battery

\documentclass{minimal}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to [battery] (1,0);
\end{circuitikz}
\end{document}


# MWE with battery1

\documentclass{minimal}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to [battery1] (1,0);
\end{circuitikz}
\end{document}