[Tex/LaTex] step-up and/or step-down transformer symbol for circuitikz

circuitikztikz-pgf

I want to incorporate a more intuitive symbol for step up/down transformer in some of my drawings, such as the following:
enter image description here

or "cute inductor" version:

enter image description here

I tried to do what this link suggested; to copy the type of code used to define an "inductor" in pgfcircbipoles.tex ie, define a "long_inductor" to use in code like, but it isn't clear to me how to fit it all together:

\begin{circuitikz}
\draw (1,5) to[short, o-] (2, 5)
to [long_inductor, l = Primary] (2, 0)
to [short, -o](1,0);
\draw (2.3,5) -- (2.3,0);
\draw (2.4,5) -- (2.4,0);
\draw (4,4) to[short, o-] (3,4)
to [inductor,l = Secondary] (3,1)
to [short, -o](4,1);
\end{circuitikz}

I've seen examples using pstricks, but I only just started learning tikz and circuitikz so at this point I'm more interested in discovering how to use these tools… including, defining my own shapes for use.

Best Answer

The number of coils can be configured, also within a picture:

\begin{circuitikz}[]
\begin{scope}
   \ctikzset{bipoles/cuteinductor/width/.initial=1.2}%default 0.6
   \ctikzset{bipoles/cuteinductor/coils/.initial=10}%default 5
   \draw (0, 0)  to [short, o-] +(1, 0)
      to [cute inductor]  +(0, 3)
      to [short, -o] +(-1, 0);
\end{scope}
%% vertical bare fore the core.  The middle is in y=1.5
\draw[thick] (1.4, 0.5) -- (1.4, 2.5);
\draw[thick] (1.6, 0.5) -- (1.6, 2.5);
%% Secondary
\draw(3, 0)  to [short, o-] +(-1, 0)
  to [cute inductor]  +(0, 3) 
  to [short, -o] +(1, 0);
%%American inductor version(only working using the most recent gitversion!)
\begin{scope}[xshift=4cm]
\begin{scope}
   \ctikzset{bipoles/americaninductor/width/.initial=1.6}%default 0.8
   \ctikzset{bipoles/americaninductor/coils/.initial=8}%default 4
   \draw(0, 0)  to [short, o-] +(1, 0)
    to [inductor]  +(0, 3)
    to [short, -o] +(-1, 0);
\end{scope}
 %% vertical bare fore the core.  The middle is in y=1.5
 \draw[thick] (1.4, 0.5) -- (1.4, 2.5);
 \draw[thick] (1.6, 0.5) -- (1.6, 2.5);
%%Secondary    
\draw (3, 0)  to [short, o-] +(-1, 0)
 to [inductor]  +(0, 3)
 to [short, -o] +(1, 0);
 \end{scope}
\end{circuitikz}

enter image description here While testing this, i found a bug, therefore, the code for the american inductor(not the cute/curly one)) is only working using the most recent git version or adjusting the code following this commit: https://github.com/circuitikz/circuitikz/commit/1dc2ee4cef798bcd8f9a5fabbaf83f66afeaf0f2

Best regards, Stefan

Related Question