我尝试模仿教科书的比例风格(美式风格),所以我修改了双极子的长度,像这样
\ctikzset{bipoles/length=.8cm}
一切都很顺利,除了美国电压源上的+和-符号,它们混合在一起,就像这样
\documentclass{standalone}
\usepackage[americanvoltages,americancurrents,
americanresistors,americaninductors,
europeanports,siunitx]{circuitikz}
\begin{document}
\ctikzset{bipoles/length=.8cm}
\begin{circuitikz}
\draw (0,0) to[V,invert,v<=$\dot{U_S}$] (0,2.5)
to[L=$\mr{j}\omega L$] (2,2.5)
to[short,i=$\dot{I}_C$] (4,2.5)
to[C=$1/\mr{j}\omega C$] (4,0) to (0,0);
\draw (2,2.5) to[R=$R$,*-*] (2,0);
\end{circuitikz}
\end{document}
答案1
更改组件相对大小的支持方式是使用类键resistors/scale
等capacitors/scale
。一旦您获得了正确的相对比例,使用全局变量scale=xxx, transform shape
将为您提供所需的大小。
该V
符号(确实vsourceam
)具有使用当前字体绘制的+
和-
符号,并且不可调整。看:
\documentclass[border=6mm]{standalone}
\usepackage[siunitx, american, RPvoltages]{circuitikz}
\ctikzset{resistors/scale=0.7}
\ctikzset{capacitors/scale=0.7}
\ctikzset{sources/scale=0.9}
\begin{document}
\begin{circuitikz}
\draw (0,0) to[V, l_=$\hat{U}(s)$] ++(0,3) to[R=\SI{5}{\ohm}] ++(3,0)
to[C=$1/j\omega C$] ++(0,-3) to[short, -*] (0,0)
node[ground]{};
\tiny
\draw (5,0) to[V, l_=$\hat{U}(s)$] ++(0,3) to[R=\SI{5}{\ohm}] ++(3,0)
to[C=$1/j\omega C$] ++(0,-3) to[short, -*] (0,0)
node[ground]{};
\end{circuitikz}
\end{document}
给出:
如果您希望能够更改字体,则必须为组件添加可配置性(嘿,我想我会将其添加到下一个版本中):
\documentclass[border=6mm]{standalone}
\usepackage[siunitx, american, RPvoltages]{circuitikz}
\makeatletter
%% Redefine vsourceam to have + and - customizable
\ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
\ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
%% Independent voltage source - American style
\pgfcircdeclarebipolescaled{sources}
{}
{\ctikzvalof{bipoles/vsourceam/height}}
{vsourceAM}
{\ctikzvalof{bipoles/vsourceam/height}}
{\ctikzvalof{bipoles/vsourceam/width}}
{
\pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
\pgf@circ@draworfill
\pgfsetcolor{\ctikzvalof{color}}
\ifpgf@circ@oldvoltagedirection
\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
\else
\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
\fi
}
\makeatother
\ctikzset{resistors/scale=0.7}
\ctikzset{capacitors/scale=0.7}
\ctikzset{sources/scale=0.9}
\begin{document}
\begin{circuitikz}
\draw (0,0) to[V, l_=$\hat{U}(s)$] ++(0,3) to[R=\SI{5}{\ohm}] ++(3,0)
to[C=$1/j\omega C$] ++(0,-3) to[short, -*] (0,0)
node[ground]{};
\ctikzset{bipoles/vsourceam/inner plus={\tiny $+$}}
\ctikzset{bipoles/vsourceam/inner minus={\tiny $-$}}
\draw (5,0) to[V, l_=$\hat{U}(s)$] ++(0,3) to[R=\SI{5}{\ohm}] ++(3,0)
to[V, invert, bipoles/vsourceam/inner plus={\color{red}\tiny $\oplus$},
bipoles/vsourceam/inner minus={}] ++(0,-3)
to[short, -*] (0,0)
node[ground]{};
\end{circuitikz}
\end{document}
答案2
部分答案:以下内容应该工作(或者至少有一些效果),但事实并非如此。
\documentclass{standalone}
\usepackage{circuitikz}
\begin{document}
\ctikzset{bipoles/length=.8cm}
\ctikzset{voltage/american font=\tiny}
\ctikzset{voltage/american plus=X}
\ctikzset{voltage/american minus=O}
\begin{circuitikz}
\draw (0,0) to[american voltage source,l=$U_z$] (0,2);
\node[below] at (current bounding box.south) {\csname pgf@circ@avplus\endcsname};
\end{circuitikz}
\end{document}