答案1
\documentclass[margin=2mm,tikz]{standalone}
\usepackage[american]{circuitikz}
\usetikzlibrary{backgrounds,calc,positioning}
\begin{document}
\begin{tikzpicture}\fill[cyan!30](-0.5,-0.5)rectangle(9.5,6);
%\draw[help lines,xstep=1,ystep=1] (0,0) grid (10,10);
%\foreach \x in {0,1,...,9} { \node [anchor=north] at (\x,0) {0\x}; }
%\foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y) {0\y}; }
% \begin{circuitikz}
\draw (9,5) to[nos,*-*,n=S1] (9,0)
node[circ] at (S1.e) {}
node[circ] at (S1.w) {};
\draw (6,0) to[battery1, color=blue!70!green!50, l=$5V$] (9,0);
\draw(6,0)--(0,0) -- (0,2.5) to[lamp,fill=yellow, l=$1W$] (4.5,2.5)to[lamp, fill=yellow,l=$1W$] (6,2.5) --(6,0);
\draw (9,5)to[lamp,fill=yellow, l_=$1$W](4,5)-|(3.75,2.5);
%\end{circuitikz}
\end{tikzpicture}
\end{document}
答案2
使用siunitx
选项(用于正确表示单位),在两个循环中绘制如下circuitikz
图所示(无方案背景填充):
\documentclass[margin=3mm]{standalone}
\usepackage[siunitx]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) -- ++ (0,2)
to[lamp,l=1<\ohm>,fill=yellow] ++ (2,0) coordinate (aux1)
to[lamp,l=1<\ohm>,fill=yellow] ++ (2,0)
-- ++ (0,-2) coordinate (aux2)
-- (0,0)
(aux1) -- ++ (0,2)
to[lamp,l=1<\ohm>,fill=yellow] ++ (2,0)
-- ++ (2,0) coordinate (aux3)
to[nos,l=K] (aux3 |- aux2)
to[battery2, a=5<V>, color=cyan, invert] (aux2)
;
\end{circuitikz}
\end{document}
编辑: 如果您希望方案背景有颜色,则需要在上述 NWE(最小工作示例)的序言中添加“˛”
\usetikzlibrary{backgrounds}
并在计划结束之前
\scoped[on background layer]
\fill[olive!20, rounded corners=3mm]
([shift={(-3mm,-3mm)}] \cbb.south west) rectangle ([shift={(3mm,3mm)}] \cbb.north east);
使用这些附加功能,方案如下所示: