![有没有办法改变 circuitikz 中雨刮器的位置(默认是中间)?](https://linux22.com/image/458140/%E6%9C%89%E6%B2%A1%E6%9C%89%E5%8A%9E%E6%B3%95%E6%94%B9%E5%8F%98%20circuitikz%20%E4%B8%AD%E9%9B%A8%E5%88%AE%E5%99%A8%E7%9A%84%E4%BD%8D%E7%BD%AE%EF%BC%88%E9%BB%98%E8%AE%A4%E6%98%AF%E4%B8%AD%E9%97%B4%EF%BC%89%EF%BC%9F.png)
这是代码。默认值始终位于中间。
\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}
\usepackage[siunitx]{circuitikz} % circuit package and include electrical units in our labels
\begin{document}
\begin{center}
\begin{circuitikz} [american voltages, longpot/.style = {pR, resistors/scale=0.75,
resistors/width=1.6, resistors/zigs=6}] \draw
(5,0) to
(5,3) to [V, v<=10<\volt>, a = $V_{source}$] (-1,3) --
(-1,0) -- (1,0) to [longpot, a^ = \SI{10} {k\ohm}, mirror] (3,0) -- (5,0)
(-1,0) --
(-1,-2) to [R, a = \SI{10} {k\ohm}] (2,-2) -- (2,-0.4)
\end{circuitikz}
\end{center}
\end{document}
文件中仅提到了雨刮器的旋转。
答案1
请参阅 Circuitikz 手册第 3.5.1 节。它展示了如何使用雨刮器 pos 键来更改雨刮器的位置。
\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}
\usepackage[siunitx]{circuitikz} % circuit package and include electrical units in our labels
\begin{document}
\begin{center}
\begin{circuitikz} [american voltages, longpot/.style = {pR, resistors/scale=0.75,
resistors/width=1.6, resistors/zigs=6}] \draw
(5,0) to
(5,3) to [V, v<=10<\volt>, a = $V_{source}$] (-1,3) --
(-1,0) -- (1,0) to [longpot, wiper pos=.2, a^ = \SI{10} {k\ohm}, mirror, n=mypot] (3,0) -- (5,0)
(-1,0) --
(-1,-2) to [R, a = \SI{10} {k\ohm}] (1,-2) -| (mypot.wiper);
\end{circuitikz}
\end{center}
\end{document}
答案2
您可以使用resistor
而不是pR
,然后在路径末尾绘制箭头。(我用它Stealth[width=3pt, inset=1pt]
来画箭头。
注意,我还使用 将您的坐标更改为相对坐标,以++(x,y)
指定相对于前一个坐标的位置。这使得调整更容易。靠近末尾的坐标++(2.7,0)
导致从前一个坐标向右移动 2.7 厘米。++(3,0)
应该是您的原始坐标。
\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}
\usepackage[siunitx]{circuitikz} % circuit package and include electrical units in our labels
\begin{document}
\begin{center}
\begin{circuitikz} [american voltages, longpot/.style = {resistor, resistors/scale=0.75, resistors/width=1.6, resistors/zigs=6}]
\draw[-{Stealth[width=3pt, inset=1pt]}] (5,0) to ++(0,3)
to [V, v<=10<\volt>, a = $V_{source}$] ++(-6,0) -- ++(0,-3) -- ++ (2,0)
to [longpot, a^ = \SI{10} {k\ohm}, mirror] ++(2,0) -- ++(2,0)
++(-6,0) -- ++(0,-2) to [R, a = \SI{10} {k\ohm}] ++(2.7,0) -- ++(0,1.8);
\end{circuitikz}
\end{center}
\end{document}