\documentclass[border=10pt]{standalone}
\usepackage[american]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0)
node[transformer] (T) {};
\draw (T.B1)
to [D] (3,0)
to [R] (3,-2.1)
to [short] (T.B2);
\draw (3,0)
to [vR] (6,0)
to [R] (6,-2.1)
to [short] (3,-2.1);
\end{circuitikz}
\end{document}
\documentclass[border=10pt]{standalone}
\usepackage[american]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0)
node[transformer] (T) {};
\draw (T.B1)
to [D] (3,0)
to [R] (3,-2)
to [short] (T.B2);
\draw (3,0)
to [vR] (6,0)
to [R] (6,-2)
to [short] (3,-2);
\end{circuitikz}
\end{document}
如您所见,使用第二个代码生成的电路看起来不太好,但对于第一个代码,我必须使用混乱的坐标(2.1 等)。有没有办法纠正这种行为,以便锚点位于正确的整数坐标上?
答案1
作为保罗·盖斯勒提及他的评论,您可以使用某些因子缩放变压器,或者,在我看来,更好的方法是使用垂直坐标系:(<coordinatea>|-<coordinateb>)
或者(<coordinateb>-|<coordinatea>)
调整坐标的垂直/水平位置:
\documentclass[border=10pt]{standalone}
\usepackage[american]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0)
node[transformer] (T) {};
\draw (T.B1)
to [D] ++(2,0)
to [R] (3,-2|-T.B2)
to [short] (T.B2);
\draw (3,0)
to [vR] (6,0)
to [R] (6,-2|-T.B2)
to [short] (3,-2|-T.B2);
\end{circuitikz}
\end{document}