如何改变电感器原理图中的弧数?

如何改变电感器原理图中的弧数?

由于捷克标准 (ČSN) 不接受 IEC 标准,因此我必须绘制一个只有 3 个圆弧的电感器。 有解决方案吗CircuiTikZ? 我已经看到一些LaTeX使用排版的论文CircuiTikZ,因此我相信有办法解决这个问题。

谢谢你的帮助。

答案1

好消息是,你可以使用 American Inductor 和 Cute Inductor 指定线圈数量。坏消息是 American Inductor 代码中存在错误。

\documentclass{standalone}
\usepackage{circuitikz}

\ctikzset{bipoles/cuteinductor/coils=3}
\ctikzset{bipoles/americaninductor/coils=3}
\ctikzset{bipoles/vcuteinductor/coils=3}% variable
\ctikzset{bipoles/vamericaninductor/coils=3}

\begin{document}
\begin{circuitikz}
\draw (0,0) to[cute inductor] (2,0)
      (0,1) to[american inductor] (2,1)
      (0,2) to[variable cute inductor] (2,2)
      (0,3) to[variable american inductor] (2,3);
\end{circuitikz}
\end{document}

演示


以下是针对美国电感器的错误修复:

\makeatletter
%% american inductor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/americaninductor/height 2}}{americaninductor}{\ctikzvalof{bipoles/americaninductor/height}}{\ctikzvalof{bipoles/americaninductor/width}}{
    \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen
    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} 
    \pgftransformationadjustments
    \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
    \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
    \divide \pgf@circ@res@step by 2
    \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
  \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
    {\pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}}
    \pgfsetbuttcap
    \pgfsetbeveljoin
    \pgfusepath{stroke}
}
\makeatother

相关内容