我试图将 circuitikz 中(欧洲)电阻器的标签放置在电阻器内部, 但它会自动将它们放置在盒子旁边,我得到了以下信息:
\documentclass[12pt,a4paper]{article}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[scale = 0.5,european]
% start points
\coordinate[label=above:B] (B) at (0,0);
\coordinate[label=above:A] (A) at (0,5);
\foreach \i in {A,B} {
\fill (\i) circle (2pt);
}
\draw (B) to (4,0) to (4,-1) to[R, label={$2R$}] (8,-1) to (8,0);
\draw (4,0) to (4,1) to[R, label={$2R$}] (8,1) to (8,0) to (12,0) to[R, l_={$R$}] (12,5) to[] (11,5);
\draw (A) to[] (1,5) to (1,3) to[R, label={$2R$}] (11,3) to[] (11,5);
\draw (1,5) to[R, label={$R$}] (6,5) to[R, label={$R$}] (11,5);
\end{circuitikz}
\end{document}
答案1
嗯,这实际上不受支持。大多数组件都会出错,并且的想法circuitikz
是您可以从切换european
到american
并且仍然有一个有效的电路......
但你可以诱使它工作:
\documentclass[12pt,a4paper]{article}
\usepackage[RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[scale = 0.5,european]
% start points
\coordinate[label=above:B] (B) at (0,0);
\coordinate[label=above:A] (A) at (0,5);
\foreach \i in {A,B} {
\fill (\i) circle (2pt);
}
% name the node, and...
\draw (B) to (4,0) to (4,-1) to[R, name=R1] (8,-1) to (8,0);
% add the thing
\node at (R1.center) {$R$};
\draw (4,0) to (4,1) to[R, label={$2R$}] (8,1) to (8,0) to (12,0) to[R, l_={$R$}] (12,5) to[] (11,5);
\draw (A) to[] (1,5) to (1,3) to[R, label={$2R$}] (11,3) to[] (11,5);
\draw (1,5) to[R, label={$R$}] (6,5) to[R, label={$R$}] (11,5);
\end{circuitikz}
\end{document}
您还可以使用一致的命名方案来自动化它们:
\documentclass[12pt,a4paper]{article}
\usepackage[RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[scale = 0.5,european]
% start points
\coordinate[label=above:B] (B) at (0,0);
\coordinate[label=above:A] (A) at (0,5);
\foreach \i in {A,B} {
\fill (\i) circle (2pt);
}
% name the nodes Rx for R and 2Rx for 2R, and...
\draw (B) to (4,0) to (4,-1) to[R, name=R1] (8,-1) to (8,0);
\draw (4,0) to (4,1) to[R, name=2R1] (8,1) to (8,0) to (12,0) to[R, name=R2] (12,5) to[] (11,5);
\draw (A) to[] (1,5) to (1,3) to[R, name=2R2] (11,3) to[] (11,5);
\draw (1,5) to[R, name=R3] (6,5) to[R, name=R4] (11,5);
% add labels
\foreach \n in {1,...,4} \node at (R\n.center) {$R$};
\foreach \n in {1,2} \node at (2R\n.center) {$2R$};
\end{circuitikz}
\end{document}