是否可以circuitikz
像这样绘制电池符号:
答案1
抱歉,我无法提供任何 circuitikz 解决方案。以下内容使用 pgf 2.1(和 2.0-cvs)中引入的 tikz 电路库。
\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}
答案2
使用battery1
:
\documentclass{standalone}
\usepackage{circuitikz}
\begin{document}
\tikz{
\draw (0,0) to [battery1] (1,0);
}
\end{document}
答案3
我是这样做的:
\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
答案4
来源
补充@RichardHDowney 的回答。circuitikz 手册包含有关可与 circuitikz 一起使用的电路元件的所有信息,位于第节3.2.4 固定源本手册的下方会出现两节电池battery
。battery1
MWE 与battery
\documentclass{minimal}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to [battery] (1,0);
\end{circuitikz}
\end{document}
MWE 与battery1
\documentclass{minimal}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to [battery1] (1,0);
\end{circuitikz}
\end{document}