Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

enter image description here

share|improve this question
    
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

2 Answers 2

up vote 4 down vote accepted

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

An example with a battery

\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}
share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.