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.– cjorssenNov 4, 2011 at 13:08
-
Which "tikz circuits library"? How to use it? Could you give an example please?– studentNov 4, 2011 at 13:16
-
See the pgfmanual mirror.ctan.org/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf p.311– cjorssenNov 4, 2011 at 13:35
-
@cjorssen: Thanks, I have found it in the manual. This led me to post another wuestion: tex.stackexchange.com/questions/33660/…– studentNov 4, 2011 at 15:04
-
5Related: tex.stackexchange.com/questions/165177/…– Steven B. SegletesFeb 11, 2015 at 12:43
4 Answers
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}
-
3Welcome to TeX.SX! Perhaps you could turn this into a complete minimal working example (MWE)? Feb 10, 2015 at 3:43
-
1Thank 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! Feb 11, 2015 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}