老师们好!请教一个绘制滑动电阻的问题及微调元件位置,要绘制的图片效果如下:
目前绘制的效果如下:
代码如下:
\documentclass{ctexbook}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[european]
\draw(0,0)to[rmeter,t=A](0,2)to[R,l_=$R$](3,2)to[pR,l_=$R'$,n=pr](5,2);
\draw(0,0)to[normal open switch](6,0)|-(pr.wiper);
\end{circuitikz}
\end{document}不知道去除多余的线,不知道怎么调元件的位置。
好像调对了,但不知原理。
\documentclass{ctexbook}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[european]
\draw(0,0)to[rmeter,t=A](0,2)to[R,l_=$R$](3,2)to[pR,l_=$R'$,n=pr](4.1,2);
\draw(0,0)to[normal open switch](6,0)|-(pr.wiper);
\end{circuitikz}
\end{document}本着学习的心态,我咨询了 TSE 上circuitikz的大神 @cis
这里的目标是要实现「单端的」电位器元件Potentiometer,可以只使用其genericpotentiometershape 这一底层的 PGF 节点形状:

其他内容手动使用tikz的路径实现即可:
% https://ask.latexstudio.net/ask/question/17966.html
% https://tex.stackexchange.com/a/757977/322482
\documentclass[margin=5pt, multi=circuitikz]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[
european,line width=1pt,line cap=round,
circuitikz/bipoles/thickness=1,% default = 2
% https://tex.stackexchange.com/a/758070/322482
% circuitikz/resistors/width=0.7,% default 0.8 ---> R and pR
circuitikz/bipoles/generic potentiometer/height 2=0.2,% default 0.3 --> only pR
% circuitikz/bipoles/generic/width=0.7,% default 0.8 --> only R
circuitikz/bipoles/generic/height=0.2,% default 0.3 --> only R
]
% R and Potentiometer
\draw (0,0)
to [rmeter, t=A, -*] (0,2) coordinate(A)
to [R, l_=R, name=r] (3,2) -- (4,2)
node[
genericpotentiometershape, %<-
anchor=west, label=below:R${}^\prime$,
] (pr) {};
% Battery and Potentiometer tap
\draw (0,0)
to[battery1] (3,0)
to[normal open switch, l_=S, n=S] (6,0)
|-(pr.wiper);
% Voltmeter
\coordinate (M) at ($(r)!.5!(pr)$);
\draw
(A) -- ++(0,1) coordinate(B)
to[rmeter, t=V] (B -| M)
-- (M) node[circ] {}; % node style circ <=> `-*'
\end{circuitikz}
\end{document}
谢谢老师!调坐标是可以的,就比较麻烦。当坐标调大一点,滑动电阻两侧的线就长点,反之太小,两侧的线会显示在内侧,到一定距离,就刚好两侧的线不显示。
@u125794 @u7648
这里的
4.1实际上也并不准确,可见这里的计算过程。