[Tex/LaTex] CircuiTikZ — create new component

circuitikz

How can I create a new component and include it in CircuiTikZ? For example a 4 bit adder?

Best Answer

There is an easy way. Use an existing component as a base, such as to[generic,color=white,n=myname] and draw anything you want in the space.

\newcommand{\speaker}[2] % #1 = name from to[generic,n=#1], #2 = rotation angle
{\draw[thick,rotate=#2] (#1) +(.2,.25) -- +(.7,.75) -- +(.7,-.75) -- +(.2,-.25);}
\begin{circuitikz}
\draw (0,2) to[C, l_=$C$, o-*] (2,2) to[short, -*] (3.5,2) to[short] (5,2);
\draw (0,0) to[short, o-*] (2,0) to[short, -*] (3.5,0) to[short] (5,0);
\draw (2,2) to[L=$L$] (2,0);
\draw (3.5,2) to[R=$R$] (3.5,0);
\draw (5,2) to[generic, n=S1](5,0);
\speaker{S1}{0}
\end{circuitikz}

enter image description here

I have improved on my technique since then, as explained in the following tutorials.

http://www.elfsoft2000.com/projects/speaker.pdf

http://www.elfsoft2000.com/projects/multipole.pdf

http://www.elfsoft2000.com/projects/bipole.pdf