答案1
像这样 ?
编辑电阻器代码以制作此自定义元素customW
。
\documentclass[border=3mm]{standalone}
\usepackage{circuitikz}
\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/resistor/height}}{customW}{\ctikzvalof{bipoles/resistor/height}}{\ctikzvalof{bipoles/resistor/width}}{
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgftransformationadjustments
\pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
\divide \pgf@circ@res@step by 8
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
\pgf@circ@res@other = \pgf@circ@res@left
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
\advance\pgf@circ@res@other by 2\pgf@circ@res@step
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
\advance\pgf@circ@res@other by 2\pgf@circ@res@step
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
\advance\pgf@circ@res@other by 2\pgf@circ@res@step
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
\advance\pgf@circ@res@other by 2 \pgf@circ@res@step
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
\pgfsetbeveljoin
\pgfusepath{draw}
}
\def\pgf@circ@customW@path#1{\pgf@circ@bipole@path{customW}{#1}}
\compattikzset{customW/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@customW@path, label=#1}}
\makeatother
\begin{document}
\begin{circuitikz}
\draw (3.5,0) to[customW] ++(3,0);
\end{circuitikz}
\end{document}