
전압 소스인 Circuitikz의 특정 요소에 문제가 있습니다.
이 요소를 회로에 수평으로 배치하면 (-) 및 (+) 기호도 회전하지만 이러한 동작은 올바르지 않습니다. 전압원의 회전으로 인해 (-) 기호가 끔찍한 ( | )로 변합니다. . 모든 회전 각도에서 경사 전압 소스를 얻는 경우에도 마찬가지입니다. 예를 들어 45° 회전하면 전압 소스의 (+) 기호가 (×)처럼 보입니다.
내가 알고 싶은 것은 전압 소스의 NON-ROTATED 극성 기호, 즉 전압 소스 회전과 무관하게 얻을 수 있습니까?
책과 마찬가지로 극성 기호의 위치를 변경하지 않고도 어떤 각도로든 회전된 미국 전압원을 완벽하게 표현합니다. (유럽식을 쓸 수도 있겠지만, 이 사람들은 익숙하지 않아서 헷갈릴 수도 있어요).
미리 감사드립니다. ☺
답변1
\documentclass{article}
\usepackage{circuitikz}
%% Independent voltage source - American style
\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourceam/height}}{vsourceAM}{\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
\pgfusepath{draw}
\pgfscope
\pgftransformxshift{\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@left}
\pgftext[rotate=-\pgf@circ@direction]{$-$}
\pgfusepath{draw}
\endpgfscope
\pgfscope
\pgftransformxshift{\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@right}
\pgftext[rotate=-\pgf@circ@direction]{$+$}
\pgfusepath{draw}
\endpgfscope
}
\makeatother
\begin{document}
\begin{circuitikz}[american voltages]
\ctikzset{bipoles/vsourceam/margin=.5}% default too big
\draw (0,0) to[V={v1}] (3,0) to[V={v2}] (3,3) to[V={v3}] (0,3) to[V={v4}] (0,0);
\draw (4,0) to[V={v5}] (6,2);
\end{circuitikz}
\end{document}
제어된 전압 소스의 경우 다음을 사용할 수 있습니다.
%% Controlled voltage source - American
\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cvsourceam/height}}{cvsourceAM}{\ctikzvalof{bipoles/cvsourceam/height}}{\ctikzvalof{bipoles/cvsourceam/width}}{
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
%\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$}
%\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$}
\pgfusepath{draw}
\pgfscope
\pgftransformxshift{\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@left}
\pgftext[rotate=-\pgf@circ@direction]{$-$}
\pgfusepath{draw}
\endpgfscope
\pgfscope
\pgftransformxshift{\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@right}
\pgftext[rotate=-\pgf@circ@direction]{$+$}
\pgfusepath{draw}
\endpgfscope
}
\makeatother