texlive[55620] Master/texmf-dist: circuitikz (21jun20)
commits+karl at tug.org
commits+karl at tug.org
Sun Jun 21 22:42:17 CEST 2020
Revision: 55620
http://tug.org/svn/texlive?view=revision&revision=55620
Author: karl
Date: 2020-06-21 22:42:13 +0200 (Sun, 21 Jun 2020)
Log Message:
-----------
circuitikz (21jun20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf
trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md
trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
trunk/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty
trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty
Added Paths:
-----------
trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.1.2.tex
trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz-1.1.2.sty
Modified: trunk/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md 2020-06-21 20:42:13 UTC (rev 55620)
@@ -1,6 +1,20 @@
<!--- CircuiTikz - Changelog --->
The major changes among the different circuitikz versions are listed here. See <https://github.com/circuitikz/circuitikz/commits> for a full list of changes.
+* Version 1.2.0 (2020-06-21)
+
+ In this release, the big change is the rewriting of the voltages output routine. Now all voltage options (american, european, and straight) take into account the shape (square border) of the component. The adjusting parameters are now (at least for passive elements) acting in similar way for all the options, too.
+
+ - Bumped version number to 1.2 (potentially incompatible changes!)
+ - Added 1.1.2 checkpoint
+ - New path-style not, buffer, and Schmitt logic ports
+ - New tutorial (using the "inline not" component)
+ - Voltage output routine rewrite; now it takes into account the shape of the component also for "american" and "straight" voltages
+ - Several fixes in the logic ports: fixed IEEE `invschmitt` name, added symmetry to the three-style shorthands for the ports, and so on
+ - Fixed a gross bug in square poles anchor borders
+ - Fixed size of not circles in flip-flops (based on logic ports style)
+ - Fixed the order of initial options, to avoid "european" overwriting single options
+
* Version 1.1.2 (2020-05-17)
- Blocks and component for three-phase networks (3-lines wire, AC/DC and DC/AC converters blocks and grid node block) added by user `@olfline` on GitHub
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -5,6 +5,40 @@
\begin{itemize}
\item
+ Version 1.2.0 (2020-06-21)
+
+ In this release, the big change is the rewriting of the voltages
+ output routine. Now all voltage options (american, european, and
+ straight) take into account the shape (square border) of the
+ component. The adjusting parameters are now (at least for passive
+ elements) acting in similar way for all the options, too.
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Bumped version number to 1.2 (potentially incompatible changes!)
+ \item
+ Added 1.1.2 checkpoint
+ \item
+ New path-style not, buffer, and Schmitt logic ports
+ \item
+ New tutorial (using the ``inline not'' component)
+ \item
+ Voltage output routine rewrite; now it takes into account the shape
+ of the component also for ``american'' and ``straight'' voltages
+ \item
+ Several fixes in the logic ports: fixed IEEE \texttt{invschmitt}
+ name, added symmetry to the three-style shorthands for the ports,
+ and so on
+ \item
+ Fixed a gross bug in square poles anchor borders
+ \item
+ Fixed size of not circles in flip-flops (based on logic ports style)
+ \item
+ Fixed the order of initial options, to avoid ``european''
+ overwriting single options
+ \end{itemize}
+\item
Version 1.1.2 (2020-05-17)
\begin{itemize}
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -280,6 +280,8 @@
Here, we will provide a list of incompabilitys between different version of circuitikz. We will try to hold this list short, but sometimes it is easier to break with old syntax than including a lot of switches and compatibility layers.
You can check the used version at your local installation using the macro \verb!\pgfcircversion{}!.
\begin{itemize}
+ \item After v1.2.0: voltage arrows, symbols and label positions are calculated with a rewritten routine. There should be little change, \emph{unless} you touched internal values\dots
+ \item After v1.1.3: during the 1.1.0 --- 1.1.2 version, the inverted Schmitt buffer in IEEE style ports was called \texttt{inv schmitt} (with an additional space). The correct name is \texttt{invschmitt port} (the same as the legacy american port).
\item After v1.1.2: the position of \texttt{american} voltages for the \texttt{open} bipoles (you can revert to old behavior, see section~\ref{sec:sub-voltage-position}).
\item After v0.9.7: the position of the text of transistor nodes has changed; see section~\ref{sec:transistors-labels}.
\item After v0.9.4: added the concept of styling of circuits. It should be backward compatible, but it's a big change, so be ready to use the \texttt{0.9.3} snapshot (see below for details).
@@ -294,13 +296,13 @@
If you have older projects that show compatibility problems, you have two options:
\begin{itemize}
\item you can use an older version locally using the git-version and picking the correct commit from the repository (branch gh-pages) or the main GitHub site directly;
- \item if you are using \LaTeX, the distribution has embedded several important old versions: \texttt{0.4}, \texttt{0.6}, \texttt{0.7}, \texttt{0.8.3}, \texttt{0.9.3}, \texttt{0.9.6} and \texttt{1.0}.
+ \item if you are using \LaTeX, the distribution has embedded several important old versions: \texttt{0.4}, \texttt{0.6}, \texttt{0.7}, \texttt{0.8.3}, \texttt{0.9.3}, \texttt{0.9.6}, \texttt{1.0} and \texttt{1.1.2}.
To switch to use them, you simply change your \verb|\usepackage| invocation like
\begin{lstlisting}
\usepackage[]{circuitikz-0.8.3} % or circuitikz-0.4, 0.6...
\end{lstlisting}
You have to take care of the options that may have changed between versions;
- \item if you are using \ConTeXt, only versions \texttt{0.8.3}, \texttt{0.9.3}, \texttt{0.9.6} and \texttt{1.0} are packaged for now; if can use it with
+ \item if you are using \ConTeXt, only versions \texttt{0.8.3}, \texttt{0.9.3}, \texttt{0.9.6}, \texttt{1.0} and \texttt{1.1.2} are packaged; if can use it with
\begin{lstlisting}
\usemodule[circuitikz-0.8.3]
\end{lstlisting}
@@ -512,6 +514,7 @@
\end{circuitikz}
\end{LTXexample}
+\clearpage
\subsection{A more complex tutorial: circuits, Romano style.}
\begingroup % do not propagate to the rest of the manual
@@ -745,11 +748,253 @@
\draw [blockdef] (vi2|-VEE) ++(0,-2) \coord(tmp)
-- node[midway, fill=white]{bloque 2} (vo2|- tmp);
\end{circuitikz}
+\endgroup
+\clearpage
+\subsection{Tutorial: a logic circuit}
+
+\begingroup % let's keep the tutorial thing separated.
+\tikzset{sr-ff/.style={flipflop, flipflop def={
+ t1=S, t2=CP, t3=R, t4={\ctikztextnot{Q}},t6=Q, td=~, nd=1}},
+}
+\ctikzset{
+ logic ports=ieee,
+ logic ports/scale=0.7,
+}
+\newcommand*{\myblock}[1]{% the parameter will be prepended to the relevant node names
+ node[sr-ff](#1-FF){} (#1-FF.bup) node[above]{SR-FF}
+ (#1-FF.pin 1) -- ++(-1,0) node[and port, anchor=out](#1-AND1){}
+ % notice the second coordinate here, so that I have just one number
+ % to change if I want more or less space
+ (#1-FF.pin 3) -- (#1-FF.pin 3 -| #1-AND1.out) node[and port, anchor=out](#1-AND2){}
+ % go left again to put the not insert point
+ (#1-AND1.in 1) to[short, -*] ++(-1,0) coordinate(#1-in)
+ % let's position the NOT in the center to be really finicky
+ % this is using the calc tikz library
+ % ($(not up)!0.5!(not up|- #1-AND2.in 2)$) node[not port, rotate=-90](#1-NOT){}
+ % and connect it
+ % (not up) -- (#1-NOT.in) (#1-NOT.out) |- (#1-AND2.in 2)
+ % with the new path-style not
+ to[inline not] (#1-in |- #1-AND2.in 2) -- (#1-AND2.in 2);
+}
+\newcommand*{\fullcirc}[1][]{%
+\begin{circuitikz}
+ \draw (0,0) \myblock{A};
+ \draw (0,-4) \myblock{B};
+ %
+ % do the connection
+ %
+ \draw (A-AND1.in 2) to[short, -*] (A-AND2.in 1)
+ to[short, -*] (B-AND1.in 2) to[short, -*] (B-AND2.in 1)
+ -- ++(0, -2) coordinate(down) node[below]{ENABLE};
+ \draw (A-FF.pin 2) to[short, -*] (B-FF.pin 2)
+ -- (B-FF.pin 2 |- down) node[below]{CP};
+ % look at the manual again here
+ \draw (B-FF.down) to[short, -*] ++(0,-0.3) coordinate(dd);
+ \draw (A-FF.down) -- ++(0,-.5) -- ++(1.5,0) |- (dd)
+ -- (dd |- down) node[below]{RESET};
+ \draw (A-in) -- ++(-0.5, 0) node[below]{$a_0$};
+ \draw (B-in) -- ++(-0.5, 0) node[below]{$a_1$};
+ %
+ #1
+ %
+\end{circuitikz}%
+}
+
+\begin{minipage}{0.45\linewidth}
+\parskip=6pt plus 12pt minus 2pt
+
+Let's suppose we want to reproduce the circuit on the right\footnotemark, maybe as part of a more complex one.
+
+Looking at the circuit to draw, I see that there is a basic block: the flip-flop with the added three-port circuit to its left, marked with the red dashed rectangle.
+The main distance to respect here is that we want the two ANDs in line with the flip-flop inputs, so I'll start with the flip-flop and then add the rest of the block.
+
+The shapes are very similar to the IEEE logic gates (see section~\ref{sec:ieeestdports});
+after a first check, the standard size of the port is a bit too big with respect to the flip-flop, so I scale them down a bit.
+
+\begin{lstlisting}
+\ctikzset{
+ logic ports=ieee,
+ logic ports/scale=0.7,
+}
+\end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.5\linewidth}
+ \fullcirc[{
+ \node[draw, red, dashed, fit=(A-in) (A-FF)]{};
+ }]
+\end{minipage}
+\footnotetext{It seems a quite popular one on \href{https://tex.stackexchange.com/q/545317/38080}{tex.stackexchange}\dots}
+
+I want a reusable block, so I will start from a coordinate and then use only relative, defining coordinates along the way.
+
+\begin{minipage}{0.7\linewidth}
+ The first thing is to define a suitable flip-flop. The standard SR~(see \ref{sec:flipflops}) is \emph{almost} what we need, but not exactly the same. So let's define a new one:
+ \begin{lstlisting}
+\tikzset{sr-ff/.style={flipflop, flipflop def={
+ t1=S, t2=CP, t3=R, t4={\ctikztextnot{Q}},
+ t6=Q, nd=1}},
+}
+ \end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.2\linewidth}
+ \begin{circuitikz}[scale=0.8, transform shape]
+ \tikzset{sr-ff/.style={flipflop, flipflop def={
+ t1=S, t2=CP, t3=R, t4={\ctikztextnot{Q}},
+ t6=Q, nd=1}},
+ }
+ \node[sr-ff]{};
+ \end{circuitikz}
+\end{minipage}
+
+\begin{minipage}{0.7\linewidth}
+
+ If you look closer, you can notice that the new flip-flop has no lead in the bottom pin; this is due to the fact that there is no label here, and leads are drawn in flip-flops only if there is a label. This can be fixed by adding a blank label (like \verb|td=~|); otherwise you have to utilize the anchors on the internal ``not'' circle.
+
+\end{minipage}\hfill
+\begin{minipage}{0.2\linewidth}
+ \begin{circuitikz}[scale=0.8, transform shape]
+ \node[sr-ff]{};
+ \end{circuitikz}
+\end{minipage}
+
+Now we can add the ``and'' gates. For example, we can add the gates to the right like this:
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \draw (0,0) node[sr-ff](FF){} (FF.bup)
+ node[above]{SR-FF};
+ \draw (FF.pin 1) -- ++(-1,0) node[and port,
+ anchor=out](AND1){}
+ (FF.pin 3) -- ++(-1,0) node[and port,
+ anchor=out](AND2){};
+\end{circuitikz}
+\end{LTXexample}
+
+You can notice a pair of things here: first of all, the use of the \texttt{anchor=out} in the port, to tell \TikZ{} that we want the node moved so that the \texttt{out} anchor is the reference one. The second one is that we have repeated the absolute shift (the \texttt{++(-1, 0)}) twice. This is a bad practice; it is much better to have the ``free'' parameters of a schematic just stated once, so that we can change them in just one point.
+
+You can of course use a macro, like \verb|\newcommand{\andshift}{(-1,0)}| but it is much more elegant to do something like this:
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \draw (0,0) node[sr-ff](FF){} (FF.bup)
+ node[above]{SR-FF};
+ \draw (FF.pin 1) -- ++(-1,0) node[and port,
+ anchor=out](AND1){}
+ (FF.pin 3) -- (FF.pin 3 -| AND1.out)
+ node[and port, anchor=out](AND2){};
+\end{circuitikz}
+\end{LTXexample}
+
+In this snippet, the coordinate \texttt{(FF.pin 3 -| AND1.out)} is the \TikZ{} way to say ``the point which is horizontally straight from \texttt{FF.pin 3} and vertically form \texttt{AND1.out}''. That way one can change the number \texttt{-1} to move both AND ports nearer or farther away.
+
+Now we can add the not port. Since version~\texttt{1.1.3} you can use a path-style not port, so you can just say: this:
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[scale=0.8, transform shape]
+\draw (0,0) node[sr-ff](FF){} (FF.bup)
+ node[above]{SR-FF} (FF.pin 1) -- ++(-1,0)
+ node[and port, anchor=out](AND1){}
+ (FF.pin 3) -- (FF.pin 3 -| AND1.out)
+ node[and port, anchor=out](AND2){}
+ (AND1.in 1) to[short, -*] ++(-1,0) coordinate(in)
+ to[inline not] (in |- AND2.in 2) -- (AND2.in 2);
+\end{circuitikz}
+\end{LTXexample}
+
+In earlier version, you should have found the center point between the two terminal, position the ``not'' shape and ten connect it, like for example (this code must stay into the \verb|\draw| command):
+
+\begin{lstlisting}
+ % let's position the NOT in the center
+ % this is using the calc tikz library
+ ($(in)!0.5!(in |- AND2.in 2)$) node[not port, rotate=-90](NOT){}
+ % and connect it
+ (in) -- (NOT.in) (NOT.out) |- (AND2.in 2)
+\end{lstlisting}
+
+Now we have the basic block; we have to use it twice, so one of the possible way to do it is to prepare a command.
+We will change the names of the nodes and the coordinates to be different for any ``call'' of the block (another option is to use a \texttt{pic}; but this is more straightforward).
+
+\begin{lstlisting}
+\newcommand*{\myblock}[1]{% Add #1- to the node and coord names
+ node[sr-ff](#1-FF){} (#1-FF.bup) node[above]{SR-FF}
+ (#1-FF.pin 1) -- ++(-1,0) node[and port, anchor=out](#1-AND1){}
+ (#1-FF.pin 3) -- (#1-FF.pin 3 -| #1-AND1.out)
+ node[and port, anchor=out](#1-AND2){}
+ (#1-AND1.in 1) to[short, -*] ++(-1,0) coordinate(#1-in)
+ to[inline not] (#1-in |- #1-AND2.in 2) -- (#1-AND2.in 2);
+}
+\end{lstlisting}
+
+
+\begin{minipage}{0.45\linewidth}
+\parskip=6pt plus 12pt minus 2pt
+
+So now we can draw two of our blocks:
+\begin{lstlisting}
+ \draw (0,0) \myblock{A};
+ \draw (0,-4) \myblock{B};
+\end{lstlisting}
+Part of the anchors and coordinates that we have accessible are marked in red in the diagram at the side.
+
+Now we have to just connect the relevant parts and add the labels. The names of the inputs are quite easy:
+\begin{lstlisting}
+ \draw (A-in) -- ++(-0.5, 0) node[below]{$a_0$};
+ \draw (B-in) -- ++(-0.5, 0) node[below]{$a_1$};
+\end{lstlisting}
+And finally:
+\end{minipage}\hfill
+\begin{minipage}{0.5\linewidth}
+ \begingroup
+ \def\showcoord(#1)<#2:#3>{%
+ node[circle, red, draw, inner sep=1pt,pin={%
+ [red, inner sep=0.5pt, font=\small,
+ pin distance=#3cm, pin edge={red, }%
+ ]#2:#1}](){}}
+ \begin{circuitikz}[]
+ \draw (0,0) \myblock{A};
+ \draw (0,-4) \myblock{B};
+ \foreach \b in {A, B}
+ \foreach \n in {in, AND1.in 2, AND2.in 1, FF.pin 2, FF.down}
+ \path (\b-\n) \showcoord(\b-\n)<45:0.6>;
+ \end{circuitikz}
+ \endgroup
+\end{minipage}
+
+\begin{lstlisting}
+ \draw (A-AND1.in 2) to[short, -*] (A-AND2.in 1)
+ to[short, -*] (B-AND1.in 2) to[short, -*] (B-AND2.in 1)
+ -- ++(0, -2) coordinate(down) node[below]{ENABLE};
+ \draw (A-FF.pin 2) to[short, -*] (B-FF.pin 2)
+ -- (B-FF.pin 2 |- down) node[below]{CP};
+ \draw (B-FF.down) to[short, -*] ++(0,-0.3) coordinate(dd);
+ \draw (A-FF.down) -- ++(0,-.5) -- ++(1.5,0) |- (dd)
+ -- (dd |- down) node[below]{RESET};
+\end{lstlisting}
+
+Will create the final diagram:
+
+\begin{circuitikz}[scale=0.8, transform shape]
+ \draw (0,0) \myblock{A};
+ \draw (0,-4) \myblock{B};
+ %
+ % do the connection
+ %
+ \draw (A-AND1.in 2) to[short, -*] (A-AND2.in 1)
+ to[short, -*] (B-AND1.in 2) to[short, -*] (B-AND2.in 1)
+ -- ++(0, -2) coordinate(down) node[below]{ENABLE};
+ \draw (A-FF.pin 2) to[short, -*] (B-FF.pin 2)
+ -- (B-FF.pin 2 |- down) node[below]{CP};
+ % look at the manual again here
+ \draw (B-FF.down) to[short, -*] ++(0,-0.3) coordinate(dd);
+ \draw (A-FF.down) -- ++(0,-.5) -- ++(1.5,0) |- (dd)
+ -- (dd |- down) node[below]{RESET};
+ \draw (A-in) -- ++(-0.5, 0) node[below]{$a_0$};
+ \draw (B-in) -- ++(-0.5, 0) node[below]{$a_1$};
+ %
+\end{circuitikz}
\endgroup
-
\section{The components}
@@ -1618,12 +1863,12 @@
\subsubsection{Stationary sources}
\begin{groupdesc}
- \circuitdescbip*[vsource]{european voltage source}{Voltage source (european style)}{}
+ \circuitdescbip*[vsource]{european voltage source}{Voltage source (european style)}{vsource}
\circuitdescbip*[vsourceC]{cute european voltage source}{Voltage source (cute european style)}{vsourceC, ceV}
- \circuitdescbip*[vsourceAM]{american voltage source}{Voltage source (american style)}{}
- \circuitdescbip*[isource]{european current source}{Current source (european style)}{}
+ \circuitdescbip*[vsourceAM]{american voltage source}{Voltage source (american style)}{vsourceAM}
+ \circuitdescbip*[isource]{european current source}{Current source (european style)}{isource}
\circuitdescbip*[isourceC]{cute european current source}{Current source (cute european style)}{isourceC, ceI}
- \circuitdescbip*[isourceAM]{american current source}{Current source (american style)}{}
+ \circuitdescbip*[isourceAM]{american current source}{Current source (american style)}{isourceAM}
\end{groupdesc}
\begin{framed}
@@ -1649,12 +1894,12 @@
\subsubsection{Controlled sources}
\begin{groupdesc}
- \circuitdescbip*[cvsource]{european controlled voltage source}{Controlled voltage source (european style)}{}
+ \circuitdescbip*[cvsource]{european controlled voltage source}{Controlled voltage source (european style)}{cvsource}
\circuitdescbip*[cvsourceC]{cute european controlled voltage source}{Voltage source (cute european style)}{cvsourceC, cceV}
- \circuitdescbip*[cvsourceAM]{american controlled voltage source}{Controlled voltage source (american style)}{}
- \circuitdescbip*[cisource]{european controlled current source}{Controlled current source (european style)}{}
+ \circuitdescbip*[cvsourceAM]{american controlled voltage source}{Controlled voltage source (american style)}{cvsourceAM}
+ \circuitdescbip*[cisource]{european controlled current source}{Controlled current source (european style)}{cisource}
\circuitdescbip*[cisourceC]{cute european controlled current source}{Current source (cute european style)}{cisourceC, cceI}
- \circuitdescbip*[cisourceAM]{american controlled current source}{Controlled current source (american style)}{}
+ \circuitdescbip*[cisourceAM]{american controlled current source}{Controlled current source (american style)}{cisourceAM}
\circuitdescbip*[ecsource]{empty controlled source}{Empty controlled source}{ecsource}
\end{groupdesc}
@@ -3885,7 +4130,7 @@
\circuitdesc*{american not port}{American \textsc{not} port}{}
\end{groupdesc}
-There is no ``european'' version of the following symbols (but you can probably use the \texttt{schmitt symbol} of the IEEE standard ports.
+There is no ``european'' version of the following symbols; for now they are used both in \texttt{american} and \texttt{european} styles, but iy may change in the future.
\begin{groupdesc}
\circuitdesc*{schmitt}{Non-Inverting Schmitt trigger}{}
@@ -3910,7 +4155,7 @@
\circuitdesc*{ieeestd buffer port}{IEEE standard buffer port}{}(in 1/180/0.2, bin 1/-155/0.2, up/30/0.2, down/-30/0.2)
\circuitdesc*{ieeestd not port}{IEEE standard ``not'' port}{}(in/180/0.2, bin/-155/0.2, out/0/0.2, bout/45/0.2)
\circuitdesc*{ieeestd schmitt port}{Schmitt port matched to IEEE standard ports}{}(in/180/0.2, out/0/0.2, bout/45/0.2)
- \circuitdesc*{ieeestd inv schmitt port}{Inverting Schmitt port matched to IEEE standard ports}{}
+ \circuitdesc*{ieeestd invschmitt port}{Inverting Schmitt port matched to IEEE standard ports}{}
\circuitdesc*{notcirc}{Inverting dot for IEEE ports}{}(west/180/0.1, east/0/0.1)
\circuitdesc*{schmitt symbol}{Schmitt symbol to add to input pins if needed}{}(north west/145/0.1, south east/-45/0.1)
\end{groupdesc}
@@ -3928,16 +4173,38 @@
\end{groupdesc}
\begin{framed}
-If (default behaviour) \texttt{americanports} option is active (or the style \texttt{[american ports]} is used), the shorthands \texttt{and port}, \texttt{or port}, \texttt{not port}, \texttt{nand port}, \texttt{not port}, \texttt{xor port}, and \texttt{xnor port} are equivalent to the american version of the respective logic port.
+If (default behaviour) \texttt{americanports} option is active (or the style \texttt{[american ports]} is used), the shorthands \texttt{and port}, \texttt{or port}, \texttt{buffer port}, \texttt{nand port}, \texttt{nor port}, \texttt{not port}, \texttt{xor port}, \texttt{xnor port}, \texttt{schmitt port} and \texttt{invschmitt port} are equivalent to the american version of the respective logic port.
-If otherwise \texttt{europeanports} option is active (or the style \texttt{[european ports]} is used), the shorthands \texttt{and port}, \texttt{or port}, \texttt{not port}, \texttt{nand port}, \texttt{not port}, \texttt{xor port}, and \texttt{xnor port} are equivalent to the european version of the respective logic port.
+If otherwise \texttt{europeanports} option is active (or the style \texttt{[european ports]} is used), the shorthands \texttt{and port}, \texttt{or port}, \texttt{buffer port}, \texttt{nand port}, \texttt{nor port}, \texttt{not port}, \texttt{xor port}, \texttt{xnor port} are equivalent to the european version of the respective logic port; \texttt{schmitt port} and \texttt{invschmitt port} are the same as in \texttt{american ports} style.
Finally, for version \texttt{1.1.0} and up, you can use the style \texttt{ieee ports} to set the shorthands to the set of \texttt{ieeestd} ports. (There is no global option for this).
\end{framed}
+\subsubsection{Path-style logic ports}
-\subsubsection{American port usage}
+The one-input, one-output ports have a handy path-style equivalent; they are the following:
+\begin{groupdesc}
+ \ctikzset{logic ports=ieee}
+ \circuitdescbip*{inline not}<not port>{``not'' logic port}{}
+ \circuitdescbip*{inline buffer}<buffer port>{``buffer'' logic port}{}
+ \circuitdescbip*{inline schmitt}<schmitt port>{Schmitt logic port}{}
+ \circuitdescbip*{inline invschmitt}<invschmitt port>{Inverting Schmitt logic port}{}
+\end{groupdesc}
+
+Those ports follows the current selected style, although you can change it on the fly (even if it has not a lot of sense); you can apply labels, annotations and (again, not a lot of sense) voltages to them. The assigned value is typeset as if it were the main text of the node.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[american]
+ \ctikzset{logic ports=ieee}
+ \draw (0,0) to[inline not=I1, l=label, v=$\Delta V$] ++(2,0);
+ \draw (0,-2) to[inline not, a=ann, european ports] ++(2,0);
+\end{circuitikz}
+\end{LTXexample}
+
+
+\subsubsection{American ports usage}
+
Since version \texttt{1.0.0}, the default shape of the family of american ``or'' ports has changed to a more ``pointy'' one, for better distinguish them from the ``and''-type ports. You can still going back to the previous aspect with the key \texttt{american or shape} that can be set to \texttt{pointy} or \texttt{roundy}. The \texttt{legacy} style will enact the old, roundy style also.
\begin{LTXexample}[varwidth=true]
@@ -4023,7 +4290,7 @@
\end{circuitikz}
\end{LTXexample}
-The flag works also for the european-style ports, and it suppress only the input leads because the negated ports in european style are ill-specified if you do not draw the output leads (and moreover, it seems really less useful).
+In an analogous manner, there is a setting \texttt{logic ports draw output leads} (and a corresponding style \texttt{no output leads}) that suppresses the drawing of the output lead. A shortcut boolean key \texttt{logic ports draw leads} will suppress or enable all leads (the corresponding styles are \texttt{no leads} and \texttt{all leads}).
You can tweak the appearance of american ``or'' family (\texttt{or}, \texttt{nor}, \texttt{xor} and \texttt{xnor}) ports, too, with the parameters \texttt{inner} (how much the base circle go ``into'' the shape, default 0.3) and \texttt{angle} (the angle at which the base starts, default 70).
@@ -4133,9 +4400,21 @@
;\end{circuitikz}
\end{LTXexample}
+This last circuit could be drawn also (and probably in a more natural manner) using the path-style components:
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[american]
+ \draw (0,0) node[ground]{} to[C] ++(0,1.5)
+ coordinate(c)
+ to[inline not] ++(2.5,0) -- ++(0,1)
+ -| ++(-5,-1)
+ to[inline not] (c);
+\end{circuitikz}
+\end{LTXexample}
+
+
\subsubsection{IEEE logic gates usage.}
\begingroup % for IEEE ports
@@ -5593,7 +5872,7 @@
\end{circuitikz}
\end{LTXexample}
-You can fine-tune the position of the \texttt{+} and \texttt{-} symbols and the label in independent way using \texttt{voltage/shift} (default \texttt{0.0} for the former and \texttt{voltage/american label distance} (the distance of the label form the lines of the symbols, default \texttt{1.1}) for the latter.
+You can fine-tune the position of the \texttt{+} and \texttt{-} symbols and the label in independent way using \texttt{voltage/shift} (default \texttt{0.0} for the former and \texttt{voltage/american label distance} (the distance of the label form the lines of the symbols, default \texttt{1.4}) for the latter.
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[american voltages]
@@ -5684,7 +5963,7 @@
\tikz \draw (0,0) to[C, i=$\imath$] (2,0);
\end{LTXexample}
-However, you can override the properties \texttt{voltage/distance from node} (how distant from the initial and final points of the path the arrow starts and ends) and \texttt{voltage/bump b} (how high the bump of the arrow is --- how curved it is)\footnote{Prior to 0.9.4 you had also \texttt{voltage/european label distance} (how distant from the bipole the voltage label will be) but this is deprecated, and the european-style label is printed near the bump)} on a per-component basis, in order to fine-tune the voltages:
+However, you can override the properties \texttt{voltage/distance from node} (how distant from the initial and final points of the path the arrow starts and ends, default \texttt{0.5}) and \texttt{voltage/bump b} (how high the bump of the arrow is --- how curved it is, default \texttt{1.5}), and also \texttt{voltage/european label distance} (how distant from the ``bump'' the voltage label will be, default \texttt{1.4}) on a per-component basis, in order to fine-tune the voltages:
\begin{LTXexample}[varwidth=true]
@@ -6572,13 +6851,13 @@
\begin{LTXexample}[varwidth]
\begin{circuitikz}
- \ctikzset{bipoles/viscoe/voltage/additional label shift/.initial=1}
+ \ctikzset{bipoles/viscoe/voltage/additional shift/.initial=1}
\draw (0,0) to[spring] ++(2,0)
to[viscoe, v=V] ++(2,0);
\end{circuitikz}
\end{LTXexample}
-Notice that by default the key \texttt{bipoles/\emph{mybipole}/voltage/additional label shift} is not defined, so if you want to use it you must create it before (this is the meaning of the \texttt{.initial} here).
+Notice that by default the key \texttt{bipoles/\emph{mybipole}/voltage/additional shift} is not defined, so if you want to use it you must create it before (this is the meaning of the \texttt{.initial} here).
As a final note, notice that the \texttt{viscoe} element is already added to the standard package.
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty 2020-06-21 20:42:13 UTC (rev 55620)
@@ -81,14 +81,17 @@
\checkclass{N}%
}%
}
-% description of a path-style component:
+% description of a path-style bipole component:
% optional: main name, if different from above
-% mandatory component name, description, comma separated alias
+% mandatory component name
+% optional between <>: shapename, if note "nodeshape"
+% mandatory description, comma separated alias
% optional between (): anchor specification list
% optional between []: internal nodes specification list
-\NewDocumentCommand{\circuitdescbip}{s o m m m d() d[]}
+% 1 2 3 4 5 6 7 8
+\NewDocumentCommand{\circuitdescbip}{s o m d<> m m d() d[]}
{
-\index{#3} \tikz\foreach \i in {#5} {\index{\i|see{#3}} };
+\index{#3} \tikz\foreach \i in {#6} {\index{\i|see{#3}} };
\twopartbox{%
\begin{circuitikz}
\IfBooleanTF{#1}{%
@@ -96,22 +99,23 @@
}{
\draw (0,0) to[#3, name=B] (2,0);
}
- \IfValueT{#6}{%
- \foreach \n/\a/\d in {#6} \path(B.\n) \showcoord(\n)<\a:\d>;
+ \IfValueT{#7}{%
+ \foreach \n/\a/\d in {#7} \path(B.\n) \showcoord(\n)<\a:\d>;
}
- \IfValueT{#7}{%
- \foreach \n/\a/\d in {#7} \path(B-\n) \showcoordb(B-\n)<\a:\d>;
+ \IfValueT{#8}{%
+ \foreach \n/\a/\d in {#8} \path(B-\n) \showcoordb(B-\n)<\a:\d>;
}
\end{circuitikz}%
}{\sloppy%
- \texttt{\textbf{#3}}: #4, \texttt{type: path-style\IfBooleanT{#1}{, fillable}%
- \IfValueT{#7}{, \texttt{name=B}}%
+ \texttt{\textbf{#3}}: #5, \texttt{type: path-style\IfBooleanT{#1}{, fillable}%
+ \IfValueT{#8}{, \texttt{name=B}}%
+ \IfValueTF{#4}{, nodename: #4.}{
\IfValueTF{#2}{, nodename: #2shape.%\drawphantomshape{#2shape}%
}{, nodename: #3shape.%\drawphantomshape{#3shape}%
- }%
+ }}%
}%
- \ifthenelse{\equal{#5}{}}{ }{%
- Aliases: \texttt{#5}. }\checkclass{B}%
+ \ifthenelse{\equal{#6}{}}{ }{%
+ Aliases: \texttt{#6}. }\checkclass{B}%
}%
}
Added: trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.1.2.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.1.2.tex (rev 0)
+++ trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.1.2.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -0,0 +1,22192 @@
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+\def\pgfcircversion{1.1.2}
+\def\pgfcircversiondate{2020/05/17}
+\writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
+
+\usemodule[tikz]
+
+\startmodule[circuitikz-1.1.2]
+\usetikzlibrary[calc]
+\usetikzlibrary[arrows.meta, bending]
+\usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1)
+
+\unprotect
+
+\edef\tikzatcode{\the\catcode`\@}
+\edef\tikzbarcode{\the\catcode`\|}
+\edef\tikzexclaimcode{\the\catcode`\!}
+\catcode`\@=11
+\catcode`\|=12
+\catcode`\!=12
+
+%%%%%%%%%%% Springe nach tex/pgfcirc.defines
+%%%---------- open: tex/pgfcirc.defines.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%
+%% Key managements
+
+\long\def\pgf at circ@comment#1{}
+
+\def\circuitikzbasekey{/tikz/circuitikz}
+
+\pgfkeys{\circuitikzbasekey/.is family}
+
+\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
+\let\ctikzset\circuitikzset
+\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
+\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
+
+%% Temporary Counters
+
+\newcount\pgf at circ@count at a
+\newcount\pgf at circ@count at b
+\newcount\pgf at circ@count at c
+%%%%%%%%%%%%
+%% Dimensions
+
+% coordinates
+\newdimen\pgf at circ@res at up
+\newdimen\pgf at circ@res at down
+\newdimen\pgf at circ@res at zero
+\newdimen\pgf at circ@res at left
+\newdimen\pgf at circ@res at right
+\newdimen\pgf at circ@res at other
+\newdimen\pgf at circ@res at step
+\newdimen\pgf at circ@res at temp
+% inital thickness
+\newdimen \pgfstartlinewidth
+
+% arrow tips, ported over old arrows library (deprecated)
+% see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
+% this was the original definition of latex' tips, renamed to avoid clashes
+%
+\pgfarrowsdeclare{latexslim}{latexslim}
+{
+ \pgfutil at tempdima=0.28pt%
+ \advance\pgfutil at tempdima by.3\pgflinewidth%
+ \pgfarrowsleftextend{+-4\pgfutil at tempdima}
+ \pgfarrowsrightextend{+6\pgfutil at tempdima}
+}
+{
+ \pgfutil at tempdima=0.28pt%
+ \advance\pgfutil at tempdima by.3\pgflinewidth%
+ \pgfpathmoveto{\pgfqpoint{6\pgfutil at tempdima}{0\pgfutil at tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{3.5\pgfutil at tempdima}{.5\pgfutil at tempdima}}
+ {\pgfqpoint{-1\pgfutil at tempdima}{1.5\pgfutil at tempdima}}
+ {\pgfqpoint{-4\pgfutil at tempdima}{3.75\pgfutil at tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-1.5\pgfutil at tempdima}{1\pgfutil at tempdima}}
+ {\pgfqpoint{-1.5\pgfutil at tempdima}{-1\pgfutil at tempdima}}
+ {\pgfqpoint{-4\pgfutil at tempdima}{-3.75\pgfutil at tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-1\pgfutil at tempdima}{-1.5\pgfutil at tempdima}}
+ {\pgfqpoint{3.5\pgfutil at tempdima}{-.5\pgfutil at tempdima}}
+ {\pgfqpoint{6\pgfutil at tempdima}{0\pgfutil at tempdima}}
+ \pgfpathclose
+ \pgfusepathqfill
+}
+
+\pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
+
+\def\pgf at circ@setifdefinedfill#1#2{%
+ % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
+ % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
+ \ifdefined\ctikzclass
+ \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
+ {% yes, it's defined
+ \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
+ \ifx\@@tmp\@@none % but it's none
+ \pgfusepath{#2}%
+ \else
+ \pgfsetfillcolor{\@@tmp}%
+ \pgfusepath{#1}%
+ \fi
+ }{% the class is defined but the fill key not; use #2
+ \pgfusepath{#2}%
+ }
+ \else
+ \pgfusepath{#2}%
+ \fi
+}
+
+%% Macro to fill or draw
+
+\def\pgf at circ@draworfill{%
+ \ifx\tikz at fillcolor\pgfutil at empty
+ \pgf at circ@setifdefinedfill{draw,fill}{draw}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \pgfusepath{draw, fill}
+ \fi
+}
+
+\def\pgf at circ@draworfillandclip{%
+ \ifx\tikz at fillcolor\pgfutil at empty
+ \pgf at circ@setifdefinedfill{draw, clip, fill}{draw, clip}
+ \pgfusepath{draw, clip}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \pgfusepath{draw, clip, fill}
+ \fi
+}
+
+\def\pgf at circ@maybefill{%
+ \ifx\tikz at fillcolor\pgfutil at empty
+ \pgf at circ@setifdefinedfill{fill}{discard}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \pgfusepath{fill}
+ \fi
+}
+
+%% Macros for setting linewidth
+% #1 is the legacy class (bipoles, tripoles) etc
+% #2 is the reference linewidth
+\def\pgf at circ@setlinewidth#1#2{%
+ \ifdefined\ctikzclass
+ \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
+ {% yes, it's defined
+ \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
+ \ifx\@@tmp\@@none % but it's none
+ \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
+ \else
+ \pgfsetlinewidth{\@@tmp #2}%
+ \fi
+ }{ % key not defined, do the legacy thing
+ \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
+ }% Ok, do nothing
+ \else % no class
+ \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
+ \fi
+}
+% use \pgf at circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
+\ctikzset{none/thickness/.initial=1.0} % do not touch
+
+%% font changes compatible with plain/LaTeX/ConTeXt
+%% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
+
+\ifpgfutil at format@is at latex
+ \long\def\pgf at circ@font at tiny{\tiny}
+ \long\def\pgf at circ@font at small{\small}
+ \long\def\pgf at circ@font at bold{\textbf}
+ \long\def\pgf at circ@font at boldmath{\boldmath}
+ \long\def\pgf at circ@font at sixbm{\fontsize{6}{7}\selectfont\boldmath}
+ \long\def\pgf at circ@font at tenbm{\fontsize{10}{12}\selectfont\boldmath}
+ \long\def\pgf at circ@font at twelve{\fontsize{12}{14}\selectfont}
+\else\ifpgfutil at format@is at plain
+ \long\def\pgf at circ@font at tiny{\fiverm}
+ \long\def\pgf at circ@font at small{\sevenrm}
+ \long\def\pgf at circ@font at bold#1{{\bf#1}}
+ \long\def\pgf at circ@font at boldmath{\bf} % to be tested
+ \long\def\pgf at circ@font at sixbm{\sevenrm\bf} %
+ \long\def\pgf at circ@font at tenbm{\tenrm\bf} %
+ \long\def\pgf at circ@font at twelve{\twelverm} %
+\else\ifpgfutil at format@is at context
+ \long\def\pgf at circ@font at tiny{\tfxx}
+ \long\def\pgf at circ@font at small{\tfx}
+ \long\def\pgf at circ@font at bold{\bold}
+ \long\def\pgf at circ@font at boldmath{\bold} % to be tested
+ \long\def\pgf at circ@font at sixbm{\tfx\bold} %
+ \long\def\pgf at circ@font at tenbm{\normal\bold}%
+ \long\def\pgf at circ@font at twelve{\tfa} %
+\fi\fi\fi
+
+
+%
+% Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
+%
+% this is needed to avoid problems with \ConTeXt
+\ifcsname normalunexpanded\endcsname
+ \let\pgfcircutil at unexpanded\normalunexpanded
+\else
+ \let\pgfcircutil at unexpanded\unexpanded
+\fi
+% minimally expand a pgfkey to check if it's {}/undefined or filled.
+\def\unexpandedvalueof#1{%
+ \pgfcircutil at unexpanded\expandafter\expandafter
+ \expandafter\pgf at circ@valueof at chk\pgfkeysvalueof{#1}}
+\def\pgf at circ@valueof at chk#1{%
+ \ifx\relax#1%
+ \expandafter\pgfutil at firstoftwo
+ \else
+ \expandafter\pgfutil at secondoftwo
+ \fi
+ {{}}% #1 is \relax, so consider empty
+ {\expandafter{#1}}% otherwise, leave the key after one more expansion
+}%
+%
+% text position (added with ieeestd logic ports. Maybe to be extended to other components,
+% like amplifiers)
+%
+\newif\ifpgf at circ@center at text\pgf at circ@center at texttrue
+\tikzset{component text/.is choice}%
+\tikzset{component text/center/.code={\pgf at circ@center at texttrue}}%
+\tikzset{component text/left/.code={\pgf at circ@center at textfalse}}%
+\ctikzset{component text/.is choice}%
+\ctikzset{component text/center/.code={\pgf at circ@center at texttrue}}%
+\ctikzset{component text/left/.code={\pgf at circ@center at textfalse}}%
+\ctikzset{left text distance/.initial=0.3em}%
+
+% voltage options
+
+\newif\ifpgf at circ@siunitx
+\newif\ifpgf at circuit@compat
+\newif\ifpgf at circ@oldvoltagedirection % default false
+\newif\ifpgf at circ@explicitvdir
+\newif\ifpgf at circ@fixbatteries
+
+\ctikzset{voltage dir/.is choice}
+\ctikzset{voltage dir/old/.code={\pgf at circ@oldvoltagedirectiontrue\pgf at circ@fixbatteriesfalse}}
+\ctikzset{voltage dir/noold/.code={\pgf at circ@oldvoltagedirectionfalse\pgf at circ@fixbatteriesfalse}}
+\ctikzset{voltage dir/RP/.code={\pgf at circ@oldvoltagedirectiontrue\pgf at circ@fixbatteriestrue}}
+\ctikzset{voltage dir/EF/.code={\pgf at circ@oldvoltagedirectionfalse\pgf at circ@fixbatteriestrue}}
+\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}
+
+% Option ">" for twoports
+\newif\ifpgf at circuit@inputarrow
+\ctikzset{>/.add code={}{\pgf at circuit@inputarrowtrue}}
+\ctikzset{inputarrow/.is choice}
+\ctikzset{inputarrow/true/.code={\pgf at circuit@inputarrowtrue}}
+\ctikzset{inputarrow/false/.code={\pgf at circuit@inputarrowfalse}}
+
+% Option "boxed" for nodes and twoports
+\newif\ifpgf at circuit@boxed
+\pgfkeys{/tikz/boxed/.add code={}{\pgf at circuit@boxedtrue}}
+\ctikzset{boxed/.add code={}{\pgf at circuit@boxedtrue}}
+\pgfkeys{/tikz/box/.add code={}{\pgf at circuit@boxedtrue}}
+\ctikzset{box/.add code={}{\pgf at circuit@boxedtrue}}
+
+% Option "dashed" for nodes and twoports
+\newif\ifpgf at circuit@dashed
+\pgfkeys{/tikz/dashed/.add code={}{\pgf at circuit@dashedtrue}}
+\ctikzset{dashed/.add code={}{\pgf at circuit@dashedtrue}}
+
+% Option "t=*" for nodes
+\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
+
+\ctikzset{current arrow scale/.initial=16}
+
+\ctikzset{bipoles/.is family}
+\ctikzset{bipoles/border margin/.initial=1.1}
+\ctikzset{bipoles/thickness/.initial=2}
+\ctikzset{tripoles/thickness/.initial=2}
+\ctikzset{quadpoles/thickness/.initial=2}
+\ctikzset{nodes width/.initial=.04}
+
+% Base len for all circuitikz
+\newdimen\pgf at circ@Rlen
+% scaled length for internal use in scalable shapes
+\newdimen\pgf at circ@scaled at Rlen
+\ctikzset{bipoles/length/.code={\pgf at circ@Rlen = #1\pgf at circ@scaled at Rlen=\pgf at circ@Rlen}}
+\pgf at circ@Rlen = 1.4cm
+% by default scale is 1.0
+\pgf at circ@scaled at Rlen=\pgf at circ@Rlen
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% main style definitions
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+% load a style file: search ctikzstyle-NAME.tex in path
+\def\ctikzloadstyle#1{%
+ \pgfutil at InputIfFileExists{ctikzstyle-#1}{}{%
+ \tikzerror{I did not find the circuitikz style #1}}%
+}
+
+% load and enact a style
+\def\ctikzsetstyle#1{%
+ \ctikzloadstyle{#1}%
+ \tikzset{#1 circuit style}%
+}
+
+% global style parameters
+\ctikzset{default/scale/.initial=1.0} % do not touch
+\ctikzset{default/fill/.initial=none} % do not touch
+\ctikzset{default/thickness/.initial=none} % do not touch
+% default is use as the generic default style for bipoles
+
+% mostly bipoles:
+
+\ctikzset{resistors/scale/.initial=1.0}
+\ctikzset{resistors/fill/.initial=none}
+\ctikzset{resistors/thickness/.initial=none}
+
+\ctikzset{capacitors/scale/.initial=1.0}
+\ctikzset{capacitors/fill/.initial=none}
+\ctikzset{capacitors/thickness/.initial=none}
+
+\ctikzset{inductors/scale/.initial=1.0}
+\ctikzset{inductors/fill/.initial=none}
+\ctikzset{inductors/thickness/.initial=none}
+
+\ctikzset{diodes/scale/.initial=1.0}
+\ctikzset{diodes/fill/.initial=none}
+\ctikzset{diodes/thickness/.initial=none}
+
+\ctikzset{batteries/scale/.initial=1.0}
+\ctikzset{batteries/fill/.initial=none}
+\ctikzset{batteries/thickness/.initial=none}
+
+\ctikzset{sources/scale/.initial=1.0}
+\ctikzset{sources/fill/.initial=none}
+\ctikzset{sources/thickness/.initial=none}
+
+\ctikzset{csources/scale/.initial=1.0}
+\ctikzset{csources/fill/.initial=none}
+\ctikzset{csources/thickness/.initial=none}
+
+\ctikzset{instruments/scale/.initial=1.0}
+\ctikzset{instruments/fill/.initial=none}
+\ctikzset{instruments/thickness/.initial=none}
+
+\ctikzset{mechanicals/scale/.initial=1.0}
+\ctikzset{mechanicals/fill/.initial=none}
+\ctikzset{mechanicals/thickness/.initial=none}
+
+\ctikzset{misc/scale/.initial=1.0}
+\ctikzset{misc/fill/.initial=none}
+\ctikzset{misc/thickness/.initial=none}
+
+\ctikzset{blocks/scale/.initial=1.0}
+\ctikzset{blocks/fill/.initial=none}
+\ctikzset{blocks/thickness/.initial=none}
+
+% mostly nodes
+
+\ctikzset{grounds/scale/.initial=1.0}
+\ctikzset{grounds/fill/.initial=none}
+\ctikzset{grounds/thickness/.initial=none}
+
+\ctikzset{power supplies/scale/.initial=1.0}
+\ctikzset{power supplies/fill/.initial=none}
+\ctikzset{power supplies/thickness/.initial=none}
+
+\ctikzset{transistors/scale/.initial=1.0}
+\ctikzset{transistors/fill/.initial=none}
+\ctikzset{transistors/thickness/.initial=none}
+
+\ctikzset{tubes/scale/.initial=1.0}
+\ctikzset{tubes/fill/.initial=none}
+\ctikzset{tubes/thickness/.initial=none}
+
+\ctikzset{RF/scale/.initial=1.0}
+\ctikzset{RF/fill/.initial=none}
+\ctikzset{RF/thickness/.initial=none}
+
+\ctikzset{electromechanicals/scale/.initial=1.0}
+\ctikzset{electromechanicals/fill/.initial=none}
+\ctikzset{electromechanicals/thickness/.initial=none}
+
+% transformers go with inductors
+\ctikzset{amplifiers/scale/.initial=1.0}
+\ctikzset{amplifiers/fill/.initial=none}
+\ctikzset{amplifiers/thickness/.initial=none}
+
+\ctikzset{switches/scale/.initial=1.0}
+\ctikzset{switches/fill/.initial=none}
+\ctikzset{switches/thickness/.initial=none}
+
+\ctikzset{logic ports/scale/.initial=1.0}
+\ctikzset{logic ports/fill/.initial=none}
+\ctikzset{logic ports/thickness/.initial=none}
+
+\ctikzset{flipflops/scale/.initial=1.0}
+\ctikzset{flipflops/fill/.initial=none}
+\ctikzset{flipflops/thickness/.initial=none}
+
+\ctikzset{muxdemuxes/scale/.initial=1.0}
+\ctikzset{muxdemuxes/fill/.initial=none}
+\ctikzset{muxdemuxes/thickness/.initial=none}
+
+\ctikzset{chips/scale/.initial=1.0}
+\ctikzset{chips/fill/.initial=none}
+\ctikzset{chips/thickness/.initial=none}
+
+\ctikzset{displays/scale/.initial=1.0}
+\ctikzset{displays/fill/.initial=none}
+\ctikzset{displays/thickness/.initial=none}
+
+% grounds and power supplies
+
+\ctikzset{monopoles/.is family}
+\ctikzset{monopoles/ground/width/.initial=.25}
+\ctikzset{monopoles/ground/connectionthickness/.initial=1}
+\ctikzset{monopoles/ground/thickness/.initial=2}
+\ctikzset{monopoles/rground/thickness/.initial=2}
+\ctikzset{monopoles/tground/thickness/.initial=3}
+\ctikzset{monopoles/vcc/width/.initial=.2}
+\ctikzset{monopoles/vcc/arrow/.initial=legacy}
+\ctikzset{monopoles/vee/arrow/.initial=legacy}
+\ctikzset{monopoles/match/width/.initial=.4}
+\ctikzset{monopoles/chassis/width/.initial=.25}
+\ctikzset{monopoles/alternative chassis/width/.initial=.25}
+\ctikzset{monopoles/equipotentiality/width/.initial=.25}
+\ctikzset{monopoles/antenna/width/.initial=.25}
+\ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
+\ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
+\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
+\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
+\ctikzset{monopoles/txantenna/width/.initial=.25}
+\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
+\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
+\ctikzset{monopoles/rxantenna/width/.initial=.25}
+\ctikzset{monopoles/bareantenna/width/.initial=.25}
+\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
+\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
+\ctikzset{monopoles/waves/width/.initial=0.5}
+
+% microstrips
+\ctikzset{bipoles/mstline/height/.initial=0.3}
+\ctikzset{bipoles/mstline/width/.initial=1.2}
+\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
+\ctikzset{monopoles/msport/width/.initial=.5}
+\ctikzset{monopoles/msrstub/height/.initial=1.0}
+\ctikzset{monopoles/msrstub/width/.initial=0.6}
+
+% microphone and loudspeaker
+\ctikzset{bipoles/loudspeaker/height/.initial=.8}
+\ctikzset{bipoles/loudspeaker/depth/.initial=.3}
+\ctikzset{bipoles/loudspeaker/width/.initial=.8}
+\ctikzset{bipoles/mic/height/.initial=1.2}
+\ctikzset{bipoles/mic/depth/.initial=.0}
+\ctikzset{bipoles/mic/width/.initial=.8}
+
+% Zig Zag resistors
+\ctikzset{resistors/zigs/.initial=3}
+\ctikzset{resistors/width/.code={%
+ \ctikzset{bipoles/resistor/width=#1}%
+ \ctikzset{bipoles/vresistor/width=#1}%
+ \ctikzset{bipoles/potentiometer/width=#1}%
+ \ctikzset{bipoles/resistivesens/width=#1}%
+ \ctikzset{bipoles/photoresistor/width=#1}%
+ \ctikzset{bipoles/thermistor/width=#1}%
+ \ctikzset{bipoles/thermistorntc/width=#1}%
+ \ctikzset{bipoles/thermistorptc/width=#1}%
+ \ctikzset{bipoles/varistor/width=#1}%
+ \ctikzset{bipoles/generic/width=#1}%
+ \ctikzset{bipoles/generic potentiometer/width=#1}%
+ \ctikzset{bipoles/ageneric/width=#1}%
+ \ctikzset{bipoles/tgeneric/width=#1}%
+}}
+\ctikzset{wiper pos/.code={%
+ \ctikzset{bipoles/potentiometer/wiper pos=#1}%
+ \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
+}}
+% zigzag resistor
+\ctikzset{bipoles/resistor/height/.initial=.3}
+\ctikzset{bipoles/resistor/width/.initial=.8}
+\ctikzset{bipoles/potentiometer/height/.initial=.8}
+\ctikzset{bipoles/potentiometer/height 2/.initial=.3}
+\ctikzset{bipoles/potentiometer/width/.initial=.8}
+\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
+\ctikzset{bipoles/vresistor/height/.initial=.6}
+\ctikzset{bipoles/vresistor/width/.initial=.8}
+\ctikzset{bipoles/resistivesens/height/.initial=.6}
+\ctikzset{bipoles/resistivesens/width/.initial=.8}
+% square resistors
+\ctikzset{bipoles/photoresistor/height/.initial=.6}
+\ctikzset{bipoles/photoresistor/height 2/.initial=.3}
+\ctikzset{bipoles/photoresistor/width/.initial=.8}
+\ctikzset{bipoles/thermistor/main/.initial=.7}
+\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
+\ctikzset{bipoles/thermistorntc/width/.initial=.8}
+\ctikzset{bipoles/thermistorntc/main/.initial=.7}
+\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
+\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
+\ctikzset{bipoles/thermistorptc/width/.initial=.8}
+\ctikzset{bipoles/thermistorptc/main/.initial=.7}
+\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
+\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
+\ctikzset{bipoles/thermistor/width/.initial=.8}
+\ctikzset{bipoles/varistor/main/.initial=.7}
+\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
+\ctikzset{bipoles/varistor/width/.initial=.8}
+\ctikzset{bipoles/generic/height/.initial=.30}
+\ctikzset{bipoles/generic/width/.initial=.80}
+\ctikzset{bipoles/generic potentiometer/height/.initial=.80}
+\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
+\ctikzset{bipoles/generic potentiometer/width/.initial=.80}
+\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
+\ctikzset{bipoles/ageneric/height/.initial=.30}
+\ctikzset{bipoles/tgeneric/height/.initial=.70}
+\ctikzset{bipoles/tgeneric/width/.initial=.80}
+\ctikzset{bipoles/ageneric/width/.initial=.80}
+
+%% Capacitors
+\ctikzset{bipoles/capacitor/height/.initial=.6}
+\ctikzset{bipoles/capacitor/width/.initial=.2}
+\ctikzset{bipoles/ecapacitor/height/.initial=.5}
+\ctikzset{bipoles/ecapacitor/width/.initial=.2}
+\ctikzset{bipoles/ecapacitor/font/.initial=\pgf at circ@font at sixbm}
+%%% pcapacitor is deprecated
+\ctikzset{bipoles/pcapacitor/height/.initial=.6}
+\ctikzset{bipoles/pcapacitor/width/.initial=.2}
+\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
+\ctikzset{bipoles/ccapacitor/height/.initial=.6}
+\ctikzset{bipoles/ccapacitor/width/.initial=.12}
+\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
+\ctikzset{bipoles/vcapacitor/height/.initial=.6}
+\ctikzset{bipoles/vcapacitor/width/.initial=.5}
+\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
+\ctikzset{bipoles/piezoelectric/height/.initial=.7}
+\ctikzset{bipoles/piezoelectric/width/.initial=.5}
+
+% Inductors
+\ctikzset{inductors/coils/.code={%
+ \ctikzset{bipoles/cuteinductor/coils=#1}%
+ \ctikzset{bipoles/cutechoke/coils=#1}%
+ \ctikzset{bipoles/americaninductor/coils=#1}%
+ \ctikzset{bipoles/vcuteinductor/coils=#1}%
+ \ctikzset{bipoles/vamericaninductor/coils=#1}%
+}}
+\ctikzset{inductors/width/.code={%
+ \ctikzset{bipoles/cuteinductor/width=#1}%
+ \ctikzset{bipoles/cutechoke/width=#1}%
+ \ctikzset{bipoles/americaninductor/width=#1}%
+ \ctikzset{bipoles/vcuteinductor/width=#1}%
+ \ctikzset{bipoles/vamericaninductor/width=#1}%
+ \ctikzset{bipoles/fullgeneric/width=#1}%
+ \ctikzset{bipoles/tfullgeneric/width=#1}%
+}}
+\ctikzset{bipoles/cuteinductor/height/.initial=.3}
+\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
+\ctikzset{bipoles/cuteinductor/width/.initial=.6}
+\ctikzset{bipoles/cuteinductor/coils/.initial=5}
+\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
+%% Cute choke settings
+\ctikzset{bipoles/cutechoke/height/.initial=.3}
+\ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
+\ctikzset{bipoles/cutechoke/width/.initial=.6}
+\ctikzset{bipoles/cutechoke/coils/.initial=5}
+\ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
+\ctikzset{bipoles/cutechoke/cstep/.initial=.3}
+\ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
+\ctikzset{bipoles/cutechoke/cthick/.initial=1}
+\newif\ifpgf at circuit@bipole at twolineschoke
+\pgf at circuit@bipole at twolineschokefalse
+\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf at circuit@bipole at twolineschokefalse}}
+\ctikzset{onelinechoke/.add code={}{\pgf at circuit@bipole at twolineschokefalse}}
+\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf at circuit@bipole at twolineschoketrue}}
+\ctikzset{twolineschoke/.add code={}{\pgf at circuit@bipole at twolineschoketrue}}
+%
+\ctikzset{bipoles/americaninductor/height/.initial=.3}
+\ctikzset{bipoles/americaninductor/height 2/.initial=.1}
+\ctikzset{bipoles/americaninductor/width/.initial=.8}
+\ctikzset{bipoles/americaninductor/coils/.initial=4}
+\ctikzset{bipoles/americaninductor/coil height/.initial=.15}
+\ctikzset{bipoles/vcuteinductor/height/.initial=.6}
+\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
+\ctikzset{bipoles/vcuteinductor/width/.initial=.6}
+\ctikzset{bipoles/vcuteinductor/coils/.initial=5}
+\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
+\ctikzset{bipoles/vamericaninductor/height/.initial=.6}
+\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
+\ctikzset{bipoles/vamericaninductor/width/.initial=.8}
+\ctikzset{bipoles/vamericaninductor/coils/.initial=4}
+\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
+\ctikzset{bipoles/tfullgeneric/height/.initial=.70}
+\ctikzset{bipoles/tfullgeneric/width/.initial=.80}
+\ctikzset{bipoles/fullgeneric/height/.initial=.30}
+\ctikzset{bipoles/fullgeneric/width/.initial=.80}
+
+% Sources
+
+\ctikzset{bipoles/esource/height/.initial=.60}
+\ctikzset{bipoles/esource/width/.initial=.60}
+\ctikzset{bipoles/pvsource/height/.initial=.60}
+\ctikzset{bipoles/pvsource/width/.initial=.60}
+\ctikzset{bipoles/isource/height/.initial=.60}
+\ctikzset{bipoles/isource/width/.initial=.60}
+\ctikzset{bipoles/oosource/height/.initial=.60}
+\ctikzset{bipoles/oosource/width/.initial=.60}
+\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/dcisource/angle/.initial=80}
+\ctikzset{bipoles/dcisource/height/.initial=.60}
+\ctikzset{bipoles/dcisource/width/.initial=.60}
+\ctikzset{bipoles/dcvsource/height/.initial=.60}
+\ctikzset{bipoles/dcvsource/width/.initial=.60}
+\ctikzset{bipoles/vsourcetri/height/.initial=.60}
+\ctikzset{bipoles/vsourcetri/width/.initial=.60}
+\ctikzset{bipoles/isourceam/height/.initial=.60}
+\ctikzset{bipoles/isourceam/width/.initial=.60}
+\ctikzset{bipoles/vsource/height/.initial=.60}
+\ctikzset{bipoles/vsource/width/.initial=.60}
+\ctikzset{bipoles/vsourceam/height/.initial=.60}
+\ctikzset{bipoles/vsourceam/width/.initial=.60}
+\ctikzset{bipoles/vsourceam/margin/.initial=.7}
+\ctikzset{bipoles/isourcesin/height/.initial=.60}
+\ctikzset{bipoles/isourcesin/width/.initial=.60}
+\ctikzset{bipoles/vsourcesin/height/.initial=.60}
+\ctikzset{bipoles/vsourcesin/width/.initial=.60}
+\ctikzset{bipoles/vsourcesquare/height/.initial=.60}
+\ctikzset{bipoles/vsourcesquare/width/.initial=.60}
+\ctikzset{bipoles/cisource/height/.initial=.7}
+\ctikzset{bipoles/cisource/width/.initial=.7}
+\ctikzset{bipoles/cisourceam/height/.initial=.7}
+\ctikzset{bipoles/cisourceam/width/.initial=.7}
+\ctikzset{bipoles/ecsource/height/.initial=.7}
+\ctikzset{bipoles/ecsource/width/.initial=.7}
+\ctikzset{bipoles/cvsource/height/.initial=.7}
+\ctikzset{bipoles/cvsource/width/.initial=.7}
+\ctikzset{bipoles/cvsourceam/height/.initial=.7}
+\ctikzset{bipoles/cvsourceam/width/.initial=.7}
+\ctikzset{bipoles/cvsourceam/margin/.initial=.7}
+\ctikzset{bipoles/cvsourceam/text scale/.initial=1}
+\ctikzset{bipoles/cisourcesin/width/.initial=.7}
+\ctikzset{bipoles/cvsourcesin/height/.initial=.7}
+\ctikzset{bipoles/cvsourcesin/width/.initial=.7}
+\ctikzset{bipoles/battery/height/.initial=.6}
+\ctikzset{bipoles/battery/width/.initial=.3}
+\ctikzset{bipoles/battery1/height/.initial=.6}
+\ctikzset{bipoles/battery1/width/.initial=.3}
+\ctikzset{bipoles/battery2/height/.initial=.6}
+\ctikzset{bipoles/battery2/width/.initial=.3}
+
+% % % ootransformer
+\ctikzset{bipoles/oosourcetrans/height/.initial=.6}
+\ctikzset{bipoles/oosourcetrans/width/.initial=.6}
+\ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
+
+% % % oootransformer
+\ctikzset{bipoles/ooosource/height/.initial=.6}
+\ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
+
+% % % primary windings
+\newif\ifpgf at circ@prim at delta
+\newif\ifpgf at circ@prim at wye
+\newif\ifpgf at circ@prim at zig
+\pgfkeys{tikz/prim/.is choice}
+\pgfkeys{tikz/prim/delta/.add code={}{\pgf at circ@prim at deltatrue}}
+\pgfkeys{tikz/prim/wye/.add code={}{\pgf at circ@prim at wyetrue}}
+\pgfkeys{tikz/prim/zig/.add code={}{\pgf at circ@prim at zigtrue}}
+
+% % % secondary windings
+\newif\ifpgf at circ@sec at delta
+\newif\ifpgf at circ@sec at wye
+\newif\ifpgf at circ@sec at zig
+\pgfkeys{tikz/sec/.is choice}
+\pgfkeys{tikz/sec/delta/.add code={}{\pgf at circ@sec at deltatrue}}
+\pgfkeys{tikz/sec/wye/.add code={}{\pgf at circ@sec at wyetrue}}
+\pgfkeys{tikz/sec/zig/.add code={}{\pgf at circ@sec at zigtrue}}
+
+% % % tertiary windings (ooosource)
+\newif\ifpgf at circ@tert at delta
+\newif\ifpgf at circ@tert at wye
+\newif\ifpgf at circ@tert at zig
+\pgfkeys{tikz/tert/.is choice}
+\pgfkeys{tikz/tert/delta/.add code={}{\pgf at circ@tert at deltatrue}}
+\pgfkeys{tikz/tert/wye/.add code={}{\pgf at circ@tert at wyetrue}}
+\pgfkeys{tikz/tert/zig/.add code={}{\pgf at circ@tert at zigtrue}}
+
+% diodes
+
+\ctikzset{bipoles/diode/height/.initial=.50}
+\ctikzset{bipoles/diode/width/.initial=.40}
+\ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
+\ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
+\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
+\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
+\ctikzset{bipoles/varcap/height/.initial=.50}
+\ctikzset{bipoles/varcap/width/.initial=.45}
+
+% switches
+
+\ctikzset{bipoles/spst/height/.initial=.35}
+\ctikzset{bipoles/spst/width/.initial=.35}
+\ctikzset{bipoles/spst/depth/.initial=.2}
+\ctikzset{bipoles/nos/height/.initial=.3}
+\ctikzset{bipoles/nos/width/.initial=.35}
+\ctikzset{bipoles/nos/depth/.initial=.2}
+\ctikzset{bipoles/ncs/height/.initial=.35}
+\ctikzset{bipoles/ncs/width/.initial=.35}
+\ctikzset{bipoles/ncs/depth/.initial=.2}
+%%% reed switch
+\ctikzset{bipoles/reed/height/.initial=.4}
+\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
+\ctikzset{bipoles/reed/depth/.initial=.4}
+
+% misc
+
+\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
+\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
+\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
+\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
+\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
+\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
+\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
+\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
+\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
+\ctikzset{bipoles/fuse/height/.initial=.20}
+\ctikzset{bipoles/fuse/width/.initial=.50}
+\ctikzset{bipoles/afuse/height/.initial=.20}
+\ctikzset{bipoles/afuse/width/.initial=.50}
+\ctikzset{bipoles/memristor/height/.initial=.30}
+\ctikzset{bipoles/memristor/wave height/.initial=.5}
+\ctikzset{bipoles/memristor/width/.initial=.80}
+\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
+\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
+\ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
+\ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/short/height/.initial=0} %dummy height for voltage positioning
+\ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning
+%\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2}
+%\ctikzset{bipoles/short/voltage/distance from node/.initial=.5}
+% multiwire
+\ctikzset{bipoles/multiwire/height/.initial=0.4}
+\ctikzset{bipoles/multiwire/width/.initial=0.2}
+\ctikzset{bipoles/multiwire/spacing/.initial=0.05}
+
+\ctikzset{bipoles/ammeter/height/.initial=.60}
+\ctikzset{bipoles/ammeter/width/.initial=.60}
+\ctikzset{bipoles/ohmmeter/height/.initial=.60}
+\ctikzset{bipoles/ohmmeter/width/.initial=.60}
+\ctikzset{bipoles/voltmeter/height/.initial=.60}
+\ctikzset{bipoles/voltmeter/width/.initial=.60}
+\ctikzset{bipoles/smeter/height/.initial=.60}
+\ctikzset{bipoles/smeter/width/.initial=.60}
+\ctikzset{bipoles/smeter/voltage/additional label shift/.initial=1}
+\ctikzset{bipoles/qmeter/depth/.initial=.40}
+\ctikzset{bipoles/qmeter/height/.initial=.80}
+\ctikzset{bipoles/qmeter/width/.initial=.60}
+% this must be specified for each one
+\ctikzset{bipoles/qvprobe/voltage/additional label shift/.initial=.5}
+\ctikzset{bipoles/qiprobe/voltage/additional label shift/.initial=.5}
+\ctikzset{bipoles/qpprobe/voltage/additional label shift/.initial=.5}
+\ctikzset{bipoles/iloop/width/.initial=.40}
+\ctikzset{bipoles/iloop/height/.initial=.60}
+
+\ctikzset{bipoles/oscope/height/.initial=.60}
+\ctikzset{bipoles/oscope/width/.initial=.60}
+\ctikzset{bipoles/oscope/voltage/additional label shift/.initial=1}
+
+
+% option to not rotate the new (Romano's) instruments
+\newif\ifpgf at circuit@straightinstruments\pgf at circuit@straightinstrumentstrue
+\pgfkeys{/tikz/straight instruments/.add code={}{\pgf at circuit@straightinstrumentstrue}}
+\ctikzset{straight instruments/.add code={}{\pgf at circuit@straightinstrumentstrue}}
+\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf at circuit@straightinstrumentsfalse}}
+\ctikzset{rotated instruments/.add code={}{\pgf at circuit@straightinstrumentsfalse}}
+
+
+\ctikzset{bipoles/buffer/height/.initial=1}
+\ctikzset{bipoles/buffer/width/.initial=1}
+\ctikzset{bipoles/not port/width/.initial=1}
+\ctikzset{bipoles/not port/height/.initial=.8}
+\ctikzset{bipoles/not port/circle width/.initial=.15}
+\ctikzset{bipoles/lamp/height/.initial=.60}
+\ctikzset{bipoles/lamp/width/.initial=.60}
+\ctikzset{bipoles/bulb/height/.initial=.8}
+\ctikzset{bipoles/bulb/width/.initial=.8}
+\ctikzset{bipoles/tline/height/.initial=.3}
+\ctikzset{bipoles/tline/width/.initial=.8}
+\ctikzset{bipoles/squid/height/.initial=.60}
+\ctikzset{bipoles/squid/width/.initial=.60}
+\ctikzset{bipoles/barrier/height/.initial=.60}
+\ctikzset{bipoles/barrier/width/.initial=.60}
+\ctikzset{bipoles/openbarrier/gap/.initial=0.5}
+\ctikzset{bipoles/thermocouple/height/.initial=.250}
+\ctikzset{bipoles/thermocouple/height 2/.initial=.60}
+\ctikzset{bipoles/thermocouple/width/.initial=.140}
+\ctikzset{bipoles/pushbutton/height/.initial=.5}
+\ctikzset{bipoles/pushbutton/height 2/.initial=.2}
+\ctikzset{bipoles/pushbutton/width/.initial=.50}
+
+\ctikzset{bipoles/twoport/width/.initial=.7}
+\ctikzset{bipoles/twoport/height/.initial=.7}
+\ctikzset{bipoles/twoport/text/.initial=}
+\ctikzset{bipoles/vco/width/.initial=.7}
+\ctikzset{bipoles/bandpass/width/.initial=.7}
+\ctikzset{bipoles/bandstop/width/.initial=.7}
+\ctikzset{bipoles/highpass/width/.initial=.7}
+\ctikzset{bipoles/lowpass/width/.initial=.7}
+\ctikzset{bipoles/adc/width/.initial=.7}
+\ctikzset{bipoles/dac/width/.initial=.7}
+\ctikzset{bipoles/dsp/width/.initial=.7}
+\ctikzset{bipoles/fft/width/.initial=.7}
+\ctikzset{bipoles/amp/width/.initial=.7}
+\ctikzset{bipoles/vamp/width/.initial=.7}
+\ctikzset{bipoles/piattenuator/width/.initial=.7}
+\ctikzset{bipoles/vpiattenuator/width/.initial=.7}
+\ctikzset{bipoles/tattenuator/width/.initial=.7}
+\ctikzset{bipoles/vtattenuator/width/.initial=.7}
+\ctikzset{bipoles/phaseshifter/width/.initial=.7}
+\ctikzset{bipoles/vphaseshifter/width/.initial=.7}
+\ctikzset{bipoles/detector/width/.initial=.7}
+
+% crossing wires
+\ctikzset{bipoles/crossing/size/.initial=.2}
+
+% Transistors starts here
+
+\newif\ifpgf at circuit@trans at depletiontype
+\pgf at circuit@trans at depletiontypefalse
+
+\newif\ifpgf at circuit@mos at arrows
+\ctikzset{tripoles/mos style/.is choice}
+\ctikzset{tripoles/mos style/no arrows/.code={\pgf at circuit@mos at arrowsfalse}}
+\ctikzset{tripoles/mos style/arrows/.code={\pgf at circuit@mos at arrowstrue}}
+\pgfkeys{/tikz/arrowmos/.add code={}{\pgf at circuit@mos at arrowstrue}}
+\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf at circuit@mos at arrowsfalse}}
+
+% Fixed label positions
+\newif\ifpgf at circuit@transisors at fixlabels
+\pgf at circuit@transisors at fixlabelstrue
+\pgfkeys{/tikz/center transistors text/.add code={}{\pgf at circuit@transisors at fixlabelstrue}}
+\ctikzset{fix transistors text/.add code={}{\pgf at circuit@transisors at fixlabelstrue}}
+\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf at circuit@transisors at fixlabelsfalse}}
+\ctikzset{legacy transistors text/.add code={}{\pgf at circuit@transisors at fixlabelsfalse}}
+
+% Option solderdot for fet
+\newif\ifpgf at circuit@fet at solderdot
+\pgfkeys{/tikz/solderdot/.add code={}{\pgf at circuit@fet at solderdottrue}}
+\ctikzset{solderdot/.add code={}{\pgf at circuit@fet at solderdottrue}}
+\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf at circuit@fet at solderdotfalse}}
+\ctikzset{nosolderdot/.add code={}{\pgf at circuit@fet at solderdotfalse}}
+
+% Option bodydiode for fet
+\newif\ifpgf at circuit@fet at bodydiode
+\pgfkeys{/tikz/bodydiode/.add code={}{\pgf at circuit@fet at bodydiodetrue}}
+\ctikzset{bodydiode/.add code={}{\pgf at circuit@fet at bodydiodetrue}}
+\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf at circuit@fet at bodydiodefalse}}
+\ctikzset{nobodydiode/.add code={}{\pgf at circuit@fet at bodydiodefalse}}
+
+% Option draw fet without gate connection
+\newif\ifpgf at circuit@bpt at drawgate
+\pgf at circuit@bpt at drawgatetrue
+\pgfkeys{/tikz/nogate/.add code={}{\pgf at circuit@bpt at drawgatefalse}}
+\ctikzset{nogate/.add code={}{\pgf at circuit@bpt at drawgatefalse}}
+\pgfkeys{/tikz/nobase/.add code={}{\pgf at circuit@bpt at drawgatefalse}}
+\ctikzset{nobase/.add code={}{\pgf at circuit@bpt at drawgatefalse}}
+
+% Option draw bpt with schottky base
+\newif\ifpgf at circuit@bpt at schottky
+\pgf at circuit@bpt at schottkyfalse
+\pgfkeys{/tikz/schottky base/.add code={}{\pgf at circuit@bpt at schottkytrue}}
+\ctikzset{schottky base/.add code={}{\pgf at circuit@bpt at schottkytrue}}
+\pgfkeys{/tikz/no schottky base/.add code={}{\pgf at circuit@bpt at schottkyfalse}}
+\ctikzset{no schottky base/.add code={}{\pgf at circuit@bpt at schottkyfalse}}
+\ctikzset{tripoles/schottky base size/.initial=0.07}
+
+% Option draw bpt without base connection
+\newif\ifpgf at circuit@bpt at drawbase
+\pgf at circuit@bpt at drawbasetrue
+\pgfkeys{/tikz/nobase/.add code={}{\pgf at circuit@bpt at drawbasefalse}}
+\ctikzset{nobase/.add code={}{\pgf at circuit@bpt at drawbasefalse}}
+\pgfkeys{/tikz/nogate/.add code={}{\pgf at circuit@bpt at drawbasefalse}}
+\ctikzset{nogate/.add code={}{\pgf at circuit@bpt at drawbasefalse}}
+
+% Option draw bpt with optical input
+\newif\ifpgf at circuit@bpt at drawphoto
+\pgf at circuit@bpt at drawphotofalse
+\pgfkeys{/tikz/photo/.add code={}{\pgf at circuit@bpt at drawphototrue}}
+\ctikzset{photo/.add code={}{\pgf at circuit@bpt at drawphototrue}}
+\pgfkeys{/tikz/photo/.add code={}{\pgf at circuit@bpt at drawphototrue}}
+\ctikzset{photo/.add code={}{\pgf at circuit@bpt at drawphototrue}}
+
+% Option draw fet without bulk connection -- Added by Burak Kelleci
+\newif\ifpgf at circuit@bpt at drawbulk
+\pgfkeys{/tikz/bulk/.add code={}{\pgf at circuit@bpt at drawbulktrue}}
+\ctikzset{bulk/.add code={}{\pgf at circuit@bpt at drawbulktrue}}
+\pgfkeys{/tikz/nobulk/.add code={}{\pgf at circuit@bpt at drawbulkfalse}}
+\ctikzset{nobulk/.add code={}{\pgf at circuit@bpt at drawbulkfalse}}
+
+% Option draw pmos with empty circle
+\newif\ifpgf at circuit@pmos at emptycircle
+\pgf at circuit@pmos at emptycirclefalse
+\ctikzset{tripoles/pmos style/.is choice}
+\pgfkeys{/tikz/emptycircle/.add code={}{\pgf at circuit@pmos at emptycircletrue}}
+\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf at circuit@pmos at emptycircletrue}}
+% Option draw pmos with no circle
+\newif\ifpgf at circuit@pmos at nocircle
+\pgf at circuit@pmos at nocirclefalse
+\pgfkeys{/tikz/nocircle/.add code={}{\pgf at circuit@pmos at nocircletrue}}
+\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf at circuit@pmos at nocircletrue}}
+% back to normal
+\pgfkeys{/tikz/fullcircle/.add code={}{\pgf at circuit@pmos at emptycirclefalse\pgf at circuit@pmos at nocirclefalse}}
+\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf at circuit@pmos at emptycirclefalse\pgf at circuit@pmos at nocirclefalse}}
+% arrows at the end, the correct way
+\newif\ifpgf at circuit@trans at arrowatend
+\pgf at circuit@trans at arrowatendfalse
+\ctikzset{transistors/arrow pos/.is choice}
+\ctikzset{transistors/arrow pos/legacy/.code={\pgf at circuit@trans at arrowatendfalse}}
+\ctikzset{transistors/arrow pos/end/.code={\pgf at circuit@trans at arrowatendtrue}}
+
+\newif\ifpgf at circuit@trans at ntype
+\pgf at circuit@trans at ntypetrue %default true
+%\newif\ifpgf at circuit@trans at ptype
+%\ctikzset{tripoles/nmos/.add code={\pgf at circuit@trans at ntypetrue}}
+\ctikzset{tripoles/nmos/width/.initial=.7}
+\ctikzset{tripoles/nmos/gate height/.initial=.35}
+\ctikzset{tripoles/nmos/base height/.initial=.5}
+\ctikzset{tripoles/nmos/conn height/.initial=0}
+\ctikzset{tripoles/nmos/height/.initial=1.1}
+\ctikzset{tripoles/nmos/base width/.initial=.5}
+\ctikzset{tripoles/nmos/gate width/.initial=.62}
+\ctikzset{tripoles/nmos/arrow pos/.initial=.6}
+\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nmos/curr direction/.initial=1}
+
+\ctikzset{tripoles/pmos/width/.initial=.7}
+\ctikzset{tripoles/pmos/gate height/.initial=.35}
+\ctikzset{tripoles/pmos/base height/.initial=.5}
+\ctikzset{tripoles/pmos/conn height/.initial=0}
+\ctikzset{tripoles/pmos/height/.initial=1.1}
+\ctikzset{tripoles/pmos/base width/.initial=.5}
+\ctikzset{tripoles/pmos/gate width/.initial=.62}
+\ctikzset{tripoles/pmos/arrow pos/.initial=.4}
+\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pmos/curr direction/.initial=-1}
+
+\ctikzset{tripoles/hemt/width/.initial=.7}
+\ctikzset{tripoles/hemt/gate height/.initial=.35}
+\ctikzset{tripoles/hemt/base height/.initial=.5}
+\ctikzset{tripoles/hemt/conn height/.initial=0}
+\ctikzset{tripoles/hemt/height/.initial=1.1}
+\ctikzset{tripoles/hemt/base width/.initial=.5}
+\ctikzset{tripoles/hemt/gate width/.initial=.62}
+\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/hemt/curr direction/.initial=1}
+
+\ctikzset{tripoles/nfet/width/.initial=.7}
+\ctikzset{tripoles/nfet/gate height/.initial=.35}
+\ctikzset{tripoles/nfet/base height/.initial=.5}
+\ctikzset{tripoles/nfet/conn height/.initial=0}
+\ctikzset{tripoles/nfet/height/.initial=1.1}
+\ctikzset{tripoles/nfet/base width/.initial=.5}
+\ctikzset{tripoles/nfet/gate width/.initial=.62}
+\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nfet/curr direction/.initial=1}
+
+\ctikzset{tripoles/pfet/width/.initial=.7}
+\ctikzset{tripoles/pfet/gate height/.initial=.35}
+\ctikzset{tripoles/pfet/base height/.initial=.5}
+\ctikzset{tripoles/pfet/conn height/.initial=0}
+\ctikzset{tripoles/pfet/height/.initial=1.1}
+\ctikzset{tripoles/pfet/base width/.initial=.5}
+\ctikzset{tripoles/pfet/gate width/.initial=.62}
+\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pfet/curr direction/.initial=-1}
+
+\ctikzset{tripoles/nigfete/width/.initial=.7}
+\ctikzset{tripoles/nigfete/gate height/.initial=.35}
+\ctikzset{tripoles/nigfete/base height/.initial=.5}
+\ctikzset{tripoles/nigfete/conn height/.initial=.35}
+\ctikzset{tripoles/nigfete/height/.initial=1.1}
+\ctikzset{tripoles/nigfete/base width/.initial=.5}
+\ctikzset{tripoles/nigfete/gate width/.initial=.62}
+\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nigfete/curr direction/.initial=1}
+
+\ctikzset{tripoles/nigfetd/width/.initial=.7}
+\ctikzset{tripoles/nigfetd/gate height/.initial=.35}
+\ctikzset{tripoles/nigfetd/base height/.initial=.5}
+\ctikzset{tripoles/nigfetd/conn height/.initial=.35}
+\ctikzset{tripoles/nigfetd/height/.initial=1.1}
+\ctikzset{tripoles/nigfetd/base width/.initial=.5}
+\ctikzset{tripoles/nigfetd/gate width/.initial=.62}
+\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nigfetd/curr direction/.initial=1}
+
+\ctikzset{tripoles/nigfetebulk/width/.initial=.7}
+\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
+\ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
+\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
+\ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
+\ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
+\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
+\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
+
+\ctikzset{tripoles/pigfete/width/.initial=.7}
+\ctikzset{tripoles/pigfete/gate height/.initial=.35}
+\ctikzset{tripoles/pigfete/base height/.initial=.5}
+\ctikzset{tripoles/pigfete/conn height/.initial=.35}
+\ctikzset{tripoles/pigfete/height/.initial=1.1}
+\ctikzset{tripoles/pigfete/base width/.initial=.5}
+\ctikzset{tripoles/pigfete/gate width/.initial=.62}
+\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pigfete/curr direction/.initial=-1}
+
+\ctikzset{tripoles/pigfetd/width/.initial=.7}
+\ctikzset{tripoles/pigfetd/gate height/.initial=.35}
+\ctikzset{tripoles/pigfetd/base height/.initial=.5}
+\ctikzset{tripoles/pigfetd/conn height/.initial=.35}
+\ctikzset{tripoles/pigfetd/height/.initial=1.1}
+\ctikzset{tripoles/pigfetd/base width/.initial=.5}
+\ctikzset{tripoles/pigfetd/gate width/.initial=.62}
+\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
+
+\ctikzset{tripoles/pigfetebulk/width/.initial=.7}
+\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
+\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
+\ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
+\ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
+\ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
+\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
+\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
+
+\ctikzset{tripoles/npn/width/.initial=.6}
+\ctikzset{tripoles/npn/base height/.initial=.45}
+\ctikzset{tripoles/npn/base height 2/.initial=.15}
+\ctikzset{tripoles/npn/base height/.initial=.4}
+\ctikzset{tripoles/npn/conn height/.initial=0}
+\ctikzset{tripoles/npn/height/.initial=1.1}
+\ctikzset{tripoles/npn/base width/.initial=.5}
+\ctikzset{tripoles/npn/arrow pos/.initial=.5}
+\ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/npn/curr direction/.initial=1}
+
+\ctikzset{tripoles/pnp/width/.initial=.6}
+\ctikzset{tripoles/pnp/base height/.initial=.45}
+\ctikzset{tripoles/pnp/base height 2/.initial=.15}
+\ctikzset{tripoles/pnp/base height/.initial=.4}
+\ctikzset{tripoles/pnp/conn height/.initial=0}
+\ctikzset{tripoles/pnp/height/.initial=1.1}
+\ctikzset{tripoles/pnp/base width/.initial=.5}
+\ctikzset{tripoles/pnp/arrow pos/.initial=.5}
+\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pnp/curr direction/.initial=-1}
+
+\ctikzset{tripoles/pigbt/width/.initial=.6}
+\ctikzset{tripoles/pigbt/gate height/.initial=.45}
+\ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
+\ctikzset{tripoles/pigbt/base height/.initial=.4}
+\ctikzset{tripoles/pigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
+\ctikzset{tripoles/pigbt/conn height/.initial=0}
+\ctikzset{tripoles/pigbt/height/.initial=1.1}
+\ctikzset{tripoles/pigbt/gate width/.initial=.62}
+\ctikzset{tripoles/pigbt/base width/.initial=.5}
+\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pigbt/curr direction/.initial=-1}
+
+\ctikzset{tripoles/nigbt/width/.initial=.6}
+\ctikzset{tripoles/nigbt/gate height/.initial=.45}
+\ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
+\ctikzset{tripoles/nigbt/base height/.initial=.4}
+\ctikzset{tripoles/nigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
+\ctikzset{tripoles/nigbt/conn height/.initial=0}
+\ctikzset{tripoles/nigbt/height/.initial=1.1}
+\ctikzset{tripoles/nigbt/gate width/.initial=.62}
+\ctikzset{tripoles/nigbt/base width/.initial=.5}
+\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nigbt/curr direction/.initial=1}
+
+\ctikzset{tripoles/Lpigbt/width/.initial=.6}
+\ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
+\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
+\ctikzset{tripoles/Lpigbt/base height/.initial=.4}
+\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
+\ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
+\ctikzset{tripoles/Lpigbt/height/.initial=1.1}
+\ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
+\ctikzset{tripoles/Lpigbt/base width/.initial=.5}
+\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
+
+\ctikzset{tripoles/Lnigbt/width/.initial=.6}
+\ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
+\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
+\ctikzset{tripoles/Lnigbt/base height/.initial=.4}
+\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
+\ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
+\ctikzset{tripoles/Lnigbt/height/.initial=1.1}
+\ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
+\ctikzset{tripoles/Lnigbt/base width/.initial=.5}
+\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
+
+\ctikzset{tripoles/igbt/outer base height/.code={
+ \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
+ \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
+}}
+\ctikzset{tripoles/igbt/outer base thickness/.code={
+ \ctikzset{tripoles/nigbt/outer base thickness=#1}
+ \ctikzset{tripoles/pigbt/outer base thickness=#1}
+ \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
+ \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
+}}
+
+\ctikzset{tripoles/njfet/width/.initial=.7}
+\ctikzset{tripoles/njfet/gate height/.initial=.5}
+\ctikzset{tripoles/njfet/gate height 2/.initial=.35}
+\ctikzset{tripoles/njfet/gate width/.initial=.5}
+\ctikzset{tripoles/njfet/conn height/.initial=.35}
+\ctikzset{tripoles/njfet/height/.initial=1.1}
+\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/njfet/curr direction/.initial=1}
+
+\ctikzset{tripoles/pjfet/width/.initial=.7}
+\ctikzset{tripoles/pjfet/gate height/.initial=.5}
+\ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
+\ctikzset{tripoles/pjfet/gate width/.initial=.5}
+\ctikzset{tripoles/pjfet/conn height/.initial=.35}
+\ctikzset{tripoles/pjfet/height/.initial=1.1}
+\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pjfet/curr direction/.initial=-1}
+
+\ctikzset{tripoles/isfet/width/.initial=1}
+\ctikzset{tripoles/isfet/gate height/.initial=.35}
+\ctikzset{tripoles/isfet/base height/.initial=.5}
+\ctikzset{tripoles/isfet/height/.initial=1.1}
+\ctikzset{tripoles/isfet/base width/.initial=.3}
+\ctikzset{tripoles/isfet/gate width/.initial=.5}
+\ctikzset{tripoles/isfet/conn height/.initial=0}
+\ctikzset{tripoles/isfet/wave width/.initial=.16}
+\ctikzset{tripoles/isfet/wave amp/.initial=.06}
+\ctikzset{tripoles/isfet/waves y sep/.initial=.22}
+\ctikzset{tripoles/isfet/waves x sep/.initial=.8}
+\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/isfet/curr direction/.initial=1}
+%
+% multi-emitter and multi-collector BJTs by Romano Giannetti
+%
+\ctikzset{tripoles/bjt/emitters/.initial=1}
+\ctikzset{tripoles/bjt/collectors/.initial=1}
+\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
+\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
+\ctikzset{tripoles/bjt/pins width/.initial=0.3}
+\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
+\ctikzset{tripoles/bjt/multi height/.initial=.5}
+\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
+%
+\ctikzset{tripoles/bjt/width/.initial=.3}
+\ctikzset{tripoles/bjt/base height 2/.initial=.4}
+\ctikzset{tripoles/bjt/base height/.initial=1.1}
+\ctikzset{tripoles/bjt/height/.initial=.4}
+\ctikzset{tripoles/bjt/base width/.initial=1}
+\ctikzset{tripoles/bjt/arrow pos/.initial=.5}
+% do NOT touch these two!
+\ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
+\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
+
+%% transistors stop here
+
+%% Logic ports
+
+\newif\ifpgf at circuit@europeanlogicport
+\ctikzset{logic ports/.is choice}
+\ctikzset{logic ports/european/.code= {\pgf at circuit@europeanlogicporttrue
+ \tikzset{and port/.style={shape=european and port}}%
+ \tikzset{or port/.style={shape=european or port}}%
+ \tikzset{xor port/.style={shape=european xor port}}%
+ \tikzset{buffer port/.style={shape=european buffer port}}%
+ \tikzset{not port/.style={shape=european not port}}%
+ \tikzset{nand port/.style={shape=european nand port}}%
+ \tikzset{nor port/.style={shape=european nor port}}%
+ \tikzset{xnor port/.style={shape=european xnor port}}%
+}}
+\ctikzset{logic ports/american/.code= {\pgf at circuit@europeanlogicportfalse
+ \tikzset{and port/.style={shape=american and port}}%
+ \tikzset{or port/.style={shape=american or port}}%
+ \tikzset{xor port/.style={shape=american xor port}}%
+ \tikzset{buffer port/.style={shape=american buffer port}}%
+ \tikzset{not port/.style={shape=american not port}}%
+ \tikzset{nand port/.style={shape=american nand port}}%
+ \tikzset{nor port/.style={shape=american nor port}}%
+ \tikzset{xnor port/.style={shape=american xnor port}}%
+}}
+
+\ctikzset{logic ports origin/.is choice}
+\ctikzset{logic ports origin/legacy/.code={
+ \ctikzset{tripoles/american and port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american or port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european and port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european or port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european not port/origin/.initial=0.8}%
+ }%
+}
+\ctikzset{logic ports origin/center/.code={%
+ \ctikzset{tripoles/american and port/origin/.initial=0}%
+ \ctikzset{tripoles/american nand port/origin/.initial=0}%
+ \ctikzset{tripoles/american nor port/origin/.initial=0}%
+ \ctikzset{tripoles/american or port/origin/.initial=0}%
+ \ctikzset{tripoles/american xor port/origin/.initial=0}%
+ \ctikzset{tripoles/american xnor port/origin/.initial=0}%
+ \ctikzset{tripoles/european and port/origin/.initial=0}%
+ \ctikzset{tripoles/european nand port/origin/.initial=0}%
+ \ctikzset{tripoles/european or port/origin/.initial=0}%
+ \ctikzset{tripoles/european nor port/origin/.initial=0}%
+ \ctikzset{tripoles/european xor port/origin/.initial=0}%
+ \ctikzset{tripoles/european xnor port/origin/.initial=0}%
+ \ctikzset{tripoles/european buffer port/origin/.initial=0}%
+ \ctikzset{tripoles/european not port/origin/.initial=0}%
+ }%
+}
+
+\newif\ifpgfcirc at roundy@or at shapes\pgfcirc at roundy@or at shapesfalse
+\ctikzset{american or shape/.is choice}
+\ctikzset{american or shape/roundy/.code={\pgfcirc at roundy@or at shapestrue}}
+\ctikzset{american or shape/pointy/.code={\pgfcirc at roundy@or at shapesfalse}}
+
+\newif\ifpgfcirc at draw@leads\pgfcirc at draw@leadstrue
+\ctikzset{logic ports draw input leads/.is choice}
+\ctikzset{logic ports draw input leads/true/.code={\pgfcirc at draw@leadstrue}}
+\ctikzset{logic ports draw input leads/false/.code={\pgfcirc at draw@leadsfalse}}
+\tikzset{input leads/.code={\pgfcirc at draw@leadstrue}}
+\tikzset{no input leads/.code={\pgfcirc at draw@leadsfalse}}
+
+\ctikzset{tripoles/american and port/width/.initial=1.1}
+\ctikzset{tripoles/american and port/height/.initial=.8}
+\ctikzset{tripoles/american and port/port width/.initial=.7}
+\ctikzset{tripoles/american and port/input height/.initial=.5}
+\ctikzset{tripoles/american nand port/width/.initial=1.1}
+\ctikzset{tripoles/american nand port/height/.initial=.8}
+\ctikzset{tripoles/american nand port/port width/.initial=.7}
+\ctikzset{tripoles/american nand port/circle width/.initial=.15}
+\ctikzset{tripoles/american nand port/input height/.initial=.5}
+\ctikzset{tripoles/american or port/width/.initial=1.1}
+\ctikzset{tripoles/american or port/height/.initial=.8}
+\ctikzset{tripoles/american or port/port width/.initial=.7}
+\ctikzset{tripoles/american or port/input height/.initial=.5}
+\ctikzset{tripoles/american or port/input skip/.initial=.25}
+\ctikzset{tripoles/american or port/aaa/.initial=.6}
+\ctikzset{tripoles/american or port/bbb/.initial=.4}
+\ctikzset{tripoles/american or port/ccc/.initial=.5}
+\ctikzset{tripoles/american or port/ddd/.initial=.0}
+\ctikzset{tripoles/american nor port/width/.initial=1.1}
+\ctikzset{tripoles/american nor port/height/.initial=.8}
+\ctikzset{tripoles/american nor port/port width/.initial=.7}
+\ctikzset{tripoles/american nor port/input height/.initial=.5}
+\ctikzset{tripoles/american nor port/input skip/.initial=.25}
+\ctikzset{tripoles/american nor port/circle width/.initial=.15}
+\ctikzset{tripoles/american nor port/aaa/.initial=.6}
+\ctikzset{tripoles/american nor port/bbb/.initial=.4}
+\ctikzset{tripoles/american nor port/ccc/.initial=.5}
+\ctikzset{tripoles/american nor port/ddd/.initial=.0}
+\ctikzset{tripoles/american xor port/width/.initial=1.1}
+\ctikzset{tripoles/american xor port/height/.initial=.8}
+\ctikzset{tripoles/american xor port/port width/.initial=.7}
+\ctikzset{tripoles/american xor port/input height/.initial=.5}
+\ctikzset{tripoles/american xor port/input skip/.initial=.15}
+\ctikzset{tripoles/american xor port/distance/.initial=.1}
+\ctikzset{tripoles/american xnor port/width/.initial=1.1}
+\ctikzset{tripoles/american xnor port/height/.initial=.8}
+\ctikzset{tripoles/american xnor port/port width/.initial=.7}
+\ctikzset{tripoles/american xnor port/input height/.initial=.5}
+\ctikzset{tripoles/american xnor port/input skip/.initial=.15}
+\ctikzset{tripoles/american xnor port/distance/.initial=.1}
+\ctikzset{tripoles/american xnor port/circle width/.initial=.15}
+\ctikzset{tripoles/american and port/origin/.initial=0.8}
+\ctikzset{tripoles/american and port/inputs/.initial=2}
+% variable number of inputs
+\ctikzset{tripoles/american nand port/origin/.initial=0.8}
+\ctikzset{tripoles/american nand port/inputs/.initial=2}
+\ctikzset{tripoles/american nor port/origin/.initial=0.8}
+\ctikzset{tripoles/american nor port/inputs/.initial=2}
+\ctikzset{tripoles/american nor port/angle/.initial=70}
+\ctikzset{tripoles/american nor port/inner/.initial=0.3}
+\ctikzset{tripoles/american or port/origin/.initial=0.8}
+\ctikzset{tripoles/american or port/inputs/.initial=2}
+\ctikzset{tripoles/american or port/angle/.initial=70}
+\ctikzset{tripoles/american or port/inner/.initial=0.3}
+\ctikzset{tripoles/american xor port/origin/.initial=0.8}
+\ctikzset{tripoles/american xor port/inputs/.initial=2}
+\ctikzset{tripoles/american xor port/angle/.initial=70}
+\ctikzset{tripoles/american xor port/inner/.initial=0.3}
+\ctikzset{tripoles/american xnor port/origin/.initial=0.8}
+\ctikzset{tripoles/american xnor port/inputs/.initial=2}
+\ctikzset{tripoles/american xnor port/angle/.initial=70}
+\ctikzset{tripoles/american xnor port/inner/.initial=0.3}
+
+\ctikzset{tripoles/european and port/width/.initial=1.4}
+\ctikzset{tripoles/european and port/height/.initial=.65}
+\ctikzset{tripoles/european and port/reserved/.initial=.6}
+\ctikzset{tripoles/european and port/input height/.initial=.6}
+\ctikzset{tripoles/european or port/width/.initial=1.4}
+\ctikzset{tripoles/european or port/height/.initial=.65}
+\ctikzset{tripoles/european or port/reserved/.initial=.6}
+\ctikzset{tripoles/european or port/input height/.initial=.6}
+\ctikzset{tripoles/european xor port/width/.initial=1.4}
+\ctikzset{tripoles/european xor port/height/.initial=.65}
+\ctikzset{tripoles/european xor port/reserved/.initial=.6}
+\ctikzset{tripoles/european xor port/input height/.initial=.6}
+\ctikzset{tripoles/european nand port/width/.initial=1.4}
+\ctikzset{tripoles/european nand port/not height/.initial=.3}
+\ctikzset{tripoles/european nand port/not width/.initial=.8}
+\ctikzset{tripoles/european nand port/height/.initial=.65}
+\ctikzset{tripoles/european nand port/reserved/.initial=.6}
+\ctikzset{tripoles/european nand port/input height/.initial=.6}
+\ctikzset{tripoles/european buffer port/width/.initial=1.4}
+\ctikzset{tripoles/european buffer port/not height/.initial=.3}
+\ctikzset{tripoles/european buffer port/not width/.initial=.8}
+\ctikzset{tripoles/european buffer port/height/.initial=.65}
+\ctikzset{tripoles/european buffer port/reserved/.initial=.6}
+\ctikzset{tripoles/european buffer port/input height/.initial=0}
+\ctikzset{tripoles/european not port/width/.initial=1.4}
+\ctikzset{tripoles/european not port/not height/.initial=.3}
+\ctikzset{tripoles/european not port/not width/.initial=.8}
+\ctikzset{tripoles/european not port/height/.initial=.65}
+\ctikzset{tripoles/european not port/reserved/.initial=.6}
+\ctikzset{tripoles/european not port/input height/.initial=0}
+\ctikzset{tripoles/european xnor port/width/.initial=1.4}
+\ctikzset{tripoles/european xnor port/not height/.initial=.3}
+\ctikzset{tripoles/european xnor port/not width/.initial=.8}
+\ctikzset{tripoles/european xnor port/height/.initial=.65}
+\ctikzset{tripoles/european xnor port/reserved/.initial=.6}
+\ctikzset{tripoles/european xnor port/input height/.initial=.6}
+\ctikzset{tripoles/european nor port/width/.initial=1.4}
+\ctikzset{tripoles/european nor port/not height/.initial=.3}
+\ctikzset{tripoles/european nor port/not width/.initial=.8}
+\ctikzset{tripoles/european nor port/height/.initial=.65}
+\ctikzset{tripoles/european nor port/reserved/.initial=.6}
+\ctikzset{tripoles/european nor port/input height/.initial=.6}
+% variable number of inputs
+\ctikzset{tripoles/european and port/origin/.initial=0.8}
+\ctikzset{tripoles/european and port/inputs/.initial=2}
+\ctikzset{tripoles/european nand port/origin/.initial=0.8}
+\ctikzset{tripoles/european nand port/inputs/.initial=2}
+\ctikzset{tripoles/european or port/origin/.initial=0.8}
+\ctikzset{tripoles/european or port/inputs/.initial=2}
+\ctikzset{tripoles/european nor port/origin/.initial=0.8}
+\ctikzset{tripoles/european nor port/inputs/.initial=2}
+\ctikzset{tripoles/european xor port/origin/.initial=0.8}
+\ctikzset{tripoles/european xor port/inputs/.initial=2}
+\ctikzset{tripoles/european xnor port/origin/.initial=0.8}
+\ctikzset{tripoles/european xnor port/inputs/.initial=2}
+\ctikzset{tripoles/european buffer port/origin/.initial=0.8}
+\ctikzset{tripoles/european buffer port/inputs/.initial=1}%
+\ctikzset{tripoles/european not port/origin/.initial=0.8}
+\ctikzset{tripoles/european not port/inputs/.initial=1}%
+%%% parameters that are not used anymore after multi-input
+%%% gates --- left for compatibility of source code.
+\ctikzset{tripoles/american xor port/aaa/.initial=.6}
+\ctikzset{tripoles/american xor port/bbb/.initial=.4}
+\ctikzset{tripoles/american xor port/ccc/.initial=.5}
+\ctikzset{tripoles/american xor port/ddd/.initial=.0}
+\ctikzset{tripoles/american xnor port/aaa/.initial=.6}
+\ctikzset{tripoles/american xnor port/bbb/.initial=.4}
+\ctikzset{tripoles/american xnor port/ccc/.initial=.5}
+\ctikzset{tripoles/american xnor port/ddd/.initial=.0}
+% switches for logic gates
+%
+\pgfkeys{/tikz/number inputs/.initial=0}
+\pgfkeys{/tikz/number inputs/.default=0}
+
+%% flip-flop specific keys (most others are the same as chips)
+
+\ctikzset{multipoles/flipflop/font/.initial=\pgf at circ@font at small}
+\ctikzset{multipoles/flipflop/fontud/.initial=\pgf at circ@font at tiny}
+\ctikzset{multipoles/flipflop/width/.initial=1.2}
+\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
+\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
+
+%% muxdemuxes keys
+
+\ctikzset{multipoles/muxdemux/base len/.initial=0.4}
+\ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
+\ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
+\ctikzset{multipoles/muxdemux/w/.initial=3.0}
+\ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
+\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
+\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
+\ctikzset{multipoles/muxdemux/NL/.initial=8}
+\ctikzset{multipoles/muxdemux/NR/.initial=1}
+\ctikzset{multipoles/muxdemux/NB/.initial=3}
+\ctikzset{multipoles/muxdemux/NT/.initial=0}
+\ctikzset{multipoles/muxdemux/square pins/.initial=0}
+%
+% switches for op amps
+% changing input polarity
+%
+\newif\ifpgf at circuit@oa at iplusup\pgf at circuit@oa at iplusupfalse
+\pgfkeys{/tikz/noinv input up/.add code={}{\pgf at circuit@oa at iplusuptrue}}
+\ctikzset{noinv input up/.add code={}{\pgf at circuit@oa at iplusuptrue}}
+\pgfkeys{/tikz/noinv input down/.add code={}{\pgf at circuit@oa at iplusupfalse}}
+\ctikzset{noinv input down/.add code={}{\pgf at circuit@oa at iplusupfalse}}
+%
+% changing output polarity (for fully diff objects)
+%
+\newif\ifpgf at circuit@oa at oplusup\pgf at circuit@oa at oplusuptrue
+\pgfkeys{/tikz/noinv output up/.add code={}{\pgf at circuit@oa at oplusuptrue}}
+\ctikzset{noinv output up/.add code={}{\pgf at circuit@oa at oplusuptrue}}
+\pgfkeys{/tikz/noinv output down/.add code={}{\pgf at circuit@oa at oplusupfalse}}
+\ctikzset{noinv output down/.add code={}{\pgf at circuit@oa at oplusupfalse}}
+
+% Operational amplifier
+\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
+\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
+\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
+\ctikzset{tripoles/op amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Fully differential operational amplifier
+\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
+\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
+\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
+\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
+\ctikzset{tripoles/fd op amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+\ctikzset{tripoles/en amp/width/.initial=1.7}
+\ctikzset{tripoles/en amp/port width/.initial=.7}
+\ctikzset{tripoles/en amp/height/.initial=1.6}
+\ctikzset{tripoles/en amp/input height/.initial=.3}
+\ctikzset{tripoles/en amp/up pos/.initial=.45}
+\ctikzset{tripoles/en amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+\ctikzset{tripoles/en amp/font2/.initial=\pgf at circ@font at twelve} % Absolute font size needed!
+\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
+\tikzset{
+ en amp text/.code = {%
+ \ctikzsetvalof{tripoles/en amp/text}{#1}%
+ },
+ en amp text A/.code = {%
+ \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
+ },
+}
+
+% Transconductance amplifier
+\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
+\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
+\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
+\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
+\ctikzset{tripoles/gm amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Instrumentation amplifier
+\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
+\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
+\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
+\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
+\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
+\ctikzset{tripoles/inst amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Instrumentation amplifier with differential output
+\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
+\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
+\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
+\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
+\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
+\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
+\ctikzset{tripoles/fd inst amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Instrumentation amplifier with gain resistor terminals
+\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
+\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
+\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
+\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
+\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
+\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
+\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
+\ctikzset{tripoles/inst amp ra/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Plain amplifier
+\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
+\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
+\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
+
+% changing fonts and symbols of amplifiers
+\ctikzset{amplifiers/symbol font/.code={%
+ \ctikzset{tripoles/inst amp ra/font=#1}%
+ \ctikzset{tripoles/fd inst amp/font=#1}%
+ \ctikzset{tripoles/inst amp/font=#1}%
+ \ctikzset{tripoles/gm amp/font=#1}%
+ \ctikzset{tripoles/en amp/font=#1}%
+ \ctikzset{tripoles/fd op amp/font=#1}%
+ \ctikzset{tripoles/op amp/font=#1}%
+}}
+\ctikzset{amplifiers/plus/.initial={$+$}}
+\ctikzset{amplifiers/minus/.initial={$-$}}
+\tikzset{amp symbol font/.code={%
+ \ctikzset{amplifiers/symbol font={#1}}%
+ }
+}
+\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
+\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
+\def\pgf at circ@ampli at plus{\ctikzvalof{amplifiers/plus}}
+\def\pgf at circ@ampli at minus{\ctikzvalof{amplifiers/minus}}
+
+\ctikzset{tripoles/thyristor/height/.initial=1.10}
+\ctikzset{tripoles/thyristor/height 2/.initial=.5}
+\ctikzset{tripoles/thyristor/width/.initial=1.0}
+\ctikzset{tripoles/thyristor/diode height/.initial=.5}
+\ctikzset{tripoles/thyristor/diode width left/.initial=.4}
+\ctikzset{tripoles/thyristor/diode width right/.initial=.3}
+
+\ctikzset{tripoles/triac/height/.initial=1.1}
+\ctikzset{tripoles/triac/width/.initial=1}
+\ctikzset{tripoles/triac/diode width left/.initial=.3}
+\ctikzset{tripoles/triac/diode width right/.initial=.3}
+
+%% Cute switches
+\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
+\ctikzset{bipoles/cuteswitch/height/.initial=.6}
+\ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
+\ctikzset{bipoles/cuteswitch/width/.initial=.50}
+\ctikzset{bipoles/cuteswitch/thickness/.initial=1}
+
+\ctikzset{tripoles/spdt/width/.initial=.85}
+\ctikzset{tripoles/spdt/height/.initial=.45}
+\ctikzset{tripoles/spdt/margin/.initial=.45}
+
+\ctikzset{tripoles/toggleswitch/height/.initial=.8}
+\ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
+\ctikzset{tripoles/toggleswitch/width/.initial=.80}
+
+\ctikzset{tripoles/mixer/width/.initial=0.7}
+\ctikzset{tripoles/adder/width/.initial=0.7}
+\ctikzset{tripoles/circulator/width/.initial=.7}
+\ctikzset{tripoles/oscillator/width/.initial=.7}
+
+
+\ctikzset{tripoles/wilkinson/height/.initial=1.3}
+\ctikzset{tripoles/wilkinson/width/.initial=1.3}
+
+\ctikzset{quadpoles/transformer/inner/.initial=0.4}
+\ctikzset{quadpoles/transformer/width/.initial=1.5}
+\ctikzset{quadpoles/transformer/width1/.initial=.4}
+\ctikzset{quadpoles/transformer/height/.initial=1.5}
+\ctikzset{quadpoles/transformer/height1/.initial=.8}
+\ctikzset{quadpoles/transformer core/inner/.initial=0.4}
+\ctikzset{quadpoles/transformer core/width/.initial=1.5}
+\ctikzset{quadpoles/transformer core/height/.initial=1.5}
+\ctikzset{quadpoles/transformer core/core height/.initial=.5}
+\ctikzset{quadpoles/transformer core/core width/.initial=.05}
+\ctikzset{quadpoles/gyrator/inner/.initial=0.4}
+\ctikzset{quadpoles/gyrator/width/.initial=1.5}
+\ctikzset{quadpoles/gyrator/height/.initial=1.5}
+\ctikzset{quadpoles/fourport/width/.initial=1.3}
+\ctikzset{quadpoles/fourport/height/.initial=1.3}
+\ctikzset{quadpoles/coupler/width/.initial=1.3}
+\ctikzset{quadpoles/coupler/height/.initial=1.3}
+\ctikzset{quadpoles/coupler2/width/.initial=1.3}
+\ctikzset{quadpoles/coupler2/height/.initial=1.3}
+
+\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
+
+\ctikzset{quadpoles style/.is choice}
+\ctikzset{quadpoles style/inward/.code={% default value
+ \ctikzset{quadpoles/transformer/inner=0.4}%
+ \ctikzset{quadpoles/transformer/width=1.5}%
+ \ctikzset{quadpoles/transformer core/inner=0.4}%
+ \ctikzset{quadpoles/transformer core/width=1.5}%
+ \ctikzset{quadpoles/gyrator/inner=0.4}%
+ \ctikzset{quadpoles/gyrator/width=1.5}%
+ }%
+}
+\ctikzset{quadpoles style/inline/.code={% now horizontal baffle
+ \ctikzset{quadpoles/transformer/inner=1}%
+ \ctikzset{quadpoles/transformer/width=0.6}%
+ \ctikzset{quadpoles/transformer core/inner=1}%
+ \ctikzset{quadpoles/transformer core/width=0.6}%
+ \ctikzset{quadpoles/gyrator/inner=1} % FIXME
+ \ctikzset{quadpoles/gyrator/width=0.6}%
+ }%
+}
+
+%
+% multipoles
+%
+\ctikzset{multipoles/thickness/.initial=2}
+\ctikzset{multipoles/font/.initial=\pgf at circ@font at tiny}
+% DIP (dual in line package) chips
+\ctikzset{multipoles/dipchip/width/.initial=1.2}
+\ctikzset{multipoles/dipchip/num pins/.initial=8}
+\ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
+\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
+% QFP (quad flat package) chips
+\ctikzset{multipoles/qfpchip/num pins/.initial=8}
+\ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
+\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
+% chip numbers
+\newif\ifpgf at circuit@chip at shownumbers\pgf at circuit@chip at shownumberstrue
+\pgfkeys{/tikz/show numbers/.add code={}{\pgf at circuit@chip at shownumberstrue}}
+\ctikzset{show numbers/.add code={}{\pgf at circuit@chip at shownumberstrue}}
+\pgfkeys{/tikz/hide numbers/.add code={}{\pgf at circuit@chip at shownumbersfalse}}
+\ctikzset{hide numbers/.add code={}{\pgf at circuit@chip at shownumbersfalse}}
+\newif\ifpgf at circuit@chip at straightnumbers\pgf at circuit@chip at straightnumberstrue
+\pgfkeys{/tikz/straight numbers/.add code={}{\pgf at circuit@chip at straightnumberstrue}}
+\ctikzset{straight numbers/.add code={}{\pgf at circuit@chip at straightnumberstrue}}
+\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf at circuit@chip at straightnumbersfalse}}
+\ctikzset{rotated numbers/.add code={}{\pgf at circuit@chip at straightnumbersfalse}}
+% external chip pins
+\ctikzset{multipoles/external pins thickness/.initial=1}
+\ctikzset{multipoles/external pins width/.initial=0.2}
+\ctikzset{multipoles/external pad fraction/.initial=0}
+\pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
+\pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
+% topmarks
+\newif\ifpgf at circuit@chip at topmark\pgf at circuit@chip at topmarktrue
+\pgfkeys{/tikz/topmark/.add code={}{\pgf at circuit@chip at topmarktrue}}
+\ctikzset{topmark/.add code={}{\pgf at circuit@chip at topmarktrue}}
+\pgfkeys{/tikz/no topmark/.add code={}{\pgf at circuit@chip at topmarkfalse}}
+\ctikzset{no topmark/.add code={}{\pgf at circuit@chip at topmarkfalse}}
+
+% rotary switch by Romano
+\ctikzset{multipoles/rotary/thickness/.initial=1}
+\ctikzset{multipoles/rotary/shape/.initial=ocirc}
+\ctikzset{multipoles/rotary/channels/.initial=5}
+\ctikzset{multipoles/rotary/angle/.initial=60}
+\ctikzset{multipoles/rotary/wiper/.initial=20}
+\ctikzset{multipoles/rotary/arrow/.is choice}
+\newif\ifpgf at circ@rotaryarrow\pgf at circ@rotaryarrowfalse
+\newif\ifpgf at circ@rotaryarrow at cw\pgf at circ@rotaryarrow at cwfalse
+\newif\ifpgf at circ@rotaryarrow at ccw\pgf at circ@rotaryarrow at ccwfalse
+\ctikzset{multipoles/rotary/arrow/none/.code={\pgf at circ@rotaryarrowfalse\pgf at circ@rotaryarrow at cwfalse\pgf at circ@rotaryarrow at ccwfalse}}
+\ctikzset{multipoles/rotary/arrow/both/.code={\pgf at circ@rotaryarrowtrue\pgf at circ@rotaryarrow at cwtrue\pgf at circ@rotaryarrow at ccwtrue}}
+\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf at circ@rotaryarrowtrue\pgf at circ@rotaryarrow at cwtrue\pgf at circ@rotaryarrow at ccwfalse}}
+\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf at circ@rotaryarrowtrue\pgf at circ@rotaryarrow at cwfalse\pgf at circ@rotaryarrow at ccwtrue}}
+
+\tikzset{%
+ rotary switch/.style args={#1in#2wiper#3}{%
+ shape=rotaryswitch,
+ /tikz/circuitikz/multipoles/rotary/channels=#1,
+ /tikz/circuitikz/multipoles/rotary/angle=#2,
+ /tikz/circuitikz/multipoles/rotary/wiper=#3,
+ },
+ rotary switch -/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=none,
+ },
+ rotary switch <-/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=ccw,
+ },
+ rotary switch ->/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=cw,
+ },
+ rotary switch <->/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=both,
+ },
+ % Notice that these should be the same as the initial values of the keys
+ rotary switch/.default={5 in 60 wiper 20},
+ rotary switch -/.default={5 in 60 wiper 20},
+ rotary switch <-/.default={5 in 60 wiper 20},
+ rotary switch ->/.default={5 in 60 wiper 20},
+ rotary switch <->/.default={5 in 60 wiper 20},
+}
+
+% %Mechanical section
+\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
+\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
+\ctikzset{bipoles/spring/height/.initial=.5}
+\ctikzset{bipoles/spring/width/.initial=.5}
+\ctikzset{bipoles/inerter/height/.initial=.7}
+\ctikzset{bipoles/inerter/width/.initial=.175}
+\ctikzset{bipoles/mass/height/.initial=.55}
+\ctikzset{bipoles/mass/box height/.initial=.4}
+\ctikzset{bipoles/mass/width/.initial=.5}
+
+\ctikzset{bipoles/damper/height/.initial=.35}
+\ctikzset{bipoles/damper/length/.initial=.3}
+\ctikzset{bipoles/damper/width/.initial=.4}
+
+
+\ctikzset{bipole/.is family}
+\ctikzset{bipole/kind/.initial=}
+\ctikzset{bipole/name/.initial=}
+\newif\ifpgf at circuit@bipole at isvoltage
+\ctikzset{bipole/is voltage/.is if=pgf at circuit@bipole at isvoltage}
+\newif\ifpgf at circuit@bipole at voltageoutsideofsymbol
+\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf at circuit@bipole at voltageoutsideofsymbol}
+\newif\ifpgf at circuit@bipole at strokedsymbol
+\ctikzset{bipole/is strokedsymbol/.is if=pgf at circuit@bipole at strokedsymbol}
+\newif\ifpgf at circuit@bipole at iscurrent
+\ctikzset{bipole/is current/.is if=pgf at circuit@bipole at iscurrent}
+
+\ctikzset{bipole/voltage/.is family}
+\newif\ifpgf at circuit@bipole at voltage@backward
+\ctikzset{bipole/voltage/direction/.is choice}
+\ctikzset{bipole/voltage/direction/forward/.code={\pgf at circuit@bipole at voltage@backwardfalse}}
+\ctikzset{bipole/voltage/direction/backward/.code={\pgf at circuit@bipole at voltage@backwardtrue}}
+\newif\ifpgf at circuit@bipole at voltage@below
+\ctikzset{bipole/voltage/position/.is choice}
+\ctikzset{bipole/voltage/position/above/.code={\pgf at circuit@bipole at voltage@belowfalse}}
+\ctikzset{bipole/voltage/position/below/.code={\pgf at circuit@bipole at voltage@belowtrue}}
+
+\ctikzset{bipole/voltage/label/unit/.initial=}
+\ctikzset{bipole/voltage/label/name/.initial=}
+
+\ctikzset{bipole/current/.is family}
+\newif\ifpgf at circuit@bipole at current@backward
+\ctikzset{bipole/current/direction/.is choice}
+\ctikzset{bipole/current/direction/forward/.code={\pgf at circuit@bipole at current@backwardfalse}}
+\ctikzset{bipole/current/direction/backward/.code={\pgf at circuit@bipole at current@backwardtrue}}
+\newif\ifpgf at circuit@bipole at current@before
+\ctikzset{bipole/current/x position/.is choice}
+\ctikzset{bipole/current/x position/after/.code={\pgf at circuit@bipole at current@beforefalse}}
+\ctikzset{bipole/current/x position/before/.code={\pgf at circuit@bipole at current@beforetrue}}
+\newif\ifpgf at circuit@bipole at current@below
+\ctikzset{bipole/current/y position/.is choice}
+\ctikzset{bipole/current/y position/above/.code={\pgf at circuit@bipole at current@belowfalse}}
+\ctikzset{bipole/current/y position/below/.code={\pgf at circuit@bipole at current@belowtrue}}
+\ctikzset{bipole/current/label/unit/.initial=}
+\ctikzset{bipole/current/label/name/.initial=}
+
+\ctikzset{bipole/flow/.is family}
+\newif\ifpgf at circuit@bipole at flow@backward
+\ctikzset{bipole/flow/direction/.is choice}
+\ctikzset{bipole/flow/direction/forward/.code={\pgf at circuit@bipole at flow@backwardfalse}}
+\ctikzset{bipole/flow/direction/backward/.code={\pgf at circuit@bipole at flow@backwardtrue}}
+\newif\ifpgf at circuit@bipole at flow@before
+\ctikzset{bipole/flow/x position/.is choice}
+\ctikzset{bipole/flow/x position/after/.code={\pgf at circuit@bipole at flow@beforefalse}}
+\ctikzset{bipole/flow/x position/before/.code={\pgf at circuit@bipole at flow@beforetrue}}
+\newif\ifpgf at circuit@bipole at flow@below
+\ctikzset{bipole/flow/y position/.is choice}
+\ctikzset{bipole/flow/y position/above/.code={\pgf at circuit@bipole at flow@belowfalse}}
+\ctikzset{bipole/flow/y position/below/.code={\pgf at circuit@bipole at flow@belowtrue}}
+\ctikzset{bipole/flow/label/unit/.initial=}
+\ctikzset{bipole/flow/label/name/.initial=}
+\ctikzset{flow/distance/.initial = .5}
+\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
+
+\ctikzset{bipole/label/.is family}
+\ctikzset{bipole/label/position/.initial=90}
+\ctikzset{bipole/label/unit/.initial=}
+\ctikzset{bipole/label/name/.initial=}
+\ctikzset{bipole/annotation/.is family}
+\ctikzset{bipole/annotation/position/.initial=-90}
+\ctikzset{bipole/annotation/unit/.initial=}
+\ctikzset{bipole/annotation/name/.initial=}
+
+\newif\ifpgf at circuit@europeanresistor
+\ctikzset{resistor/.is choice}
+\ctikzset{resistor/american/.code = \pgf at circuit@europeanresistorfalse }
+\ctikzset{resistor/european/.code = \pgf at circuit@europeanresistortrue }
+
+\ctikzset{inductor/.is choice}
+\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
+\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
+\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
+
+%
+% Flipping arrows in LED and photodiodes
+%
+\newif\ifpgf at led@fliparrows
+\newif\ifpgf at pd@fliparrows
+\pgf at led@fliparrowsfalse
+\pgf at pd@fliparrowsfalse
+%
+% by default the arrows start (LED) and go (PD) to the anode.
+%
+\ctikzset{led arrows from anode/.code=\pgf at led@fliparrowsfalse}
+\ctikzset{pd arrows to anode/.code=\pgf at pd@fliparrowsfalse}
+%
+% but they can start form the cathode (LED) or go to it (PD)
+%
+\ctikzset{led arrows from cathode/.code=\pgf at led@fliparrowstrue}
+\ctikzset{pd arrows to cathode/.code=\pgf at pd@fliparrowstrue}
+
+\newif\ifpgf at circuit@strokediode
+\newif\ifpgf at circuit@fulldiode
+\pgf at circuit@strokediodefalse
+\pgf at circuit@fulldiodefalse
+
+\ctikzset{diode/.is choice}
+\ctikzset{diode/empty/.code = \pgf at circuit@fulldiodefalse\pgf at circuit@strokediodefalse}%default
+\ctikzset{diode/full/.code = \pgf at circuit@fulldiodetrue }
+\ctikzset{diode/stroke/.code = \pgf at circuit@strokediodetrue}
+
+\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
+\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
+\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
+
+\ctikzset{thickness/.initial=2}
+\ctikzset{color/.initial=black}
+\pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
+
+\newif\ifpgf at circ@siunitx
+\newif\ifpgf at circ@siunitx at res
+
+%
+% voltage and current options
+%
+
+\newif\ifpgf at circuit@europeancurrent
+\newif\ifpgf at circuit@europeanvoltage
+\newif\ifpgf at circuit@bipole at voltage@straight
+
+\ctikzset{voltage/.is choice}
+%
+% straight is expected to be a subset of european, so disable it in american style
+%
+\ctikzset{voltage/american/.code = {\pgf at circuit@europeanvoltagefalse\pgf at circuit@bipole at voltage@straightfalse}}
+\ctikzset{voltage/european/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straightfalse}}
+\ctikzset{voltage/straight/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straighttrue}}
+\ctikzset{voltage/curved/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straighttrue}}
+
+\ctikzset{current/.is choice}
+\ctikzset{current/american/.code = \pgf at circuit@europeancurrentfalse}
+\ctikzset{current/european/.code = \pgf at circuit@europeancurrenttrue}
+
+% this is left for backward compatibility...
+\ctikzset{straight/.is choice}
+\ctikzset{straight/true/.code = {\pgf at circuit@bipole at voltage@straighttrue}}
+\ctikzset{straight/false/.code = {\pgf at circuit@bipole at voltage@straightfalse}}
+\ctikzset{bipole/straight/.is if=pgf at circuit@bipole at voltage@straight}
+% never used, removed (RG 2020-05-17)
+% \ctikzset{straightvoltage value/.initial=true}
+% \ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}}
+
+%
+% voltage is used also to set parameters, apart for the /.is choice
+% above. I hope it is ok --- would be a mess otherwise
+%
+
+\ctikzset{voltage/distance from node/.initial=.5} %\pgf at circ@Rlen units
+\ctikzset{voltage/distance from line/.initial=.08} % pos, tra 0 e 1
+\ctikzset{voltage/bump a/.initial=1.2}
+\ctikzset{voltage/bump b/.initial=1.5}
+\ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
+\ctikzset{voltage shift/.style={voltage/shift=#1}}
+\tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
+\ctikzset{voltage/european label distance/.initial=1.4}
+\ctikzset{voltage/american label distance/.initial=1.1}
+% shaping the +/- sign, see pgfcircvoltage.tex
+\ctikzset{voltage/american font/.initial={}}
+\ctikzset{voltage/american plus/.initial={$+$}}
+\ctikzset{voltage/american minus/.initial={$-$}}
+
+% special cases for voltage positions
+\ctikzset{bipoles/generic/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/generic/voltage/bump b/.initial=2}
+\ctikzset{bipoles/generic/voltage/european label distance/.initial=1.8}
+%\ctikzset{bipoles/thermocouple/voltage/distance from node/.initial=.3}
+\ctikzset{bipoles/thermocouple/voltage/bump b/.initial=2.2}
+\ctikzset{bipoles/thermocouple/voltage/european label distance/.initial=1.5}
+\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
+\ctikzset{bipoles/ageneric/voltage/european label distance/.initial=1.8}
+\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
+\ctikzset{bipoles/fullgeneric/voltage/european label distance/.initial=1.8}
+\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
+\ctikzset{bipoles/memristor/voltage/european label distance/.initial=1.8}
+%\ctikzset{bipoles/tline/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
+\ctikzset{bipoles/tline/voltage/european label distance/.initial=2.1}
+%\ctikzset{bipoles/varistor/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
+\ctikzset{bipoles/varistor/voltage/european label distance/.initial=2}
+%\ctikzset{bipoles/photoresistor/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=2}
+\ctikzset{bipoles/photoresistor/voltage/european label distance/.initial=1.8}
+%\ctikzset{bipoles/thermistor/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
+\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=2}
+%\ctikzset{bipoles/thermistorntc/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
+%\ctikzset{bipoles/thermistorptc/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
+%
+% american open voltage adjusting
+%
+\newif\ifpgf at adjust@open at voltage\pgf at adjust@open at voltagetrue
+\ctikzset{american open voltage/.is choice}
+\ctikzset{american open voltage/center/.code={\pgf at adjust@open at voltagetrue}}
+\ctikzset{american open voltage/legacy/.code={\pgf at adjust@open at voltagefalse}}
+
+%
+% currents
+%
+\ctikzset{current/distance/.initial = .5}
+
+%
+% voltage and current styles
+%
+
+\tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
+\tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
+\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
+\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
+\tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
+\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
+\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
+
+\newif\ifpgf at circuit@europeangfsurgearrester
+\ctikzset{gas filled surge arrester choice/.is choice}
+\ctikzset{gas filled surge arrester choice/european/.code= {\pgf at circuit@europeangfsurgearrestertrue}}
+\ctikzset{gas filled surge arrester choice/american/.code= {\pgf at circuit@europeangfsurgearresterfalse}}
+
+\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
+\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
+\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
+\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
+\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
+\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
+\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
+
+%
+% general styles
+%
+
+\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
+\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
+\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
+
+
+% noise sources
+\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
+
+\ctikzset{label/align/.is choice}
+\ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
+\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
+\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
+
+% seven segment displays by RGtti
+
+\newif\ifpgf at circ@sevenseg at dot
+\newif\ifpgf at circ@sevenseg at box
+\def\pgf at circ@sevenseg at dotstate{empty}
+\ctikzset{seven seg/.is family}
+\ctikzset{seven seg/dot/.is choice}
+% none means no dot, not space for it. Empty means no dot, but space
+\ctikzset{seven seg/dot/none/.code={\pgf at circ@sevenseg at dotfalse}}
+\ctikzset{seven seg/dot/empty/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{empty}}}
+\ctikzset{seven seg/dot/off/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{off}}}
+\ctikzset{seven seg/dot/on/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{on}}}
+%
+\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf at circ@Rlen
+\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
+\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
+\ctikzset{seven seg/box sep/.initial=1pt}% external box gap
+\ctikzset{seven seg/color on/.initial=red}% color for segment "on"
+\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
+\ctikzset{seven seg/box/.is choice}
+\ctikzset{seven seg/box/off/.code={\pgf at circ@sevenseg at boxfalse}}
+\ctikzset{seven seg/box/on/.code={\pgf at circ@sevenseg at boxtrue}}
+
+\ctikzset{seven seg/bits/.initial=0000000}
+
+\ctikzset{seven seg/value/.code={%
+ \edef\@@tmp{#1}%
+ \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
+ \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
+ \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
+ \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
+ \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
+ \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
+ \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
+ \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
+ \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
+ \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
+ \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
+}}
+
+\tikzset{%
+ seven segment val/.style args={#1dot#2box#3}{%
+ shape=bare7seg,
+ /tikz/circuitikz/seven seg/value=#1,
+ /tikz/circuitikz/seven seg/dot=#2,
+ /tikz/circuitikz/seven seg/box=#3,
+ },
+ seven segment bits/.style args={#1dot#2box#3}{%
+ shape=bare7seg,
+ /tikz/circuitikz/seven seg/bits=#1,
+ /tikz/circuitikz/seven seg/dot=#2,
+ /tikz/circuitikz/seven seg/box=#3,
+ },
+}
+
+
+%%%%%%%%%% new
+\pgfkeys{\circuitikzbasekey/.search also={/tikz}}
+
+% Electronic tubes: diodetube, triode, tetrode and pentode
+\ctikzset{tubes/width/.initial=1} % relative width
+\ctikzset{tubes/height/.initial=1.4} % relative height
+\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
+\ctikzset{tubes/anode distance/.initial=0.40} % distance from center
+\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
+\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
+\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
+\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
+\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
+\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
+\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
+\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
+\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
+\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
+\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
+
+\newif\ifpgf at circuit@tubes at filament\pgf at circuit@tubes at filamentfalse
+\pgfkeys{/tikz/filament/.add code={}{\pgf at circuit@tubes at filamenttrue}}
+\ctikzset{tubes/filament/.add code={}{\pgf at circuit@tubes at filamenttrue}}
+\newif\ifpgf at circuit@tubes at nocathode\pgf at circuit@tubes at nocathodefalse
+\pgfkeys{/tikz/nocathode/.add code={}{\pgf at circuit@tubes at nocathodetrue}}
+\ctikzset{tubes/nocathode/.add code={}{\pgf at circuit@tubes at nocathodetrue}}
+\newif\ifpgf at circuit@tubes at fullcathode\pgf at circuit@tubes at fullcathodefalse
+\pgfkeys{/tikz/fullcathode/.add code={}{\pgf at circuit@tubes at fullcathodetrue}}
+\ctikzset{tubes/fullcathode/.add code={}{\pgf at circuit@tubes at fullcathodetrue}}
+
+% powerelectronic blocks
+\ctikzset{bipoles/sacdc/width/.initial=.7}
+\ctikzset{bipoles/sdcac/width/.initial=.7}
+\ctikzset{bipoles/tacdc/width/.initial=.7}
+\ctikzset{bipoles/tdcac/width/.initial=.7}
+\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
+
+%%%---------- close: tex/pgfcirc.defines
+%%%%%%%%%%% Springe nach tex/pgfcircutils
+%%%---------- open: tex/pgfcircutils.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+\def\pgf at circ@handleSI#1{
+ \noexpandarg
+ \def\pgf at temp{}
+ \StrBetween{#1}{<}{>}[\pgf at circ@handleSI at unit]
+ \StrLen{\pgf at circ@handleSI at unit}[\pgf at circ@handleSI at unit@len]
+
+ \ifnum\pgf at circ@handleSI at unit@len=0
+ \pgf at circ@siunitx at resfalse
+ \else
+ \IfEndWith{#1}{>}{
+ \pgf at circ@siunitx at restrue
+ \noexpandarg
+ \StrBefore{#1}{<}[\pgf at circ@handleSI at val]
+ %\typeout{si |#1|}
+ }{
+ \pgf at circ@siunitx at resfalse
+ %\typeout{no si |#1|}
+ }
+\fi
+}
+
+\def\pgf at circ@ifkeyempty#1{
+ \pgfextra{
+ \ctikzset{#1/.get=\pgf at circ@temp}
+ \edef\pgf at temp{}
+ }
+ \ifx\pgf at circ@temp\pgf at temp
+ }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Math routines
+
+\def\pgf at circ@stripdecimals#1.#2\pgf at nil{#1}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% useful commands
+
+\ifpgfutil at format@is at latex
+ %% flipping text
+ \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
+ \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
+ \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
+ % text mode overbar
+ % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
+ \def\ctikztextnot#1{$\overline{\hbox{#1}}\m at th$}
+\else\ifpgfutil at format@is at plain
+ % text mode overbar
+ % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
+ \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
+\else\ifpgfutil at format@is at context
+ % text mode overbar
+ % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
+ \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
+\fi\fi\fi
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% switch to use fpu in reciprocal scale transformations
+%%
+%% this code has been contributed by Schrödinger's cat
+%% https://tex.stackexchange.com/a/529159/38080
+%%
+\tikzset{use fpu reciprocal/.code={%
+\def\pgfmathreciprocal@##1{%
+ \begingroup
+ \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
+ \pgfmathparse{1/##1}%
+ \pgfmath at smuggleone\pgfmathresult
+ \endgroup
+}}}%
+
+%%%---------- close: tex/pgfcircutils
+
+%%%%%%%%%%% Springe nach tex/pgfcircshapes
+%%%---------- open: tex/pgfcircshapes.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Other shapes
+
+%% Nothing
+
+\pgfdeclareshape{emptyshape}{
+ \savedanchor{\northeast}{%
+ \pgf at x=.5\wd\pgfnodeparttextbox%
+ \pgf at y=.5\ht\pgfnodeparttextbox%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+}
+%
+% Provision for changing opacity. Only expert use, see the manual.
+%
+\ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
+\tikzset{open poles opacity/.code={%
+ \ctikzset{poles/open fill opacity=#1}%
+}}
+\ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
+\tikzset{full poles opacity/.code={%
+ \ctikzset{poles/full fill opacity=#1}%
+}}
+
+%% Full terminal
+
+\pgfdeclareshape{circ}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \pgfpointborderellipse{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}
+ }{\pgfpoint{\ctikzvalof{nodes width}*\pgf at circ@Rlen}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}}
+ }
+ \behindforegroundpath{
+
+ \pgfscope
+ \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+
+ }
+}
+
+%% Empty round terminal
+
+\pgfdeclareshape{ocirc}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \pgfpointborderellipse{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}
+ }{\pgfpoint{\ctikzvalof{nodes width}*\pgf at circ@Rlen}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}}
+ }
+
+ \behindforegroundpath{
+
+ \pgfscope
+ \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifx\tikz at fillcolor\pgfutil at empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ % note that this element has no class, but will inherit it when used
+ % into another component
+ \pgf at circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \fi
+ \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+
+ }
+}
+
+%% Diamond terminal
+
+\pgfdeclareshape{diamondpole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ % \typeout{IN\space X:\the\pgf at x\space Y:\the\pgf at y}
+ \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf at x>0,1,-1)}
+ \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf at y>0,1,-1)}
+ \pgfmathsetlength{\pgf at xa}{abs(\pgf at x)}
+ \pgfmathsetlength{\pgf at ya}{abs(\pgf at y)}
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ % \typeout{MID\space X:\the\pgf at xa\space Y:\the\pgf at ya\space L:\the\pgf at circ@res at up}
+ % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
+ \pgfpointintersectionoflines
+ {\pgfpointorigin}{\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfqpoint{0pt}{\pgf at circ@res at up}}{\pgfqpoint{\pgf at circ@res at up}{0pt}}
+ % \typeout{CROSS \space X:\the\pgf at x\space Y:\the\pgf at y}
+ \pgf at x=\@@switchx\pgf at x
+ \pgf at y=\@@switchy\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgftransformrotate{45}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf at circ@res at temp}{-\pgf at circ@res at temp}}
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+%% Diamond terminal, unfilled
+
+\pgfdeclareshape{odiamondpole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ % \typeout{IN\space X:\the\pgf at x\space Y:\the\pgf at y}
+ \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf at x>0,1,-1)}
+ \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf at y>0,1,-1)}
+ \pgfmathsetlength{\pgf at xa}{abs(\pgf at x)}
+ \pgfmathsetlength{\pgf at ya}{abs(\pgf at y)}
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ % \typeout{MID\space X:\the\pgf at xa\space Y:\the\pgf at ya\space L:\the\pgf at circ@res at up}
+ % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
+ \pgfpointintersectionoflines
+ {\pgfpointorigin}{\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfqpoint{0pt}{\pgf at circ@res at up}}{\pgfqpoint{\pgf at circ@res at up}{0pt}}
+ % \typeout{CROSS \space X:\the\pgf at x\space Y:\the\pgf at y}
+ \pgf at x=\@@switchx\pgf at x
+ \pgf at y=\@@switchy\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgftransformrotate{45}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf at circ@res at temp}{-\pgf at circ@res at temp}}
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifx\tikz at fillcolor\pgfutil at empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ % note that this element has no class, but will inherit it when used
+ % into another component
+ \pgf at circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \fi
+ \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+%% square terminal, filled
+
+\pgfdeclareshape{squarepole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at y}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpointborderrectangle
+ {\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfqpoint{\pgf at circ@res at up}{\pgfqpoint{\pgf at circ@res at up}}}
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf at circ@res at temp}{-\pgf at circ@res at temp}}
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+%% square terminal, unfilled
+
+\pgfdeclareshape{osquarepole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at y}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpointborderrectangle
+ {\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfqpoint{\pgf at circ@res at up}{\pgfqpoint{\pgf at circ@res at up}}}
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf at circ@res at temp}{-\pgf at circ@res at temp}}
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifx\tikz at fillcolor\pgfutil at empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ % note that this element has no class, but will inherit it when used
+ % into another component
+ \pgf at circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \fi
+ \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+% BNC connector
+
+\pgfdeclareshape{bnc}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ % BNC size is 2.5 times the size of the internal "ocirc"
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgf at y=2.5\pgf at y
+ \pgf at x=-\pgf at y
+ }
+ % center is on the opening
+ \anchor{center}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{zero}{ \pgfpointorigin }
+ \anchor{hot}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{shield}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ % geo-anchors
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{right}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{left}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \pgfpointborderellipse{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}
+ }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf at circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf at circ@Rlen}}
+ }
+ \behindforegroundpath{
+ \pgfextracty{\pgf at circ@res at other}{\northwest}
+ \pgf at circ@res at step=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ \pgfsetcolor{\ctikzvalof{color}}
+ % external circle
+ \pgfscope
+ % clipping path: first a rectangle bigger then the shape
+ % to avoid problems with the line thickness
+ \pgfpathrectanglecorners{\pgfpoint{-2\pgf at circ@res at other}{-2\pgf at circ@res at other}}
+ {\pgfpoint{2\pgf at circ@res at other}{2\pgf at circ@res at other}}
+ % next the opening to the right
+ \pgfpathrectanglecorners{\pgfpoint{-\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ {\pgfpoint{2\pgf at circ@res at other}{\pgf at circ@res at step}}
+ % do the difference and clip before drawing
+ \pgfseteorule
+ \pgfusepath{clip}
+ \pgfpathcircle{\pgfpointorigin}{\pgf at circ@res at other}
+ \pgfusepath{draw}
+ \endpgfscope
+ % internal circle
+ \pgfpathcircle{\pgfpointorigin}{\pgf at circ@res at step}
+ \pgf at circ@draworfill
+ % and the contact line to the right
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+%% Fill for correct rectangular joins
+
+\pgfdeclareshape{rectjoinfill}{
+ \savedanchor{\northeast}{%
+ \pgf at x=.5\pgflinewidth%
+ \pgf at y=.5\pgflinewidth%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfpathrectanglecorners
+ {\pgfpoint{0}{.5\pgflinewidth}}
+ {\pgfpoint{0}{-.5\pgflinewidth}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+%% transistor arrow
+
+\def\pgf at circ@find at linescale{
+ % find the scale inverse of the scale factor: line width do not scale
+ % with scale=..., transform shape so we have to counteract it.
+ \iftikz at fullytransformed % this is true if `transform shape` is active
+ % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
+ % Note that this trick is not working inside a `spy` environment...
+ \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
+ \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
+ \else
+ \pgfmathsetmacro{\@@factor}{1.0}
+ \fi
+}
+
+\pgfdeclareshape{trarrow}{%
+ % this arrow is only filled but grows with the linewidth, more or less
+ % like currarrow do
+ \savedanchor{\northeast}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \pgf at circ@find at linescale
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgfpoint{0.7*\pgf at circ@res at step +0.5*\@@factor*\pgflinewidth}
+ {0.8*\pgf at circ@res at step+0.7593*\@@factor*\pgflinewidth}
+ }
+ % The arrow size should be more or less the same of a currarrow, which is
+ % both filled and stroke, for backward output compatibility (more or less)
+ %
+ % angle \beta W is \pgf at circ@Rlen/\ctikzvalof{current arrow scale}
+ % |-\__ currarrow as the tip at (W,0)
+ % | | and the upper tail at (-0.7*W, 0.8*W)
+ % | \__ it then "overshoot" do to the linew width L
+ % | \__ xangle \alpha
+ % ---0------->
+ %
+ % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
+ % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
+ % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
+ %
+ \savedanchor{\northwest}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at circ@find at linescale
+ \pgfpoint{-0.7*\pgf at circ@res at step -0.5*\@@factor*\pgflinewidth}
+ {0.8*\pgf at circ@res at step+0.7593*\@@factor*\pgflinewidth}
+ }
+ \savedanchor{\tip}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at circ@find at linescale
+ \pgfpoint{\pgf at circ@res at step + 1.743*\@@factor*\pgflinewidth}{0pt}
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{tip}{
+ \tip
+ }
+ \anchor{btip}{% this anchor is behind the tip of half a linewidth
+ \tip
+ \pgf at circ@find at linescale
+ \pgf at circ@res at temp=\@@factor\pgflinewidth
+ \advance\pgf at x by -.5\pgf at circ@res at temp
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \northwest
+ \pgf at circ@res at up=\pgf at y
+ \pgf at circ@res at left=\pgf at x
+ \tip
+ \pgf at circ@res at step = \pgf at x
+ %
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfpathclose
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{fill} % just fill
+ \endpgfscope
+ }
+}
+
+%% Current arrow
+
+\pgfdeclareshape{currarrow}{
+ \savedanchor{\northeast}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at x=.5\pgf at circ@res at step
+ \pgf at y=\pgf at x%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{tip}{
+ \pgfpointorigin
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at x =\pgf at circ@res at step
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+
+ \pgfpathmoveto{\pgfpoint{-.7\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{-.7\pgf at circ@res at step}{-.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{-.7\pgf at circ@res at step}{.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-.7\pgf at circ@res at step}{0pt}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{draw,fill}
+
+ \endpgfscope
+ }
+}
+
+%% Flow arrow
+
+\pgfdeclareshape{flowarrow}{
+ \savedanchor{\northeast}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at y=.5\pgf at circ@res at step
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by 4
+ \pgf at x=\pgf at circ@res at step%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{text}{% text centered above
+ \pgfpointorigin
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{tip}{
+ \pgfpointorigin
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at x =\pgf at circ@res at step
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by 4
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{draw}
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
+ \endpgfscope
+ }
+}
+
+%% Input arrow
+
+\pgfdeclareshape{inputarrow}{
+ \savedanchor{\northeast}{% this is really not northeast, really -northwest
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at y=.5\pgf at circ@res at step
+ \pgf at x=1.7\pgf at circ@res at step
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax\pgf at x=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast\pgf at x=0cm\relax}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y\pgf at x=0cm\relax}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \savedanchor{\tip}{
+ \pgfpointorigin
+ }
+ \anchor{center}{
+ \tip
+ }
+ \anchor{tip}{
+ \tip
+ }
+ \behindforegroundpath{
+
+ \pgfscope
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by 16
+
+ \pgfpathmoveto{\pgfpoint{-1.7\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{-1.7\pgf at circ@res at step}{-.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfpoint{-1.7\pgf at circ@res at step}{.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-1.7\pgf at circ@res at step}{0pt}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{fill}
+
+ \endpgfscope
+ }
+}
+
+
+%% box
+
+\pgfdeclareshape{box}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \behindforegroundpath{
+
+ \pgfscope
+ \pgf at circ@res at step = \ctikzvalof{bipoles/twoport/width}\pgf at circ@Rlen
+ \pgf at circ@res at step = 0.5\pgf at circ@res at step
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{-\pgf at circ@res at step}{\pgf at circ@res at step}}{\pgfpoint{\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+%% box scaled with blocks
+
+\pgfdeclareshape{blockbox}{
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{blocks/scale}\pgf at circ@Rlen}}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \behindforegroundpath{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{blocks/scale}\pgf at circ@Rlen}
+ \pgfscope
+ \pgf at circ@res at step = \ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at step = 0.5\pgf at circ@res at step
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{-\pgf at circ@res at step}{\pgf at circ@res at step}}{\pgfpoint{\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+% full nodes for wire crossing
+
+\pgfdeclareshape{jump crossing}
+{
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{bipoles/crossing/size}\pgf at circ@Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \behindbackgroundpath{
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ % horizontal jumper
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.4\pgf at circ@res at left}{0pt}}
+ \pgfpatharc{0}{-180}{0.4*\pgf at circ@res at left}
+ \pgfsetbeveljoin
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ % vertical, broken path
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ }
+}
+\pgfdeclareshape{plain crossing}
+{
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{bipoles/crossing/size}\pgf at circ@Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \behindbackgroundpath{
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ % horizontal jumper
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ % vertical, broken path
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ }
+}
+
+%%%---------- close: tex/pgfcircshapes
+%%%%%%%%%%% Springe nach tex/pgfcircmonopoles
+%%%---------- open: tex/pgfcircmonopoles.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Monopoles
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%
+%% Grounds
+%%%%%%%%%%%%%
+
+
+%% Ground symbol
+% #1 -> name
+% #2 -> width
+% #3 -> depth
+% #4 -> code
+\long\def\pgf at circ@declareground#1#2#3#4{
+ \pgfdeclareshape{#1}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\southeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/ground/width}\pgf at circ@scaled at Rlen
+ \pgf at x=#2\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/ground/width}\pgf at circ@scaled at Rlen
+ \pgf at y=-#3\pgf at y
+ }
+ \anchor{north}{\pgfpointorigin}
+ \anchor{north east}{\southeast\pgf at y=0pt\relax}
+ \anchor{east}{\southeast\pgf at y=.5\pgf at y}
+ \anchor{south east}{\southeast}
+ \anchor{south}{\southeast\pgf at x=0pt\relax}
+ \anchor{south west}{\southeast\pgf at x=-\pgf at x}
+ \anchor{west}{\southeast\pgf at y=.5\pgf at y\pgf at x=-\pgf at x}
+ \anchor{north west}{\southeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{left}{\pgfpointorigin}
+ \anchor{right}{\pgfpointorigin}
+ \anchor{center}{\pgfpointorigin}
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/ground/width}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+ #4
+ \endpgfscope
+ }
+ }
+}
+
+
+\pgf at circ@declareground{ground}{0.6}{1.6}{
+ \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.4\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.25\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+\pgf at circ@declareground{tlground}{0.6}{0.4}{
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{0pt}}
+ \pgfpathmoveto{\pgfpoint{-.4\pgf at circ@res at step}{-0.2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-0.2\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.25\pgf at circ@res at step}{-0.4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-0.4\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+
+\pgf at circ@declareground{rground}{0.6}{1}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfsetroundcap\pgfusepath{draw}
+}
+
+\pgf at circ@declareground{tground}{0.6}{0}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{0pt}}
+ \pgfusepath{draw}
+}
+
+\pgf at circ@declareground{sground}{0.6}{1.8}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0}{-1.8\pgf at circ@res at step}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+}
+
+% noiseless ground
+\pgf at circ@declareground{nground}{0.9}{1.6}{
+ \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.4\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.25\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.9\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfpatharc{0}{180}{0.9\pgf at circ@res at step}
+ \pgfusepath{draw}
+}
+
+% protective ground
+\pgf at circ@declareground{pground}{0.9}{1.8}{
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf at circ@res at step}}{0.9\pgf at circ@res at step}
+ \pgf at circ@draworfill
+ \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.4\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.25\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+% chassis ground
+\pgf at circ@declareground{cground}{1}{2}{
+ \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-1.00\pgf at circ@res at step}{-2.10\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-0.75\pgf at circ@res at step}{-1.50\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{ 0.75\pgf at circ@res at step}{-1.50\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{ 0.50\pgf at circ@res at step}{-2.10\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{ 0.00\pgf at circ@res at step}{-1.50\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-0.25\pgf at circ@res at step}{-2.10\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+% Contributed by @fotesan https://github.com/fotesan
+% european ground
+\pgf at circ@declareground{eground}{1.1}{1.7}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-1\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-1.1\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-.6\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-.1\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.1\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{.4\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.9\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+\pgf at circ@declareground{eground2}{1.1}{1.7}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-1\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-1.1\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-.4\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.45\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.9\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+%%%%%%%%%%%%%%%%%%
+%% Power supplies
+%%%%%%%%%%%%%%%%%%
+
+% Vcc
+\pgfdeclareshape{vcc}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
+ \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
+ \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
+ \pgfmathsetlength{\pgf at x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf at circ@Rlen}%
+ }
+ \savedanchor{\northeast}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at circ@res at step
+ \pgf at y=3\pgf at x%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y\relax}
+ \anchor{south}{\pgfpointorigin}
+ \anchor{west}{\northeast\pgf at y=0.5\pgf at y\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{center}{\pgfpointorigin}
+ \anchor{left}{\pgfpointorigin}
+ \anchor{right}{\pgfpointorigin}
+ \anchor{text}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf at circ@res at step+2\ht\pgfnodeparttextbox}}
+ \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf at circ@res at step+2\ht\pgfnodeparttextbox}}
+ \pgf at x=0pt
+ \pgf at y=2\pgf at circ@res at step
+ \advance \pgf at y by 0.5\ht\pgfnodeparttextbox
+ \pgf at x=-.5\wd\pgfnodeparttextbox
+ }
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \edef\pgf at circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf at temp{legacy}
+ \ifx\pgf at temp\pgf at circ@temp
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0}{1.5\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{.8\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \else
+ \pgfsetarrowsend{\pgf at circ@temp}
+ \fi
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+% Vee
+\pgfdeclareshape{vee}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
+ \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
+ \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
+ \pgfmathsetlength{\pgf at x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf at circ@Rlen}%
+ }
+ \savedanchor{\northeast}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at circ@res at step
+ \pgf at y=-3\pgf at x%
+ }
+ \anchor{south}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y\relax}
+ \anchor{north}{\pgfpointorigin}
+ \anchor{west}{\northeast\pgf at y=0.5\pgf at y\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast}
+ \anchor{south west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast\pgf at y=0pt\relax}
+ \anchor{north west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{center}{\pgfpointorigin}
+ \anchor{left}{\pgfpointorigin}
+ \anchor{right}{\pgfpointorigin}
+ \anchor{text}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf at circ@res at step-2\ht\pgfnodeparttextbox}}
+ \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf at circ@res at step-2\ht\pgfnodeparttextbox}}
+ \pgf at x=0pt
+ \pgf at y=-2\pgf at circ@res at step
+ \advance \pgf at y by -1.5\ht\pgfnodeparttextbox
+ \pgf at x=-.5\wd\pgfnodeparttextbox
+ }
+
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \edef\pgf at circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf at temp{legacy}
+ \ifx\pgf at temp\pgf at circ@temp
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{-.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0}{-1.5\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{-.8\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \else
+ \pgfsetarrowsend{\pgf at circ@temp}
+ \fi
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+%%%%%%%%%%%%%%%%
+%% RF elements
+%%%%%%%%%%%%%%%%
+
+% Legacy tlinestub
+% Contributed by Leonardo Azzinnari
+\pgfdeclareshape{tlinestub}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\northeast}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step = \ctikzvalof{bipoles/tline/width} \pgf at circ@scaled at Rlen
+ \pgf at x=1.2\pgf at circ@res at step
+ \pgf at circ@res at step = \ctikzvalof{bipoles/tline/width} \pgf at circ@scaled at Rlen
+ \pgf at y=.2\pgf at circ@res at step%
+ }
+ % the center is on the left side of the shape for facility of usage
+ \anchor{north}{\northeast\pgf at x=0.5\pgf at x\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0.5\pgf at x\relax}
+ \anchor{west}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=0cm\relax}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at x=0cm\pgf at y=-\pgf at y}
+ \anchor{center}{\pgfpointorigin}
+ \behindforegroundpath{
+ \pgfstartlinewidth=\pgflinewidth
+
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{bipoles/tline/width} \pgf at circ@scaled at Rlen
+ \pgf at circ@res at step=0.6\pgf at circ@scaled at Rlen
+
+ \pgfscope\begin{pgftransparencygroup}
+ \pgfpathellipse{\pgfpoint{0.5\pgf at circ@res at step}{0\pgf at circ@res at step}}{\pgfpoint{0.125\pgf at circ@res at step}{0\pgf at circ@res at step}}{\pgfpoint{0\pgf at circ@res at step}{0.25\pgf at circ@res at step}}
+ \pgf at circ@maybefill
+ \pgfpathmoveto{\pgfpoint{0.5\pgf at circ@res at step}{0.25\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{1.5\pgf at circ@res at step}{0.25\pgf at circ@res at step}}
+ \pgfpatharc{90}{-90}{0.125\pgf at circ@res at step and 0.25\pgf at circ@res at step}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{-0.25\pgf at circ@res at step}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \pgfpathellipse{\pgfpoint{0.5\pgf at circ@res at step}{0\pgf at circ@res at step}}{\pgfpoint{0.125\pgf at circ@res at step}{0\pgf at circ@res at step}}{\pgfpoint{0\pgf at circ@res at step}{0.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \end{pgftransparencygroup} \endpgfscope
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{0pt}}
+ \pgfusepath{draw}
+ }
+}
+
+%% New antennas without tails
+
+% main body of antennas
+\def\pgf at circ@antennabody{%
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at step}{2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{2\pgf at circ@res at step}}
+ \pgfsetbeveljoin
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{2\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+% Waves for the antennas.
+\def\pgf at circ@antennawaves{%
+ \pgfscope
+ % define a triangle for clipping the waves
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4.2\pgf at circ@res at step}{3\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4.2\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathclose
+ \pgfusepath{clip}
+ % ...and build the waves as clipped circles
+ \pgf at circ@count at a=8\pgf at circ@res at other=0.5\pgf at circ@res at step
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>2
+ \pgfpathcircle{\pgfpoint{0pt}{\pgf at circ@res at step}}{\the\pgf at circ@count at a*\pgf at circ@res at other}
+ \advance\pgf at circ@count at a-1\relax%
+ \repeatpgfmathloop
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+% additional shape with the waves
+\pgfdeclareshape{waves}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/waves/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step
+ \pgf at y=\pgf at circ@res at step
+ }
+ \anchor{text}{
+ \northeast
+ \pgf at y=\dimexpr\pgf at y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \anchor{top}{\northeast\pgf at x=0pt}
+ \anchor{right}{\northeast\pgf at y=0pt}
+ \anchor{left}{\northeast\pgf at x=-\pgf at x\pgf at y=0pt}
+ \anchor{bottom}{\northeast\pgf at y=-\pgf at y\pgf at x=0pt}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{north east}{\northeast}
+ \anchor{east}{\northeast\pgf at y=0pt}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y\pgf at x=0pt}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{west}{\northeast\pgf at x=-\pgf at x\pgf at y=0pt}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/waves/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at step=0.5\pgf at circ@res at step
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfscope
+ % define a triangle for clipping the waves
+ \pgfpathmoveto{\pgfpoint{-2\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{2.1\pgf at circ@res at step}{2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{2.1\pgf at circ@res at step}{-2\pgf at circ@res at step}}
+ \pgfpathclose
+ \pgfusepath{clip}
+ % ...and build the waves as clipped circles
+ \c at pgf@counta=8\pgf at circ@res at other=0.5\pgf at circ@res at step
+ \pgfmathloop%
+ \ifnum\c at pgf@counta>1
+ \pgfpathcircle{\pgfpoint{-2\pgf at circ@res at step}{0pt}}{\the\c at pgf@counta*\pgf at circ@res at other}
+ \advance\c at pgf@counta-1\relax%
+ \repeatpgfmathloop
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+% the three types of antennas: simple, TX, RX. Notice that you can flip them...
+
+\pgfdeclareshape{bareantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step
+ \pgf at y=2\pgf at circ@res at step
+ }
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf at y
+ \pgf at y=\dimexpr\pgf at y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \anchor{top}{\northeast\pgf at x=0pt}
+ \anchor{right}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{left}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{bottom}{\pgfpointorigin}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{west}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{south}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \behindforegroundpath{
+ \pgf at circ@antennabody
+ }
+}
+
+\pgfdeclareshape{bareTXantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step
+ \pgf at y=2\pgf at circ@res at step
+ }
+ \savedanchor{\savedwaves}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=4.2\pgf at circ@res at step
+ \pgf at y=\pgf at circ@res at step
+ }
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf at y
+ \pgf at x=\dimexpr-\pgf at x-\wd\pgfnodeparttextbox\relax
+ \pgf at y=\dimexpr\pgf at y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \anchor{waves}{\savedwaves}
+ \anchor{top}{\northeast\pgf at x=0pt}
+ \anchor{right}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{left}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{bottom}{\pgfpointorigin}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{west}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{south}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \behindforegroundpath{
+ \pgf at circ@antennabody
+ \pgf at circ@antennawaves
+ }
+}
+
+\pgfdeclareshape{bareRXantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step
+ \pgf at y=2\pgf at circ@res at step
+ }
+ \savedanchor{\savedwaves}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-4.2\pgf at circ@res at step
+ \pgf at y=\pgf at circ@res at step
+ }
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf at y
+ \pgf at y=\dimexpr\pgf at y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \anchor{waves}{\savedwaves}
+ \anchor{top}{\northeast\pgf at x=0pt}
+ \anchor{right}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{left}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{bottom}{\pgfpointorigin}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{west}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{south}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \behindforegroundpath{
+ \pgf at circ@antennabody
+ \pgftransformxshift{-5.2\pgf at circ@res at step}
+ \pgf at circ@antennawaves
+ }
+}
+
+% Microstrip monopoles
+
+\pgfdeclareshape{mslstub}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\southeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{bipoles/mstline/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=\ctikzvalof{bipoles/mstline/height}\pgf at circ@scaled at Rlen
+ \pgf at y=-.5\pgf at y
+ }
+ \savedanchor{\northwest}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{bipoles/mstline/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-.5\pgf at x
+ \pgf at y=\ctikzvalof{bipoles/mstline/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ }
+ \anchor{north}{\northwest\pgf at x=0pt\relax}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{east}{\southeast\pgf at y=0pt\relax}
+ \anchor{south east}{\southeast}
+ \anchor{south}{\southeast\pgf at x=0pt\relax}
+ \anchor{south west}{\southeast\pgf at x=-\pgf at x}
+ \anchor{west}{\northwest\pgf at y=0pt\relax}
+ \anchor{north west}{\northwest}
+ %
+ \anchor{center}{\northwest\pgf at y=0pt\relax}
+ \anchor{left}{\northwest\pgf at y=0pt\relax}
+ \anchor{right}{\southeast\pgf at y=0pt\relax}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+ \behindbackgroundpath{
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at right}{\southeast}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfextracty{\pgf at circ@res at down}{\southeast}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.25*\pgf at circ@res at up}
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{msrstub}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\southeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/msrstub/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=0pt\relax
+ }
+ \savedanchor{\northwest}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/msrstub/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-.5\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/msrstub/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ }
+ \anchor{north}{\northwest\pgf at x=0pt\relax}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{east}{\southeast\pgf at y=0pt\relax}
+ \anchor{south east}{\southeast}
+ \anchor{south}{\southeast\pgf at x=0pt\relax}
+ \anchor{south west}{\southeast\pgf at x=-\pgf at x}
+ \anchor{west}{\northwest\pgf at y=0pt\relax}
+ \anchor{north west}{\northwest}
+ %
+ \anchor{center}{\pgfpointorigin}
+ \anchor{left}{\pgfpointorigin}
+ \anchor{right}{\pgfpointorigin}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+ \behindbackgroundpath{
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at right}{\southeast}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfextracty{\pgf at circ@res at down}{\southeast}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.25*\pgf at circ@res at up}
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfscope
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointpolar{135}{\pgf at circ@res at step}}
+ \pgfpatharc{135}{45}{\pgf at circ@res at step}
+ \pgfpathlineto{\pgfpointpolar{45}{\pgf at circ@res at up}}
+ \pgfpatharc{45}{135}{\pgf at circ@res at up}
+ \pgfclosepath
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{msport}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\southeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/msport/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=\ctikzvalof{bipoles/mstline/height}\pgf at circ@scaled at Rlen
+ \pgf at y=-.5\pgf at y
+ }
+ \savedanchor{\northwest}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/msport/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-.5\pgf at x
+ \pgf at y=\ctikzvalof{bipoles/mstline/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ }
+ \anchor{north}{\northwest\pgf at x=0pt\relax}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{east}{\southeast\pgf at y=0pt\relax}
+ \anchor{south east}{\southeast}
+ \anchor{south}{\southeast\pgf at x=0pt\relax}
+ \anchor{south west}{\southeast\pgf at x=-\pgf at x}
+ \anchor{west}{\northwest\pgf at y=0pt\relax}
+ \anchor{north west}{\northwest}
+ %
+ \anchor{center}{\northwest\pgf at y=0pt\relax}
+ \anchor{left}{\northwest\pgf at y=0pt\relax}
+ \anchor{right}{\southeast\pgf at y=0pt\relax}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ }
+ \behindbackgroundpath{
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at right}{\southeast}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfextracty{\pgf at circ@res at down}{\southeast}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.5*\pgf at circ@res at up}
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+% Legacy antennas (with tails)
+\def\pgf at circ@shift at antenna@xy#1#2{%
+ \pgf at y=\dimexpr\pgf at y+#2\pgf at circ@res at step
+ \pgf at x=\dimexpr\pgf at x+#1\pgf at circ@res at step
+\relax}
+
+% Legacy antenna
+\pgfdeclareshape{antenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/antenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step%-0.5\pgflinewidth
+ \pgf at y=4\pgf at circ@res at step
+ }
+ \anchor{north}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=0cm\pgf at circ@shift at antenna@xy{0}{2}}
+ \anchor{east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at circ@shift at antenna@xy{0}{3}\relax}
+ \anchor{south}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y \pgf at x=0cm\pgf at circ@shift at antenna@xy{0}{4}\relax}
+ \anchor{west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{0}{3}}
+ \anchor{north east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at circ@shift at antenna@xy{0}{2}}
+ \anchor{north west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{0}{2}}
+ \anchor{south east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at circ@shift at antenna@xy{0}{4}}
+ \anchor{south west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{0}{4}}
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/antenna/width}\pgf at circ@scaled at Rlen
+
+ \pgftransformxshift{ -4\pgf at circ@res at step }
+
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{5\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{3\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ }
+}
+
+% Legacy TX antenna
+\pgfdeclareshape{txantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/antenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step%-0.5\pgflinewidth
+ \pgf at y=4\pgf at circ@res at step
+ }
+ \anchor{north}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=0cm\pgf at circ@shift at antenna@xy{2}{2}}
+ \anchor{east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at circ@shift at antenna@xy{4}{3}\relax}
+ \anchor{south}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y \pgf at x=0cm\pgf at circ@shift at antenna@xy{2}{4}\relax}
+ \anchor{west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{3}}
+ \anchor{north east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at circ@shift at antenna@xy{4}{2}}
+ \anchor{north west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{2}}
+ \anchor{south east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at circ@shift at antenna@xy{4}{4}}
+ \anchor{south west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{4}}
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/txantenna/width}\pgf at circ@scaled at Rlen
+
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step}{0pt}}
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{5\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{3\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{5.5\pgf at circ@res at step}{6\pgf at circ@res at step}}
+ % \pgfpatharc{60}{-60}{\pgf at circ@res at step and \pgf at circ@res at step}
+ \pgfpatharc{30}{-30}{2\pgf at circ@res at step} \pgfpathmoveto{\pgfpoint{6\pgf at circ@res at step}{6.25\pgf at circ@res at step}}
+ \pgfpatharc{30}{-30}{2.5\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{6.5\pgf at circ@res at step}{6.5\pgf at circ@res at step}}
+ \pgfpatharc{30}{-30}{3\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{7\pgf at circ@res at step}{6.75\pgf at circ@res at step}}
+ \pgfpatharc{30}{-30}{3.5\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{7.5\pgf at circ@res at step}{7\pgf at circ@res at step}}
+ \pgfpatharc{30}{-30}{4\pgf at circ@res at step}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ }
+}
+
+% Legacy RX antenna
+\pgfdeclareshape{rxantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/antenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step%-0.5\pgflinewidth
+ \pgf at y=4\pgf at circ@res at step
+ }
+ \anchor{north}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=0cm\pgf at circ@shift at antenna@xy{2}{2}}
+ \anchor{east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at circ@shift at antenna@xy{4}{3}\relax}
+ \anchor{south}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y \pgf at x=0cm\pgf at circ@shift at antenna@xy{2}{4}\relax}
+ \anchor{west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{3}}
+ \anchor{north east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at circ@shift at antenna@xy{4}{2}}
+ \anchor{north west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{2}}
+ \anchor{south east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at circ@shift at antenna@xy{4}{4}}
+ \anchor{south west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{4}}
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/rxantenna/width}\pgf at circ@scaled at Rlen
+
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step}{0pt}}
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{5\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{3\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{6\pgf at circ@res at step}{7\pgf at circ@res at step}}
+ % \pgfpatharc{60}{-60}{\pgf at circ@res at step and \pgf at circ@res at step}
+ \pgfpatharc{150}{210}{4\pgf at circ@res at step} \pgfpathmoveto{\pgfpoint{6.5\pgf at circ@res at step}{6.75\pgf at circ@res at step}}
+ \pgfpatharc{150}{210}{3.5\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{7\pgf at circ@res at step}{6.5\pgf at circ@res at step}}
+ \pgfpatharc{150}{210}{3\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{7.5\pgf at circ@res at step}{6.25\pgf at circ@res at step}}
+ \pgfpatharc{150}{210}{2.5\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{8\pgf at circ@res at step}{6\pgf at circ@res at step}}
+ \pgfpatharc{150}{210}{2\pgf at circ@res at step}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ }
+}
+
+% Legacy match
+\pgfdeclareshape{match}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\northeast}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step = \ctikzvalof{monopoles/match/width} \pgf at circ@scaled at Rlen
+ \pgf at x=2\pgf at circ@res at step
+ \pgf at circ@res at step = \ctikzvalof{monopoles/match/width} \pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at circ@res at step%
+ }
+ % the center is on the left side of the shape for facility of usage
+ \anchor{north}{\northeast\pgf at x=0.5\pgf at x\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=0pt\pgf at x=0.5\pgf at x\relax}
+ \anchor{west}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=0cm\relax}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\pgfpointorigin}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{text}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/match/width}\pgf at circ@scaled at Rlen
+ \pgf at x=1.5\pgf at x
+ \advance \pgf at x by -.5\wd\pgfnodeparttextbox
+ \pgf at y=-1.5\ht\pgfnodeparttextbox
+ }
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/match/width}\pgf at circ@scaled at Rlen
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{2\pgf at circ@res at step}{0pt}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{2\pgf at circ@res at step}{0.5\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{2\pgf at circ@res at step}{0}}
+ \pgfusepath{fill}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \endpgfscope
+ }
+}
+
+%%%---------- close: tex/pgfcircmonopoles
+%%%%%%%%%%% Springe nach tex/pgfcircbipoles
+%%%---------- open: tex/pgfcircbipoles.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%% Generic macro for defining a bipole shape
+% #1 - additional anchors
+% #2 - lower y-size of the bipole (from the center).
+% #3 - #shape is the name of the shape
+% #4 - upper y-size of the bipole (from the center)
+% #5 - width of the bipole
+% #6 - macros drawing the bipole
+%
+\long\def\pgfcircdeclarebipole{%
+ \pgfcircdeclarebipolescaled{default}}
+
+%% Generic macro for defining a bipole shape
+% #1 - scale factor
+% #2 - additional anchors
+% #3 - lower y-size of the bipole (from the center).
+% #4 - #shape is the name of the shape
+% #5 - upper y-size of the bipole (from the center)
+% #6 - width of the bipole
+% #7 - macros drawing the bipole
+%
+\long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
+ \pgfdeclareshape{#4shape}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\northeast}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen
+ \pgf at y=#5\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=#6\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \savedanchor{\northeastborder}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen
+ \pgf at y=#5\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{bipoles/border margin}\pgf at y
+ \pgf at x=#6\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x=\ctikzvalof{bipoles/border margin}\pgf at x
+ }
+ \savedanchor{\southwestborder}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen
+ \pgf at y=-#3\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{bipoles/border margin}\pgf at y
+ \pgf at x=-#6\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x=\ctikzvalof{bipoles/border margin}\pgf at x
+ }
+ \savedanchor{\southwest}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen
+ \pgf at y=-#3\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-#6\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \savedanchor{\centerpoint}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen
+ \pgf at circ@res at down=-#3\pgf at circ@scaled at Rlen
+ \pgf at circ@res at up=#5\pgf at circ@scaled at Rlen
+ \pgfpointorigin
+ \pgf at y=\pgf at circ@res at up
+ \advance\pgf at y by\pgf at circ@res at down
+ \pgf at y=.5\pgf at y
+ }
+ \anchor{center}{\pgfpointorigin}
+ \anchor{n}{
+ \northeast
+ \pgf at x=0cm
+ }
+ \anchor{north east}{
+ \northeast
+ }
+ \anchor{north west}{
+ \northeast
+ \pgf at x=-\pgf at x
+ }
+ \anchor{ne}{
+ \northeast
+ }
+ \anchor{nw}{
+ \northeast
+ \pgf at x=-\pgf at x
+ }
+ \anchor{e}{
+ \northeast
+ \pgf at y=0cm
+ }
+ \anchor{s}{
+ \southwest
+ \pgf at x=0cm
+ }
+ \anchor{south east}{
+ \southwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south west}{
+ \southwest
+ }
+ \anchor{se}{
+ \southwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{sw}{
+ \southwest
+ }
+ \anchor{w}{
+ \southwest
+ \pgf at y=0cm
+ }
+ \anchor{north}{
+ \northeast
+ \pgf at x=0cm
+ }
+ \anchor{east}{
+ \northeast
+ \pgf at y=0cm
+ }
+ \anchor{south}{
+ \southwest
+ \pgf at x=0cm
+ }
+ \anchor{west}{
+ \southwest
+ \pgf at y=0cm
+ }
+ \anchor{right}{
+ \northeast
+ \pgf at y=0cm
+ }
+ \anchor{above}{
+ \northeast
+ \pgf at x=0cm
+ }
+ \anchor{left}{
+ \southwest
+ \pgf at y=0cm
+ }
+ \anchor{below}{
+ \southwest
+ \pgf at x=0cm
+ }
+ \anchor{a}{
+ \northeast
+ \pgf at y=0cm
+ }
+ \anchor{b}{
+ \southwest
+ \pgf at y=0cm
+ }
+ \savedanchor{\textanchor}{%
+ \pgf at y=\ht\pgfnodeparttextbox
+ \pgf at x=-.5\wd\pgfnodeparttextbox
+ }
+ \anchor{text}{
+ \textanchor
+ }
+ \anchorborder{%
+ \ifpgf at circuit@bipole at inverted
+ \pgf at circ@res at left=-\pgf at x
+ \pgf at circ@res at right=-\pgf at y
+ \else
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at right=\pgf at y
+ \fi
+ \ifdim\pgf at circ@res at right>0cm
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at right}}{\northeastborder}
+ \else
+ \southwestborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at right}}{\pgfpoint{-\pgf at x}{-\pgf at y}}
+ \fi
+ }
+
+ #2
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northeast
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at zero = 0cm
+ \pgf at circ@res at left = -\pgf at x
+ \pgf at circ@res at right = \pgf at x
+ \southwest
+ \pgf at circ@res at down = \pgf at y
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
+ #7
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ }
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Standard bipole shapes declarations
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%
+% Resistive components
+%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% Short circuit
+
+%%% NOTICE that the short is really NOT drawn; we trust the fact that its
+%%% natural length is zero.
+\pgfcircdeclarebipole
+{}
+{0}
+{short}
+{0}
+{0}
+{ }
+
+%% Open circuit
+\pgfcircdeclarebipole
+{}
+{\ctikzvalof{bipoles/open/height}}
+{open}
+{\ctikzvalof{bipoles/open/height}}
+{\ctikzvalof{bipoles/open/width}}
+{ }
+
+% multiwire(s)
+\pgfcircdeclarebipole
+{}
+{\ctikzvalof{bipoles/multiwire/height}}
+{multiwire}
+{\ctikzvalof{bipoles/multiwire/height}}
+{\ctikzvalof{bipoles/multiwire/width}}
+{
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+}
+
+\pgfcircdeclarebipole
+{}
+{\ctikzvalof{bipoles/multiwire/height}}
+{bmultiwire}
+{\ctikzvalof{bipoles/multiwire/height}}
+{\ctikzvalof{bipoles/multiwire/width}}
+{
+ \pgf at circ@res at other=\ctikzvalof{bipoles/multiwire/spacing}\pgf at circ@Rlen
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+}
+
+\pgfcircdeclarebipole
+{}
+{\ctikzvalof{bipoles/multiwire/height}}
+{tmultiwire}
+{\ctikzvalof{bipoles/multiwire/height}}
+{\ctikzvalof{bipoles/multiwire/width}}
+{
+ \pgf at circ@res at other=\ctikzvalof{bipoles/multiwire/spacing}\pgf at circ@Rlen
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left+2\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{2\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+}
+
+%
+%
+%% Generic bipole - used as resistor by some (bleah)
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/generic/height}}
+{generic}
+{\ctikzvalof{bipoles/generic/height}}
+{\ctikzvalof{bipoles/generic/width}}
+{
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+}
+
+%
+% generic crossed, suggested by Radványi Patrik Tamás <patrikradvanyi at gmail.com>
+% inherit "generic" properties
+%
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/generic/height}}
+{xgeneric}
+{\ctikzvalof{bipoles/generic/height}}
+{\ctikzvalof{bipoles/generic/width}}
+{
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ % cross it
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+}
+%% Generic empty tunable
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/tgeneric/height}}
+{tgeneric}
+{\ctikzvalof{bipoles/tgeneric/height}}
+{\ctikzvalof{bipoles/tgeneric/width}}
+{
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{.4\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{.4\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \pgfscope
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{.5\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-.5\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Generic asymmetric bipole
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/ageneric/height}}
+{ageneric}
+{\ctikzvalof{bipoles/ageneric/height}}
+{\ctikzvalof{bipoles/ageneric/width}}
+{
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfpathrectanglecorners{\pgfpoint{.7\pgf at circ@res at right}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{stroke,fill}
+}
+
+%% Memristor
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/memristor/height}}
+{memristor}
+{\ctikzvalof{bipoles/memristor/height}}
+{\ctikzvalof{bipoles/memristor/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/resistor/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 14
+
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.72*\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.72*\pgf at circ@res at left}{\ctikzvalof{bipoles/memristor/wave height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.35*\pgf at circ@res at left}{\ctikzvalof{bipoles/memristor/wave height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.35*\pgf at circ@res at left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-.05*\pgf at circ@res at left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-.05*\pgf at circ@res at left}{\ctikzvalof{bipoles/memristor/wave height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.42*\pgf at circ@res at right}{\ctikzvalof{bipoles/memristor/wave height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.42*\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.8*\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+
+ \pgfpathrectanglecorners{\pgfpoint{.7\pgf at circ@res at right}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{stroke,fill}
+}
+
+%% Photoresistor
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/photoresistor/height 2}}
+{photoresistor}
+{\ctikzvalof{bipoles/photoresistor/height}}
+{\ctikzvalof{bipoles/photoresistor/width}}
+{
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at right}{-\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfscope
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{.7\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.3\pgf at circ@res at right}{-1.2\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{.45\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.05\pgf at circ@res at right}{-1.2\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Thermistor
+\pgfcircdeclarebipolescaled{resistors}
+{{% anchor for labelling the type of dependency
+ \anchor{label}{%
+ \southwest
+ \pgf at x=0.4\pgf at x
+ \pgf at y=1.2\pgf at y
+ }%
+}}
+{\ctikzvalof{bipoles/thermistor/height}}
+{thermistor}
+{\ctikzvalof{bipoles/thermistor/height}}
+{\ctikzvalof{bipoles/thermistor/width}}
+{
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\ctikzvalof{bipoles/thermistor/main}\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{-\ctikzvalof{bipoles/thermistor/main}\pgf at circ@res at up}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ %\pgfscope
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at left}{-\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{1.2\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{1.2\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ %\endpgfscope
+}
+
+%% Thermistor PTC
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/thermistorptc/height 2}}
+{thermistorptc}
+{\ctikzvalof{bipoles/thermistorptc/height}}
+{\ctikzvalof{bipoles/thermistorptc/width}}
+{
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\ctikzvalof{bipoles/thermistorptc/main}\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{-\ctikzvalof{bipoles/thermistorptc/main}\pgf at circ@res at up}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgftext[top,x=.85\pgf at circ@res at left,y=.75\pgf at circ@res at down]{\pgf at circ@font at tiny$\vartheta$}
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{.62\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.62\pgf at circ@res at left}{.7\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{.45\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.45\pgf at circ@res at left}{.7\pgf at circ@res at down}}
+ \pgfusepath{draw}
+}
+
+%% Thermistor NTC
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/thermistorntc/height 2}}
+{thermistorntc}
+{\ctikzvalof{bipoles/thermistorntc/height}}
+{\ctikzvalof{bipoles/thermistorntc/width}}
+{
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\ctikzvalof{bipoles/thermistorntc/main}\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{-\ctikzvalof{bipoles/thermistorntc/main}\pgf at circ@res at up}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgftext[top,x=.85\pgf at circ@res at left,y=.75\pgf at circ@res at down]{\pgf at circ@font at tiny$\vartheta$}
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{.62\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.62\pgf at circ@res at left}{.7\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{.45\pgf at circ@res at left}{.7\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.45\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+}
+
+%% Generic tunable
+\pgfcircdeclarebipolescaled{resistors}
+{
+ \savedanchor{\wiper}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen
+ \pgf at ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at ya
+ \pgf at xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf at circ@scaled at Rlen
+ \pgfmathsetlength{\pgf at x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf at xa}
+ }
+ \anchor{wiper}{\wiper}
+ \anchor{W}{\wiper}
+}
+{\ctikzvalof{bipoles/generic potentiometer/height 2}}
+{genericpotentiometer}
+{\ctikzvalof{bipoles/generic potentiometer/height}}
+{\ctikzvalof{bipoles/generic potentiometer/width}}
+{
+
+ \pgf at circ@res at step = \ctikzvalof{bipoles/resistor/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 14
+
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+ \pgfscope
+ %\pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetarrowsend{latexslim}
+ \pgfextractx{\pgf at circ@res at other}{\wiper}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{-\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Zig zag resistores
+\def\pgf at circ@zigzag#1{%
+ \divide \pgf at circ@res at step by \numexpr4*\zigs\relax
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \pgf at circ@count at a=\zigs\relax
+ % first half zig
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{-#1\pgf at circ@res at down}}
+ \pgfmathloop%
+ \advance\pgf at circ@count at a by -1\relax% Loop zigs -1 times
+ \ifnum\pgf at circ@count at a>0
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{#1\pgf at circ@res at down}}
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{-#1\pgf at circ@res at down}}
+ \repeatpgfmathloop%
+ % last zig and a half
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{#1\pgf at circ@res at down}}
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at zero}}
+ \pgfsetbeveljoin
+ \pgfusepath{draw}
+}
+
+%% Resistor
+\pgfcircdeclarebipolescaled{resistors}
+{
+\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
+}
+{\ctikzvalof{bipoles/resistor/height}}
+{resistor}
+{\ctikzvalof{bipoles/resistor/height}}
+{\ctikzvalof{bipoles/resistor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+ \pgfmathsetlength{\pgf at circ@res at step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
+ \pgf at circ@zigzag{1}
+}
+
+
+%% Variable resistor
+\pgfcircdeclarebipolescaled{resistors}
+{
+\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
+}
+{\ctikzvalof{bipoles/vresistor/height}}
+{vresistor}
+{\ctikzvalof{bipoles/vresistor/height}}
+{\ctikzvalof{bipoles/vresistor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+ \pgfmathsetlength{\pgf at circ@res at step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
+ \pgf at circ@zigzag{.5}
+
+ \pgfscope
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{.4\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-.4\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Potentiometer
+\pgfcircdeclarebipolescaled{resistors}
+{
+ \savedanchor{\wiper}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen
+ \pgf at ya=\ctikzvalof{bipoles/potentiometer/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at ya
+ \pgf at xa=\ctikzvalof{bipoles/potentiometer/width}\pgf at circ@scaled at Rlen
+ \pgfmathsetlength{\pgf at x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf at xa}
+ }
+ \anchor{wiper}{\wiper}
+ \anchor{W}{\wiper}
+ \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
+}
+{\ctikzvalof{bipoles/potentiometer/height 2}}
+{potentiometer}
+{\ctikzvalof{bipoles/potentiometer/height}}
+{\ctikzvalof{bipoles/potentiometer/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+ \pgfmathsetlength{\pgf at circ@res at step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
+ \pgf at circ@zigzag{1}
+
+ \pgfscope
+ %\pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetarrowsend{latexslim}
+ \pgfextractx{\pgf at circ@res at other}{\wiper}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{-\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Resistive sensor
+\pgfcircdeclarebipolescaled{resistors}
+{% anchor for labelling the type of dependency
+ \anchor{label}{\southwest\pgf at x=0.4\pgf at x}%
+ \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
+}
+{\ctikzvalof{bipoles/resistivesens/height}}
+{resistivesens}
+{\ctikzvalof{bipoles/resistivesens/height}}
+{\ctikzvalof{bipoles/resistivesens/width}}
+{%
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+ \pgfmathsetlength{\pgf at circ@res at step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
+ \pgf at circ@zigzag{.5}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{.4\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-.4\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-.9\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%%%%%%%%%%%%%%
+%% Capacitors
+%%%%%%%%%%%%%
+
+%% Plain Capacitor
+\pgfcircdeclarebipolescaled{capacitors}
+{}
+{\ctikzvalof{bipoles/capacitor/height}}
+{capacitor}
+{\ctikzvalof{bipoles/capacitor/height}}
+{\ctikzvalof{bipoles/capacitor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+}
+
+%% Capacitive sensor
+\pgfcircdeclarebipolescaled{capacitors}
+{
+ \anchor{label}{\southwest\pgf at x=2.6\pgf at x\pgf at y=1.2\pgf at y}%
+}
+{\ctikzvalof{bipoles/capacitor/height}}
+{capacitivesens}
+{\ctikzvalof{bipoles/capacitor/height}}
+{\ctikzvalof{bipoles/capacitor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{2.6\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-2.6\pgf at circ@res at right}{1.2\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-4.4\pgf at circ@res at right}{1.2\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Polar Capacitor (DEPRECATED)
+\pgfcircdeclarebipolescaled{capacitors}
+{}
+{\ctikzvalof{bipoles/pcapacitor/height}}
+{polarcapacitor}
+{\ctikzvalof{bipoles/pcapacitor/height}}
+{\ctikzvalof{bipoles/pcapacitor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgftransformrotate{-90}
+ \pgfpathsine{\pgfpoint{\pgf at circ@res at up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf at circ@res at left}}
+ \pgfpathcosine{\pgfpoint{\pgf at circ@res at up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf at circ@res at left}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+}
+
+
+%% Curved capacitor
+% see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
+% for a rationale
+%
+\pgfcircdeclarebipolescaled{capacitors}
+{}
+{\ctikzvalof{bipoles/ccapacitor/height}}
+{ccapacitor}
+{\ctikzvalof{bipoles/ccapacitor/height}}
+{\ctikzvalof{bipoles/ccapacitor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgftransformrotate{-90}
+ \pgfpathsine{\pgfpoint{\pgf at circ@res at up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf at circ@res at right}}
+ \pgfpathcosine{\pgfpoint{\pgf at circ@res at up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf at circ@res at right}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+}
+
+
+
+
+%% Electrolytic Capacitor
+\pgfcircdeclarebipolescaled{capacitors}
+{}
+{\ctikzvalof{bipoles/ecapacitor/height}}
+{ecapacitor}
+{\ctikzvalof{bipoles/ecapacitor/height}}
+{\ctikzvalof{bipoles/ecapacitor/width}}
+{
+ \pgfsetrectcap
+ % % % Draw plus pole
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgf at circ@draworfill
+ % % Draw minus pole
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfsetfillcolor{\ctikzvalof{color}}
+ \pgfusepath{draw,fill}
+ \pgfsetfillcolor{\ctikzvalof{color}}
+ % % plus pole annotation
+ \pgftext[right,at=\pgfpoint{1.2\pgf at circ@res at left}{.6\pgf at circ@res at up}]
+ {\ctikzvalof{bipoles/ecapacitor/font} $+$}
+}
+
+%% Variable Capacitor
+\pgfcircdeclarebipolescaled{capacitors}
+{}
+{\ctikzvalof{bipoles/vcapacitor/height}}
+{vcapacitor}
+{\ctikzvalof{bipoles/vcapacitor/height}}
+{\ctikzvalof{bipoles/vcapacitor/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf at circ@res at right
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at step}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at step}{0pt}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfusepath{draw}
+}
+
+
+%% Piezoelectric Element
+
+\pgfcircdeclarebipolescaled{capacitors}
+{}
+{\ctikzvalof{bipoles/piezoelectric/height}}
+{piezoelectric}
+{\ctikzvalof{bipoles/piezoelectric/height}}
+{\ctikzvalof{bipoles/piezoelectric/width}}
+{
+ % \pgf at circ@res at step = \ctikzvalof{bipoles/piezoelectric/width}\pgf at circ@Rlen
+ % \divide \pgf at circ@res at step by 5
+
+ %% Outer markings
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ %% Inner Box
+ \pgf at circ@res at step = \pgf at circ@res at right \divide \pgf at circ@res at step by 10
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners
+ {\pgfpoint{\pgf at circ@res at left+4*\pgf at circ@res at step}{\pgf at circ@res at up-\pgf at circ@res at step}}
+ {\pgfpoint{\pgf at circ@res at right-4*\pgf at circ@res at step}{\pgf at circ@res at down+\pgf at circ@res at step}}
+ \pgf at circ@draworfill
+ \endpgfscope
+}
+
+%%%%%%%%%%%%%%%
+%% Inductors
+%%%%%%%%%%%%%%%
+
+%% cute inductor
+\pgfcircdeclarebipolescaled{inductors}
+{
+ \savedanchor{\midtap}{%
+ \pgf at x=0pt\relax
+ \pgfmathsetlength{\pgf at y}{%
+ (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
+ \ctikzvalof{bipoles/cuteinductor/height} :% even
+ -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
+ *\pgf at circ@scaled at Rlen/2
+ }
+ }
+ \anchor{midtap}{\midtap}
+}
+{\ctikzvalof{bipoles/cuteinductor/lower coil height}}
+{cuteinductor}
+{\ctikzvalof{bipoles/cuteinductor/height}}
+{\ctikzvalof{bipoles/cuteinductor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+
+ \pgfmathsetlength{\pgf at circ@res at other}%width of small coil
+ {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
+
+
+ \pgfmathsetlength{\pgf at circ@res at step}
+ {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf at circ@res at other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at 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 {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
+ {
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and \pgf at circ@res at up}
+ \pgfpatharc{0}{-180}{\pgf at circ@res at other and -\pgf at circ@res at down}
+ }
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and \pgf at circ@res at up}
+ \pgfsetbuttcap
+ \pgfsetbeveljoin
+ \pgfusepath{stroke}
+}
+
+%% cute inductive sensor
+\pgfcircdeclarebipolescaled{inductors}
+{% anchor for labelling the type of dependency
+ \anchor{label}{\southwest\pgf at x=0.8\pgf at x\pgf at y=2.6\pgf at y}%
+ \savedanchor{\midtap}{%
+ \pgf at x=0pt\relax
+ \pgfmathsetlength{\pgf at y}{%
+ (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
+ \ctikzvalof{bipoles/cuteinductor/height} :% even
+ -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
+ *\pgf at circ@scaled at Rlen/2
+ }
+ }
+ \anchor{midtap}{\midtap}
+}
+{\ctikzvalof{bipoles/cuteinductor/lower coil height}}
+{scuteinductor}
+{\ctikzvalof{bipoles/cuteinductor/height}}
+{\ctikzvalof{bipoles/cuteinductor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+
+ \pgfmathsetlength{\pgf at circ@res at other}%width of small coil
+ {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
+
+
+ \pgfmathsetlength{\pgf at circ@res at step}
+ {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf at circ@res at other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at 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 {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
+ {
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and \pgf at circ@res at up}
+ \pgfpatharc{0}{-180}{\pgf at circ@res at other and -\pgf at circ@res at down}
+ }
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and \pgf at circ@res at up}
+ \pgfsetbuttcap
+ \pgfsetbeveljoin
+ \pgfusepath{stroke}
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{.8\pgf at circ@res at right}{2\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-.8\pgf at circ@res at right}{2.6\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-1.6\pgf at circ@res at right}{2.6\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% cute choke
+\pgfcircdeclarebipolescaled{inductors}
+{
+ \savedanchor{\midtap}{%
+ \pgf at x=0pt\relax
+ \pgfmathsetlength{\pgf at y}{%
+ (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
+ \ctikzvalof{bipoles/cuteinductor/height} :% even
+ -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
+ *\pgf at circ@scaled at Rlen/2
+ }
+ }
+ \anchor{midtap}{\midtap}
+}
+{\ctikzvalof{bipoles/cutechoke/lower coil height}}
+{cutechoke}
+{\ctikzvalof{bipoles/cutechoke/height}}
+{\ctikzvalof{bipoles/cutechoke/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+
+ \pgfmathsetlength{\pgf at circ@res at other}%width of small coil
+ {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
+
+
+ \pgfmathsetlength{\pgf at circ@res at step}
+ {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf at circ@res at other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at 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 {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
+ {
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and \pgf at circ@res at up}
+ \pgfpatharc{0}{-180}{\pgf at circ@res at other and -\pgf at circ@res at down}
+ }
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and \pgf at circ@res at up}
+ \pgfsetbuttcap
+ \pgfsetbeveljoin
+ \pgfusepath{stroke}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf at circ@res at up}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
+ \pgfusepath{stroke}
+
+ \ifpgf at circuit@bipole at twolineschoke
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf at circ@res at up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf at circ@res at up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf at circ@res at up}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
+ \pgfusepath{stroke}
+ \fi
+}
+
+%% variable cute inductor
+\pgfcircdeclarebipolescaled{inductors}
+{
+ \savedanchor{\midtap}{%
+ \pgf at x=0pt\relax
+ \pgfmathsetlength{\pgf at y}{%
+ (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
+ \ctikzvalof{bipoles/cuteinductor/height} :% even
+ -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
+ *\pgf at circ@scaled at Rlen/2
+ }
+ }
+ \anchor{midtap}{\midtap}
+}
+{\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
+{vcuteinductor}
+{\ctikzvalof{bipoles/vcuteinductor/height}}
+{\ctikzvalof{bipoles/vcuteinductor/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+
+ \pgfmathsetlength{\pgf at circ@res at other}%width of small coil
+ {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
+
+
+ \pgfmathsetlength{\pgf at circ@res at step}
+ {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf at circ@res at other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
+
+ \pgfscope
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{.4\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at 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 {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
+ {
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and .5\pgf at circ@res at up}
+ \pgfpatharc{0}{-180}{\pgf at circ@res at other and -.5\pgf at circ@res at down}
+ }
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and .5\pgf at circ@res at up}
+ \pgfsetbuttcap
+ \pgfsetbeveljoin
+ \pgfusepath{stroke}
+}
+
+%% american inductor
+\pgfcircdeclarebipolescaled{inductors}
+{
+ \savedanchor{\midtap}{%
+ \pgf at x=0pt\relax
+ \pgfmathsetlength{\pgf at y}{%
+ (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
+ 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
+ 0) %odd
+ *\pgf at circ@scaled at Rlen/2
+ }
+ }
+ \anchor{midtap}{\midtap}
+}
+{\ctikzvalof{bipoles/americaninductor/height 2}}
+{americaninductor}
+{\ctikzvalof{bipoles/americaninductor/height}}
+{\ctikzvalof{bipoles/americaninductor/width}}
+{
+ \pgf at circ@res at step=\ctikzvalof{bipoles/americaninductor/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+ \advance \pgf at circ@res at step by \pgfhorizontaltransformationadjustment\pgflinewidth
+ \divide \pgf at circ@res at step by \ctikzvalof{bipoles/americaninductor/coils}
+ \divide \pgf at circ@res at step by 2
+ \pgf at circ@res at other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf at circ@scaled at Rlen
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at 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 at circ@res at step and \pgf at circ@res at other}
+ }
+ \pgfsetbuttcap
+ \pgfsetbeveljoin
+ \pgfusepath{stroke}
+}
+
+
+%% american inductive sensor
+\pgfcircdeclarebipolescaled{inductors}
+{% anchor for labelling the type of dependency
+ \anchor{label}{\southwest\pgf at x=0.8\pgf at x\pgf at y=2.6\pgf at y}%
+ \savedanchor{\midtap}{%
+ \pgf at x=0pt\relax
+ \pgfmathsetlength{\pgf at y}{%
+ (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
+ 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
+ 0) %odd
+ *\pgf at circ@scaled at Rlen/2
+ }
+ }
+ \anchor{midtap}{\midtap}
+}
+{\ctikzvalof{bipoles/americaninductor/height 2}}
+{samericaninductor}
+{\ctikzvalof{bipoles/americaninductor/height}}
+{\ctikzvalof{bipoles/americaninductor/width}}
+{
+ \pgf at circ@res at step=\ctikzvalof{bipoles/americaninductor/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+ \advance \pgf at circ@res at step by \pgfhorizontaltransformationadjustment\pgflinewidth
+ \divide \pgf at circ@res at step by \ctikzvalof{bipoles/americaninductor/coils}
+ \divide \pgf at circ@res at step by 2
+ \pgf at circ@res at other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf at circ@scaled at Rlen
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at 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 at circ@res at step and \pgf at circ@res at other}
+ }
+ \pgfsetbuttcap
+ \pgfsetbeveljoin
+ \pgfusepath{stroke}
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{.8\pgf at circ@res at right}{2\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-.8\pgf at circ@res at right}{2.6\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-1.6\pgf at circ@res at right}{2.6\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% variable american inductor
+\pgfcircdeclarebipolescaled{inductors}
+{
+ \savedanchor{\midtap}{%
+ \pgf at x=0pt\relax
+ \pgfmathsetlength{\pgf at y}{%
+ (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
+ 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
+ 0) %odd
+ *\pgf at circ@scaled at Rlen/2
+ }
+ }
+ \anchor{midtap}{\midtap}
+}
+{\ctikzvalof{bipoles/vamericaninductor/height 2}}
+{vamericaninductor}
+{\ctikzvalof{bipoles/vamericaninductor/height}}
+{\ctikzvalof{bipoles/vamericaninductor/width}}
+{
+ \pgf at circ@res at step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+ \advance \pgf at circ@res at step by \pgfhorizontaltransformationadjustment\pgflinewidth
+ \divide \pgf at circ@res at step by \ctikzvalof{bipoles/vamericaninductor/coils}
+ \divide \pgf at circ@res at step by 2
+ \pgf at circ@res at other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf at circ@scaled at Rlen
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at 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/vamericaninductor/coils}}
+ {
+ \pgfpatharc{180}{0}{\pgf at circ@res at step and \pgf at circ@res at other}
+ }
+ \pgfsetbuttcap
+ \pgfsetbeveljoin
+ \pgfusepath{stroke}
+
+ \pgfscope
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{.4\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-.4\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Generic bipole, filled - used as inductor by some
+\pgfcircdeclarebipolescaled{inductors}
+{
+ \anchor{midtap}{\northeast\pgf at x=0pt\relax}
+}
+{\ctikzvalof{bipoles/fullgeneric/height}}
+{fullgeneric}
+{\ctikzvalof{bipoles/fullgeneric/height}}
+{\ctikzvalof{bipoles/fullgeneric/width}}
+{
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfusepath{draw,fill}
+}
+
+%% Generic sensor, filled - used as inductive sensor by some
+\pgfcircdeclarebipolescaled{inductors}
+{% anchor for labelling the type of dependency
+ \anchor{label}{\southwest\pgf at x=0.4\pgf at x\pgf at y=2\pgf at y}%
+ \anchor{midtap}{\northeast\pgf at x=0pt\relax}
+}
+{\ctikzvalof{bipoles/fullgeneric/height}}
+{sfullgeneric}
+{\ctikzvalof{bipoles/fullgeneric/height}}
+{\ctikzvalof{bipoles/fullgeneric/width}}
+{
+
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfusepath{draw,fill}
+ %\pgfscope
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at left}{-2\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{2\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{2\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ %\endpgfscope
+}
+
+%% Generic full tunable
+\pgfcircdeclarebipolescaled{inductors}
+{
+ \anchor{midtap}{\northeast\pgf at x=0pt\relax}
+}
+{\ctikzvalof{bipoles/tfullgeneric/height}}
+{tfullgeneric}
+{\ctikzvalof{bipoles/tfullgeneric/height}}
+{\ctikzvalof{bipoles/tfullgeneric/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/resistor/width}\pgf at circ@Rlen
+ \divide \pgf at circ@res at step by 14
+
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{.4\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{.4\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfusepath{draw,fill}
+
+ \pgfscope
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{.5\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-.5\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%%%%%%%%%%%
+%% Battery
+%%%%%%%%%%%
+
+%% Battery
+\pgfcircdeclarebipolescaled{batteries}
+{}
+{\ctikzvalof{bipoles/battery/height}}
+{battery}
+{\ctikzvalof{bipoles/battery/height}}
+{\ctikzvalof{bipoles/battery/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/battery/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 6
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \ifpgf at circ@fixbatteries
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{.5\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at step}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{.5\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \else
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at step}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at step}{.5\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{.5\pgf at circ@res at down}}
+ \fi
+ \pgfusepath{draw}
+}
+
+
+%% Battery 1 % poles with equl thickness
+
+\pgfcircdeclarebipolescaled{batteries}
+{}
+{\ctikzvalof{bipoles/battery1/height}}
+{battery1}
+{\ctikzvalof{bipoles/battery1/height}}
+{\ctikzvalof{bipoles/battery1/width}}
+{
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at right}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0}}
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at left}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfusepath{draw}
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \ifpgf at circ@fixbatteries
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.33\pgf at circ@res at right}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at left}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.33\pgf at circ@res at left}{.5\pgf at circ@res at down}}
+ \else
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at right}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.33\pgf at circ@res at right}{.5\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.33\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \fi
+ \pgfusepath{draw}
+}
+
+%% Battery 2 % negative pole thicker
+
+\pgfcircdeclarebipolescaled{batteries}
+{}
+{\ctikzvalof{bipoles/battery2/height}}
+{battery2}
+{\ctikzvalof{bipoles/battery2/height}}
+{\ctikzvalof{bipoles/battery2/width}}
+{
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at right}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0}}
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at left}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfusepath{draw}
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \ifpgf at circ@fixbatteries
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.33\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{3\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at left}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.33\pgf at circ@res at left}{.5\pgf at circ@res at down}}
+ \else
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.33\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{3\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{.33\pgf at circ@res at right}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.33\pgf at circ@res at right}{.5\pgf at circ@res at down}}
+ \fi
+ \pgfusepath{draw}
+}
+
+%%%%%%%%%%%
+%% Round and diamond sources
+%%%%%%%%%%%
+
+%% Independent voltage source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/vsource/height}}
+{vsource}
+{\ctikzvalof{bipoles/vsource/height}}
+{\ctikzvalof{bipoles/vsource/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+}
+
+%% To change the internal symbols of the voltage source american style
+\ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
+\ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
+%% Independent voltage source - American style
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/vsourceam/height}}
+{vsourceAM}
+{\ctikzvalof{bipoles/vsourceam/height}}
+{\ctikzvalof{bipoles/vsourceam/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifpgf at circ@oldvoltagedirection
+ \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf at circ@res at down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
+ \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf at circ@res at up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
+ \else
+ \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf at circ@res at down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
+ \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf at circ@res at up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
+ \fi
+}
+
+%% Independent sinusoidal voltage source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/vsourcesin/height}}
+{vsourcesin}
+{\ctikzvalof{bipoles/vsourcesin/height}}
+{\ctikzvalof{bipoles/vsourcesin/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+
+ \pgf at circ@res at up = .5\pgf at circ@res at up
+ \pgfscope
+ \pgftransformrotate{90}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at up}{0cm}}
+ \pgfpathsine{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{.5\pgf at circ@res at up}{-.5\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{.5\pgf at circ@res at up}{-.5\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+% Square Voltage source - contributed by Alistair Kwan
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/vsourcesquare/height}}
+{vsourcesquare}
+{\ctikzvalof{bipoles/vsourcesquare/height}}
+{\ctikzvalof{bipoles/vsourcesquare/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \pgf at circ@res at up = .5\pgf at circ@res at up
+ \pgfscope
+ \pgftransformrotate{90}
+ \pgfpathmoveto{\pgfpoint{-1\pgf at circ@res at up}{0cm}}
+ \pgfpathlineto{\pgfpoint{-1\pgf at circ@res at up}{1\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0\pgf at circ@res at up}{1\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0\pgf at circ@res at up}{-1\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at up}{-1\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at up}{0\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+% Triangle Voltage source - contributed by Ralf Farkas
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/vsourcetri/height}}
+{vsourcetri}
+{\ctikzvalof{bipoles/vsourcetri/height}}
+{\ctikzvalof{bipoles/vsourcetri/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+
+ \pgf at circ@res at up = .5\pgf at circ@res at up
+ \pgfscope
+ \pgftransformrotate{90}
+ \pgfpathmoveto{\pgfpoint{-1\pgf at circ@res at up}{0cm}}
+ \pgfpathlineto{\pgfpoint{-0.5\pgf at circ@res at up}{0.75\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at up}{-0.75\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at up}{0\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+
+%% PV Source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/pvsource/height}}
+{pvsource}
+{\ctikzvalof{bipoles/pvsource/height}}
+{\ctikzvalof{bipoles/pvsource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgf at circ@draworfill
+
+ \pgfpathmoveto{\pgfpoint{.15\pgf at circ@res at right}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0}}
+ \pgfpathmoveto{\pgfpoint{.15\pgf at circ@res at left}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfusepath{draw}
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{.15\pgf at circ@res at left}{.4\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.15\pgf at circ@res at left}{.4\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{.15\pgf at circ@res at right}{.6\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.15\pgf at circ@res at right}{.6\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ %Arrow Part
+ \pgfscope
+ \pgfsetarrowsend{latex}
+ \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf at circ@res at left}{0}}{\pgfpointpolar{-45}{2.2\pgf at circ@res at up}}}
+ \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf at circ@res at left}{0}}{\pgfpointpolar{-45}{1.3\pgf at circ@res at up}}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf at circ@res at up}}{\pgfpointpolar{-45}{2.2\pgf at circ@res at up}}}
+ \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf at circ@res at up}}{\pgfpointpolar{-45}{1.3\pgf at circ@res at up}}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+}
+
+%% Empty Source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/esource/height}}
+{esource}
+{\ctikzvalof{bipoles/esource/height}}
+{\ctikzvalof{bipoles/esource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+}
+
+%% DC Current Source with open shape
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/dcisource/height}}
+{dcisource}
+{\ctikzvalof{bipoles/dcisource/height}}
+{\ctikzvalof{bipoles/dcisource/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@maybefill
+ \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
+ \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf at circ@res at up}}
+ \pgfpatharc{\@@angle}{-\@@angle}{\pgf at circ@res at up}
+ \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf at circ@res at up}}
+ \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf at circ@res at up}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{.7\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgftransformshift{\pgfpoint{.5\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+}
+
+%% DC-Voltage source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/dcvsource/height}}
+{dcvsource}
+{\ctikzvalof{bipoles/dcvsource/height}}
+{\ctikzvalof{bipoles/dcvsource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at up}{.5\pgf at circ@res at left}}
+ \pgfpathlineto{\pgfpoint{.2\pgf at circ@res at up}{.5\pgf at circ@res at right}}
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at down}{.5\pgf at circ@res at left}}
+ \pgfpathlineto{\pgfpoint{.2\pgf at circ@res at down}{.5\pgf at circ@res at right}}
+ \pgfusepath{draw}
+}
+
+%% Independent current source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/isource/height}}
+{isource}
+{\ctikzvalof{bipoles/isource/height}}
+{\ctikzvalof{bipoles/isource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgf at circ@draworfill
+}
+
+%% Independent double oo source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/oosource/height}}
+{oosource}
+{\ctikzvalof{bipoles/oosource/height}}
+{\ctikzvalof{bipoles/oosource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf at circ@res at left}{0}}
+ {\ctikzvalof{bipoles/oosource/circlesize}\pgf at circ@res at left}
+ \pgf at circ@maybefill
+ \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf at circ@res at right}{0}}
+ {\ctikzvalof{bipoles/oosource/circlesize}\pgf at circ@res at right}
+ \pgf at circ@draworfill
+ \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf at circ@res at left}{0}}
+ {\ctikzvalof{bipoles/oosource/circlesize}\pgf at circ@res at left}
+ \pgfusepath{draw}
+}
+
+% % % winding symbols
+% triangle
+\def\pgf at circ@delta#1{
+ \pgfscope
+ \pgftransformscale{-.01\pgf at circ@res at left*#1}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \pgftransformrotate{-\pgfcircmathresult}
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0}{.866\pgf at circ@res at up}}
+ \pgfpathclose
+ \pgfusepath{stroke}
+ \endpgfscope
+}
+
+% star
+\def\pgf at circ@wye#1{
+ \pgfscope
+ \pgftransformscale{-.015\pgf at circ@res at left*#1}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \pgftransformrotate{-\pgfcircmathresult}
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpointpolar{-30}{\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpointpolar{-150}{\pgf at circ@res at down}}
+ \pgfusepath{stroke}
+ \endpgfscope
+}
+
+% zigzag
+\def\pgf at circ@zig#1{
+ \pgfscope
+ \pgftransformscale{-.015\pgf at circ@res at left*#1}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \pgftransformrotate{-\pgfcircmathresult}
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpointpolar{90}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointpolar{60}{\pgf at circ@res at up}}
+
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpointpolar{210}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointpolar{0}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpointpolar{330}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointpolar{-60}{\pgf at circ@res at up}}
+ \pgfusepath{stroke}
+ \endpgfscope
+}
+
+% % % % round three-phase transformer
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/oosourcetrans/height}}
+{oosourcetrans}
+{\ctikzvalof{bipoles/oosourcetrans/height}}
+{\ctikzvalof{bipoles/oosourcetrans/width}}
+{
+
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf at circ@res at left}{0}}
+ {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at left}
+ \pgf at circ@maybefill
+ \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf at circ@res at right}{0}}
+ {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at right}
+ \pgf at circ@draworfill
+ \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf at circ@res at left}{0}}
+ {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at left}
+ \pgfusepath{draw}
+
+
+% % % % draw inner symbols
+
+ %%primary winding
+ \ifpgf at circ@prim at delta
+ \pgfscope
+ \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at left}
+ \pgf at circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@prim at wye
+ \pgfscope
+ \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at left}
+ \pgf at circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@prim at zig
+ \pgfscope
+ \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at left}
+ \pgf at circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
+ \endpgfscope
+ \fi\fi\fi
+
+ %%secondary winding
+ \ifpgf at circ@sec at delta
+ \pgfscope
+ \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at right}
+ \pgf at circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@sec at wye
+ \pgfscope
+ \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at right}
+ \pgf at circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@sec at zig
+ \pgfscope
+ \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf at circ@res at right}
+ \pgf at circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
+ \endpgfscope
+ \fi\fi\fi
+}
+
+
+% % % % ooosource for three phase transformer
+\pgfcircdeclarebipolescaled{sources}
+{
+ \anchor{right}{
+ \northeast
+ \pgf at y=0pt
+ \pgfmathparse{
+ \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
+ %%the sqrt must be > 0, the circles have to intersect
+ sqrt(
+ pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
+ pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
+ )
+ }
+ \pgf at x=\pgfmathresult\pgf at x
+ }
+ \anchor{east}{
+ \northeast
+ \pgf at y=0pt
+ }
+ \savedanchor{\centerprim}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf at circ@scaled at Rlen
+ \pgf at y=0pt
+ \pgf at x=.5\pgf at circ@scaled at Rlen
+ }
+ \anchor{centerprim}{
+ \centerprim
+ }
+ \savedanchor{\centersec}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf at circ@scaled at Rlen
+ \pgfpointpolar{60}{.5\pgf at circ@scaled at Rlen}
+ \pgf at y=-\pgf at y
+ \pgf at x=-\pgf at x
+ }
+ \anchor{centersec}{
+ \centersec
+ }
+ \savedanchor{\centertert}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf at circ@scaled at Rlen
+ \pgfpointpolar{60}{.5\pgf at circ@scaled at Rlen}
+ \pgf at y=\pgf at y
+ \pgf at x=-\pgf at x
+ }
+ \anchor{centertert}{
+ \centertert
+ }
+
+ % add some anchors in case the are needed :)
+ \anchor{prim1}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@scaled at Rlen
+ \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf at circ@scaled at Rlen}}
+ }
+ \anchor{prim2}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@scaled at Rlen
+ \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf at circ@scaled at Rlen}}
+ }
+ \anchor{sec1}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@scaled at Rlen
+ \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf at circ@scaled at Rlen}}
+ }
+ \anchor{sec2}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@scaled at Rlen
+ \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf at circ@scaled at Rlen}}
+ }
+ \anchor{sec3}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@scaled at Rlen
+ \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf at circ@scaled at Rlen}}
+ }
+ \anchor{tert1}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@scaled at Rlen
+ \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf at circ@scaled at Rlen}}
+ }
+ \anchor{tert2}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@scaled at Rlen
+ \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf at circ@scaled at Rlen}}
+ }
+ \anchor{tert3}{
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf at circ@Rlen
+ \pgf at circ@scaled at Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@scaled at Rlen
+ \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf at circ@scaled at Rlen}}
+ }
+}
+{\ctikzvalof{bipoles/ooosource/height}}
+{ooosource}
+{\ctikzvalof{bipoles/ooosource/height}}
+{\ctikzvalof{bipoles/ooosource/height}}
+{
+% \pgf at circ@res at other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf at circ@scaled at Rlen
+
+% % filling
+% left
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf at circ@res at left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at left}
+ \pgf at circ@maybefill
+
+ % up
+ \pgfscope
+ \pgfpointorigin
+ \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf at circ@res at right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}
+ \pgf at circ@maybefill
+ \endpgfscope
+% down
+ \pgfscope
+ \pgfpointorigin
+ \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf at circ@res at right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+% drawing
+ % left
+ \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf at circ@res at left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at left}
+ \pgfusepath{draw}
+
+ % up
+ \pgfscope
+ \pgfpointorigin
+ \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf at circ@res at right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}
+ \pgfusepath{draw}
+ \endpgfscope
+
+% % % draw inner symbols
+
+% % primary winding
+ \ifpgf at circ@prim at delta
+ \pgfscope
+ \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at left}
+ \pgf at circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@prim at wye
+ \pgfscope
+ \pgftransformxshift{.6\pgf at circ@res at left}
+ \pgf at circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@prim at zig
+ \pgfscope
+ \pgftransformxshift{.6\pgf at circ@res at left}
+ \pgf at circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+ \fi\fi\fi
+
+% % secondary winding
+ \ifpgf at circ@sec at delta
+ \pgfscope
+ \pgfpointorigin
+ \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}}
+ \pgf at circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@sec at wye
+ \pgfscope
+ \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}}
+ \pgf at circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@sec at zig
+ \pgfscope
+ \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}}
+ \pgf at circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+ \fi\fi\fi
+
+% % tertiary winding
+ \ifpgf at circ@tert at delta
+ \pgfscope
+ \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}}
+ \pgf at circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@tert at wye
+ \pgfscope
+ \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}}
+ \pgf at circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+
+ \else\ifpgf at circ@tert at zig
+ \pgfscope
+ \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf at circ@res at right}}
+ \pgf at circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
+ \endpgfscope
+ \fi\fi\fi
+}
+
+%% Independent current source - American
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/isourceam/height}}
+{isourceAM}
+{\ctikzvalof{bipoles/isourceam/height}}
+{\ctikzvalof{bipoles/isourceam/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+
+ \pgfpathmoveto{\pgfpoint{.7\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgftransformshift{\pgfpoint{.5\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+}
+
+%% Independent sinusoidal current source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/isource/height}}
+{isourcesin}
+{\ctikzvalof{bipoles/isource/height}}
+{\ctikzvalof{bipoles/isource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+
+ \pgf at circ@res at up = .5\pgf at circ@res at up
+ \pgfscope
+ \pgftransformrotate{90}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at up}{0cm}}
+ \pgfpathsine{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{.5\pgf at circ@res at up}{-.5\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{.5\pgf at circ@res at up}{-.5\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Empty controlled source
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/ecsource/height}}
+{ecsource}
+{\ctikzvalof{bipoles/ecsource/height}}
+{\ctikzvalof{bipoles/ecsource/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+}
+
+%% Controlled voltage source
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/cvsource/height}}
+{cvsource}
+{\ctikzvalof{bipoles/cvsource/height}}
+{\ctikzvalof{bipoles/cvsource/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+}
+
+%% To change the internal symbols of the controlled voltage source american style
+\ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
+\ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}}
+%% Controlled voltage source - American
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/cvsourceam/height}}
+{cvsourceAM}
+{\ctikzvalof{bipoles/cvsourceam/height}}
+{\ctikzvalof{bipoles/cvsourceam/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifpgf at circ@oldvoltagedirection
+ \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf at circ@res at left]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
+ \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf at circ@res at right]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
+ \else
+ \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf at circ@res at left]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
+ \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf at circ@res at right]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
+ \fi
+}
+
+%% Controlled sinusoidal voltage source
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/cvsourcesin/height}}
+{cvsourcesin}
+{\ctikzvalof{bipoles/cvsourcesin/height}}
+{\ctikzvalof{bipoles/cvsourcesin/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgf at circ@res at up = .5\pgf at circ@res at up
+ \pgfscope
+ \pgftransformrotate{90}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at up}{0cm}}
+ \pgfpathsine{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{.5\pgf at circ@res at up}{-.5\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{.5\pgf at circ@res at up}{-.5\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Controlled sinusoidal current source
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/cvsourcesin/height}}
+{cisourcesin}
+{\ctikzvalof{bipoles/cvsourcesin/height}}
+{\ctikzvalof{bipoles/cvsourcesin/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgf at circ@res at up = .5\pgf at circ@res at up
+ \pgfscope
+ \pgftransformrotate{90}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at up}{0cm}}
+ \pgfpathsine{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{.5\pgf at circ@res at up}{-.5\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{.5\pgf at circ@res at up}{-.5\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Controlled current source
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/cisource/height}}
+{cisource}
+{\ctikzvalof{bipoles/cisource/height}}
+{\ctikzvalof{bipoles/cisource/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+}
+
+%% Controlled current source - American
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/cisourceam/height}}
+{cisourceAM}
+{\ctikzvalof{bipoles/cisourceam/height}}
+{\ctikzvalof{bipoles/cisourceam/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \pgfpathmoveto{\pgfpoint{.7\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgftransformshift{\pgfpoint{.5\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+}
+
+%% Cute Independent voltage source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/vsource/height}}
+{vsourceC}
+{\ctikzvalof{bipoles/vsource/height}}
+{\ctikzvalof{bipoles/vsource/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
+ \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfsetroundcap\pgfusepath{draw}
+}
+
+%% Cute Independent current source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/isource/height}}
+{isourceC}
+{\ctikzvalof{bipoles/isource/height}}
+{\ctikzvalof{bipoles/isource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
+ \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{.6\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{.6\pgf at circ@res at down}}
+ \pgfsetroundcap\pgfusepath{draw}
+}
+
+%% Cute Controlled voltage source
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/cvsource/height}}
+{cvsourceC}
+{\ctikzvalof{bipoles/cvsource/height}}
+{\ctikzvalof{bipoles/cvsource/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@draworfill
+ \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
+ \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfsetroundcap\pgfusepath{draw}
+}
+
+%% Cute Controlled current source
+\pgfcircdeclarebipolescaled{csources}
+{}
+{\ctikzvalof{bipoles/cisource/height}}
+{cisourceC}
+{\ctikzvalof{bipoles/cisource/height}}
+{\ctikzvalof{bipoles/cisource/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@draworfill
+ \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
+ \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at zero}{.6\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at zero}{.6\pgf at circ@res at down}}
+ \pgfsetroundcap\pgfusepath{draw}
+}
+
+%% Noise voltage source
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/vsource/height}}
+{vsourceN}
+{\ctikzvalof{bipoles/vsource/height}}
+{\ctikzvalof{bipoles/vsource/width}}
+{
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ %
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=0.125\pgf at circ@scaled at Rlen\relax
+ \edef\pgf at noise@temp{dashed}
+ \edef\pgf at noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
+ \ifx\pgf at noise@temp\pgf at noise@fill
+ % fillable in this case
+ \pgf at circ@draworfillandclip
+ \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
+ \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by \pgf at circ@res at step\advance\pgf at circ@res at down by \pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by \pgf at circ@res at step\advance\pgf at circ@res at down by \pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by \pgf at circ@res at step\advance\pgf at circ@res at down by \pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ %
+ \advance\pgf at circ@res at up by -4\pgf at circ@res at step \advance\pgf at circ@res at down by -4\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by -\pgf at circ@res at step\advance\pgf at circ@res at down by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by -\pgf at circ@res at step\advance\pgf at circ@res at down by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \else
+ \pgfsetfillcolor{\pgf at noise@fill}
+ \pgfusepath{draw,fill}
+ \fi
+ \endpgfscope
+ \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
+ \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfsetroundcap\pgfusepath{draw}
+}
+%% Noise current source
+
+\pgfcircdeclarebipolescaled{sources}
+{}
+{\ctikzvalof{bipoles/isource/height}}
+{isourceN}
+{\ctikzvalof{bipoles/isource/height}}
+{\ctikzvalof{bipoles/isource/width}}
+{
+ \pgfpointorigin
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ %
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=0.125\pgf at circ@scaled at Rlen\relax
+ \edef\pgf at noise@temp{dashed}
+ \edef\pgf at noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
+ \ifx\pgf at noise@temp\pgf at noise@fill
+ % fillable in this case
+ \pgf at circ@draworfillandclip
+ \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
+ \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by \pgf at circ@res at step\advance\pgf at circ@res at down by \pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by \pgf at circ@res at step\advance\pgf at circ@res at down by \pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by \pgf at circ@res at step\advance\pgf at circ@res at down by \pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ %
+ \advance\pgf at circ@res at up by -4\pgf at circ@res at step \advance\pgf at circ@res at down by -4\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by -\pgf at circ@res at step\advance\pgf at circ@res at down by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at up by -\pgf at circ@res at step\advance\pgf at circ@res at down by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \else
+ \pgfsetfillcolor{\pgf at noise@fill}
+ \pgfusepath{draw,fill}
+ \fi
+ \endpgfscope
+ \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
+ \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{.6\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{.6\pgf at circ@res at down}}
+ \pgfsetroundcap\pgfusepath{draw}
+}
+
+%%%%%%%%%%%%%%
+%% Diodes
+%%%%%%%%%%%%%%
+
+%% Black generic diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{fulldiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at left}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% Black Zener diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{fullzdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at left}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw,fill}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Black alternative zigzag Zener diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{fullzzdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at left}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw,fill}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-1.8\pgf at circ@res at left}{\pgf at circ@res at down-0.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-0.2\pgf at circ@res at left}{\pgf at circ@res at up-0.5\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Black Schottky diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{fullsdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at left}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw,fill}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{.6\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-1.4\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-1.4\pgf at circ@res at left}{.6\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+}
+
+%% Black tunnel diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{fulltdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at left}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw,fill}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%
+% draw LED arrows
+%
+\def\pgf at circ@draw at ledarrows{%
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetarrowsend{latexslim}
+ \ifpgf at led@fliparrows
+ \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-0.6\pgf at circ@res at right}{1.8\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.6\pgf at circ@res at right}{0.6\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \else
+ \pgfpathmoveto{\pgfpoint{-0.4\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.6\pgf at circ@res at right}{2\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.2\pgf at circ@res at right}{0.8\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{1.2\pgf at circ@res at right}{1.8\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \fi
+}
+%
+% ---and photodiode arrows
+%
+\def\pgf at circ@draw at pdarrows{%
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetarrowsstart{latexslim}
+ \ifpgf at pd@fliparrows
+ \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-0.6\pgf at circ@res at right}{1.8\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.6\pgf at circ@res at right}{0.6\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \else
+ \pgfpathmoveto{\pgfpoint{-0.4\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.6\pgf at circ@res at right}{2\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.2\pgf at circ@res at right}{0.8\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{1.2\pgf at circ@res at right}{1.8\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \fi
+}
+%% Black light emitting diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{fulllediode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at left}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgf at circ@draw at ledarrows
+}
+
+%% Black photodiode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{fullpdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at left}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgf at circ@draw at pdarrows
+}
+
+%% Black varcap
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/varcap/height}}
+{fullvarcap}
+{\ctikzvalof{bipoles/varcap/height}}
+{\ctikzvalof{bipoles/varcap/width}}
+{
+ \pgf at circ@res at temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgfsetlinewidth{\pgf at circ@res at temp}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{0pt}}
+ \pgfusepath{draw,fill}
+ %
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% Code for the diode triangle
+\def\pgf at circ@basicdiodeshape{
+ % \pgfscope
+ \pgftransformxshift{\pgf at circ@res at left}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \pgfscope
+ % to allow filling, we need to draw explicitly the stroke here.
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \ifpgf at circuit@bipole at strokedsymbol
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{0pt}}
+ \pgfusepath{draw}
+ \fi
+ \endpgfscope
+ % \endpgfscope
+}
+
+%% Empty generic diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{emptydiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgf at circ@basicdiodeshape
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% Empty Zener diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{emptyzdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgf at circ@basicdiodeshape
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-0.6\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Empty alternative zigzag Zener diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{emptyzzdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfscope
+ \pgf at circ@basicdiodeshape
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-1.8\pgf at circ@res at left}{\pgf at circ@res at down-0.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-0.2\pgf at circ@res at left}{\pgf at circ@res at up-0.5\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+%% Empty Schottky diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{emptysdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgf at circ@basicdiodeshape
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{.6\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-1.4\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-1.4\pgf at circ@res at left}{.6\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+}
+
+%% Empty tunnel diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{emptytdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgf at circ@basicdiodeshape
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-.6\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Empty light emitting diode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{emptylediode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgf at circ@basicdiodeshape
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgf at circ@draw at ledarrows
+}
+
+%% Empty photodiode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/diode/height}}
+{emptypdiode}
+{\ctikzvalof{bipoles/diode/height}}
+{\ctikzvalof{bipoles/diode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope
+ \pgf at circ@basicdiodeshape
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgf at circ@draw at pdarrows
+}
+
+%% Empty varcap
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/varcap/height}}
+{emptyvarcap}
+{\ctikzvalof{bipoles/varcap/height}}
+{\ctikzvalof{bipoles/varcap/width}}
+{
+ \pgf at circ@res at temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgfsetlinewidth{\pgf at circ@res at temp}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ % \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{0pt}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \pgfscope
+ % to allow filling, we need to draw explicitily the stroke here.
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \ifpgf at circuit@bipole at strokedsymbol
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw}
+ \fi
+ \endpgfscope
+ %
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-2\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% Empty bidirectionaldiode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/bidirectionaldiode/height}}
+{emptybidirectionaldiode}
+{\ctikzvalof{bipoles/bidirectionaldiode/height}}
+{\ctikzvalof{bipoles/bidirectionaldiode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgf at circ@res at other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf at circ@res at left
+ \pgf at circ@res at step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf at circ@res at right
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.95\pgf at circ@res at step}{0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.95\pgf at circ@res at other}{-0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+
+ \pgf at circ@draworfill
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+}
+
+%% Full bidirectionaldiode
+\pgfcircdeclarebipolescaled{diodes}
+{}
+{\ctikzvalof{bipoles/bidirectionaldiode/height}}
+{fullbidirectionaldiode}
+{\ctikzvalof{bipoles/bidirectionaldiode/height}}
+{\ctikzvalof{bipoles/bidirectionaldiode/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgf at circ@res at other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf at circ@res at left
+ \pgf at circ@res at step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf at circ@res at right
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.95\pgf at circ@res at step}{0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.95\pgf at circ@res at other}{-0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+
+ \pgfusepath{draw, fill}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+}
+
+%% Black thyristor
+\pgfcircdeclarebipolescaled{diodes}
+{
+ \anchor{gate}{\northeast}
+ \anchor{anode}{\southwest\pgf at y=0cm}
+ \anchor{G}{\northeast}
+ \anchor{cathode}{\northeast\pgf at y=0cm }
+}
+{\ctikzvalof{tripoles/thyristor/height 2}}
+{fullthyristor}
+{\ctikzvalof{tripoles/thyristor/height}}
+{\ctikzvalof{tripoles/thyristor/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgf at circ@res at other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf at circ@res at left
+ \pgf at circ@res at step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf at circ@res at right
+
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at other}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw,fill}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{2*\pgf at circ@res at step-2*\pgf at circ@res at other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{2*\pgf at circ@res at step-2*\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{-\pgf at circ@res at down}}
+
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+
+}
+
+%% Empty thyristor
+
+\pgfcircdeclarebipolescaled{diodes}
+{
+ \anchor{gate}{\northeast}
+ \anchor{anode}{\southwest\pgf at y=0cm}
+ \anchor{G}{\northeast}
+ \anchor{cathode}{\northeast\pgf at y=0cm }
+}
+{\ctikzvalof{tripoles/thyristor/height 2}}
+{emptythyristor}
+{\ctikzvalof{tripoles/thyristor/height}}
+{\ctikzvalof{tripoles/thyristor/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgf at circ@res at other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf at circ@res at left
+ \pgf at circ@res at step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf at circ@res at right
+
+ \pgfscope
+ \pgftransformxshift{\pgf at circ@res at other}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \pgfscope
+ % to allow filling, we need to draw explicitily the stroke here.
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \ifpgf at circuit@bipole at strokedsymbol
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{0pt}}
+ \pgfusepath{draw}
+ \fi
+ \endpgfscope
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{2*\pgf at circ@res at step-2*\pgf at circ@res at other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{2*\pgf at circ@res at step-2*\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{-\pgf at circ@res at down}}
+
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+}
+
+%% Empty triac
+\pgfcircdeclarebipolescaled{diodes}
+{
+ \anchor{gate}{\northeast}
+ \anchor{anode}{\southwest\pgf at y=0cm}
+ \anchor{G}{\northeast}
+ \anchor{cathode}{\northeast\pgf at y=0cm }
+}
+{\ctikzvalof{tripoles/triac/height}}
+{emptytriac}
+{\ctikzvalof{tripoles/triac/height}}
+{\ctikzvalof{tripoles/triac/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgf at circ@res at other = \ctikzvalof{tripoles/triac/diode width left}\pgf at circ@res at left
+ \pgf at circ@res at step = \ctikzvalof{tripoles/triac/diode width right}\pgf at circ@res at right
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.95\pgf at circ@res at step}{0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.95\pgf at circ@res at other}{-0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+
+ \pgf at circ@draworfill
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{-0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}} % sqrt(1/2)
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+}
+
+%% Full triac
+\pgfcircdeclarebipolescaled{diodes}
+{
+ \anchor{gate}{\northeast}
+ \anchor{anode}{\southwest\pgf at y=0cm}
+ \anchor{G}{\northeast}
+ \anchor{cathode}{\northeast\pgf at y=0cm }
+}
+{\ctikzvalof{tripoles/triac/height}}
+{fulltriac}
+{\ctikzvalof{tripoles/triac/height}}
+{\ctikzvalof{tripoles/triac/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgf at circ@res at other = \ctikzvalof{tripoles/triac/diode width left}\pgf at circ@res at left
+ \pgf at circ@res at step = \ctikzvalof{tripoles/triac/diode width right}\pgf at circ@res at right
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.95\pgf at circ@res at step}{0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.95\pgf at circ@res at other}{-0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}}
+
+ \pgfusepath{draw,fill}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{-0.707*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-1.414*(\pgf at circ@res at other-\pgf at circ@res at step)}} % sqrt(1/2)
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}} % sqrt(1/2)
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+}
+
+%%%%%%%%%%%%%
+%% switches
+%%%%%%%%%%%%%
+
+%% (Closing) SPST
+\pgfcircdeclarebipolescaled{switches}
+{}
+{\ctikzvalof{bipoles/spst/depth}}
+{cspst}
+{\ctikzvalof{bipoles/spst/height}}
+{\ctikzvalof{bipoles/spst/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf at circ@res at right}}
+ \pgfpatharc{90}{-20}{1.2\pgf at circ@res at right}
+ \pgfsetarrowsend{latexslim}
+ \pgfsetbeveljoin
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Opening SPST
+\pgfcircdeclarebipolescaled{switches}
+{}
+{\ctikzvalof{bipoles/spst/depth}}
+{ospst}
+{\ctikzvalof{bipoles/spst/height}}
+{\ctikzvalof{bipoles/spst/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf at circ@res at right}}
+ \pgfpatharc{-10}{90}{1.2\pgf at circ@res at right}
+ \pgfsetarrowsend{latexslim}
+ \pgfsetbeveljoin
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% Normal open Switch
+\pgfcircdeclarebipolescaled{switches}
+{}
+{\ctikzvalof{bipoles/nos/depth}}
+{nos}
+{\ctikzvalof{bipoles/nos/height}}
+{\ctikzvalof{bipoles/nos/width}}
+{
+
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.9\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfsetbuttcap
+ \pgfusepath{draw}
+}
+
+%% Normal closed Switch
+\pgfcircdeclarebipolescaled{switches}
+{}
+{\ctikzvalof{bipoles/ncs/depth}}
+{ncs}
+{\ctikzvalof{bipoles/ncs/height}}
+{\ctikzvalof{bipoles/ncs/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.9\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.2\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.2\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% Push Button
+\pgfcircdeclarebipolescaled{switches}
+{}
+{\ctikzvalof{bipoles/pushbutton/height 2}}
+{pushbutton}
+{\ctikzvalof{bipoles/pushbutton/height}}
+{\ctikzvalof{bipoles/pushbutton/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{.5\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+ \pgftransformshift{\pgfpoint{2\pgf at circ@res at right}{0pt}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+}
+
+%% Normally closed Push Button
+\pgfcircdeclarebipolescaled{switches}
+{}
+{\ctikzvalof{bipoles/pushbutton/height 2}}
+{ncpushbutton}
+{\ctikzvalof{bipoles/pushbutton/height}}
+{\ctikzvalof{bipoles/pushbutton/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ % Warning, if the nodes will have a class, we have to touch this.
+ \pgf at circ@res at temp=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at temp}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-\pgf at circ@res at temp}}
+ \pgfpathmoveto{\pgfpoint{0}{-\pgf at circ@res at temp}}
+ \pgfpathlineto{\pgfpoint{0}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ %
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+ \pgftransformshift{\pgfpoint{2\pgf at circ@res at right}{0pt}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+}
+%%% reed switches
+\pgfcircdeclarebipolescaled{switches}
+{}
+{\ctikzvalof{bipoles/reed/depth}}
+{reed}
+{\ctikzvalof{bipoles/reed/height}}
+{\ctikzvalof{bipoles/reed/width}}
+{
+ % this is designed to be the same as a "nos".
+ \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
+ \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ % eclosure
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at up}{\pgf at circ@res at up}}
+ \pgfpatharc{90}{-90}{\pgf at circ@res at up}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at up}{-\pgf at circ@res at up}}
+ \pgfpatharc{270}{90}{\pgf at circ@res at up}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ % switch
+ \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\@@tmpx\pgf at circ@res at right}{\@@tmpy\pgf at circ@res at up}}
+ % connection lines
+ \pgfsetbuttcap
+ \pgfusepath{draw}
+ \endpgfscope
+ % connection lines
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\@@tmpx\pgf at circ@res at left}{0pt}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\@@tmpx\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+}
+
+% cute switch "to" shapes help function
+% #1 -> name
+% #2 -> barposition
+% #3 -> arrowcode
+\long\def\pgfcircdeclarecutesw#1#2#3{
+ \pgfcircdeclarebipolescaled{switches}
+ {
+ \savedanchor\midlever{
+ % these values are calculated when we create the definition of the shape.
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{bipoles/cuteswitch/height}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at temp=\ctikzvalof{nodes width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf at circ@res at temp
+ \pgf at circ@res at down = -.5\pgf at y
+ \pgf at circ@res at up = .5\pgf at y
+ \pgfextracty{\pgf at circ@res at other}{#2}
+ \pgf at x=0pt
+ \pgf at y=.5\pgf at circ@res at other
+ }
+ % radius of the connector
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ % If cnnecting nodes are scaled, we have to modify this
+ \saveddimen{\radius}{\pgfmathsetlength\pgf at x{\pgf at circ@Rlen*\ctikzvalof{nodes width}}}
+ % shapename
+ \savedmacro{\thisshape}{\def\thisshape{\tikz at fig@name}}
+ % shape type
+ \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
+ % mid of the lever, to stack switches
+ \anchor{mid}{\midlever}
+ \anchor{cout}{\northeast \pgf at y=0cm}
+ \anchor{cin}{\southwest\pgf at y=0cm}
+ \anchor{out}{\northeast \pgf at y=0cm\advance\pgf at x by \radius}
+ \anchor{in}{\southwest\pgf at y=0cm\advance\pgf at x by -\radius}
+ }
+ {\ctikzvalof{bipoles/cuteswitch/height 2}}
+ {#1}
+ {\ctikzvalof{bipoles/cuteswitch/height}}
+ {\ctikzvalof{bipoles/cuteswitch/width}}{
+ \pgfscope
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ % If cnnecting nodes are scaled, we have to modify this
+ \pgf at circ@res at temp=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgf at circ@res at temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf at circ@res at temp
+ \pgfsetlinewidth{2\pgf at circ@res at temp}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{#2}
+ \pgfsetroundcap\pgfusepath{draw}
+ \endpgfscope
+ \pgfscope % arrow
+ #3
+ \endpgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
+ \pgftransformshift{\pgfpoint{2\pgf at circ@res at right}{0pt}}
+ \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
+ }
+}
+
+%% closed cute switch
+\pgfcircdeclarecutesw{cuteclosedswitch}
+ {\pgfpoint{\pgf at circ@res at right}{1.5\pgf at circ@res at temp}}
+ {}
+
+%% open cute switch
+\pgfcircdeclarecutesw{cuteopenswitch}
+ {\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ {}
+
+%% closing cute switch
+\pgfcircdeclarecutesw{cuteclosingswitch}
+ {\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ {
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}} % in node
+ \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf at circ@res at right}}
+ \pgfpatharc{70}{-10}{1.2\pgf at circ@res at right}
+ \pgfsetarrowsend{latexslim}
+ \pgfusepath{draw}
+ }
+
+%% opening cute switch
+\pgfcircdeclarecutesw{cuteopeningswitch}
+ {\pgfpoint{\pgf at circ@res at right}{1.5\pgf at circ@res at temp}}
+ {
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}} % in node
+ \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf at circ@res at right}}
+ \pgfpatharc{-10}{60}{1.2\pgf at circ@res at right}
+ \pgfsetarrowsend{latexslim}
+ \pgfusepath{draw}
+ }
+
+%%%%%%%%%%%%%%%%%
+%% Instruments
+%%%%%%%%%%%%%%%%%
+
+% % METERINGSHAPE
+\long\def\drawmeteringcircle{
+ \def\pgf at circ@temp{right}
+ \ifx\tikz at res@label at pos\pgf at circ@temp
+ \pgf at circ@res at step=-1.2\pgf at circ@res at up
+ \else
+ \def\pgf at circ@temp{below}
+ \ifx\tikz at res@label at pos\pgf at circ@temp
+ \pgf at circ@res at step=-1.2\pgf at circ@res at up
+ \else
+ \pgf at circ@res at step=1.2\pgf at circ@res at up
+ \fi
+ \fi
+ %draw connections to circle
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{.9\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathmoveto{\pgfpoint{.9\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+ %draw circle
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpointorigin}{.9\pgf at circ@res at up}
+ \pgf at circ@draworfill
+ \endpgfscope
+ %draw arrow
+ \pgfscope
+ \pgfsetarrowsend{latex}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%AMPEREMETER
+\pgfcircdeclarebipolescaled{instruments}
+{}
+{\ctikzvalof{bipoles/ammeter/height}}
+{ammeter}
+{\ctikzvalof{bipoles/ammeter/height}}
+{\ctikzvalof{bipoles/ammeter/width}}
+{
+ \drawmeteringcircle
+ \pgfnode{circle}{center}{\pgf at circ@font at bold{A}}{}{}
+}
+%OHMMETER
+\pgfcircdeclarebipolescaled{instruments}
+{}
+{\ctikzvalof{bipoles/ohmmeter/height}}
+{ohmmeter}
+{\ctikzvalof{bipoles/ohmmeter/height}}
+{\ctikzvalof{bipoles/ohmmeter/width}}
+{
+ \drawmeteringcircle
+ \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
+}
+%VOLTMETER
+\pgfcircdeclarebipolescaled{instruments}
+{}
+{\ctikzvalof{bipoles/voltmeter/height}}
+{voltmeter}
+{\ctikzvalof{bipoles/voltmeter/height}}
+{\ctikzvalof{bipoles/voltmeter/width}}
+{
+ \drawmeteringcircle
+ \pgfnode{circle}{center}{\pgf at circ@font at bold{V}}{}{}
+
+}
+
+% oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
+\pgfcircdeclarebipolescaled{instruments}
+{
+ \anchor{in 1}{\southwest\pgf at y=0.75\pgf at y\pgf at x=0.4\pgf at x}
+ \anchor{in 2}{\southwest\pgf at y=0.75\pgf at y\pgf at x=-0.4\pgf at x}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+}
+{\ctikzvalof{bipoles/oscope/height}}
+{oscope}
+{\ctikzvalof{bipoles/oscope/height}}
+{\ctikzvalof{bipoles/oscope/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at right}{\northeast}
+ \pgfextractx{\pgf at circ@res at left}{\southwest}
+ \pgfextracty{\pgf at circ@res at down}{\southwest}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.25*\pgf at circ@res at up}
+ \pgfscope
+ \pgfsetcornersarced{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at step}}
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ % this would create a round (analog?) scope...
+ % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ % get the rotation
+ \ifpgf at circuit@straightinstruments
+ \pgfgettransformentries\a\b\temp\temp\temp\temp
+ \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
+ \else
+ \edef\rot{0}
+ \fi
+ % and unrotate the scope
+ \pgfscope
+ \pgftransformrotate{\rot}
+ % grid
+ \pgfscope
+ \pgfsetlinewidth{0.5\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0.75\pgf at circ@res at left}{0.25\pgf at circ@res at down}}
+ \pgfpathgrid[stepx=\pgf at circ@res at step, stepy=\pgf at circ@res at step]%
+ {\pgfpoint{0.75\pgf at circ@res at left}{0.5\pgf at circ@res at down}}
+ {\pgfpoint{0.75\pgf at circ@res at right}{0.5\pgf at circ@res at up}}
+ \pgfsetstrokeopacity{0.5}
+ \pgfusepath{draw}
+ \endpgfscope
+ % function displayed, thanks to
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0.75\pgf at circ@res at left}{0.25\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.05\pgf at circ@res at left}{0.25\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.05\pgf at circ@res at left}{0.25\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.65\pgf at circ@res at right}{0.25\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.65\pgf at circ@res at right}{0.25\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+% generic round meter with always horizontal text, no arrow
+\pgfcircdeclarebipolescaled{instruments}
+{}
+{\ctikzvalof{bipoles/esource/height}}
+{rmeter}
+{\ctikzvalof{bipoles/esource/height}}
+{\ctikzvalof{bipoles/esource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ % draw the text label
+ % get the rotation
+ \ifpgf at circuit@straightinstruments
+ \pgfgettransformentries\a\b\temp\temp\temp\temp
+ \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
+ \else
+ \edef\rot{0}
+ \fi
+ % and unrotate the scope
+ \pgfscope
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgftransformrotate{\rot}
+ \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
+ \endpgfscope
+}
+
+% generic round meter with always horizontal text, with arrow
+\pgfcircdeclarebipolescaled{instruments}
+{}
+{\ctikzvalof{bipoles/esource/height}}
+{rmeterwa}
+{\ctikzvalof{bipoles/esource/height}}
+{\ctikzvalof{bipoles/esource/width}}
+{
+ \pgfpointorigin
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ % draw the text label
+ % get the rotation
+ \ifpgf at circuit@straightinstruments
+ \pgfgettransformentries\a\b\temp\temp\temp\temp
+ \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
+ \else
+ \edef\rot{0}
+ \fi
+ % and unrotate the scope
+ \pgfscope
+ \pgftransformrotate{\rot}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ % arrow: create a center hole to have better visual
+ \pgfscope
+ % clipping path: first a rectangle bigger then the shape
+ % to avoid problems with the line thickness
+ \pgfpathrectanglecorners{\pgfpoint{2\pgf at circ@res at left}{2\pgf at circ@res at down}}
+ {\pgfpoint{2\pgf at circ@res at right}{2\pgf at circ@res at up}}
+ % next open a circle into it
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf at circ@res at up}}{\pgfpoint{.6\pgf at circ@res at left}{0}}
+ % do the difference and clip before drawing
+ \pgfseteorule
+ \pgfusepath{clip}
+ \pgfsetarrowsend{latexslim}
+ % the arrow is better if it has a bit of breath and it's not 45º
+ \pgfpathmoveto{\pgfpoint{.8\pgf at circ@res at left}{1.2\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.8\pgf at circ@res at right}{1.2\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
+ \endpgfscope
+}
+
+% generic square meter with always horizontal text
+\pgfcircdeclarebipolescaled{instruments}
+{
+ \anchor{in 1}{\southwest\pgf at y=0.75\pgf at y\pgf at x=0.4\pgf at x}
+ \anchor{in 2}{\southwest\pgf at y=0.75\pgf at y\pgf at x=-0.4\pgf at x}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+}
+{\ctikzvalof{bipoles/smeter/height}}
+{smeter}
+{\ctikzvalof{bipoles/smeter/height}}
+{\ctikzvalof{bipoles/smeter/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at right}{\northeast}
+ \pgfextractx{\pgf at circ@res at left}{\southwest}
+ \pgfextracty{\pgf at circ@res at down}{\southwest}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.25*\pgf at circ@res at up}
+ \pgfscope
+ \pgfsetcornersarced{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at step}}
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ % get the rotation
+ \ifpgf at circuit@straightinstruments
+ \pgfgettransformentries\a\b\temp\temp\temp\temp
+ \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
+ \else
+ \edef\rot{0}
+ \fi
+ % and unrotate the scope
+ \pgfscope
+ \pgftransformrotate{\rot}
+ % the metering window
+ \pgfscope
+ \def\@starta{105}\def\@stopa{75}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf at circ@res at up}}
+ \pgfpatharc{\@starta}{\@stopa}{2\pgf at circ@res at up}
+ \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf at circ@res at up}}
+ \pgfpatharc{\@stopa}{\@starta}{2.5\pgf at circ@res at up}
+ \pgfclosepath
+ \pgfpathmoveto{\pgfpointpolar{80}{2\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgftext[center, y=0.5\pgf at circ@res at down]{\ctikzvalof{bipoles/twoport/text}}
+ \endpgfscope
+}
+
+% probes qucs style:
+% #1 : name
+% #2 : extra code
+\long\def\pgfcirc at qucsprobe#1#2{
+ \pgfcircdeclarebipolescaled{instruments}
+ {
+ \anchor{v+}{\southwest\pgf at x=0.6\pgf at x}
+ \anchor{v-}{\southwest\pgf at x=-0.6\pgf at x}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+ }
+ {\ctikzvalof{bipoles/qmeter/depth}}
+ {#1}
+ {\ctikzvalof{bipoles/qmeter/height}}
+ {\ctikzvalof{bipoles/qmeter/width}}
+ {
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at right}{\northeast}
+ \pgfextractx{\pgf at circ@res at left}{\southwest}
+ \pgfextracty{\pgf at circ@res at down}{\southwest}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.25*\pgf at circ@res at up}
+ \pgfscope
+ \pgfscope
+ \pgfsetcornersarced{\pgfpoint{\pgf at circ@res at step}{\pgf at circ@res at step}}
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ \def\@starta{103}\def\@stopa{77}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfscope
+ \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf at circ@res at up}}
+ \pgfpatharc{\@starta}{\@stopa}{2.1\pgf at circ@res at up}
+ \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf at circ@res at up}}
+ \pgfpatharc{\@stopa}{\@starta}{2.5\pgf at circ@res at up}
+ \pgfclosepath
+ \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgf at circ@draworfill
+ \endpgfscope
+ #2
+ \endpgfscope
+ }
+}
+
+\pgfcirc at qucsprobe{qiprobe}{
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+ \pgfnode{currarrow}{center}{}{}{}
+}
+
+\pgfcirc at qucsprobe{qvprobe}{
+ \pgfmathsetlength{\pgf at circ@res at other}{\ctikzvalof{nodes width}*\pgf at circ@scaled at Rlen}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at left}{0pt}}
+ \pgfpathcircle{\pgfpoint{.6\pgf at circ@res at left+\pgf at circ@res at other}{0pt}}{\pgf at circ@res at other}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathcircle{\pgfpoint{.6\pgf at circ@res at right-\pgf at circ@res at other}{0pt}}{\pgf at circ@res at other}
+ \pgfusepath{draw}
+ \pgfscope
+ % "+" and "-", drawn so that they scale correctly
+ \pgfsetlinewidth{2\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left+\pgf at circ@res at other}{-1.5\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at left+\pgf at circ@res at other}{-3.5\pgf at circ@res at other}}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left+0\pgf at circ@res at other}{-2.5\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at left+2\pgf at circ@res at other}{-2.5\pgf at circ@res at other}}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at right+0\pgf at circ@res at other}{-2.5\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right-2\pgf at circ@res at other}{-2.5\pgf at circ@res at other}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+\pgfcirc at qucsprobe{qpprobe}{
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+ \pgfnode{currarrow}{center}{}{}{}
+ \pgfmathsetlength{\pgf at circ@res at other}{\ctikzvalof{nodes width}*\pgf at circ@scaled at Rlen}
+ \pgfpathcircle{\pgfpoint{.6\pgf at circ@res at left}{-3\pgf at circ@res at other}}{\pgf at circ@res at other}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left}{-4\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathcircle{\pgfpoint{.6\pgf at circ@res at right}{-3\pgf at circ@res at other}}{\pgf at circ@res at other}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at right}{-4\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfscope
+ % "+" and "-", drawn so that they scale correctly
+ \pgfsetlinewidth{2\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left+3\pgf at circ@res at other}{-2\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at left+3\pgf at circ@res at other}{-4\pgf at circ@res at other}}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left+2\pgf at circ@res at other}{-3\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at left+4\pgf at circ@res at other}{-3\pgf at circ@res at other}}
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at right-4\pgf at circ@res at other}{-3\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right-2\pgf at circ@res at other}{-3\pgf at circ@res at other}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+% current loop for oscope and similar: stylized
+\pgfcircdeclarebipolescaled{instruments}
+{
+ \anchor{i}{\northeast\pgf at x=0pt\relax}
+ \anchor{text}{
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at left}{\northeast}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf at circ@res at left}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+}
+{\ctikzvalof{bipoles/iloop/height}}
+{iloop}
+{\ctikzvalof{bipoles/iloop/height}}
+{\ctikzvalof{bipoles/iloop/width}}
+{
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at right}{\northeast}
+ \pgf at circ@res at down=-\pgf at circ@res at up
+ \pgf at circ@res at left=-\pgf at circ@res at right
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfsetcolor{\ctikzvalof{color}}
+ % external ellipse
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ % clipping path: first a rectangle bigger then the shape
+ % to avoid problems with the line thickness
+ \pgfpathrectanglecorners{\pgfpoint{2\pgf at circ@res at left}{2\pgf at circ@res at down}}
+ {\pgfpoint{2\pgf at circ@res at right}{2\pgf at circ@res at up}}
+ % next the opening to the left
+ \pgfpathrectanglecorners{\pgfpoint{2\pgf at circ@res at left}{.1\pgf at circ@res at down}}
+ {\pgfpoint{0pt}{.1\pgf at circ@res at up}}
+ % do the difference and clip before drawing
+ \pgfseteorule
+ \pgfusepath{clip}
+ \pgfpathellipse{\pgfpointorigin}{
+ \pgfpoint{0pt}{0.8\pgf at circ@res at up}}{
+ \pgfpoint{0.4\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+ \endpgfscope
+ % internal wire
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.3\pgf at circ@res at right}{0pt}}
+ \pgfpathmoveto{\pgfpoint{0.5\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ % and the contact line up
+ \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+% current loop for oscope and similar: real (double connection)
+\pgfcircdeclarebipolescaled{instruments}
+{
+ \anchor{i+}{
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at right}{\northeast}
+ \pgf at circ@res at step=0.4\pgf at circ@res at right
+ \pgf at circ@res at other=0.8\pgf at circ@res at up
+ \pgfpointpolar{105}{\pgf at circ@res at step and \pgf at circ@res at other}
+ \pgf at y=\pgf at circ@res at up
+ }
+ \anchor{i-}{
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at right}{\northeast}
+ \pgf at circ@res at step=0.4\pgf at circ@res at right
+ \pgf at circ@res at other=0.8\pgf at circ@res at up
+ \pgfpointpolar{75}{\pgf at circ@res at step and \pgf at circ@res at other}
+ \pgf at y=\pgf at circ@res at up
+ }
+ \anchor{text}{
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at left}{\northeast}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf at circ@res at left}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+}
+{\ctikzvalof{bipoles/iloop/height}}
+{iloop2}
+{\ctikzvalof{bipoles/iloop/height}}
+{\ctikzvalof{bipoles/iloop/width}}
+{
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at right}{\northeast}
+ \pgf at circ@res at down=-\pgf at circ@res at up
+ \pgf at circ@res at left=-\pgf at circ@res at right
+ % must be the same than internal i+ and i- anchors definition
+ \pgf at circ@res at step=0.4\pgf at circ@res at right
+ \pgf at circ@res at other=0.8\pgf at circ@res at up
+ \def\@plus{\pgfpointpolar{105}{\pgf at circ@res at step and \pgf at circ@res at other}}
+ \def\@minus{\pgfpointpolar{75}{\pgf at circ@res at step and \pgf at circ@res at other}}
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfsetcolor{\ctikzvalof{color}}
+ % external ellipse
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ % clipping path: first a rectangle bigger then the shape
+ % to avoid problems with the line thickness
+ \pgfpathrectanglecorners{\pgfpoint{2\pgf at circ@res at left}{2\pgf at circ@res at down}}
+ {\pgfpoint{2\pgf at circ@res at right}{2\pgf at circ@res at up}}
+ % next the opening to the left
+ \pgfpathrectanglecorners{\pgfpoint{2\pgf at circ@res at left}{.1\pgf at circ@res at down}}
+ {\pgfpoint{0pt}{.1\pgf at circ@res at up}}
+ % do the difference and clip before drawing
+ \pgfseteorule
+ \pgfusepath{clip}
+ \pgfpathmoveto{\@plus}
+ \pgfpatharc{105}{435}{\pgf at circ@res at step and \pgf at circ@res at other}
+ \pgfusepath{draw}
+ \endpgfscope
+ % internal wire
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.3\pgf at circ@res at right}{0pt}}
+ \pgfpathmoveto{\pgfpoint{0.5\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ % and the contact line up
+ % I use ...left and ---right as temporal lengths here to avoid defining more
+ \pgfextractx{\pgf at circ@res at left}{\@plus}
+ \pgfextractx{\pgf at circ@res at right}{\@minus}
+ \pgfpathmoveto{\@plus}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\@minus}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+
+%% Varistor
+\pgfcircdeclarebipolescaled{resistors}
+{}
+{\ctikzvalof{bipoles/varistor/height}}
+{varistor}
+{\ctikzvalof{bipoles/varistor/height}}
+{\ctikzvalof{bipoles/varistor/width}}
+{
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\ctikzvalof{bipoles/varistor/main}\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{-\ctikzvalof{bipoles/varistor/main}\pgf at circ@res at up}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at left}{-\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ \pgftext[top,x=.65\pgf at circ@res at left,y=1.2\pgf at circ@res at down]{{\pgf at circ@font at tiny\textsf{U}}}
+}
+
+%%%%%%%%%%%%%%
+%% RF bipoles
+%%%%%%%%%%%%%%
+
+% transmission line
+\pgfcircdeclarebipolescaled{RF}
+{}
+{\ctikzvalof{bipoles/tline/height}}
+{tline}
+{\ctikzvalof{bipoles/tline/height}}
+{\ctikzvalof{bipoles/tline/width}}
+{
+ \pgf at circ@res at step=.2\pgf at circ@res at right % half x axis
+ \begin{pgftransparencygroup}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpatharc{-90}{90}{-\pgf at circ@res at step and -\pgf at circ@res at up}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgf at circ@draworfill
+ \pgfpathellipse{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at step}{0pt}}
+ {\pgfpoint{\pgf at circ@res at step}{0pt}}{\pgfpoint{0pt}{-\pgf at circ@res at up}}
+ \pgf at circ@draworfill
+ \end{pgftransparencygroup}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right-\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfusepath{stroke}
+}
+
+% microstrip transmission line
+\pgfcircdeclarebipolescaled{RF}
+{}
+{\ctikzvalof{bipoles/mstline/height}}
+{mstline}
+{\ctikzvalof{bipoles/mstline/height}}
+{\ctikzvalof{bipoles/mstline/width}}
+{
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+}
+
+%%%%%%%%%%%%%%%%%%%
+%% Block diagrams
+%%%%%%%%%%%%%%%%%%%
+
+%% Draw the two-port fillable box
+\def\pgf at circ@twoportbox{
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@draworfill
+ \endpgfscope
+}
+
+%% Generic two port box
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/twoport/height}}
+{twoport}
+{\ctikzvalof{bipoles/twoport/height}}
+{\ctikzvalof{bipoles/twoport/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+ % draw outer box
+ \pgf at circ@twoportbox
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
+
+}
+
+%% voltage controled oscillator
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/vco/width}}
+{vco}
+{\ctikzvalof{bipoles/twoport/width}}
+{\ctikzvalof{bipoles/vco/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/vco/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+ % draw circle
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpoint{0}{0}} {\pgf at circ@res at step}
+ \pgf at circ@draworfill
+ \endpgfscope
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner sine waves
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.5\pgf at circ@res at step}{0\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+%% bandpass filter
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/bandpass/width}}
+{bandpass}
+{\ctikzvalof{bipoles/bandpass/width}}
+{\ctikzvalof{bipoles/bandpass/width}}
+{
+
+ \pgf at circ@res at step = \ctikzvalof{bipoles/bandpass/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-0.15\pgf at circ@res at step}{0.35\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.15\pgf at circ@res at step}{0.65\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{-0.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-0.15\pgf at circ@res at step}{-0.65\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.15\pgf at circ@res at step}{-0.35\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+%% bandstop filter
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/bandstop/width}}
+{bandstop}
+{\ctikzvalof{bipoles/bandstop/width}}
+{\ctikzvalof{bipoles/bandstop/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/bandstop/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt}% always draw solid line for inner symbol
+ \pgfsetarrows{-}%never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-0.15\pgf at circ@res at step}{-0.15\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.15\pgf at circ@res at step}{0.15\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{-0.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+%% highpass filter
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/highpass/width}}
+{highpass}
+{\ctikzvalof{bipoles/highpass/width}}
+{\ctikzvalof{bipoles/highpass/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/highpass/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-0.15\pgf at circ@res at step}{-0.15\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.15\pgf at circ@res at step}{0.15\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{-0.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-0.15\pgf at circ@res at step}{-0.65\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.15\pgf at circ@res at step}{-0.35\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+%% lowpass filter
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/lowpass/width}}
+{lowpass}
+{\ctikzvalof{bipoles/lowpass/width}}
+{\ctikzvalof{bipoles/lowpass/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/lowpass/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-0.15\pgf at circ@res at step}{0.35\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.15\pgf at circ@res at step}{0.65\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-0.15\pgf at circ@res at step}{-0.15\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.15\pgf at circ@res at step}{0.15\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{-0.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.25\pgf at circ@res at step}{-.25\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.25\pgf at circ@res at step}{.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+%% ADC
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/adc/width}}
+{adc}
+{\ctikzvalof{bipoles/adc/width}}
+{\ctikzvalof{bipoles/adc/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/adc/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\texti{A}
+ \def\textii{D}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \def\texti{D}
+ \def\textii{A}
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \def\texti{D}
+ \def\textii{A}
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \def\texti{A}
+ \def\textii{D}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgftext[center,x=0.45\pgf at circ@res at left,y=0.45\pgf at circ@res at up]{\textsf{\texti}}
+ \pgftext[center,x=0.45\pgf at circ@res at right,y=0.45\pgf at circ@res at down]{\textsf{\textii}}
+}
+
+%% DAC
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/dac/width}}
+{dac}
+{\ctikzvalof{bipoles/dac/width}}
+{\ctikzvalof{bipoles/dac/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/dac/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\texti{D}
+ \def\textii{A}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \def\texti{A}
+ \def\textii{D}
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \def\texti{A}
+ \def\textii{D}
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \def\texti{D}
+ \def\textii{A}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgftext[center,x=0.45\pgf at circ@res at left,y=0.45\pgf at circ@res at up]{\textsf{\texti}}
+ \pgftext[center,x=0.45\pgf at circ@res at right,y=0.45\pgf at circ@res at down]{\textsf{\textii}}
+}
+
+%% DSP
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/dsp/width}}
+{dsp}
+{\ctikzvalof{bipoles/dsp/width}}
+{\ctikzvalof{bipoles/dsp/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/dsp/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgftext[center,x=0,y=0]{\textsf{DSP}}
+}
+
+%% FFT
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/fft/width}}
+{fft}
+{\ctikzvalof{bipoles/fft/width}}
+{\ctikzvalof{bipoles/fft/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/fft/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgftext[center,x=0,y=0]{\textsf{FFT}}
+}
+
+%% Amplifier
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{
+ \ifpgf at circuit@boxed
+ \ctikzvalof{bipoles/twoport/width}
+ \else
+ \ctikzvalof{bipoles/amp/width}
+ \fi
+}
+{amp}
+{
+ \ifpgf at circuit@boxed
+ \ctikzvalof{bipoles/twoport/width}
+ \else
+ \ctikzvalof{bipoles/amp/width}
+ \fi
+}
+{
+ \ifpgf at circuit@boxed
+ \ctikzvalof{bipoles/twoport/width}
+ \else
+ \ctikzvalof{bipoles/amp/width}
+ \fi
+}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/amp/width}\pgf at circ@scaled at Rlen
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \ifpgf at circuit@boxed
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfnode{blockbox}{center}{}{pgf at box}{\pgfusepath{draw}}
+ \pgf at circ@draworfill
+ \fi
+
+ % draw input arrow
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ \ifpgf at circuit@boxed
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
+ \pgf at circ@res at step=.7\pgf at circ@res at step % scale amp symbol when inside a box
+ \else
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \fi
+
+ \pgfsetarrows{-} %never draw arrows
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0.55\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{0}}
+ \pgfpathlineto{\pgfpoint{-0.5\pgf at circ@res at step}{-0.55\pgf at circ@res at step}}
+
+ \pgfpathclose
+ \pgf at circ@draworfill
+
+ % draw inner text
+ \pgftext[center,x=-0.12\pgf at circ@res at step,y=0]{\ctikzvalof{bipoles/twoport/text}}
+}
+
+
+%% variable amplifier
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{
+ \ifpgf at circuit@boxed
+ \ctikzvalof{bipoles/twoport/width}
+ \else
+ \ctikzvalof{bipoles/amp/width}
+ \fi
+}
+{vamp}
+{
+ \ifpgf at circuit@boxed
+ \ctikzvalof{bipoles/twoport/width}
+ \else
+ \ctikzvalof{bipoles/amp/width}
+ \fi
+}
+{
+ \ifpgf at circuit@boxed
+ \ctikzvalof{bipoles/twoport/width}
+ \else
+ \ctikzvalof{bipoles/amp/width}
+ \fi
+}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/amp/width}\pgf at circ@scaled at Rlen
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \ifpgf at circuit@boxed
+ \pgfnode{blockbox}{center}{}{pgf at box}{\pgfusepath{draw}}
+ \fi
+
+ % draw input arrow
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ \ifpgf at circuit@boxed
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
+ \pgf at circ@res at step=.7\pgf at circ@res at step % scale amp symbol when inside a box
+ \else
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \fi
+
+
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{0.55\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{0}}
+ \pgfpathlineto{\pgfpoint{-0.5\pgf at circ@res at step}{-0.55\pgf at circ@res at step}}
+
+ \pgfpathclose
+ \pgf at circ@draworfill
+
+ % draw inner text
+ \pgftext[center,x=-0.12\pgf at circ@res at step,y=0]{\ctikzvalof{bipoles/twoport/text}}
+
+ % draw arrow
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetarrowsend{latex}
+ \pgfpathmoveto{\pgfpoint{-0.8\pgf at circ@res at step}{-0.5\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.6\pgf at circ@res at step}{0.6\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+%% pi attenuator
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/piattenuator/width}}
+{piattenuator}
+{\ctikzvalof{bipoles/piattenuator/width}}
+{\ctikzvalof{bipoles/piattenuator/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/piattenuator/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0.4\pgf at circ@res at left}{0.4\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.4\pgf at circ@res at left}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.4\pgf at circ@res at right}{0.4\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.4\pgf at circ@res at right}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.6\pgf at circ@res at left}{0.4\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.6\pgf at circ@res at right}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% variable pi attenuator
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/vpiattenuator/width}}
+{vpiattenuator}
+{\ctikzvalof{bipoles/vpiattenuator/width}}
+{\ctikzvalof{bipoles/vpiattenuator/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0.4\pgf at circ@res at left}{0.4\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.4\pgf at circ@res at left}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.4\pgf at circ@res at right}{0.4\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.4\pgf at circ@res at right}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.6\pgf at circ@res at left}{0.4\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.6\pgf at circ@res at right}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfsetarrowsend{latex}
+ \pgfpathmoveto{\pgfpoint{0.7\pgf at circ@res at left}{0.5\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at right}{0.8\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% T attenuator
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/tattenuator/width}}
+{tattenuator}
+{\ctikzvalof{bipoles/tattenuator/width}}
+{\ctikzvalof{bipoles/tattenuator/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/tattenuator/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.6\pgf at circ@res at left}{0.4\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.6\pgf at circ@res at right}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% variable T attenuator
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/vtattenuator/width}}
+{vtattenuator}
+{\ctikzvalof{bipoles/vtattenuator/width}}
+{\ctikzvalof{bipoles/vtattenuator/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/vtattenuator/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.6\pgf at circ@res at left}{0.4\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.6\pgf at circ@res at right}{0.4\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfsetarrowsend{latex}
+ \pgfpathmoveto{\pgfpoint{0.7\pgf at circ@res at left}{0.5\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at right}{0.8\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% phase shifter
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/phaseshifter/width}}
+{phaseshifter}
+{\ctikzvalof{bipoles/phaseshifter/width}}
+{\ctikzvalof{bipoles/phaseshifter/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/phaseshifter/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % inner symbol
+ \pgftext[center,x=0,y=0]{\Large$\varphi$}
+}
+
+%% variable phase shifter
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/phaseshifter/width}}
+{vphaseshifter}
+{\ctikzvalof{bipoles/vphaseshifter/width}}
+{\ctikzvalof{bipoles/vphaseshifter/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % inner symbol
+ \pgftext[center,x=0,y=0]{\Large$\varphi$}
+
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetarrowsend{latex}
+ \pgfpathmoveto{\pgfpoint{0.75\pgf at circ@res at left}{0.65\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at right}{0.65\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% detector
+\pgfcircdeclarebipolescaled{blocks}
+{}
+{\ctikzvalof{bipoles/detector/width}}
+{detector}
+{\ctikzvalof{bipoles/detector/width}}
+{\ctikzvalof{bipoles/detector/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/detector/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % draw inner stuff
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{0.8\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0.75\pgf at circ@res at left}{0}}
+ \pgfpathlineto{\pgfpoint{0.75\pgf at circ@res at right}{0}}
+ \pgfusepath{draw}
+
+ \ifpgf at circuit@fulldiode
+ \pgfmathparse{2\pgf at circ@res at up / \pgf at circ@scaled at Rlen / \ctikzvalof{bipoles/generic/width}}
+ \pgftransformscale{\pgfmathresult}
+ \pgfnode{fulldiodeshape}{center}{}{pgf at fulldiode}{\pgfusepath{fill}}
+ \else
+ \pgfmathparse{2\pgf at circ@res at up / \pgf at circ@scaled at Rlen / \ctikzvalof{bipoles/resistor/width}}
+ \pgftransformscale{\pgfmathresult}
+ \pgfnode{emptydiodeshape}{center}{}{pgf at emptydiode}{\pgfusepath{fill}}
+ \fi
+
+}
+
+%% single phase ac/dc converter
+\pgfcircdeclarebipolescaled{blocks}
+{
+ \anchor{dc1}{
+ \northeast
+ \pgf at y=.4\pgf at y
+ }
+ \anchor{dc2}{
+ \northeast
+ \pgf at y=-.4\pgf at y
+ }
+}
+{\ctikzvalof{bipoles/sacdc/width}}
+{sacdc}
+{\ctikzvalof{bipoles/sacdc/width}}
+{\ctikzvalof{bipoles/sacdc/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/sacdc/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ % draw sin wave
+ \pgfpathmoveto{\pgfpoint{-.76\pgf at circ@res at step}{.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ % draw equal sign
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at step}{-.375\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at step}{-0.375\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at step}{-.625\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at step}{-0.625\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+
+
+%% single phase dc/ac converter
+\pgfcircdeclarebipolescaled{blocks}
+{
+ \anchor{dc1}{
+ \northeast
+ \pgf at y=.4\pgf at y
+ \pgf at x=-\pgf at x
+ }
+ \anchor{dc2}{
+ \northeast
+ \pgf at y=-.4\pgf at y
+ \pgf at x=-\pgf at x
+ }
+}
+{\ctikzvalof{bipoles/sdcac/width}}
+{sdcac}
+{\ctikzvalof{bipoles/sdcac/width}}
+{\ctikzvalof{bipoles/sdcac/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/sdcac/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ % draw sin wave
+ \pgfpathmoveto{\pgfpoint{.14\pgf at circ@res at step}{-.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ % draw equal sign
+ \pgfpathmoveto{\pgfpoint{-.2\pgf at circ@res at step}{.375\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-0.7\pgf at circ@res at step}{0.375\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-.2\pgf at circ@res at step}{.625\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-0.7\pgf at circ@res at step}{0.625\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+
+%% threephase ac/dc converter
+\pgfcircdeclarebipolescaled{blocks}
+{
+ \anchor{dc1}{
+ \northeast
+ \pgf at y=.4\pgf at y
+ }
+ \anchor{dc2}{
+ \northeast
+ \pgf at y=-.4\pgf at y
+ }
+ \anchor{ac1}{
+ \northeast
+ \pgf at y=.6\pgf at y
+ \pgf at x=-\pgf at x
+ }
+ \anchor{ac2}{
+ \northeast
+ \pgf at y=0\pgf at y
+ \pgf at x=-\pgf at x
+ }
+ \anchor{ac3}{
+ \northeast
+ \pgf at y=-.6\pgf at y
+ \pgf at x=-\pgf at x
+ }
+}
+{\ctikzvalof{bipoles/tacdc/width}}
+{tacdc}
+{\ctikzvalof{bipoles/tacdc/width}}
+{\ctikzvalof{bipoles/tacdc/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/tacdc/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ % draw sin waves
+ \pgfpathmoveto{\pgfpoint{-.76\pgf at circ@res at step}{.65\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-.76\pgf at circ@res at step}{.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-.76\pgf at circ@res at step}{.35\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+
+
+
+ % draw equal sign
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at step}{-.375\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at step}{-0.375\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at step}{-.625\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at step}{-0.625\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+
+%% threephase dc/ac converter
+\pgfcircdeclarebipolescaled{blocks}
+{
+ \anchor{dc1}{
+ \northeast
+ \pgf at y=.4\pgf at y
+ \pgf at x=-\pgf at x
+ }
+ \anchor{dc2}{
+ \northeast
+ \pgf at y=-.4\pgf at y
+ \pgf at x=-\pgf at x
+ }
+ \anchor{ac1}{
+ \northeast
+ \pgf at y=.6\pgf at y
+ }
+ \anchor{ac2}{
+ \northeast
+ \pgf at y=0\pgf at y
+ }
+ \anchor{ac3}{
+ \northeast
+ \pgf at y=-.6\pgf at y
+ }
+}
+{\ctikzvalof{bipoles/tdcac/width}}
+{tdcac}
+{\ctikzvalof{bipoles/tdcac/width}}
+{\ctikzvalof{bipoles/tdcac/width}}
+{
+ \pgf at circ@res at step = \ctikzvalof{bipoles/tdcac/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ % rotate inner symbol
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
+ \pgftransformrotate{270}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
+ \pgftransformrotate{180}
+ \fi\fi
+ \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
+ \pgftransformrotate{90}
+ \fi\fi
+
+ % draw inner symbol
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ % draw sin waves
+ \pgfpathmoveto{\pgfpoint{.14\pgf at circ@res at step}{-.65\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{.14\pgf at circ@res at step}{-.5\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{.14\pgf at circ@res at step}{-.35\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.17\pgf at circ@res at step}{-.17\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.17\pgf at circ@res at step}{.17\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+
+
+
+ % draw equal sign
+ \pgfpathmoveto{\pgfpoint{-.2\pgf at circ@res at step}{.375\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-0.7\pgf at circ@res at step}{0.375\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{-.2\pgf at circ@res at step}{.625\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-0.7\pgf at circ@res at step}{0.625\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%
+%% MECHANICAL SYMBOLS
+%%%%%%%%%%%%%%%%%%%%%%%
+
+%% mechanical capacitance - stiffness/spring
+
+\pgfcircdeclarebipolescaled{mechanicals}
+{}
+{\ctikzvalof{bipoles/spring/height}}
+{spring}
+{\ctikzvalof{bipoles/spring/height}}
+{\ctikzvalof{bipoles/spring/width}}{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+
+ \pgfmathsetlength{\pgf at circ@res at step}
+ {(\ctikzvalof{bipoles/spring/width}*\pgf at circ@scaled at Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf at circ@res at zero}}
+ \pgfsetcornersarced{\pgfpoint{.5\pgf at circ@res at up}{.5\pgf at circ@res at up}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \advance\pgf at circ@res at other by 2\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at zero}}
+ \pgfsetbuttcap
+ \pgfsetbeveljoin
+ \pgfusepath{stroke}
+}
+
+%% mechanical capacitance - inerter
+\pgfcircdeclarebipolescaled{mechanicals}
+{}
+{\ctikzvalof{bipoles/inerter/height}}
+{inerter}
+{\ctikzvalof{bipoles/inerter/height}}
+{\ctikzvalof{bipoles/inerter/width}}
+{
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+}
+
+
+%% mechanical inductance - mass
+\pgfcircdeclarebipolescaled{mechanicals}
+{}
+{\ctikzvalof{bipoles/mass/box height}}
+{mass}
+{\ctikzvalof{bipoles/mass/height}}
+{\ctikzvalof{bipoles/mass/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgftransformationadjustments
+ \pgfpathrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ {\pgfpoint{-2\pgf at circ@res at down}{-2\pgf at circ@res at down}}
+ \pgf at circ@draworfill
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfsetrectcap
+ \pgfsetmiterjoin
+ \pgfusepath{stroke}
+}
+
+%% mechanical resistor - damper
+\pgfcircdeclarebipolescaled{mechanicals}
+{}
+{\ctikzvalof{bipoles/damper/height}}
+{damper}
+{\ctikzvalof{bipoles/damper/height}}
+{\ctikzvalof{bipoles/damper/width}}
+{
+ \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf at circ@res at right}{\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgf at circ@maybefill
+
+ % line into the damper
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf at circ@res at right}
+ {\pgf at circ@res at zero}}
+ \pgfusepath{stroke}
+
+ % damper box
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+
+ \pgfsetrectcap
+ \pgfsetmiterjoin
+ \pgfusepath{stroke}
+
+ % damper vertical element
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf at circ@res at right}
+ {.8\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf at circ@res at right}
+ {.8\pgf at circ@res at up}}
+ \pgfsetbuttcap
+ \pgfusepath{stroke}
+
+}
+%% mechanical viscoelastic element, suggested by @alex
+%% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
+\pgfcircdeclarebipolescaled{mechanicals}
+{} % extra anchors
+{\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
+{viscoe} % name
+{\ctikzvalof{bipoles/damper/height}} % height (above the path line)
+{\ctikzvalof{bipoles/damper/width}} % width
+{ % draw the bipole
+ \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf at circ@res at right}{\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgf at circ@maybefill
+
+ % spring into the damper
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfsetcornersarced{\pgfpoint{.25\pgf at circ@res at up}{.25\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.75\pgf at circ@res at left}{.75\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.5\pgf at circ@res at left}{-.75\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at left}{.75\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf at circ@res at right}{.75\pgf at circ@res at up}}
+ \pgfusepath{stroke}
+ \endpgfscope
+ % damper box
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+
+ \pgfsetrectcap
+ \pgfsetmiterjoin
+ \pgfusepath{stroke}
+
+ % damper vertical element
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf at circ@res at right}
+ {.8\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf at circ@res at right}
+ {.8\pgf at circ@res at up}}
+ \pgfsetbuttcap
+ \pgfusepath{stroke}
+
+}
+
+%%%%%%%%%%%%%%%%
+%% Crossing
+%%%%%%%%%%%%%%%%
+
+%% crossing bipole (but see also nodes)
+\pgfcircdeclarebipole
+{}
+{\ctikzvalof{bipoles/crossing/size}}
+{crossing}
+{\ctikzvalof{bipoles/crossing/size}}
+{\ctikzvalof{bipoles/crossing/size}}{
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{0.4\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpatharc{0}{-180}{0.4*\pgf at circ@res at left}
+ \pgfsetbeveljoin
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Miscellaneous bipoles
+%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% loudspeaker and microphone
+
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/loudspeaker/depth}}
+{loudspeaker}
+{\ctikzvalof{bipoles/loudspeaker/height}}
+{\ctikzvalof{bipoles/loudspeaker/width}}{
+
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{.4\pgf at circ@res at up}}
+ {\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint{0.5\pgf at circ@res at left}{.4\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.8\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.8\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at right}{.4\pgf at circ@res at up}}
+ \pgfpathclose
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+}
+
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/mic/depth}}
+{mic}
+{\ctikzvalof{bipoles/mic/height}}
+{\ctikzvalof{bipoles/mic/width}}{
+
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpoint{0pt}{.6\pgf at circ@res at up}}{.4\pgf at circ@res at up}
+ \pgf at circ@draworfill
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{-.2\pgf at circ@res at up}{0pt}}
+ % 0.25358 is 0.6-0.4*cos(30)
+ \pgfpathlineto{\pgfpoint{-.2\pgf at circ@res at up}{.25358\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at up}{.25358\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.2\pgf at circ@res at up}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%% european gas filled surge arrester
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/european gas filled surge arrester/height}}
+{european gas filled surge arrester}
+{\ctikzvalof{bipoles/european gas filled surge arrester/height}}
+{\ctikzvalof{bipoles/european gas filled surge arrester/width}}
+{
+
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgf at circ@draworfill
+
+ \pgfscope
+ \pgfsetarrowsend{latexslim}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf at circ@res at left}{0pt}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfusepath{draw}
+
+ \endpgfscope
+}
+
+%% american gas filled surge arrester
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/american gas filled surge arrester/height}}
+{american gas filled surge arrester}
+{\ctikzvalof{bipoles/american gas filled surge arrester/height}}
+{\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpointorigin \pgf at circ@res at other = \pgf at x \advance \pgf at circ@res at other by -\pgf at circ@res at up
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpointorigin}{.9\pgf at circ@res at up}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at other}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfsetarrowsend{latex}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+ \endpgfscope{}
+
+ \pgfcircle{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/dot x}\pgf at circ@res at left}{\ctikzvalof{bipoles/american gas filled surge arrester/dot y}\pgf at circ@res at down}}{\ctikzvalof{bipoles/american gas filled surge arrester/size}\pgf at circ@res at down}
+ \pgfusepath{fill}
+}
+
+%% thermocouple
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/thermocouple/height 2}}
+{thermocouple}
+{\ctikzvalof{bipoles/thermocouple/height}}
+{\ctikzvalof{bipoles/thermocouple/width}}
+{
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{.5\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{.5\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathlineto{\pgfpoint{0}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{.5\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0}}
+ \pgfusepath{draw}
+}
+
+%% fuse
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/fuse/height}}
+{fuse}
+{\ctikzvalof{bipoles/fuse/height}}
+{\ctikzvalof{bipoles/fuse/width}}
+{
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0}}
+ \pgfusepath{draw}
+
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgf at circ@draworfill
+}
+
+%% asymmetric fuse
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/afuse/height}}
+{afuse}
+{\ctikzvalof{bipoles/afuse/height}}
+{\ctikzvalof{bipoles/afuse/width}}
+{
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfpathrectanglecorners{\pgfpoint{.7\pgf at circ@res at right}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{stroke,fill}
+}
+
+%% SQUID added by Cor Molenaar 5 March 2010
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/squid/height}}
+{squid}
+{\ctikzvalof{bipoles/squid/height}}
+{\ctikzvalof{bipoles/squid/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgfpathmoveto{\pgfpoint{0.35*\pgf at circ@res at left}{1.35*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.35*\pgf at circ@res at right}{0.65*\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0.35*\pgf at circ@res at left}{0.65*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.35*\pgf at circ@res at right}{1.35*\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0.35*\pgf at circ@res at left}{1.35*\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.35*\pgf at circ@res at right}{0.65*\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint{0.35*\pgf at circ@res at left}{0.65*\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.35*\pgf at circ@res at right}{1.35*\pgf at circ@res at down}}
+
+ \pgfusepath{draw}
+}
+
+% Generic barrier added by Cor Molenaar 5 March 2010
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/barrier/height}}
+{barrier}
+{\ctikzvalof{bipoles/barrier/height}}
+{\ctikzvalof{bipoles/barrier/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{0.35*\pgf at circ@res at left}{0.35*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.35*\pgf at circ@res at right}{0.35*\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint{0.35*\pgf at circ@res at left}{0.35*\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.35*\pgf at circ@res at right}{0.35*\pgf at circ@res at up}}
+
+ \pgfusepath{draw}
+}
+
+%
+% open version of the barrier symbol
+% suggested by Radványi Patrik Tamás <patrikradvanyi at gmail.com>
+%
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/barrier/height}}
+{openbarrier}
+{\ctikzvalof{bipoles/barrier/height}}
+{\ctikzvalof{bipoles/barrier/width}}
+{
+ % this is set with normal wire linewidth
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf at circ@res at left}{0pt}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+
+ % do the cross part
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{0.35*\pgf at circ@res at left}{0.35*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.35*\pgf at circ@res at right}{0.35*\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint{0.35*\pgf at circ@res at left}{0.35*\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.35*\pgf at circ@res at right}{0.35*\pgf at circ@res at up}}
+
+ \pgfusepath{draw}
+}
+%% Lamp
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/lamp/height}}
+{lamp}
+{\ctikzvalof{bipoles/lamp/height}}
+{\ctikzvalof{bipoles/lamp/width}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \pgfpathmoveto{\pgfpoint{.7071*\pgf at circ@res at left}{.7071*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.7071*\pgf at circ@res at right}{.7071*\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint{.7071*\pgf at circ@res at left}{.7071*\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.7071*\pgf at circ@res at right}{.7071*\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+%% bulb
+\pgfcircdeclarebipolescaled{misc}
+{}
+{\ctikzvalof{bipoles/bulb/height}}
+{bulb}
+{\ctikzvalof{bipoles/bulb/height}}
+{\ctikzvalof{bipoles/bulb/width}}
+{%
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf at circ@res at up}}{\pgfpoint{0.8\pgf at circ@res at left}{0}}
+ \pgf at circ@draworfill
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpathlineto{\pgfpoint{0.4\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgfpatharc{0}{-180}{0.4*\pgf at circ@res at left}
+ \pgfsetbeveljoin
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at zero}}
+ \pgfusepath{draw}
+}
+
+
+% end of pgfcircbipoles.tex
+%%%---------- close: tex/pgfcircbipoles
+%%%%%%%%%%% Springe nach tex/pgfcirctripoles
+%%%---------- open: tex/pgfcirctripoles.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Tripoles
+
+%%%%%%%%%%%%%
+%% switches
+%%%%%%%%%%%%%
+
+% Legacy spdt
+\pgfdeclareshape{spdt}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/spdt/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/spdt/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{left}{%
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{out 1}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{out 2}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \anchor{center}{
+ \pgf at y=0pt
+ \pgf at x=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@res at other = \ctikzvalof{tripoles/spdt/margin}\pgf at circ@res at left
+
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at other}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgftransformshift{\pgfpoint{-\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
+ \endpgfscope
+ \pgfscope
+ \pgftransformshift{\pgfpoint{-\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
+ \endpgfscope
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
+ \pgfpathlineto{
+ \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf at circ@res at other}{-100pt}}}
+ {\pgfpoint{-.05\pgf at circ@res at up}{-.05\pgf at circ@res at up}}
+ }
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+
+% cute switch "node" shapes, matching with cute "to" shapes
+% #1 -> name
+% #2 -> barposition
+% #3 -> arrowcode
+\long\def\pgfcircdeclarecutespdt#1#2#3{
+ \pgfdeclareshape{#1}
+ {
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{bipoles/cuteswitch/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/spdt/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.25\pgf at x
+ }
+ \savedanchor\midlever{
+ % these values are calculated when we create the definition of the shape.
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{bipoles/cuteswitch/height}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at temp=\ctikzvalof{nodes width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf at circ@res at temp
+ \pgf at circ@res at down = -.5\pgf at y
+ \pgf at circ@res at up = .5\pgf at y
+ \pgfextracty{\pgf at circ@res at other}{#2}
+ \pgf at x=0pt
+ \pgf at y=.5\pgf at circ@res at other
+ }
+ % radius of the connector
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ \saveddimen{\radius}{\pgfmathsetlength\pgf at x{\pgf at circ@Rlen*\ctikzvalof{nodes width}}}
+ % shapename
+ \savedmacro{\thisshape}{\def\thisshape{\tikz at fig@name}}
+ % shape type
+ \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
+ % mid of the lever, to stack switches
+ \anchor{mid}{\midlever}
+ % center anchors
+ \anchor{cin}{ \northwest \pgf at y=0pt}
+ \anchor{cout 1}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{cout 2}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ % horizontal angles
+ \anchor{in}{ \northwest \pgf at y=0pt\advance\pgf at x by -\radius}
+ \anchor{out 1}{ \northwest \pgf at x=-\pgf at x \advance\pgf at x by \radius}
+ \anchor{out 2}{ \northwest \pgf at x=-\pgf at x \advance\pgf at x by \radius \pgf at y=-\pgf at y }
+
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgfscope
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ \pgf at circ@res at temp=\radius\relax
+ \pgf at circ@res at temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf at circ@res at temp
+ \pgfsetlinewidth{2\pgf at circ@res at temp}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{#2}
+ \pgfsetroundcap\pgfusepath{draw}
+ \endpgfscope
+ \pgfscope % arrow
+ #3
+ \endpgfscope
+ % terminals
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
+ \endpgfscope
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
+ \endpgfscope
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
+ \endpgfscope
+
+ }
+ }
+}
+
+\pgfcircdeclarecutespdt{cute spdt up}
+{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up-1.5\pgf at circ@res at temp}}
+{}
+
+\pgfcircdeclarecutespdt{cute spdt mid}
+{\pgfpoint{\pgf at circ@res at right}{0pt}}
+{}
+
+\pgfcircdeclarecutespdt{cute spdt down}
+{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down+1.5\pgf at circ@res at temp}}
+{}
+
+\pgfcircdeclarecutespdt{cute spdt up arrow}
+{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up-1.5\pgf at circ@res at temp}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}} % in node
+ \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf at circ@res at right}}
+ \pgfpatharc{70}{-50}{1.5\pgf at circ@res at right}
+ \pgfsetarrowsend{latexslim}
+ \pgfusepath{draw}
+}
+
+\pgfcircdeclarecutespdt{cute spdt mid arrow}
+{\pgfpoint{\pgf at circ@res at right}{0pt}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}} % in node
+ \pgfsetarrowsstart{latexslim}
+ \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf at circ@res at right}}
+ \pgfpatharc{-60}{60}{1.5\pgf at circ@res at right}
+ \pgfsetarrowsend{latexslim}
+ \pgfusepath{draw}
+}
+
+\pgfcircdeclarecutespdt{cute spdt down arrow}
+{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down+1.5\pgf at circ@res at temp}}
+{
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}} % in node
+ \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf at circ@res at right}}
+ \pgfpatharc{-50}{70}{1.5\pgf at circ@res at right}
+ \pgfsetarrowsend{latexslim}
+ \pgfusepath{draw}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% Logic ports
+%%
+%% Code from John Kormylo at tex.stackexchange.com
+%% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
+%% Integration and fixes from Romano Giannetti and TheTeXnician <38565529+TheTeXnician at users.noreply.github.com>
+%%
+
+\newcount\pgf at circ@res at count% reserve global register
+
+\def\pgf at circ@logicport at input#1% #1 = \pgfmathcounter
+{%
+ \pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \step
+ \pgf at circ@res at step=\dimexpr 2\pgf at y -2\pgf at circ@res at up\relax
+ \advance\pgf at y by -#1\pgf at circ@res at step\relax
+}%
+
+% #1 = \pgfmathcounter #2=type #3 specificic port
+% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
+\def\pgf at circ@logicport at baseinput#1#2#3%
+{%
+ % and and nand
+ \ifnum #2=1\relax
+ \pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \pgfextractx{\pgf at circ@res at left}{\southwest}%
+ \step
+ \pgf at circ@res at step=\dimexpr 2\pgf at y -2\pgf at circ@res at up\relax
+ \advance\pgf at y by -#1\pgf at circ@res at step\relax
+ \pgf at x=\ctikzvalof{tripoles/american #3 port/port width}\pgf at circ@res at left
+ \fi
+ % or and nor
+ \ifnum #2=2\relax
+ \pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \pgfextractx{\pgf at circ@res at left}{\southwest}%
+ \pgfextractx{\pgf at circ@res at right}{\northeast}%
+ \step
+ \pgf at circ@res at step=\dimexpr 2\pgf at y -2\pgf at circ@res at up\relax
+ \advance\pgf at y by -#1\pgf at circ@res at step\relax
+ \edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american #3 port/angle}}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american #3 port/inner}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradius}{\pgf at circ@res at other /(1 - cos(\pgf at circ@math at angle)}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradius}{\pgf at circ@res at up /sin(\pgf at circ@math at angle)}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american #3 port/port width}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xorigin}{\pgf at circ@res at other + \pgf at circ@math at xradius*cos(\pgf at circ@math at angle)}%
+ \pgf at circ@res at temp=\pgf at y
+ \pgfmathsetmacro{\pgf at circ@math at angle}{asin(\pgf at circ@res at temp/\pgf at circ@math at yradius)}%
+ \pgfmathsetlength{\pgf at circ@res at other}{\pgf at circ@math at xradius*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \pgf at x=\pgf at circ@res at other
+ \fi
+ % xor and xnor
+ \ifnum #2=3\relax
+ \pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \pgfextractx{\pgf at circ@res at left}{\southwest}%
+ \pgfextractx{\pgf at circ@res at right}{\northeast}%
+ \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf at circ@math at angle}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american #3 port/inner}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradius}{\pgf at circ@res at other /(1 - cos(\pgf at circ@math at angle)}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradius}{\pgf at circ@res at up / sin(\pgf at circ@math at angle))}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american #3 port/port width}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xorigin}{\pgf at circ@res at other + \pgf at circ@math at xradius*cos(\pgf at circ@math at angle)}%
+ \pgf at circ@res at temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at distance}{\pgf at circ@res at temp}
+ % this compensates for the effect of the line width on the gap between the arcs
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradiusA}{\pgf at circ@math at yradius -2\pgflinewidth}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradiusA}{\pgf at circ@math at xradius -2\pgflinewidth}%
+
+ \step
+ \pgf at circ@res at step=\dimexpr 2\pgf at y -2\pgf at circ@res at up\relax
+ \advance\pgf at y by -#1\pgf at circ@res at step\relax
+ \pgf at circ@res at temp=\pgf at y
+ \pgfmathsetmacro{\pgf at circ@math at angle}{asin(\pgf at circ@res at temp / \pgf at circ@math at yradiusA)}%
+ \pgfmathsetlength{\pgf at circ@res at other}{\pgf at circ@math at xradiusA*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \advance\pgf at circ@res at other by -\pgf at circ@math at distance
+ \pgf at x=\pgf at circ@res at other
+ \fi
+ % european
+ \ifnum #2=4\relax
+ \pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \pgfextractx{\pgf at circ@res at other}{\left}%
+ \step
+ \pgf at circ@res at step=\dimexpr 2\pgf at y -2\pgf at circ@res at up\relax
+ \advance\pgf at y by -#1\pgf at circ@res at step\relax
+ \pgf at x=\pgf at circ@res at other
+ \fi
+}%
+
+%%% american
+\long\def\pgfcircdeclarelogicport#1#2#3{%
+ \pgfdeclareshape{american #1 port}%
+ {%
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedmacro\resize{% automatic
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at up = \ctikzvalof{tripoles/american #1 port/height}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at up = .5\pgf at circ@res at up
+ \pgf at circ@res at down = -\pgf at circ@res at up
+ \pgf at circ@res at right = \ctikzvalof{tripoles/american #1 port/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at right = .5\pgf at circ@res at right
+ \pgf at circ@res at left = -\pgf at circ@res at right
+ }%
+ \savedmacro\inputs{% get number of inputs
+ \pgf at circ@res at count=\pgfkeysvalueof{/tikz/number inputs}\relax%
+ \ifnum\pgf at circ@res at count=0
+ \pgf at circ@res at count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
+ \fi
+ \ifnum\pgf at circ@res at count<2 \pgf at circ@res at count=2\fi
+ \ifnum\pgf at circ@res at count>16 \pgf at circ@res at count=16\fi
+ \def\inputs{\the\pgf at circ@res at count}%
+ }%
+ \savedanchor\step{% 1/2 gap at edges
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step = \ctikzvalof{tripoles/american #1 port/height}\pgf at circ@scaled at Rlen
+ \divide\pgf at circ@res at step by \pgf at circ@res at count
+ \pgfpoint{\pgf at circ@res at left}{\dimexpr\pgf at circ@res at up+0.5\pgf at circ@res at step}%
+ }%
+ \savedanchor\northeast{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \savedanchor\southwest{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf at circ@res at left}{0pt}}
+ \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf at circ@res at right}{0pt}}
+ \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf at circ@res at right}{0pt}}
+
+ \anchor{center}{\origin}% for backwards compatibility
+ \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+
+ % create input anchors
+ \expandafter\pgfutil at g@addto at macro\csname pgf at sh@s at american #1 port\endcsname{%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf at circ@res at count%
+ \else%
+ %\pgfutil at ifundefined{pgf at anchor@american #1 port at in \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf at anchor@american #1 port at in \pgfmathcounter\endcsname{%
+ \noexpand\pgf at circ@logicport at input{\pgfmathcounter}% defined above
+ }%
+ \expandafter\xdef\csname pgf at anchor@american #1 port at bin \pgfmathcounter\endcsname{%
+ \noexpand\pgf at circ@logicport at baseinput{\pgfmathcounter}{#2}{#1}% defined above
+ }%
+ %}{}%
+ \repeatpgfmathloop%
+ }
+
+ \anchor{out}{\northeast\pgf at y=0pt}
+ \anchor{bout}{\right\pgf at y=0pt}
+
+
+ \anchor{left}{\left}% edges of component minus leads
+ \anchor{right}{\right}
+
+ \anchor{north east}{\northeast}% see \Compass macro
+ \anchor{south west}{\southwest}
+ \anchor{north}{\pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \pgfpoint{0cm}{\pgf at circ@res at up}}
+ \anchor{north west}{\pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \pgfextractx{\pgf at circ@res at left}{\southwest}%
+ \pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \anchor{west}{\pgfextractx{\pgf at circ@res at left}{\southwest}%
+ \pgfpoint{\pgf at circ@res at left}{0cm}}
+ \anchor{south}{\pgfextracty{\pgf at circ@res at down}{\southwest}%
+ \pgfpoint{0cm}{\pgf at circ@res at down}}
+ \anchor{south east}{\pgfextracty{\pgf at circ@res at down}{\southwest}%
+ \pgfextractx{\pgf at circ@res at right}{\northeast}%
+ \pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \anchor{east}{\pgfextractx{\pgf at circ@res at right}{\northeast}%
+ \pgfpoint{\pgf at circ@res at right}{0cm}}
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ #3
+ }
+}
+}
+%%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\pgfcircdeclarelogicport{and}{1}{
+ \pgfextracty{\pgf at circ@res at temp}{\step}%
+ \pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
+ \pgf at circ@res at count = \inputs\relax
+ \ifpgfcirc at draw@leads
+ %input leads
+ \loop\ifnum\pgf at circ@res at count>0
+ \advance\pgf at circ@res at temp by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}%
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/american and port/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at temp}}
+ \advance\pgf at circ@res at count by -1
+ \repeat
+ \fi
+ % output lead
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/american and port/port width}\pgf at circ@res at right}
+ {0pt}}
+ \pgfusepath{draw}
+
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american and port/port width}\pgf at circ@res at left
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfpatharc{-90}{90}{-2\pgf at circ@res at other and \pgf at circ@res at up}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ }
+%%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \pgfcircdeclarelogicport{nand}{1}{
+ \pgfextracty{\pgf at circ@res at temp}{\step}%
+ \pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
+ \pgf at circ@res at count = \inputs\relax
+ \ifpgfcirc at draw@leads
+ %input leads
+ \loop\ifnum\pgf at circ@res at count>0
+ \advance\pgf at circ@res at temp by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}%
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/american nand port/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at temp}}
+ \advance\pgf at circ@res at count by -1
+ \repeat
+ \fi
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/american nand port/port width}\pgf at circ@res at right} {0pt}}
+
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgf at circ@res at step = \ctikzvalof{tripoles/american nand port/circle width}\pgf at circ@res at right
+ \pgf at circ@res at other = \ctikzvalof{tripoles/american nand port/port width}\pgf at circ@res at right
+ \pgf at circ@res at temp = \dimexpr 2\pgf at circ@res at other - \pgf at circ@res at step\relax
+
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at other}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at other}{\pgf at circ@res at down}}
+ \pgfpatharc{-90}{90}{\pgf at circ@res at temp and \pgf at circ@res at up}
+ \pgfpathclose
+
+ \pgfpathellipse
+ {\pgfpoint{\pgf at circ@res at other-.5\pgf at circ@res at step}{0pt}}
+ {\pgfpoint{.5\pgf at circ@res at step}{0pt}}
+ {\pgfpoint{0pt}{.5\pgf at circ@res at step}}
+
+ \pgf at circ@draworfill
+}
+%%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\pgfcircdeclarelogicport{nor}{2}{
+ \edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american nor port/angle}}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american nor port/inner}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradius}{\pgf at circ@res at other /(1 - cos(\pgf at circ@math at angle)}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradius}{\pgf at circ@res at up /sin(\pgf at circ@math at angle)}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american nor port/port width}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xorigin}{\pgf at circ@res at other + \pgf at circ@math at xradius*cos(\pgf at circ@math at angle)}%
+
+ \pgfextracty{\pgf at circ@res at temp}{\step}%
+ \pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
+ \pgf at circ@res at count = \inputs\relax
+ \ifpgfcirc at draw@leads
+ %input leads
+ \loop\ifnum\pgf at circ@res at count>0
+ \advance\pgf at circ@res at temp by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}%
+ \pgfmathsetmacro{\pgf at circ@math at angle}{asin(\pgf at circ@res at temp/\pgf at circ@math at yradius)}%
+ \pgfmathsetlength{\pgf at circ@res at other}{\pgf at circ@math at xradius*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at temp}}%
+ \advance\pgf at circ@res at count by -1
+ \repeat
+ \fi
+
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american nor port/port width}\pgf at circ@res at right
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+
+ \pgfusepath{draw}
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+
+ \edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american nor port/angle}}%
+ \pgf at circ@res at step = \ctikzvalof{tripoles/american nor port/circle width}\pgf at circ@res at right
+ \pgf at circ@res at temp = \dimexpr 2\pgf at circ@res at other - \pgf at circ@res at step\relax
+ \advance\pgf at circ@res at other by -\pgf at circ@res at step
+
+ % main shape
+ \ifpgfcirc at roundy@or at shapes
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}% for symmetry
+ \pgfpatharc{0}{90}{\pgf at circ@res at temp and \pgf at circ@res at up}%
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradius and \pgf at circ@math at yradius}%
+ \pgfpatharc{-90}{0}{\pgf at circ@res at temp and \pgf at circ@res at up}%
+ \pgfpathclose
+ \else
+ \pgfmathsetlength{\pgf at circ@res at temp}{\pgf at circ@math at xradius*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradius and \pgf at circ@math at yradius}%
+ \pgfpathcurveto{\pgfpoint{0.3\pgf at circ@res at right}{\pgf at circ@res at down}}{\pgfpoint{0.3\pgf at circ@res at right}{0.5\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathcurveto{\pgfpoint{0.3\pgf at circ@res at right}{0.5\pgf at circ@res at up}}{\pgfpoint{0.3\pgf at circ@res at right}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpathclose
+ \fi
+
+ % not dot
+ \pgfpathellipse
+ {\pgfpoint{\pgf at circ@res at other+.5\pgf at circ@res at step}{0pt}}
+ {\pgfpoint{.5\pgf at circ@res at step}{0pt}}
+ {\pgfpoint{0pt}{.5\pgf at circ@res at step}}
+
+ \pgf at circ@draworfill
+}
+%%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\pgfcircdeclarelogicport{or}{2}{
+ \edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american or port/angle}}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american or port/inner}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradius}{\pgf at circ@res at other /(1 - cos(\pgf at circ@math at angle)}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradius}{\pgf at circ@res at up /sin(\pgf at circ@math at angle)}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american or port/port width}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xorigin}{\pgf at circ@res at other + \pgf at circ@math at xradius*cos(\pgf at circ@math at angle)}%
+
+ \pgfextracty{\pgf at circ@res at temp}{\step}%
+ \pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
+ \pgf at circ@res at count = \inputs\relax
+ \ifpgfcirc at draw@leads
+ %input leads
+ \loop\ifnum\pgf at circ@res at count>0
+ \advance\pgf at circ@res at temp by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}%
+ \pgfmathsetmacro{\pgf at circ@math at angle}{asin(\pgf at circ@res at temp/\pgf at circ@math at yradius)}%
+ \pgfmathsetlength{\pgf at circ@res at other}{\pgf at circ@math at xradius*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at temp}}%
+ \advance\pgf at circ@res at count by -1
+ \repeat
+ \fi
+
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american or port/port width}\pgf at circ@res at right
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+
+ \pgfusepath{draw}
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+
+ \edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american or port/angle}}%
+
+ % main shape
+ \ifpgfcirc at roundy@or at shapes
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}% for symmetry
+ \pgfpatharc{0}{90}{2\pgf at circ@res at other and \pgf at circ@res at up}%
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradius and \pgf at circ@math at yradius}%
+ \pgfpatharc{-90}{0}{2\pgf at circ@res at other and \pgf at circ@res at up}%
+ \pgfpathclose
+ \else
+ \pgfmathsetlength{\pgf at circ@res at temp}{\pgf at circ@math at xradius*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradius and \pgf at circ@math at yradius}%
+ \pgfpathcurveto{\pgfpoint{0.3\pgf at circ@res at right}{\pgf at circ@res at down}}{\pgfpoint{0.3\pgf at circ@res at right}{0.5\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathcurveto{\pgfpoint{0.3\pgf at circ@res at right}{0.5\pgf at circ@res at up}}{\pgfpoint{0.3\pgf at circ@res at right}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpathclose
+ \fi
+
+ \pgf at circ@draworfill
+}
+%%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\pgfcircdeclarelogicport{xor}{3}{
+ \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf at circ@math at angle}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american xor port/inner}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradius}{\pgf at circ@res at other /(1 - cos(\pgf at circ@math at angle)}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradius}{\pgf at circ@res at up / sin(\pgf at circ@math at angle))}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american xor port/port width}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xorigin}{\pgf at circ@res at other + \pgf at circ@math at xradius*cos(\pgf at circ@math at angle)}%
+ \pgf at circ@res at temp=\ctikzvalof{tripoles/american xor port/distance}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at distance}{\pgf at circ@res at temp}
+ % this compensates for the effect of the line width on the gap between the arcs
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradiusA}{\pgf at circ@math at yradius -2\pgflinewidth}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradiusA}{\pgf at circ@math at xradius -2\pgflinewidth}%
+
+ \pgfextracty{\pgf at circ@res at temp}{\step}%
+ \pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
+ \pgf at circ@res at count = \inputs\relax
+ \ifpgfcirc at draw@leads
+ %input leads
+ \loop\ifnum\pgf at circ@res at count>0
+ \advance\pgf at circ@res at temp by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}%
+ \pgfmathsetmacro{\pgf at circ@math at angle}{asin(\pgf at circ@res at temp / \pgf at circ@math at yradiusA)}%
+ \pgfmathsetlength{\pgf at circ@res at other}{\pgf at circ@math at xradiusA*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \advance\pgf at circ@res at other by -\pgf at circ@math at distance
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at temp}}%
+ \advance\pgf at circ@res at count by -1
+ \repeat
+ \fi
+
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american xor port/port width}\pgf at circ@res at right
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+
+ \pgfusepath{draw}
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+
+ \edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american xor port/angle}}%
+
+ % main shape
+ \ifpgfcirc at roundy@or at shapes
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}% for symmetry
+ \pgfpatharc{0}{90}{2\pgf at circ@res at other and \pgf at circ@res at up}%
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradius and \pgf at circ@math at yradius}%
+ \pgfpatharc{-90}{0}{2\pgf at circ@res at other and \pgf at circ@res at up}%
+ \pgfpathclose
+ \else
+ \pgfmathsetlength{\pgf at circ@res at temp}{\pgf at circ@math at xradius*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradius and \pgf at circ@math at yradius}%
+ \pgfpathcurveto{\pgfpoint{0.3\pgf at circ@res at right}{\pgf at circ@res at down}}{\pgfpoint{0.3\pgf at circ@res at right}{0.5\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathcurveto{\pgfpoint{0.3\pgf at circ@res at right}{0.5\pgf at circ@res at up}}{\pgfpoint{0.3\pgf at circ@res at right}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpathclose
+ \fi
+ \pgf at circ@draworfill
+
+ \pgfmathsetlength{\pgf at circ@res at temp}{(\pgf at circ@math at yradiusA)*sin(\pgf at circ@math at angle)}%
+
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at other-\pgf at circ@math at distance}{\pgf at circ@res at temp}}% first arc
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradiusA and \pgf at circ@math at yradiusA}%
+
+ \pgfusepath{draw}
+}
+%%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\pgfcircdeclarelogicport{xnor}{3}{
+ \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf at circ@math at angle}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american xnor port/inner}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradius}{\pgf at circ@res at other /(1 - cos(\pgf at circ@math at angle)}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradius}{\pgf at circ@res at up / sin(\pgf at circ@math at angle))}%
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american xnor port/port width}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at xorigin}{\pgf at circ@res at other + \pgf at circ@math at xradius*cos(\pgf at circ@math at angle)}%
+ \pgf at circ@res at temp=\ctikzvalof{tripoles/american xor port/distance}\pgf at circ@res at right
+ \pgfmathsetlengthmacro{\pgf at circ@math at distance}{\pgf at circ@res at temp}
+ % this compensates for the effect of the line width on the gap between the arcs
+ \pgfmathsetlengthmacro{\pgf at circ@math at yradiusA}{\pgf at circ@math at yradius -2\pgflinewidth}%
+ \pgfmathsetlengthmacro{\pgf at circ@math at xradiusA}{\pgf at circ@math at xradius -2\pgflinewidth}%
+
+ \pgfextracty{\pgf at circ@res at temp}{\step}%
+ \pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
+ \pgf at circ@res at count = \inputs\relax
+ \ifpgfcirc at draw@leads
+ %input leads
+ \loop\ifnum\pgf at circ@res at count>0
+ \advance\pgf at circ@res at temp by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}%
+ \pgfmathsetmacro{\pgf at circ@math at angle}{asin(\pgf at circ@res at temp / \pgf at circ@math at yradiusA)}%
+ \pgfmathsetlength{\pgf at circ@res at other}{\pgf at circ@math at xradiusA*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \advance\pgf at circ@res at other by -\pgf at circ@math at distance
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{\pgf at circ@res at temp}}%
+ \advance\pgf at circ@res at count by -1
+ \repeat
+ \fi
+
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american xnor port/port width}\pgf at circ@res at right
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+
+ \pgfusepath{draw}
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+
+ \edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american xnor port/angle}}%
+ \pgf at circ@res at step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf at circ@res at right
+ \pgf at circ@res at temp = \dimexpr 2\pgf at circ@res at other - \pgf at circ@res at step\relax
+ \advance\pgf at circ@res at other by -\pgf at circ@res at step
+
+ % main shape
+ \ifpgfcirc at roundy@or at shapes
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{0pt}}% for symmetry
+ \pgfpatharc{0}{90}{\pgf at circ@res at temp and \pgf at circ@res at up}%
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradius and \pgf at circ@math at yradius}%
+ \pgfpatharc{-90}{0}{\pgf at circ@res at temp and \pgf at circ@res at up}%
+ \pgfpathclose
+ \else
+ \pgfmathsetlength{\pgf at circ@res at temp}{\pgf at circ@math at xradius*cos(\pgf at circ@math at angle)-\pgf at circ@math at xorigin}%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradius and \pgf at circ@math at yradius}%
+ \pgfpathcurveto{\pgfpoint{0.3\pgf at circ@res at right}{\pgf at circ@res at down}}{\pgfpoint{0.3\pgf at circ@res at right}{0.5\pgf at circ@res at down}}{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfpathcurveto{\pgfpoint{0.3\pgf at circ@res at right}{0.5\pgf at circ@res at up}}{\pgfpoint{0.3\pgf at circ@res at right}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at up}}
+ \pgfpathclose
+ \fi
+
+ \pgfpathellipse
+ {\pgfpoint{\pgf at circ@res at other+.5\pgf at circ@res at step}{0pt}}
+ {\pgfpoint{.5\pgf at circ@res at step}{0pt}}
+ {\pgfpoint{0pt}{.5\pgf at circ@res at step}}
+ \pgf at circ@draworfill
+
+ \pgf at circ@res at other=\ctikzvalof{tripoles/american xnor port/port width}\pgf at circ@res at left
+ \pgfmathsetlength{\pgf at circ@res at temp}{(\pgf at circ@math at yradiusA)*sin(\pgf at circ@math at angle)}%
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other-\pgf at circ@math at distance}{\pgf at circ@res at temp}}% first arc
+ \pgfpatharc{\pgf at circ@math at angle}{-\pgf at circ@math at angle}{\pgf at circ@math at xradiusA and \pgf at circ@math at yradiusA}%
+
+ \pgfusepath{draw}
+}
+
+%%% Original one-input ports
+
+\pgfdeclareshape{american not port}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{bipoles/not port/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/not port/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in 1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{bin}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{bin 1}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{bout}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-0.7\pgf at x
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgf at circ@res at other = \ctikzvalof{bipoles/not port/circle width}\pgf at circ@res at right
+
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{.7\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=.7\pgf at circ@res at step
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+ \pgf at circ@draworfill
+ \pgfpathellipse
+ {\pgfpoint{\pgf at circ@res at step-.5\pgf at circ@res at other}{0pt}}
+ {\pgfpoint{.5\pgf at circ@res at other}{0pt}}
+ {\pgfpoint{0pt}{.5\pgf at circ@res at other}}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \ifpgfcirc at draw@leads
+ %input leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
+ \fi
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+ }
+}
+
+\pgfdeclareshape{american buffer port}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{bipoles/not port/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/not port/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in 1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{bin}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{bin 1}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{bout}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-0.7\pgf at x
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{.7\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=.7\pgf at circ@res at step
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \ifpgfcirc at draw@leads
+ %input leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
+ \fi
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+ }
+}
+\pgfdeclareshape{invschmitt}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{bipoles/not port/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/not port/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in 1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{bin}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
+ \anchor{bin 1}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{bout}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-0.7\pgf at x
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgf at circ@res at other = \ctikzvalof{bipoles/not port/circle width}\pgf at circ@res at right
+
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{.7\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=.7\pgf at circ@res at step
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step-\pgf at circ@res at other}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \pgfpathellipse
+ {\pgfpoint{\pgf at circ@res at step-.5\pgf at circ@res at other}{0pt}}
+ {\pgfpoint{.5\pgf at circ@res at other}{0pt}}
+ {\pgfpoint{0pt}{.5\pgf at circ@res at other}}
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \ifpgfcirc at draw@leads
+ %input leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
+ \fi
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+ %draw inner shape
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left}{.3\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{.3\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{.3\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.05\pgf at circ@res at left}{.3\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{.4\pgf at circ@res at left}{.3\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at left}{.3\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at left}{.3\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ }
+}
+
+\pgfdeclareshape{schmitt}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{bipoles/not port/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/not port/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in 1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{bin}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
+ \anchor{bin 1}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{bout}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-.7\pgf at x
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{.7\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=.7\pgf at circ@res at step
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \ifpgfcirc at draw@leads
+ %input leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
+ \fi
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right-\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ %draw inner shape
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+
+ \pgfpathmoveto{\pgfpoint{.6\pgf at circ@res at left}{.3\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{.3\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at left}{.3\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.05\pgf at circ@res at left}{.3\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{.4\pgf at circ@res at left}{.3\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at left}{.3\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at left}{.3\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ }
+}
+
+
+%%% start european logic ports, from John Kormylo
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+
+% #1 - name
+% #2 - text inside
+% #3 - number of inputs
+% #4 = is it a not?
+%
+% option to add a circle for not-output, see
+% https://github.com/circuitikz/circuitikz/issues/385
+%
+\newif\ifpgf at circ@european at port@circle\pgf at circ@european at port@circlefalse
+\newif\ifpgf at circ@european at port@circle at ieee\pgf at circ@european at port@circle at ieeefalse
+\ctikzset{tripoles/european not shape/.initial=ocirc}
+\ctikzset{tripoles/european not symbol/.is choice}
+\ctikzset{tripoles/european not symbol/triangle/.code={\pgf at circ@european at port@circlefalse}}
+\ctikzset{tripoles/european not symbol/circle/.code={%
+\pgf at circ@european at port@circletrue\pgf at circ@european at port@circle at ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
+\ctikzset{tripoles/european not symbol/ieee circle/.code={%
+\pgf at circ@european at port@circletrue\pgf at circ@european at port@circle at ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
+
+\long\def\pgfcircdeclareeurologicport#1#2#3#4{
+ \pgfdeclareshape{european #1 port}
+ {
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \saveddimen{\boutshift}{%
+ \ifpgf at circ@european at port@circle
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \edef\pgf at temp{ocirc}
+ \edef\pgf at circ@temp{\ctikzvalof{tripoles/european not shape}}
+ \ifx\pgf at temp\pgf at circ@temp % it's ocirc
+ \pgfmathsetlength{\pgf at x}{2*\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \else % it's ieee not circ
+ \pgf at circ@notradius % defined together with ieeestd ports
+ \pgf at x=2\pgf at circ@res at temp
+ \fi
+ \else
+ \pgf at x=0pt
+ \fi
+ }
+ \savedmacro\resize{% automatic
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at up = \ctikzvalof{tripoles/european #1 port/height}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at up = .5\pgf at circ@res at up
+ \pgf at circ@res at down = -\pgf at circ@res at up
+ \pgf at circ@res at right = \ctikzvalof{tripoles/european #1 port/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at right = .5\pgf at circ@res at right
+ \pgf at circ@res at left = -\pgf at circ@res at right
+ }%
+ \savedmacro\inputs{% get number of inputs
+ \pgf at circ@res at count=\pgfkeysvalueof{/tikz/number inputs}\relax%
+ \ifnum\pgf at circ@res at count=0
+ \pgf at circ@res at count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
+ \fi
+ \ifnum\pgf at circ@res at count<2 \pgf at circ@res at count=2\fi
+ \ifnum\pgf at circ@res at count>16 \pgf at circ@res at count=16\fi
+ \def\inputs{\the\pgf at circ@res at count}%
+ }%
+ \savedanchor\step{% 1/2 gap at edges
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step = \ctikzvalof{tripoles/european #1 port/height}\pgf at circ@scaled at Rlen
+ \divide\pgf at circ@res at step by #3
+ \pgfpoint{\pgf at circ@res at left}{\dimexpr\pgf at circ@res at up+0.5\pgf at circ@res at step}%
+ }%
+ \savedanchor\northeast{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}%
+ \savedanchor\southwest{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}%
+ \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at left}{0pt}}%
+ \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at right}{0pt}}%
+ \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf at circ@res at right}{0pt}}%
+
+ \anchor{center}{\origin}% for backwards compatibility
+ % the text anchor overlaps the logic symbol
+ \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
+ % create input anchors
+ \ifnum#3=1\relax
+ \anchor{in}{\southwest\pgfpoint{\pgf at x}{0pt}}% or \step
+ \anchor{in 1}{\southwest\pgfpoint{\pgf at x}{0pt}}% or \step
+ \anchor{bin}{\left\pgfpoint{\pgf at x}{0pt}}% or \step
+ \anchor{bin 1}{\left\pgfpoint{\pgf at x}{0pt}}% or \step
+ \else
+ \expandafter\pgfutil at g@addto at macro\csname pgf at sh@s at european #1 port\endcsname{%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>#3%
+ \else%
+ %\pgfutil at ifundefined{pgf at anchor@european #1 port at in \pgfmathcounter}{% redundant
+ \expandafter\xdef\csname pgf at anchor@european #1 port at in \pgfmathcounter\endcsname{%
+ \noexpand\pgf at circ@logicport at input{\pgfmathcounter}% defined above
+ }%
+ \expandafter\xdef\csname pgf at anchor@european #1 port at bin \pgfmathcounter\endcsname{%
+ \noexpand\pgf at circ@logicport at baseinput{\pgfmathcounter}{4}{#1}% defined above
+ }%
+ %}{}%
+ \repeatpgfmathloop%
+ }
+ \fi
+ \anchor{out}{\northeast\pgf at y=0pt}
+ \anchor{bout}{\right\advance\pgf at x by \boutshift\pgf at y=0pt}
+
+ \anchor{left}{\left}% edges of component minus leads
+ \anchor{right}{\right}
+
+ \anchor{north east}{\northeast}% see \Compass macro
+ \anchor{south west}{\southwest}
+ \anchor{north}{\pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \pgfpoint{0cm}{\pgf at circ@res at up}}
+ \anchor{north west}{\pgfextracty{\pgf at circ@res at up}{\northeast}%
+ \pgfextractx{\pgf at circ@res at left}{\southwest}%
+ \pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \anchor{west}{\pgfextractx{\pgf at circ@res at left}{\southwest}%
+ \pgfpoint{\pgf at circ@res at left}{0cm}}
+ \anchor{south}{\pgfextracty{\pgf at circ@res at down}{\southwest}%
+ \pgfpoint{0cm}{\pgf at circ@res at down}}
+ \anchor{south east}{\pgfextracty{\pgf at circ@res at down}{\southwest}%
+ \pgfextractx{\pgf at circ@res at right}{\northeast}%
+ \pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \anchor{east}{\pgfextractx{\pgf at circ@res at right}{\northeast}%
+ \pgfpoint{\pgf at circ@res at right}{0cm}}
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathrectanglecorners
+ {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at left}{\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ \ifpgfcirc at draw@leads
+ %input leads
+ \ifnum#3=1\relax
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}%
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at left}{0pt}}%
+ \else
+ \pgfextracty{\pgf at circ@res at temp}{\step}%
+ \pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
+ %\pgf at circ@res at count = #3\relax% redundant
+ \loop\ifnum\pgf at circ@res at count>0
+ \advance\pgf at circ@res at temp by -\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}%
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at left}
+ {\pgf at circ@res at temp}}
+ \advance\pgf at circ@res at count by -1
+ \repeat
+ \fi
+ \fi
+ %
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{%
+ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at right}{0pt}}
+ %
+ \pgfusepath{draw}
+ %
+ \edef\pgf at temp{not}
+ \edef\pgf at circ@temp{#4}
+ \ifx\pgf at temp\pgf at circ@temp % is a not
+ \ifpgf at circ@european at port@circle
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at right}
+ % reset linewidth for IEEE ports, otherwise they will multiply...
+ \ifpgf at circ@european at port@circle at ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
+ \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
+ \endpgfscope
+ \else
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/european #1 port/not height}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \fi
+ \fi
+ %
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgftext{#2}
+ }
+ }
+}
+\pgfcircdeclareeurologicport{and}{\&}{\pgf at circ@res at count}{}
+\pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf at circ@res at count}{}
+\pgfcircdeclareeurologicport{xor}{$=1$}{\pgf at circ@res at count}{}
+\pgfcircdeclareeurologicport{not}{$1$}{1}{not}
+\pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
+\pgfcircdeclareeurologicport{nand}{\&}{\pgf at circ@res at count}{not}
+\pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf at circ@res at count}{not}
+\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf at circ@res at count}{not}
+
+%% end european logic ports
+
+%%%%%%%%%%%%%%%%%%%%%%%%
+%% Transistors
+%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\long\def\pgfcircdeclaretransistor#1#2#3{
+ \pgfdeclareshape{#1}
+ {
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northeast{% upper right
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/#1/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=0pt
+ }
+ \savedanchor\left{%center left
+ \pgf at y=0pt
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/#1/width}\pgf at circ@scaled at Rlen
+ }
+ \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0
+ \pgf at y=0pt
+ \pgf at x=0pt
+ }
+ \anchor{text}{
+ \northeast
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \ifpgf at circuit@transisors at fixlabels
+ \ifpgf at circuit@fet at bodydiode
+ % try to put the text to the right of the flyback diode
+ \pgfmathsetlength{\pgf at circ@res at other}{(
+ \ctikzvalof{tripoles/#1/bodydiode distance}*
+ \ctikzvalof{tripoles/#1/width} +
+ \ctikzvalof{tripoles/#1/bodydiode scale}*
+ \ctikzvalof{bipoles/diode/height}/2
+ )*\pgf at circ@scaled at Rlen}
+ \advance\pgf at x by \pgf at circ@res at other
+ \fi
+ % add a bit of space to avoid central (substrate) terminal if drawn
+ \advance\pgf at x by 0.05\pgf at circ@scaled at Rlen\relax
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ \else
+ \pgf at y=.7\pgf at y
+ \pgf at x= \pgf at circ@scaled at Rlen
+ \pgf at x=0.1\pgf at x
+ \fi
+ }
+ \anchor{pathstart}{ % south
+ \northeast
+ \pgf at y=-\pgf at y
+ }
+ \anchor{pathend}{
+ \northeast
+ }
+ \anchor{north}{
+ \northeast
+ \pgf at circ@res at step=\pgf at y
+ \left
+ \pgf at y=\pgf at circ@res at step
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{west}{
+ \left
+ }
+ \anchor{east}{
+ \northeast
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northeast
+ \pgf at circ@res at step=\pgf at y
+ \left
+ \pgf at y=-\pgf at circ@res at step
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{south west}{
+ \northeast
+ \pgf at circ@res at step=\pgf at y
+ \left
+ \pgf at y=-\pgf at circ@res at step
+ }
+ \anchor{north east}{
+ \northeast
+ }
+ \anchor{north west}{
+ \northeast
+ \pgf at circ@res at step=\pgf at y
+ \left
+ \pgf at y=\pgf at circ@res at step
+ }
+ \anchor{south east}{
+ \northeast
+ \pgf at y=-\pgf at y
+ }
+ \anchor{B}{
+ \northeast
+ \pgf at circ@res at step=\ctikzvalof{tripoles/#1/conn height}\pgf at y
+ \left
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at circ@res at step
+ }
+ \anchor{base}{
+ \northeast
+ \pgf at circ@res at step=\ctikzvalof{tripoles/#1/conn height}\pgf at y
+ \left
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at circ@res at step
+ }
+ \anchor{bulk}{ %added by Burak Kelleci
+ \northeast
+ \pgf at circ@res at step=\ctikzvalof{tripoles/#1/conn height}\pgf at y
+ \right
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at circ@res at step
+ }
+ \anchor{nobulk}{ %added by Burak Kelleci
+ \left
+ \pgf at x=\ctikzvalof{tripoles/#1/base width}\pgf at x
+ }
+ \anchor{G}{
+ \northeast
+ \pgf at circ@res at step=\ctikzvalof{tripoles/#1/conn height}\pgf at y
+ \left
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at circ@res at step
+ }
+ \anchor{gate}{
+ \northeast
+ \pgf at circ@res at step=\ctikzvalof{tripoles/#1/conn height}\pgf at y
+ \left
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at circ@res at step
+ }
+ \anchor{nobase}{
+ \left
+ \pgf at x=\ctikzvalof{tripoles/#1/base width}\pgf at x
+ }
+ \anchor{nogate}{
+ \left
+ \pgf at x=\ctikzvalof{tripoles/#1/gate width}\pgf at x
+ }
+ \anchor{E}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ }
+ \anchor{emitter}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ }
+ \anchor{C}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ }
+ \anchor{collector}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ }
+ \anchor{S}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ }
+ \anchor{source}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ }
+ \anchor{D}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ }
+ \anchor{drain}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ }
+ \anchor{body C in}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at y
+ }
+ \anchor{body E in}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at y
+ }
+ \anchor{body C out}{
+ \northeast
+ \pgf at ya=\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ \pgf at ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at ya
+ \pgf at y=\pgf at ya
+ \left
+ \pgf at x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf at x
+ \pgf at y=\pgf at ya
+ }
+ \anchor{body E out}{
+ \northeast
+ \pgf at ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf at y
+ \pgf at ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at ya
+ \pgf at y=\pgf at ya
+ \left
+ \pgf at x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf at x
+ \pgf at y=\pgf at ya
+ }
+ #2
+ \backgroundpath{
+ \pgftransformationadjustments
+ \pgfsetcolor{\ctikzvalof{color}}
+ %
+ \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
+ \pgf at circuit@trans at ntypetrue
+ \else
+ \pgf at circuit@trans at ntypefalse
+ \fi
+ \northeast
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = \pgf at x
+ \left
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ %
+ #3
+ % BODY DIODE
+ \ifpgf at circuit@fet at bodydiode
+ \drawbodydiode{#1}
+ \fi
+ %
+ }
+}
+}
+
+\long\def\drawbodydiode#1{
+ \pgfscope
+ \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf at circ@res at left}{\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgftransformrotate{90}
+ % diode scale and bodydiode scale interacts. We want the size of the diode
+ % proportional to the transistor, so we will:
+ % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
+ \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
+ \pgftransformscale{\@@BDscale}
+ \ifpgf at circuit@fulldiode
+ \pgfnode{fulldiodeshape}{center}{}{pgf at bodydiode}{\pgfusepath{fill}}
+ \else
+ \pgfnode{emptydiodeshape}{center}{}{pgf at bodydiode}{\pgfusepath{fill}}
+ \fi
+ \endpgfscope
+ % Draw stroke line
+ \ifpgf at circuit@strokediode
+ \pgfpathmoveto{\pgfpointanchor{pgf at bodydiode}{west}}
+ \pgfpathlineto{\pgfpointanchor{pgf at bodydiode}{east}}
+ \pgfusepath{stroke}
+ \fi
+ %Draw upper connection to body diode
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointanchor{pgf at bodydiode}{east}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at circ@res at up}}
+ \pgftransformscale{0.5}
+ \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
+ \endpgfscope{}
+ %Draw lower connection to body diode
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf at circ@res at left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpointanchor{pgf at bodydiode}{west}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf at circ@res at down}}
+ \pgftransformscale{0.5}
+ \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
+ \endpgfscope
+}
+
+\long\def\declarebpt#1{
+ \pgfcircdeclaretransistor{#1}{
+ \anchor{inner up}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/#1/base height}\pgf at y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/#1/base height}\pgf at y
+ }
+ }{
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height 2}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ % drawing base
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \ifpgf at circuit@bpt at schottky
+ % upper
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up+
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left+
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up+
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left+
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up}}
+ % % lower
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down-
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left-
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down-
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left-
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down}}
+ \fi
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height 2}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfusepath{draw}
+ %draw arrow depending on type of transistor
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \edef\@@anchor{center}
+ \ifpgf at circuit@trans at ntype
+ \ifpgf at circuit@trans at arrowatend
+ \edef\@@anchor{btip}
+ \pgftransformlineattime{1.0}{%
+ \pgfpoint%
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/#1/base height 2}\pgf at circ@res at down}%
+ }{%
+ \pgfpoint{\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down}%
+ }
+ \else
+ \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
+ \pgfpoint%
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/#1/base height 2}\pgf at circ@res at down}%
+ }{%
+ \pgfpoint{\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down}%
+ }
+ \fi
+ \else % p-type
+ \ifpgf at circuit@trans at arrowatend
+ \edef\@@anchor{tip}
+ \pgftransformlineattime{1.0}{%
+ \pgfpoint{\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up}%
+ }{%
+ \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/#1/base height 2}\pgf at circ@res at up}%
+ }
+ \else
+ \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
+ \pgfpoint{\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up}%
+ }{%
+ \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/#1/base height 2}\pgf at circ@res at up}%
+ }
+ \fi
+ \fi
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+
+ \ifpgf at circuit@bpt at drawphoto
+ \pgfscope
+ \pgfsetarrowsstart{latexslim}
+ \pgfpathmoveto{\pgfpointadd{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ {\pgfpoint{0.05\pgf at circ@res at left}{0.1\pgf at circ@res at up}}}
+ \pgfpathlineto{\pgfpointadd{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ {\pgfpoint{0.5\pgf at circ@res at left}{0.3\pgf at circ@res at up}}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpointadd{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ {\pgfpoint{0.05\pgf at circ@res at left}{-0.1\pgf at circ@res at up}}}
+ \pgfpathlineto{\pgfpointadd{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ {\pgfpoint{0.5\pgf at circ@res at left}{0.1\pgf at circ@res at up}}}
+ \pgfusepath{draw}
+ \endpgfscope
+ \else
+ \ifpgf at circuit@bpt at drawbase
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \fi
+ \fi
+ }
+}
+
+\declarebpt{npn}
+\declarebpt{pnp}
+%
+% multi-emitter and multi-collector BJTs by Romano Giannetti
+%
+\def\pgf at circ@bjt at C@anchor#1{% #1: collector number
+ \pgfextractx{\pgf at circ@res at temp}{\basedimension}
+ \pgfextracty{\pgf at circ@res at other}{\basedimension}
+ \ifnum\cdir>0 % NPN, above
+ \pgfpoint{\pgf at circ@res at temp}{%
+ \pgf at circ@res at other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
+ \else % PNP, below
+ \pgfpoint{\pgf at circ@res at temp}{%
+ -\pgf at circ@res at other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
+ \fi
+}
+\def\pgf at circ@bjt at E@anchor#1{% #1: collector number
+ \pgfextractx{\pgf at circ@res at temp}{\basedimension}
+ \pgfextracty{\pgf at circ@res at other}{\basedimension}
+ \ifnum\cdir<0 % PNP, above
+ \pgfpoint{\pgf at circ@res at temp}{%
+ \pgf at circ@res at other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
+ \else % PNP, below
+ \pgfpoint{\pgf at circ@res at temp}{%
+ -\pgf at circ@res at other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
+ \fi
+}
+
+\long\def\declarebjt#1{
+ \pgfdeclareshape{bjt#1}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ % \cdir is 1 for npn, -1 for pnp
+ \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
+ \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
+ \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
+ % step up or down for the additional C/Es
+ \saveddimen{\multistep}{\pgfmathsetlength{\pgf at x}{%
+ \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
+ \ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}}
+ \saveddimen{\external}{\pgfmathsetlength{\pgf at x}{%
+ \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}}
+ \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/bjt/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=\ctikzvalof{tripoles/bjt/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \savedanchor\northeast{% upper right
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at circ@res at step}{%
+ \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
+ \ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \ifnum\cdir> 0
+ \edef\numup{\numC}\edef\numdown{\numE}
+ \else
+ \edef\numup{\numE}\edef\numdown{\numC}
+ \fi
+ \pgfmathsetlength{\pgf at y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf at circ@scaled at Rlen
+ + (\numup-1)*\pgf at circ@res at step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
+ + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{tripoles/bjt/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \savedanchor\southeast{% lower right
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at circ@res at step}{%
+ \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
+ \ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \ifnum\cdir> 0
+ \edef\numup{\numC}\edef\numdown{\numE}
+ \else
+ \edef\numup{\numE}\edef\numdown{\numC}
+ \fi
+ \pgfmathsetlength{\pgf at y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf at circ@scaled at Rlen
+ - (\numdown-1)*\pgf at circ@res at step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
+ - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{tripoles/bjt/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \savedanchor\southwest{% lower left
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at circ@res at step}{%
+ \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
+ \ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \ifnum\cdir> 0
+ \edef\numup{\numC}\edef\numdown{\numE}
+ \else
+ \edef\numup{\numE}\edef\numdown{\numC}
+ \fi
+ \pgfmathsetlength{\pgf at y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf at circ@scaled at Rlen
+ - (\numdown-1)*\pgf at circ@res at step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
+ - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf at circ@scaled at Rlen
+ - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ }
+ \anchor{center}{\pgfpointorigin}
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\southwest\pgf at x=0cm\relax}
+ \anchor{west}{\southwest\pgf at y=0cm}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at ya=\pgf at y\southwest\pgf at y=\pgf at ya}
+ \anchor{south west}{\southwest}
+ \anchor{south east}{\southeast}
+
+ \anchor{text}{\northeast\pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
+ \anchor{B}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x\advance\pgf at x by -\external}
+ \anchor{base}{\basedimension\pgf at y=0cm\pgf at x=-\pgf at x\advance\pgf at x by -\external}
+ \anchor{nobase}{\basedimension\pgf at y=0cm\pgf at x=-\pgf at x}
+ % center of the base "bar"
+ \anchor{cbase}{\basedimension\pgf at x=-\pgf at x
+ \pgfmathsetlength{\pgf at y}{\cdir*(\numC-\numE)*\multistep/2}%
+ }
+ % geometrical centers
+ \anchor{vcenter}{\pgf at x=0cm\relax
+ \pgfmathsetlength{\pgf at y}{\cdir*(\numC-\numE)*\multistep/2}%
+ }
+ \anchor{gcenter}{%
+ \northeast\pgf at xa=0.5\pgf at x
+ \southwest\advance\pgf at xa by 0.5\pgf at x
+ \pgf at x=\pgf at xa
+ \pgfmathsetlength{\pgf at y}{\cdir*(\numC-\numE)*\multistep/2}%
+ }
+ % external connections
+ \anchor{E}{
+ \ifnum\cdir>0% npn, emitter down
+ \southeast
+ \else
+ \northeast
+ \fi
+ }% first emitter
+ \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
+ \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
+ \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
+
+ \backgroundpath{
+ \pgftransformationadjustments
+ \pgfsetcolor{\ctikzvalof{color}}
+ %
+ % set the type and up and down number of connections
+ %
+ \ifnum\cdir> 0
+ \pgf at circuit@trans at ntypetrue
+ \edef\numup{\numC}
+ \edef\numdown{\numE}
+ \else
+ \pgf at circuit@trans at ntypefalse
+ \edef\numup{\numE}
+ \edef\numdown{\numC}
+ \fi
+ \basedimension
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = \pgf at x
+ \pgf at circ@res at left = -\pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\multistep
+ %
+ % set arrow positions options
+ %
+ \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
+ \ifpgf at circuit@trans at arrowatend
+ \edef\@@pos{1.0}
+ \ifpgf at circuit@trans at ntype % arrow is toward outside, push it a bit
+ \edef\@@anchor{btip}
+ \else
+ \edef\@@anchor{tip}
+ \fi
+ \fi
+ %
+ % Drawing upper connections
+ %
+ \pgfscope
+ \pgf at circ@count at a=\numup\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ \advance\pgf at circ@count at a-1\relax
+ \pgfmathsetlength{\pgf at circ@res at other}{\the\pgf at circ@count at a*\multistep}%
+ \ifnum\pgf at circ@count at a=\numexpr\numup-1\relax % draw the external pin connection
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at right}%
+ {\pgf at circ@res at up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf at circ@res at other}}%
+ \pgfpathlineto{\pgfpoint
+ {\pgf at circ@res at right}%
+ {\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf at circ@res at other}}%
+ \else
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at right}%
+ {\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf at circ@res at other}}%
+ \fi
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/bjt/base height 2}\pgf at circ@res at up+\pgf at circ@res at other}}%
+ \pgfsetroundcap % better when connecting to sloped lines
+ \pgfusepath{draw}
+ \ifpgf at circuit@trans at ntype\else % it's a PNP; draw arrow
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint
+ {\pgf at circ@res at right}%
+ {\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf at circ@res at other}%
+ }{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/bjt/base height 2}\pgf at circ@res at up+\pgf at circ@res at other}%
+ }
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+ \fi
+ \repeatpgfmathloop
+ \endpgfscope
+ %
+ % Drawing base
+ %
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at up+(\numup-1)*\multistep}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at down-(\numdown-1)*\multistep}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \ifpgf at circuit@bpt at schottky
+ % upper
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at up+(\numup-1)*\multistep}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at up+(\numup-1)*\multistep+
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left+
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at up+(\numup-1)*\multistep+
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left+
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at up+(\numup-1)*\multistep}}
+ % lower
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at down-(\numdown-1)*\multistep}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at down-(\numdown-1)*\multistep-
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left-
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at down-(\numdown-1)*\multistep-
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left-
+ \ctikzvalof{tripoles/schottky base size}\pgf at circ@scaled at Rlen}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf at circ@res at down-(\numdown-1)*\multistep}}
+ \fi
+ \pgfsetroundcap % I like it more...
+ \pgfusepath{draw}
+ \endpgfscope
+ %
+ % draw base external connection
+ %
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left-\external}{0pt}}
+ \pgfusepath{draw}
+ %
+ % Drawing lower connections
+ %
+ \pgfscope
+ \pgf at circ@count at a=\numdown\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ \advance\pgf at circ@count at a-1\relax
+ \pgfmathsetlength{\pgf at circ@res at other}{\the\pgf at circ@count at a*\multistep}%
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/bjt/base height 2}\pgf at circ@res at down-\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint
+ {\pgf at circ@res at right}
+ {\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf at circ@res at other}}
+ \ifnum\pgf at circ@count at a=\numexpr\numdown-1\relax % draw the external pin connection
+ \pgfpathlineto{\pgfpoint
+ {\pgf at circ@res at right}
+ {\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf at circ@res at other-\external}}
+ \fi
+ \pgfsetroundcap % better when connecting to sloped lines
+ \pgfusepath{draw}
+ \ifpgf at circuit@trans at ntype % it's a NPN; draw arrow
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/bjt/base height 2}\pgf at circ@res at down-\pgf at circ@res at other}%
+ }{\pgfpoint
+ {\pgf at circ@res at right}%
+ {\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf at circ@res at other}%
+ }
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+ \fi
+ \repeatpgfmathloop
+ \endpgfscope
+ }
+ % \pgf at sh@s@<name of the shape here> contains all the code for the shape
+ % and is executed just before a node is drawn.
+ \expandafter\pgfutil at g@addto at macro\csname pgf at sh@s at bjt#1\endcsname{%
+ % Start with the maximum collector number and go backwards.
+ \pgf at circ@count at a=\numC\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@bjt#1 at C\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@bjt at C@anchor{\the\pgf at circ@count at a}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ % and emitters
+ \pgf at circ@count at a=\numE\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@bjt#1 at E\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@bjt at E@anchor{\the\pgf at circ@count at a}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ }%
+ }
+}
+
+\declarebjt{npn}
+\declarebjt{pnp}
+
+% end of multi-bjts
+
+\long\def\declareigbt#1{
+ \pgfcircdeclaretransistor{#1}{
+ \anchor{inner up}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/#1/gate height}\pgf at y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/#1/gate height}\pgf at y
+ }
+ }
+ {
+ %draw upper connection
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/gate height 2}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ %draw thicker gate lines
+ \pgfscope
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/outer base height}\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/outer base height}\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
+ % set the normal thickness
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
+ \pgfsetlinewidth{\@@extrat\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ %draw lower connection
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/gate height 2}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfusepath{draw}
+ %draw arrow depending on type of transistor
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \ifpgf at circuit@trans at arrowatend
+ \ifpgf at circuit@trans at ntype
+ \edef\@@anchor{btip}\edef\@@pos{1.0}
+ \else
+ \edef\@@anchor{tip}\edef\@@pos{1.0}
+ \fi
+ \else
+ \edef\@@anchor{center}\edef\@@pos{0.5}
+ \fi
+ \ifpgf at circuit@trans at ntype
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint%
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/#1/gate height 2}\pgf at circ@res at down}%
+ }{%
+ \pgfpoint{\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at down}%
+ }
+ \else
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint{\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at up}%
+ }{%
+ \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/#1/gate height 2}\pgf at circ@res at up}%
+ }
+ \fi
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+ %draw gate
+ \ifpgf at circuit@trans at ntype
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/conn height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
+ {\ctikzvalof{tripoles/#1/conn height}\pgf at circ@res at down}}
+ \else
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/conn height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
+ {\ctikzvalof{tripoles/#1/conn height}\pgf at circ@res at up}}
+ \fi
+ \pgfusepath{draw}
+ }
+}
+
+\declareigbt{pigbt}
+\declareigbt{nigbt}
+\declareigbt{Lnigbt}
+\declareigbt{Lpigbt}
+
+\pgfcircdeclaretransistor{nmos}{
+ \anchor{inner up}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/nmos/gate height}\pgf at y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/nmos/gate height}\pgf at y
+ }
+ }{%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/nmos/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/nmos/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/nmos/gate height}\pgf at circ@res at up}}
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/nmos/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/nmos/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/nmos/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/nmos/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/nmos/base height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/nmos/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/nmos/base height}\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/nmos/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/nmos/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/nmos/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/nmos/gate height}\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ \ifpgf at circuit@mos at arrows
+ \pgfscope
+ \ifpgf at circuit@trans at arrowatend
+ \pgftransformshift{\pgfpoint
+ {\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at down}%
+ }
+ \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
+ \else
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
+ \pgfpoint%
+ {\ctikzvalof{tripoles/nmos/gate width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/nmos/gate height}\pgf at circ@res at down}%
+ }{%
+ \pgfpoint
+ {\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/nmos/gate height}\pgf at circ@res at down}%
+ }
+ \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
+ \fi
+ \endpgfscope
+ \fi
+
+ \ifpgf at circuit@bpt at drawgate
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/nmos/gate width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \fi
+
+ \ifpgf at circuit@bpt at drawbulk % added by Burak Kelleci
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \fi
+}
+
+\pgfcircdeclaretransistor{pmos}{
+ \anchor{inner up}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/pmos/gate height}\pgf at y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/pmos/gate height}\pgf at y
+ }
+ }{%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \ifpgf at circuit@mos at arrows
+ \pgfscope
+ \ifpgf at circuit@trans at arrowatend
+ \pgftransformshift{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/base width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at up}%
+ }
+ \pgftransformrotate{180}
+ \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
+ \else
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
+ \pgfpoint%
+ {\pgf at circ@res at right}%
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at up}%
+ }{%
+ \pgfpoint
+ {\ctikzvalof{tripoles/pmos/gate width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at up}%
+ }
+ \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
+ \fi
+ \endpgfscope
+ \fi
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pmos/base height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pmos/base height}\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/pmos/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+
+
+ \pgfusepath{draw}
+ \ifpgf at circuit@bpt at drawgate
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/gate width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \fi
+
+ \ifpgf at circuit@bpt at drawbulk % added by Burak Kelleci
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfusepath{draw}
+ \fi
+
+ \ifpgf at circuit@pmos at nocircle\else
+ % we are not scaling the circle with the MOS --- I think it's better to have it
+ % coherent with the poles/nodes of the rest of the circuit.
+ \pgfpathcircle{\pgfpoint
+ {\ctikzvalof{tripoles/pmos/gate width}\pgf at circ@res at left - \ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \ifpgf at circuit@pmos at emptycircle
+ \pgfsetfillcolor{white}
+ \fi
+ \pgfusepath{draw,fill}
+ \fi
+}
+
+%% HEMT FET Transistor
+\pgfcircdeclaretransistor{hemt}{
+ \anchor{inner up}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/hemt/gate height}\pgf at y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/hemt/gate height}\pgf at y
+ }
+ }{%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/hemt/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/hemt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/hemt/gate height}\pgf at circ@res at up}}
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/hemt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/hemt/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/hemt/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/hemt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/hemt/base height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/hemt/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/hemt/base height}\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/hemt/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfusepath{draw}
+}
+
+\long\def\drawfetcore#1{
+ \pgftransformationadjustments
+ %top connection
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up}}
+ \ifpgf at circuit@trans at depletiontype
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down}}
+ \else
+
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up*0.45}}
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at up*0.25}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down*0.25}}
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/nfet/base height}\pgf at circ@res at down*0.45}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/base height}\pgf at circ@res at down}}
+ \fi
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ %Bulk connection line
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+
+ %bottom connection
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfusepath{draw}
+
+ %draw thick gate line
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/gate height}\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ % arrows
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \ifpgf at circuit@trans at arrowatend
+ \ifpgf at circuit@trans at ntype
+ \edef\@@anchor{tip}
+ \edef\@@pos{1.0}
+ \else
+ \edef\@@anchor{btip}
+ \edef\@@pos{0.0}
+ \fi
+ \else
+ \edef\@@anchor{center}\edef\@@pos{0.6}
+ \fi
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint
+ {\pgf at circ@res at right}%
+ {\pgf at circ@res at up+\pgf at circ@res at down}%
+ }{%
+ \pgfpoint%
+ {\ctikzvalof{tripoles/#1/base width}\pgf at circ@res at left}%
+ {\pgf at circ@res at up+\pgf at circ@res at down}%
+ }
+ \ifpgf at circuit@trans at ntype
+ \else
+ \pgftransformrotate{180}
+ \fi
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+
+% GATE CONNECTION
+\ifpgf at circuit@bpt at drawgate
+ \ifpgf at circuit@trans at ntype
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/#1/conn height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf at circ@res at down}}
+ \else
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf at circ@res at left}
+ {-\ctikzvalof{tripoles/#1/conn height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf at circ@res at down}}
+ \fi
+ \pgfusepath{draw}
+\fi
+
+}
+
+\long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3
+{\pgfcircdeclaretransistor{#1}{
+ \anchor{bulk}{\left\pgf at x=0pt}
+ \anchor{B}{\left\pgf at x=0pt}%override Base anchor from npn&igbt
+ \anchor{inner up}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/#1/gate height}\pgf at y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/#1/gate height}\pgf at y
+ }
+ #2
+ }
+ {#3}
+}
+
+\pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
+ \pgf at circuit@trans at depletiontypefalse
+ \drawfetcore{nfet}
+}
+
+\pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
+ \pgf at circuit@trans at depletiontypefalse
+ \drawfetcore{pfet}
+}
+
+% N-CHANNEL IGFET ENHANCEMENT TYPE
+\pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
+ \pgf at circuit@trans at depletiontypefalse
+ \drawfetcore{nigfete}
+
+ % SOURCE CONNECTION
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ % SOLDER DOT at source-bulk connection
+ \ifpgf at circuit@fet at solderdot
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{
+ \ctikzvalof{tripoles/nigfete/gate height}\pgf at circ@res at down}}
+ \pgfnode{circ}{center}{}{}{}
+ \endpgfscope{}
+\fi
+}
+
+% N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
+\pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
+ \pgf at circuit@trans at depletiontypefalse
+ \drawfetcore{nigfetebulk}
+ % SOLDER DOT at source-bulk connection
+ \ifpgf at circuit@fet at solderdot
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{
+ \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf at circ@res at down}}
+ \pgfnode{circ}{center}{}{}{}
+ \endpgfscope{}
+ \fi
+}
+
+% N-CHANNEL IGFET DEPLETION TYPE
+\pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
+ \pgf at circuit@trans at depletiontypetrue
+ \drawfetcore{nigfetd}
+
+ % SOURCE CONNECTION
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ % SOLDER DOT at source-bulk connection
+ \ifpgf at circuit@fet at solderdot
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{
+ \ctikzvalof{tripoles/nigfete/gate height}\pgf at circ@res at down}}
+ \pgfnode{circ}{center}{}{}{}
+ \endpgfscope{}
+ \fi
+}
+
+% P-CHANNEL IGFET ENHANCEMENT TYPE
+\pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
+ \pgf at circuit@trans at depletiontypefalse
+ \drawfetcore{pigfete}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+
+ % SOURCE CONNECTION
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+
+ % SOLDER DOT at source-bulk connection
+ \ifpgf at circuit@fet at solderdot
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{
+ \ctikzvalof{tripoles/pigfete/gate height}\pgf at circ@res at up}}
+ \pgfnode{circ}{center}{}{}{}
+ \endpgfscope
+ \fi
+}
+
+% P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
+\pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
+ \pgf at circuit@trans at depletiontypefalse
+ \drawfetcore{pigfetebulk}
+}
+
+% P-CHANNEL IGFET DEPLETION TYPE
+\pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
+ \pgf at circuit@trans at depletiontypetrue
+ \drawfetcore{pigfetd}
+
+ % SOURCE CONNECTION
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+
+ % SOLDER DOT at source-bulk connection
+ \ifpgf at circuit@fet at solderdot
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{
+ \ctikzvalof{tripoles/nigfete/gate height}\pgf at circ@res at up}}
+ \pgfnode{circ}{center}{}{}{}
+ \endpgfscope{}
+ \fi
+}
+
+\pgfcircdeclaretransistor{njfet}{
+ \anchor{inner up}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf at y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf at y
+ }
+ }{%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/njfet/gate height 2}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/njfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/njfet/gate height 2}\pgf at circ@res at up}}
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/njfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/njfet/gate height 2}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/njfet/gate height 2}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/njfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/njfet/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/njfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/njfet/gate height}\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ % arrow
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \ifpgf at circuit@trans at arrowatend
+ \edef\@@anchor{tip}\edef\@@pos{1.0}
+ \else
+ \edef\@@anchor{center}\edef\@@pos{0.6}
+ \fi
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint{\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/njfet/gate height 2}\pgf at circ@res at down}%
+ }{%
+ \pgfpoint
+ {\ctikzvalof{tripoles/njfet/gate width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/njfet/gate height 2}\pgf at circ@res at down}%
+ }
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/njfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/njfet/gate height 2}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
+ {\ctikzvalof{tripoles/njfet/gate height 2}\pgf at circ@res at down}}
+ \pgfusepath{draw}
+}
+
+\pgfcircdeclaretransistor{pjfet}{
+ \anchor{inner up}{
+ \northeast
+ \pgf at y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf at y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at y
+ }
+ }{%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/pjfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at circ@res at up}}
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/pjfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/pjfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pjfet/gate height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/pjfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pjfet/gate height}\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \ifpgf at circuit@trans at arrowatend
+ \edef\@@anchor{btip}\edef\@@pos{1.0}
+ \else
+ \edef\@@anchor{center}\edef\@@pos{0.4}
+ \fi
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint%
+ {\ctikzvalof{tripoles/pjfet/gate width}\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at circ@res at up}%
+ }{%
+ \pgfpoint{\pgf at circ@res at left}%
+ {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at circ@res at up}%
+ }
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/pjfet/gate width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
+ {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+\pgfdeclaretransistorwrapperaddbulk{isfet}{}{%
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ % DRAIN CONNECTION
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/isfet/gate height}\pgf at circ@res at up}}
+ % DRAIN
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/isfet/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/isfet/gate height}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ % GATE, DEPLETION TYPE
+ \pgfscope %% added
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/isfet/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/isfet/base height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/isfet/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/isfet/base height}\pgf at circ@res at down}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth} %% added
+ \pgfusepath{draw} %% added
+ \endpgfscope %% added
+
+ % BULK
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/isfet/base width}\pgf at circ@res at left}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+.5\pgflinewidth}
+ {\pgf at circ@res at up+\pgf at circ@res at down}}
+
+ % SOURCE
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/isfet/base width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/isfet/gate height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}
+ {\ctikzvalof{tripoles/isfet/gate height}\pgf at circ@res at down}}
+ % SOURCE CONNECTION
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
+ \pgfusepath{draw}
+
+ % SOLDER DOT at source-bulk connection
+ \ifpgf at circuit@fet at solderdot
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{
+ \ctikzvalof{tripoles/nigfete/gate height}\pgf at circ@res at down}}
+ \pgfnode{circ}{center}{}{}{}
+ \endpgfscope{}
+ \fi
+ % ARROW
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \ifpgf at circuit@trans at arrowatend
+ \edef\@@anchor{tip}\edef\@@pos{1.0}
+ \else
+ \edef\@@anchor{center}\edef\@@pos{0.6}
+ \fi
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint
+ {\pgf at circ@res at right}%
+ {\pgf at circ@res at up+\pgf at circ@res at down}%
+ }{%
+ \pgfpoint%
+ {\ctikzvalof{tripoles/isfet/base width}\pgf at circ@res at left}%
+ {\pgf at circ@res at up+\pgf at circ@res at down}%
+ }
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+ \pgfusepath{draw}
+
+ % Wavy lines
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf at circ@res at up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf at circ@res at up}{0cm}}
+ \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf at circ@res at up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf at circ@res at up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+% end of transistors
+
+%%%%%%%%%%%%%
+%% Switches
+%%%%%%%%%%%%%
+
+\pgfcircdeclarebipole{
+ \anchor{out 1}{
+ \northeast
+ \pgf at y=0cm
+ }
+ \anchor{out 2}{
+ \northeast
+ \pgf at y=.8\pgf at y
+ }
+}
+{\ctikzvalof{tripoles/toggleswitch/height 2}}
+{toggleswitch}
+{\ctikzvalof{tripoles/toggleswitch/height}}
+{\ctikzvalof{tripoles/toggleswitch/width}}
+{
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.3\pgf at circ@res at left}{0pt}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{.3\pgf at circ@res at left}{0pt}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{.5\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.5\pgf at circ@res at right}{0}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{.8\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.5\pgf at circ@res at right}{.8\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.5\pgf at circ@res at right}{.15\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.2\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfusepath{draw}
+
+ \pgfsetdash{{.08\pgf at circ@res at up}{.04\pgf at circ@res at up}{.7\pgf at circ@res at up}{.04\pgf at circ@res at up}{.8\pgf at circ@res at up}}{0cm}
+ \pgfpathmoveto{\pgfpoint{0}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0}{.8\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{.2\pgf at circ@res at left}{.6\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0}{.4\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0}{.2\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \pgfsetdash{}{0cm}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% operational and instrumentation amplifiers
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\pgfdeclareshape{op amp}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \savedanchor\left{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \savedanchor\left{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=0pt
+ }
+ \savedanchor\inOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/op amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in up}{
+ \inOneFixed
+ }
+ \anchor{in down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/op amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \anchor{-}{
+ \inOne
+ }
+ \anchor{+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\up{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/op amp/up pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at right}{0pt}}
+ }
+ \anchor{up}{
+ \up
+ }
+ \anchor{down}{
+ \up
+ \pgf at y=-\pgf at y
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \left
+ }
+ \anchor{east}{
+ \left
+ \pgf at x=-\pgf at x
+ }
+
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/op amp/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin up}{
+ \inOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bin down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b-}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % end border anchors
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ % Triangle
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=\ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at step
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ % Negative input terminal
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/op amp/input height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/op amp/input height}\pgf at circ@res at up}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/op amp/input height}\pgf at circ@res at up}]{\ctikzvalof{tripoles/op amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at plus\else\pgf at circ@ampli at minus\fi}
+
+ % Positive input terminal
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/op amp/input height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/op amp/input height}\pgf at circ@res at down}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/op amp/input height}\pgf at circ@res at down}]{\ctikzvalof{tripoles/op amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at minus\else\pgf at circ@ampli at plus\fi}
+
+ % Output terminal
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf at circ@res at right}{0pt}}
+ \pgfsetrectcap
+ \pgfusepath{draw}
+ }
+}
+
+% Op amp shape as in european standard EN 60617
+\pgfdeclareshape{en amp}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/en amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/en amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \savedanchor\left{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/en amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \savedanchor\inOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/en amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/en amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/en amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in up}{
+ \inOneFixed
+ }
+ \anchor{in down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/en amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/en amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/en amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \anchor{-}{
+ \inOne
+ }
+ \anchor{+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ }
+ \anchor{up}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{down}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \left
+ }
+ \anchor{east}{
+ \left
+ \pgf at x=-\pgf at x
+ }
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/en amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/en amp/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin up}{
+ \inOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bin down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b-}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % end border anchors
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/en amp/input height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/en amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/en amp/input height}\pgf at circ@res at up}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/en amp/input height}\pgf at circ@res at up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at plus\else\pgf at circ@ampli at minus\fi}
+
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/en amp/input height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/en amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/en amp/input height}\pgf at circ@res at down}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/en amp/input height}\pgf at circ@res at down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at minus\else\pgf at circ@ampli at plus\fi}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+ \pgfsetrectcap
+ \pgfusepath{draw}
+
+
+ \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf at circ@res at up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
+ % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf at circ@res at up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$}
+ }
+}
+
+% Fully differential output op amp
+% Contributed by Kristofer M. Monisit
+\pgfdeclareshape{fd op amp}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \savedanchor\outline{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at oplusup\else\pgf at y=-\pgf at y\fi
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at y=-\pgf at y\pgf at x=0pt\relax
+ }
+ \anchor{north}{
+ \northwest\pgf at x=0pt\relax
+ }
+ \savedanchor\left{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=0pt
+ }
+ \savedanchor\inOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in up}{
+ \inOneFixed
+ }
+ \anchor{in down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \anchor{-}{
+ \inOne
+ }
+ \anchor{+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\up{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/fd op amp/up pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/fd op amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf at circ@res at right}{0pt}}
+ }
+ \anchor{up}{
+ \up
+ }
+ \anchor{down}{
+ \up
+ \pgf at y=-\pgf at y
+ }
+ \anchor{out up}{
+ \northwest
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/output height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf at x
+ }
+ \anchor{out down}{
+ \northwest
+ \pgf at y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf at x
+ }
+ \anchor{out +}{
+ \outline
+ \pgf at y=\ctikzvalof{tripoles/fd op amp/output height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf at x
+ }
+ \anchor{out -}{
+ \outline
+ \pgf at y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf at x
+ }
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/fd op amp/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin up}{
+ \inOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bin down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b-}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{bout +}{
+ \outline
+ \pgf at xa=\pgf at x\pgf at ya=\pgf at y
+ \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
+ {\pgfpoint{\pgf at xa}{0pt}}
+ {\pgfpoint{0pt}{\pgf at ya}}
+ }
+ \anchor{bout -}{
+ \outline
+ \pgf at xa=\pgf at x\pgf at ya=\pgf at y
+ \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
+ {\pgfpoint{\pgf at xa}{0pt}}
+ {\pgfpoint{0pt}{\pgf at ya}}
+ \pgf at y=-\pgf at y
+ }
+ \anchor{bout up}{
+ \northwest
+ \pgf at xa=\pgf at x\pgf at ya=\pgf at y
+ \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
+ {\pgfpoint{\pgf at xa}{0pt}}
+ {\pgfpoint{0pt}{\pgf at ya}}
+ }
+ \anchor{bout down}{
+ \northwest
+ \pgf at xa=\pgf at x\pgf at ya=\pgf at y
+ \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
+ {\pgfpoint{\pgf at xa}{0pt}}
+ {\pgfpoint{0pt}{\pgf at ya}}
+ \pgf at y=-\pgf at y
+ }
+ % end border anchors
+ \anchor{west}{
+ \left
+ }
+ \anchor{east}{
+ \left
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf at x
+ }
+ \anchor{out}{% should not be used
+ \left
+ \pgf at x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf at x
+ }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf at x \pgf at y=-\pgf at y }
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ % Triangle
+ % Includes output terminals in the traingular shape
+ % to ensure that diagonal joins are properly displayed
+ % we first draw the main triangle and the leads with normal thickness,
+ % and the redraw the main triangle with the component shape
+ \pgfscope
+ % shift origin a bit to ease calculations
+ \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=\ctikzvalof{tripoles/fd op amp/port width}\pgf at circ@res at step
+
+ % Initial point (right vertex)
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+
+ % Negative output terminal
+ \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf at circ@res at step}{0pt}}{\pgfpoint{0pt}{\pgf at circ@res at up}}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf at circ@res at step}{0pt}}{\pgfpoint{0pt}{\pgf at circ@res at up}}}
+
+ % Top vertex
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+
+ % Bottom vertex
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+
+ % Positive output terminal
+ \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf at circ@res at step}{0pt}}{\pgfpoint{0pt}{\pgf at circ@res at down}}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf at circ@res at step}{0pt}}{\pgfpoint{0pt}{\pgf at circ@res at down}}}
+
+ % Right vertex
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+
+ \pgfpathclose
+ \pgfusepath{stroke}
+
+ % ok, now we'll redraw the triangle with the class specific
+ % thickness and optionally fill
+
+ \pgfscope
+ \pgf at circ@setlinewidth{quadpoles}{\pgflinewidth}
+
+ % Initial point (right vertex)
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ % Top vertex
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ % Bottom vertex
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope % thick and fill
+ \endpgfscope % shift
+
+ % Negative input terminal
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/fd op amp/input height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/fd op amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/fd op amp/input height}\pgf at circ@res at up}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf at circ@res at up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at plus\else\pgf at circ@ampli at minus\fi}
+
+ % Positive input terminal
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/fd op amp/input height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/fd op amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/fd op amp/input height}\pgf at circ@res at down}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf at circ@res at down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at minus\else\pgf at circ@ampli at plus\fi}
+
+ % Negative output terminal label
+ \pgftext[right, bottom, x=3pt, y=1pt, at=\pgfpoint{0pt}{0.425\pgf at circ@res at down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf at circuit@oa at oplusup\pgf at circ@ampli at minus\else\pgf at circ@ampli at plus\fi}
+
+ % Positive output terminal label
+ \pgftext[right, top, x=3pt, y=-1pt, at=\pgfpoint{0pt}{0.425\pgf at circ@res at up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf at circuit@oa at oplusup\pgf at circ@ampli at plus\else\pgf at circ@ampli at minus\fi}
+
+ \pgfsetrectcap
+ \pgfusepath{draw}
+ }
+}
+
+
+% Instrumentation amplifier with differential output
+\pgfdeclareshape{fd inst amp}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ % when tikz calls the anchor it wants the relative position in the lengths
+ % \pgf at x \pgf at y
+ % \pgfpoint* functions set that variables
+ % anchors are visible outside and run on use
+ \anchor{center}{\pgfpointorigin}
+ % savedanchors are internals and run on node creation (not use)
+ % bounding-box top left
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{nw}{
+ \northwest
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at y=-\pgf at y\pgf at x=0pt\relax
+ }
+ \anchor{north}{
+ \northwest\pgf at x=0pt\relax
+ }
+ \savedanchor\left{%
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}
+ {\left
+ \pgf at x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf at x
+ }
+ \savedanchor\inOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in up}{
+ \inOneFixed
+ }
+ \anchor{in down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \anchor{-}{
+ \inOne
+ }
+ \anchor{+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\up{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/fd inst amp/up pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf at circ@res at up}}
+ }
+ \anchor{up}{
+ \up
+ }
+ \anchor{down}{
+ \up
+ \pgf at y=-\pgf at y
+ }
+ % reference voltage input anchors.
+ \savedanchor\refv{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/fd inst amp/refv pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf at circ@res at up}}
+ }
+ % we need both because they are normally drawn under the amp, and if you
+ % mirror it vertically you need them
+ \anchor{refv up}{
+ \refv
+ }
+ \anchor{refv down}{
+ \refv
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\outport{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-.5\pgf at x
+ \ifpgf at circuit@oa at oplusup\else\pgf at y=-\pgf at y\fi
+ }
+ \anchor{out}{
+ \outport
+ \pgf at y=0pt
+ }
+ \anchor{out +}{
+ \outport
+ }
+ \anchor{out -}{
+ \outport
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\outportfixed{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-.5\pgf at x
+ }
+ \anchor{out up}{
+ \outportfixed
+ }
+ \anchor{out down}{
+ \outportfixed
+ \pgf at y=-\pgf at y
+ }
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin up}{
+ \inOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bin down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b-}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at x=-\pgf at x \pgf at y=0pt
+ }
+ \anchor{bout +}{
+ \outport
+ \pgf at ya=\pgf at y \leftedge \pgf at x=-\pgf at x \pgf at y=\pgf at ya
+ }
+ \anchor{bout -}{
+ \outport
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at x=-\pgf at x \pgf at y=\pgf at ya
+ }
+ \anchor{bout up}{
+ \outportfixed
+ \pgf at ya=\pgf at y \leftedge \pgf at x=-\pgf at x \pgf at y=\pgf at ya
+ }
+ \anchor{bout down}{
+ \outportfixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at x=-\pgf at x \pgf at y=\pgf at ya
+ }
+ % end border anchors
+ %
+ \anchor{west}{
+ \left
+ }
+ \anchor{east}{
+ \left
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+
+ % let's start drawing the component
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ %
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ % main component, normally in thicker lines
+ \pgfscope
+ \newdimen\pgf at circ@res at right@double
+ \pgf at circ@res at right@double=2\pgf at circ@res at right
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at step
+ %first point (near output)
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right@double}{0}}
+ %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf at circ@res at up}}
+ % and then to the input "front up", "down", to the output short side "down"
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf at circ@res at down}}
+ % ...and close
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ % input terminal up
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/fd inst amp/input height}\pgf at circ@res at up}}
+ %
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/fd inst amp/input height}\pgf at circ@res at up}}
+ %
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf at circ@res at up}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at plus\else\pgf at circ@ampli at minus\fi}
+
+ % input terminal down
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/fd inst amp/input height}\pgf at circ@res at down}}
+ %
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/fd inst amp/input height}\pgf at circ@res at down}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf at circ@res at down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at minus\else\pgf at circ@ampli at plus\fi}
+
+ % output leads down and up
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf at circ@res at down}} %
+ \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf at circ@res at down}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf at circuit@oa at oplusup$-\;$\else$+\;$\fi}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf at circ@res at up}} %
+ \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf at circ@res at up}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf at circuit@oa at oplusup$+\;$\else$-\;$\fi}
+ %
+ \pgfsetrectcap
+ \pgfusepath{draw}
+ }
+}
+
+% Transconductance amplifier (Transkonduktanzverstärker)
+\pgfdeclareshape{gm amp}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/gm amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/gm amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ }
+ \savedanchor\left{%
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}
+ {\left
+ \pgf at x = \ctikzvalof{tripoles/op amp/port width}\pgf at x
+ }
+ \savedanchor\inOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/gm amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/gm amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/gm amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in up}{
+ \inOneFixed
+ }
+ \anchor{in down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/gm amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/gm amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/gm amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \anchor{-}{
+ \inOne
+ }
+ \anchor{+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\up{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/gm amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/gm amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/gm amp/up pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf at circ@res at up}}
+ }
+ \anchor{up}{
+ \up
+ }
+ \anchor{down}{
+ \up
+ \pgf at y=-\pgf at y
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/gm amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/gm amp/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin up}{
+ \inOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bin down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b-}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % end border anchors
+ \anchor{west}{
+ \left
+ }
+ \anchor{east}{
+ \left
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \pgfscope
+ \newdimen\pgf at circ@res at right@double
+ \pgf at circ@res at right@double=2\pgf at circ@res at right
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at step
+ %Umrandung:
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at right@double}{0}} %geändert startpunkt neu am ausgangsstrich
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf at circ@res at up}}%vom Ausgang nach oben
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}} %neu ecke links oben nach rechts oben
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}} %bei deneigängen runter
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf at circ@res at down}}%ecke links unten nach rechts unten
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/gm amp/input height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/gm amp/input height}\pgf at circ@res at up}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/gm amp/input height}\pgf at circ@res at up}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at plus\else\pgf at circ@ampli at minus\fi}
+
+
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/gm amp/input height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/gm amp/input height}\pgf at circ@res at down}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/gm amp/input height}\pgf at circ@res at down}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at minus\else\pgf at circ@ampli at plus\fi}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf at circ@res at right}{0pt}} %
+ \pgfsetrectcap
+ \pgfusepath{draw}
+
+ }
+}
+
+% Instrumentation amplifier
+\pgfdeclareshape{inst amp}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ % when tikz calls the anchor it wants the relative position in the lengths
+ % \pgf at x \pgf at y
+ % \pgfpoint* functions set that variables
+ % anchors are visible outside and run on use
+ \anchor{center}{\pgfpointorigin}
+ % savedanchors are internals and run on node creation (not use)
+ % bounding-box top left
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{nw}{
+ \northwest
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ }
+ \savedanchor\left{%
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}
+ {\left
+ \pgf at x = \ctikzvalof{tripoles/op amp/port width}\pgf at x
+ }
+ \savedanchor\inOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/inst amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in up}{
+ \inOneFixed
+ }
+ \anchor{in down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/inst amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \anchor{-}{
+ \inOne
+ }
+ \anchor{+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\up{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/inst amp/up pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf at circ@res at up}}
+ }
+ \anchor{up}{
+ \up
+ }
+ \anchor{down}{
+ \up
+ \pgf at y=-\pgf at y
+ }
+ % reference voltage input anchors.
+ \savedanchor\refv{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/inst amp/refv pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf at circ@res at up}}
+ }
+ % we need both because they are normally drawn under the amp, and if you
+ % mirror it vertically you need them
+ \anchor{refv up}{
+ \refv
+ }
+ \anchor{refv down}{
+ \refv
+ \pgf at y=-\pgf at y
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/inst amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/inst amp/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin up}{
+ \inOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bin down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b-}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % end border anchors
+ \anchor{west}{
+ \left
+ }
+ \anchor{east}{
+ \left
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+
+ % let's start drawing the component
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ %
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ % main component, normally in thicker lines
+ \pgfscope
+ \newdimen\pgf at circ@res at right@double
+ \pgf at circ@res at right@double=2\pgf at circ@res at right
+
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at step
+ %first point (near output)
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at right@double}{0}}
+ %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf at circ@res at up}}
+ % and then to the input "front up", "down", to the output short side "down"
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf at circ@res at down}}
+ % ...and close
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ % Negative input terminal
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp/input height}\pgf at circ@res at up}}
+ %
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp/input height}\pgf at circ@res at up}}
+ %
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/inst amp/input height}\pgf at circ@res at up}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at plus\else\pgf at circ@ampli at minus\fi}
+
+ % Positive input terminal
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp/input height}\pgf at circ@res at down}}
+ %
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp/input height}\pgf at circ@res at down}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/inst amp/input height}\pgf at circ@res at down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at minus\else\pgf at circ@ampli at plus\fi}
+
+ % Output terminal
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf at circ@res at right}{0pt}} %
+ %
+ \pgfsetrectcap
+ \pgfusepath{draw}
+ }
+}
+
+% Instrumentation amplifier with terminals for gain resistance between inputs
+\pgfdeclareshape{inst amp ra}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ % bounding-box top left
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{nw}{
+ \northwest
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at y=-\pgf at y\pgf at x=0pt\relax
+ }
+ \anchor{north}{
+ \northwest\pgf at x=0pt\relax
+ }
+ \savedanchor\left{%
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}
+ {\left
+ \pgf at x = \ctikzvalof{tripoles/op amp/port width}\pgf at x
+ }
+ % inputs (+-)
+ \savedanchor\inOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{in up}{
+ \inOneFixed
+ }
+ \anchor{in down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \anchor{-}{
+ \inOne
+ }
+ \anchor{+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ }
+ % R ampli anchors. They are by default at 20% more than R-length distance
+ % you can change that with the `ra pos` key (use 0.5 for one-R).
+ \savedanchor\raOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\pgf at circ@scaled at Rlen
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{ra up}{
+ \raOneFixed
+ }
+ \anchor{ra down}{
+ \raOneFixed
+ \pgf at y=-\pgf at y
+ }
+ \savedanchor\raOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\pgf at circ@scaled at Rlen
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \anchor{ra-}{
+ \raOne
+ }
+ \anchor{ra+}{
+ \raOne
+ \pgf at y=-\pgf at y
+ }
+ % power supplies
+ \savedanchor\up{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/inst amp ra/up pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf at circ@res at up}}
+ }
+ \anchor{up}{
+ \up
+ }
+ \anchor{down}{
+ \up
+ \pgf at y=-\pgf at y
+ }
+ % reference voltage input anchors.
+ \savedanchor\refv{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/inst amp ra/height}\pgf at circ@scaled at Rlen
+ \pgf at y=0.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf at circ@scaled at Rlen
+ \pgf at x=0.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/inst amp ra/refv pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf at circ@res at up}}
+ }
+ % we need both because they are normally drawn under the amp, and if you
+ % mirror it vertically you need them
+ \anchor{refv up}{
+ \refv
+ }
+ \anchor{refv down}{
+ \refv
+ \pgf at y=-\pgf at y
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin up}{
+ \inOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bin down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b-}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bra up}{
+ \raOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bra down}{
+ \raOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bra-}{
+ \raOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bra+}{
+ \raOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % end border anchors
+ \anchor{west}{
+ \left
+ }
+ \anchor{east}{
+ \left
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+
+ % drawing of the component
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \newdimen\pgf at circ@res at right@double
+ \pgf at circ@res at right@double=2\pgf at circ@res at right
+
+ % main component, normally in thicker lines
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at step
+ %primer punto: la linea de salida (lado componente)
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at right@double}{0}}
+ %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf at circ@res at up}}
+ % and then to the input "front up", "down", to the output short side "down"
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf at circ@res at down}}
+ % ...and close
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ % ra terminal -
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf at circ@Rlen}}
+ %
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf at circ@Rlen}}
+ % ra terminal +
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf at circ@Rlen}}
+ %
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}
+ {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf at circ@Rlen}}
+
+ % Negative input terminal
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp ra/input height}\pgf at circ@res at up}}
+ %
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp ra/input height}\pgf at circ@res at up}}
+ %
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf at circ@res at up}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at plus\else\pgf at circ@ampli at minus\fi}
+
+ % Positive input terminal
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp ra/input height}\pgf at circ@res at down}}
+ %
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/inst amp ra/input height}\pgf at circ@res at down}}
+ \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf at circ@res at down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf at circuit@oa at iplusup\pgf at circ@ampli at minus\else\pgf at circ@ampli at plus\fi}
+
+ % Output terminal
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf at circ@res at right}{0pt}} %
+ %
+ \pgfsetrectcap
+ \pgfusepath{draw}
+ }
+}
+
+% Buffer
+% Contributed by Danilo Piazzalunga
+\pgfdeclareshape{buffer}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{bipoles/buffer/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/buffer/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \savedanchor\left{%
+ \pgf at y=0pt
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{bin}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
+ \anchor{bout}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-0.7\pgf at x
+ }
+
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \northwest
+ \pgfmathsetlength{\pgf at x}{0.7*\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{.7\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=.7\pgf at circ@res at step
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+ }
+}
+
+% plain amplifier, no symbols
+\pgfdeclareshape{plain amp}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/plain amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \savedanchor\left{%
+ \pgf at y=0pt
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/plain amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/plain amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \ifpgf at circuit@oa at iplusup\pgf at y=-\pgf at y\fi
+ }
+ \savedanchor\inOneFixed{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/plain amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at y=\ctikzvalof{tripoles/plain amp/input height}\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{-}{
+ \inOne
+ }
+ \anchor{+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ }
+ \anchor{in up}{
+ \inOneFixed
+ }
+ \anchor{in down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ }
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/plain amp/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin up}{
+ \inOneFixed
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bin down}{
+ \inOneFixed
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b-}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{b+}{
+ \inOne
+ \pgf at y=-\pgf at y
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % end border anchors
+ \savedanchor\up{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/plain amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/plain amp/up pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at right}{0pt}}
+ }
+ \anchor{up}{
+ \up
+ }
+ \anchor{down}{
+ \up
+ \pgf at y=-\pgf at y
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at step
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/plain amp/input height}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/plain amp/input height}\pgf at circ@res at up}}
+
+
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/plain amp/input height}\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at left}
+ {\ctikzvalof{tripoles/plain amp/input height}\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+ }
+}
+
+% plain amplifier, no symbols, one input
+\pgfdeclareshape{plain mono amp}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/plain amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \savedanchor\left{%
+ \pgf at y=0pt
+ }
+ \savedanchor\inOne{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=0pt\relax
+ }
+ \anchor{in}{
+ \inOne
+ }
+ % support for border anchors
+ \savedanchor\leftedge{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x = \ctikzvalof{tripoles/plain amp/port width}\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{leftedge}{\leftedge}
+ \anchor{rightedge}{\leftedge \pgf at x =-\pgf at x }
+ \anchor{bin}{
+ \inOne
+ \pgf at ya=\pgf at y \leftedge \pgf at y=\pgf at ya
+ }
+ \anchor{bout}{
+ \leftedge
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ % end border anchors
+ \savedanchor\up{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/plain amp/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/plain amp/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfpointlineattime{
+ \ctikzvalof{tripoles/plain amp/up pos}}{
+ \pgfpoint{
+ \ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at left}
+ {\pgf at circ@res at up}}
+ {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at right}{0pt}}
+ }
+ \anchor{up}{
+ \up
+ }
+ \anchor{down}{
+ \up
+ \pgf at y=-\pgf at y
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf at x}{\pgf at x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at left}
+ \pgf at circ@res at step=\pgf at circ@res at right
+ \advance\pgf at circ@res at step by -\pgf at circ@res at left
+ \pgf at circ@res at step=\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at step
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\pgf at circ@res at left}
+ {0pt}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at left}
+ {0pt}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf at circ@res at right}{0pt}}
+
+ \pgfusepath{draw}
+ }
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% electromechanical device (motor/generator)
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\pgfdeclareshape{elmech}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/elmech/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/elmech/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{text}{
+ \pgfpointorigin
+ \advance \pgf at x by -.5\wd\pgfnodeparttextbox
+ \advance \pgf at y by -.5\ht\pgfnodeparttextbox
+ }
+ \anchor{left}{%
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{right}{%
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{top}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{pathstart}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{pathend}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{bottom}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{center}{
+ \pgf at y=0pt
+ \pgf at x=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{%
+ \@tempdima=\pgf at x\@tempdimb=\pgf at y
+ \northwest\pgf at circ@res at other=-\pgf at x
+ \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf at circ@res at other}{\pgf at circ@res at other}}
+ }
+ \anchor{block north west}{\northwest\pgf at x=0.5\pgf at x}
+ \anchor{block south west}{\northwest\pgf at x=0.5\pgf at x\pgf at y=-\pgf at y}
+ \anchor{block north east}{\northwest\pgf at x=-0.5\pgf at x}
+ \anchor{block south east}{\northwest\pgf at x=-0.5\pgf at x\pgf at y=-\pgf at y}
+ \anchor{block up right}{
+ \northwest
+ % remember that pgf at x is negative
+ % center of the block is at 0.5*H+W*cos(30)/2
+ \pgf at y=\dimexpr0.5\pgf at y - 0.433\pgf at x\relax
+ \pgf at x=-0.5\pgf at x
+ }
+ \anchor{block up left}{
+ \northwest
+ % remember that pgf at x is negative
+ % center of the block is at 0.5*H+W*cos(30)/2
+ \pgf at y=\dimexpr0.5\pgf at y - 0.433\pgf at x\relax
+ \pgf at x=0.5\pgf at x
+ }
+ \anchor{block down right}{
+ \northwest
+ % remember that pgf at x is negative
+ % center of the block is at 0.5*H+W*cos(30)/2
+ \pgf at y=\dimexpr0.5\pgf at y - 0.433\pgf at x\relax
+ \pgf at y=-\pgf at y
+ \pgf at x=-0.5\pgf at x
+ }
+ \anchor{block down left}{
+ \northwest
+ % remember that pgf at x is negative
+ % center of the block is at 0.5*H+W*cos(30)/2
+ \pgf at y=\dimexpr0.5\pgf at y - 0.433\pgf at x\relax
+ \pgf at y=-\pgf at y
+ \pgf at x=0.5\pgf at x
+ }
+ \behindbackgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{tripoles/elmech/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at up=\ctikzvalof{tripoles/elmech/height}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfscope % clip the bar: whole size minus the circle
+ \pgfpathrectanglecorners{\pgfpoint{-.5\pgf at circ@res at step}{-.5\pgf at circ@res at up}}{\pgfpoint{.5\pgf at circ@res at step}{.5\pgf at circ@res at up}}
+ \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf at circ@res at step}
+ \pgfseteorule
+ \pgfusepath{clip}
+ \pgfpathrectangle{\pgfpoint{-.25\pgf at circ@res at step}{-.5\pgf at circ@res at up}}{\pgfpoint{.5\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfsetfillcolor{\ctikzvalof{color}}
+ \pgfusepath{fill, draw}
+ \endpgfscope
+ \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf at circ@res at step}
+ \ifx\tikz at fillcolor\pgfutil at empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ \pgf at circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \pgfusepath{draw, fill}
+ \fi
+ \endpgfscope
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%% Magnetron
+%%%%%%%%%%%%%%%%%%%
+
+\pgfdeclareshape{magnetron}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/magnetron/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/magnetron/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{anode}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{cathode1}{
+ \northwest
+ \pgf at circ@res at step=\pgf at y
+ \pgfmathparse{cos(105)}
+ \pgf at x=\pgfmathresult\pgf at circ@res at step
+ \pgfmathparse{sin(105)}
+ \pgf at y=\pgfmathresult\pgf at circ@res at step
+ %\pgfpointorigin
+ %\pgfpathmoveto{\pgfpointpolar{105}{\pgf at circ@res at step}}%not working in a scaled tikzpicture
+ }
+ \anchor{cathode2}{
+ \northwest
+ \pgf at circ@res at step=\pgf at y
+ \pgfmathparse{cos(75)}
+ \pgf at x=\pgfmathresult\pgf at circ@res at step
+ \pgfmathparse{sin(75)}
+ \pgf at y=\pgfmathresult\pgf at circ@res at step
+ %\pgfpointorigin
+ %\pgfpathmoveto{\pgfpointpolar{75}{\pgf at circ@res at step}}%not working in a scaled tikzpicture
+ }
+ \anchor{text}{
+ \pgfpointorigin
+ \advance \pgf at x by -.5\wd\pgfnodeparttextbox
+ \advance \pgf at y by -.5\ht\pgfnodeparttextbox
+ }
+ \anchor{left}{%
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{right}{%
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{top}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{pathstart}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{pathend}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{bottom}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{center}{
+ \pgf at y=0pt
+ \pgf at x=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{tripoles/magnetron/width}\pgf at circ@scaled at Rlen
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgfmathsetlength{\pgf at circ@res at other}{sin(15)*\pgf at circ@res at up}
+
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ %create outer circle
+ \pgfpathcircle{\pgfpoint{0}{0}} {\pgf at circ@res at right}
+ \pgf at circ@draworfill
+ %create chambers
+ \foreach \angle in {45,135,225,315}{
+ \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf at circ@res at right}}
+ \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf at circ@res at right}}
+ }
+ \pgfsetroundcap
+ \pgfusepath{draw}
+ \pgfscope
+ %draw connection from outside
+ %anode
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{0\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0\pgf at circ@res at right}{.5\pgf at circ@res at down}}
+ %cathodes
+ \pgfpathmoveto{\pgfpointpolar{105}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at other}{.5\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpointpolar{75}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{.5\pgf at circ@res at up}}
+ \pgfsetbuttcap
+ \pgfusepath{draw}
+ \endpgfscope
+ %create cathode
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at other}{.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0}{.15\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at other}{.5\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ %create anode
+ \pgfpathmoveto{\pgfpoint{0.3\pgf at circ@res at left}{.5\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.3\pgf at circ@res at right}{.5\pgf at circ@res at down}}
+
+ \pgfsetbuttcap
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Electronic tubes, submitted by J. op den Brouw
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Draw tube outline
+\def\pgf at circ@tubes at drawtube{%
+ \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfutil at tempdima=\pgf at circ@res at right
+ \advance\pgfutil at tempdima by -\pgf at circ@res at up
+ \pgfpathlineto{\pgfpoint{\pgfutil at tempdima}{\pgf at circ@res at up}}
+ \pgfpatharc{90}{-90}{\pgf at circ@res at up}
+ \pgfpathlineto{\pgfpoint{-\pgfutil at tempdima}{-\pgf at circ@res at up}}
+ \pgfpatharc{270}{90}{\pgf at circ@res at up}
+ \else
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{0pt}}
+ \pgfutil at tempdima=\pgf at circ@res at up
+ \advance\pgfutil at tempdima by -\pgf at circ@res at right
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at right}{\pgfutil at tempdima}}
+ \pgfpatharc{180}{0}{\pgf at circ@res at right}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-\pgfutil at tempdima}}
+ \pgfpatharc{180}{0}{-\pgf at circ@res at right}
+ \fi
+ \pgfpathclose
+}
+
+%% The diode (tube), triode, tetrode and pentode only differ in the
+%% number of grids. So we construct a generic declare function in
+%% which we can put code for the grid anchors and grid drawing code
+%% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
+\long\def\pgfcircdeclaretube#1#2#3{%
+ \pgfdeclareshape{#1}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at up=\ctikzvalof{tubes/height}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at right=\ctikzvalof{tubes/width}\pgf at circ@scaled at Rlen
+ % x and y should be half the Rlen
+ \pgf at y=\pgf at circ@res at up
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\pgf at circ@res at right
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{north} {%
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{east}{%
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=0pt
+ }
+ \anchor{south}{%
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{west}{%
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{north west}{%
+ \northwest
+ }
+ \anchor{north east}{%
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{anode} {%
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{cathode}{%
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=\ctikzvalof{tubes/cathode width}\pgf at x
+ }
+ \anchor{cathode 1}{%
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=\ctikzvalof{tubes/cathode width}\pgf at x
+ }
+ \anchor{cathode 2}{%
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=-\ctikzvalof{tubes/cathode width}\pgf at x
+ }
+ \anchor{filament 1}{%
+ \northwest
+ \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
+ \pgf at x=\pgfmathresult\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \anchor{filament 2}{%
+ \northwest
+ \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
+ \pgf at x=-\pgfmathresult\pgf at x
+ \pgf at y=-\pgf at y
+ }
+
+ % Extra anchors
+ #2
+
+ \backgroundpath{
+ \pgfscope
+ % Line width for tripoles
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ % Setup to draw tube
+ \pgf at circ@res at up=\ctikzvalof{tubes/height}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at right=\ctikzvalof{tubes/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at up=\ctikzvalof{tubes/tube radius}\pgf at circ@res at up
+ \pgf at circ@res at right=\ctikzvalof{tubes/tube radius}\pgf at circ@res at right
+
+ % Tube outline
+ \pgf at circ@tubes at drawtube
+
+ % Setup to draw grid, filament, anode and cathode
+ \pgf at circ@res at up=\ctikzvalof{tubes/height}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at right=\ctikzvalof{tubes/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at up=0.5\pgf at circ@res at up
+ \pgf at circ@res at right=0.5\pgf at circ@res at right
+
+ % Tube fill color (if any)
+ \pgf at circ@draworfill
+
+ % Grid drawing
+ #3
+
+ % Filament (is not drawn by default)
+ \ifpgf at circuit@tubes at filament
+ \pgf at circ@res at temp=-\ctikzvalof{tubes/cathode distance}\pgf at circ@res at up
+ \advance\pgf at circ@res at temp by -\ctikzvalof{tubes/filament distance}\pgf at circ@res at up
+ \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
+ \pgf at xa=\pgfmathresult\pgf at circ@res at right
+ \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
+ \pgf at ya=\pgfmathresult\pgf at circ@res at up
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at temp}}
+ \pgfpathlineto{\pgfpoint{-\pgf at xa}{-\pgf at ya}}
+ \pgfpathlineto{\pgfpoint{-\pgf at xa}{-\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at temp}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{-\pgf at ya}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{-\pgf at circ@res at up}}
+ \pgf at circuit@tubes at filamentfalse
+ \fi
+
+ % Anode (or plate)
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at up}} % north
+ \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf at circ@res at right}{\ctikzvalof{tubes/anode distance}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf at circ@res at right}{\ctikzvalof{tubes/anode distance}\pgf at circ@res at up}}
+
+ % Cathode
+ \ifpgf at circuit@tubes at nocathode
+ \pgf at circuit@tubes at nocathodefalse
+ \else
+ \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf at circ@res at up}{\ctikzvalof{tubes/cathode corners}\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf at circ@res at right}{-\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf at circ@res at right}{-\ctikzvalof{tubes/cathode distance}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf at circ@res at right}{-\ctikzvalof{tubes/cathode distance}\pgf at circ@res at up}}
+ \ifpgf at circuit@tubes at fullcathode
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf at circ@res at right}{-\pgf at circ@res at up}}
+ \pgf at circuit@tubes at fullcathodefalse
+ \else
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf at circ@res at right}{-\ctikzvalof{tubes/cathode distance}\pgf at circ@res at up-\ctikzvalof{tubes/cathode right extend}\pgf at circ@res at up}}
+ \fi
+ \fi
+
+ % Draw the background
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+ }
+}
+
+\pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
+
+\pgfcircdeclaretube{triode}
+{
+ \anchor{grid} {% should not be used
+ \northwest
+ \pgf at y=\ctikzvalof{tubes/grid shift}\pgf at y
+ }
+ \anchor{control} {%
+ \northwest
+ \pgf at y=\ctikzvalof{tubes/grid shift}\pgf at y
+ }
+}
+{
+ % Grid protrusion
+ \pgf at xa=-\ctikzvalof{tubes/tube radius}\pgf at circ@res at right
+ \advance\pgf at xa by -\ctikzvalof{tubes/grid protrusion}\pgf at circ@res at right
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{\ctikzvalof{tubes/grid shift}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{\ctikzvalof{tubes/grid shift}\pgf at circ@res at up}}
+ % Grid dashes: calculations
+ \pgf at xb=2\pgf at circ@res at right
+ \pgf at circ@res at step=\ctikzvalof{tubes/tube radius}\pgf at xb
+ \pgf at circ@count at a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
+ \multiply\pgf at circ@count at a by 2\relax
+ \advance\pgf at circ@count at a by 1\relax
+ \advance\pgf at circ@res at step by -\pgf at xa
+ \divide\pgf at circ@res at step by \pgf at circ@count at a
+ % Grid dashes: draw
+ \pgf at circ@res at temp=\pgf at xa
+ \pgf at circ@count at a=\ctikzvalof{tubes/grid dashes}
+ \loop
+ \advance\pgf at circ@res at temp by\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\ctikzvalof{tubes/grid shift}\pgf at circ@res at up}}
+ \advance\pgf at circ@res at temp by\pgf at circ@res at step
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp}{\ctikzvalof{tubes/grid shift}\pgf at circ@res at up}}
+ \advance\pgf at circ@count at a by-1
+ \ifnum\pgf at circ@count at a>0\relax
+ \repeat
+}
+
+\pgfcircdeclaretube{tetrode}
+{
+ \anchor{grid} {% should not be used
+ \northwest
+ \pgfutil at tempdima=\pgf at y
+ \pgf at y=-\ctikzvalof{tubes/grid separation}\pgf at y
+ \pgf at y=0.5\pgf at y
+ \advance\pgf at y by \ctikzvalof{tubes/grid shift}\pgfutil at tempdima
+ }
+ \anchor{control} {%
+ \northwest
+ \pgfutil at tempdima=\pgf at y
+ \pgf at y=-\ctikzvalof{tubes/grid separation}\pgf at y
+ \pgf at y=0.5\pgf at y
+ \advance\pgf at y by \ctikzvalof{tubes/grid shift}\pgfutil at tempdima
+ }
+ \anchor{screen} {%
+ \northwest
+ \pgfutil at tempdima=\pgf at y
+ \pgf at y=\ctikzvalof{tubes/grid separation}\pgf at y
+ \pgf at y=0.5\pgf at y
+ \advance\pgf at y by \ctikzvalof{tubes/grid shift}\pgfutil at tempdima
+ }
+}
+{
+ % Grid x/y points
+ \pgf at xa=-\ctikzvalof{tubes/tube radius}\pgf at circ@res at right
+ \advance\pgf at xa by -\ctikzvalof{tubes/grid protrusion}\pgf at circ@res at right
+ \pgfutil at tempdima=\ctikzvalof{tubes/grid separation}\pgf at circ@res at up
+ \pgfutil at tempdimb=-\pgfutil at tempdima
+ \pgfutil at tempdima=0.5\pgfutil at tempdima
+ \advance\pgfutil at tempdima by \ctikzvalof{tubes/grid shift}\pgf at circ@res at up
+ \pgfutil at tempdimb=0.5\pgfutil at tempdimb
+ \advance\pgfutil at tempdimb by \ctikzvalof{tubes/grid shift}\pgf at circ@res at up
+ % Grid protrusion
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{\pgfutil at tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{\pgfutil at tempdimb}}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{\pgfutil at tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{\pgfutil at tempdima}}
+ % Grid dashes: calculations
+ \pgf at xb=2\pgf at circ@res at right
+ \pgf at circ@res at step=\ctikzvalof{tubes/tube radius}\pgf at xb
+ \pgf at circ@count at a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
+ \multiply\pgf at circ@count at a by 2\relax
+ \advance\pgf at circ@count at a by 1\relax
+ \advance\pgf at circ@res at step by -\pgf at xa
+ \divide\pgf at circ@res at step by \pgf at circ@count at a
+ % Grid dashes: draw
+ \pgf at circ@res at temp=\pgf at xa
+ \pgf at circ@count at a=\ctikzvalof{tubes/grid dashes}
+ \loop
+ \advance\pgf at circ@res at temp by\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgfutil at tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at step}{\pgfutil at tempdima}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgfutil at tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at step}{\pgfutil at tempdimb}}
+ \advance\pgf at circ@res at temp by\pgf at circ@res at step
+ \advance\pgf at circ@count at a by-1
+ \ifnum\pgf at circ@count at a>0\relax
+ \repeat
+}
+
+\pgfcircdeclaretube{pentode}
+{
+ \anchor{grid} {% should not be used
+ \northwest
+ \pgfutil at tempdima=\pgf at y
+ \pgf at y=-\ctikzvalof{tubes/grid separation}\pgf at y
+ \advance\pgf at y by \ctikzvalof{tubes/grid shift}\pgfutil at tempdima
+ }
+ \anchor{control} {%
+ \northwest
+ \pgfutil at tempdima=\pgf at y
+ \pgf at y=-\ctikzvalof{tubes/grid separation}\pgf at y
+ \advance\pgf at y by \ctikzvalof{tubes/grid shift}\pgfutil at tempdima
+ }
+ \anchor{screen} {%
+ \northwest
+ \pgf at y=\ctikzvalof{tubes/grid shift}\pgf at y
+ }
+ \anchor{suppressor} {%
+ \northwest
+ \pgfutil at tempdima=\pgf at y
+ \pgf at y=\ctikzvalof{tubes/grid separation}\pgf at y
+ \advance\pgf at y by \ctikzvalof{tubes/grid shift}\pgfutil at tempdima
+ }
+}
+{
+ % Grid x/y points
+ \pgf at xa=-\ctikzvalof{tubes/tube radius}\pgf at circ@res at right
+ \advance\pgf at xa by -\ctikzvalof{tubes/grid protrusion}\pgf at circ@res at right
+ \pgfutil at tempdima=\ctikzvalof{tubes/grid separation}\pgf at circ@res at up
+ \pgfutil at tempdimb=-\pgfutil at tempdima
+ \advance\pgfutil at tempdima by \ctikzvalof{tubes/grid shift}\pgf at circ@res at up
+ \advance\pgfutil at tempdimb by \ctikzvalof{tubes/grid shift}\pgf at circ@res at up
+ \pgf at circ@res at other=\ctikzvalof{tubes/grid shift}\pgf at circ@res at up
+ % Grid protrusion
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{\pgfutil at tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{\pgfutil at tempdimb}}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{\pgfutil at tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{\pgfutil at tempdima}}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{\pgf at circ@res at other}}
+ % Grid dashes: calculations
+ \pgf at xb=2\pgf at circ@res at right
+ \pgf at circ@res at step=\ctikzvalof{tubes/tube radius}\pgf at xb
+ \pgf at circ@count at a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
+ \multiply\pgf at circ@count at a by 2\relax
+ \advance\pgf at circ@count at a by 1\relax
+ \advance\pgf at circ@res at step by -\pgf at xa
+ \divide\pgf at circ@res at step by \pgf at circ@count at a
+ % Grid dashes: draw
+ \pgf at circ@res at temp=\pgf at xa
+ \pgf at circ@count at a=\ctikzvalof{tubes/grid dashes}
+ \loop
+ \advance\pgf at circ@res at temp by\pgf at circ@res at step
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgfutil at tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at step}{\pgfutil at tempdima}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgfutil at tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at step}{\pgfutil at tempdimb}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at step}{\pgf at circ@res at other}}
+ \advance\pgf at circ@res at temp by\pgf at circ@res at step
+ \advance\pgf at circ@count at a by-1
+ \ifnum\pgf at circ@count at a>0\relax
+ \repeat
+}
+
+\pgfcircdeclaretube{pentode suppressor to cathode}
+{
+ \anchor{grid} {% should not be used
+ \northwest
+ \pgfutil at tempdima=\pgf at y
+ \pgf at y=-\ctikzvalof{tubes/grid separation}\pgf at y
+ \advance\pgf at y by \ctikzvalof{tubes/grid shift}\pgfutil at tempdima
+ }
+ \anchor{control} {%
+ \northwest
+ \pgfutil at tempdima=\pgf at y
+ \pgf at y=-\ctikzvalof{tubes/grid separation}\pgf at y
+ \advance\pgf at y by \ctikzvalof{tubes/grid shift}\pgfutil at tempdima
+ }
+ \anchor{screen} {%
+ \northwest
+ \pgf at y=\ctikzvalof{tubes/grid shift}\pgf at y
+ }
+}
+{
+ % Grid x/y points
+ \pgf at xa=-\ctikzvalof{tubes/tube radius}\pgf at circ@res at right
+ \advance\pgf at xa by -\ctikzvalof{tubes/grid protrusion}\pgf at circ@res at right
+ \pgfutil at tempdima=\ctikzvalof{tubes/grid separation}\pgf at circ@res at up
+ \pgfutil at tempdimb=-\pgfutil at tempdima
+ \advance\pgfutil at tempdima by \ctikzvalof{tubes/grid shift}\pgf at circ@res at up
+ \advance\pgfutil at tempdimb by \ctikzvalof{tubes/grid shift}\pgf at circ@res at up
+ \pgf at circ@res at other=\ctikzvalof{tubes/grid shift}\pgf at circ@res at up
+ % Grid protrusion
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{\pgfutil at tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{\pgfutil at tempdimb}}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at right}{\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{\pgf at xa}{\pgf at circ@res at other}}
+ % Grid dashes: calculations
+ \pgf at xb=2\pgf at circ@res at right
+ \pgf at circ@res at step=\ctikzvalof{tubes/tube radius}\pgf at xb
+ \pgf at circ@count at a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
+ \multiply\pgf at circ@count at a by 2\relax
+ \advance\pgf at circ@count at a by 1\relax
+ \advance\pgf at circ@res at step by -\pgf at xa
+ \divide\pgf at circ@res at step by \pgf at circ@count at a
+ % Grid dashes: draw
+ \pgf at circ@res at temp=\pgf at xa
+ \pgf at circ@count at a=\ctikzvalof{tubes/grid dashes}
+ \loop
+ \advance\pgf at circ@res at temp by\pgf at circ@res at step
+ \ifnum\pgf at circ@count at a>1\relax
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgfutil at tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at step}{\pgfutil at tempdimb}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at step}{\pgf at circ@res at other}}
+ \fi
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp}{\pgfutil at tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at step}{\pgfutil at tempdima}}
+ \advance\pgf at circ@res at temp by\pgf at circ@res at step
+ \advance\pgf at circ@count at a by-1
+ \ifnum\pgf at circ@count at a>0\relax
+ \repeat
+ % Grid: connection from suppressor to cathode
+ \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf at circ@res at up}{\ctikzvalof{tubes/cathode corners}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp}{\pgfutil at tempdima-2*\ctikzvalof{tubes/grid separation}\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf at circ@res at right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf at circ@res at right}{-\ctikzvalof{tubes/cathode distance}\pgf at circ@res at up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf at circ@res at up}}
+
+}
+
+%%%---------- close: tex/pgfcirctripoles
+%%%%%%%%%%% Springe nach tex/pgfcircquadpoles
+%%%---------- open: tex/pgfcircquadpoles.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Quadripoles
+
+\long\def\pgfcircdeclarequadpole#1#2#3{
+ \pgfdeclareshape{#1}
+ {
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ % shapename
+ \savedmacro{\thisshape}{\def\thisshape{\tikz at fig@name}}
+ \anchor{center}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=0pt
+ }
+ \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{quadpoles/#1/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=.5\pgf at circ@scaled at Rlen
+ \pgf at x=-\ctikzvalof{quadpoles/#1/width}\pgf at x
+ }
+ %% we define the upper right (positive coord) dot (which is B1)
+ \savedanchor{\innerdot}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at xa=.5\pgf at circ@scaled at Rlen
+ \pgf at xa=-\ctikzvalof{quadpoles/#1/width}\pgf at xa
+ % by default use the cute inductor size
+ \pgfmathsetlength\pgf at x{-\stretto*\pgf at xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf at circ@scaled at Rlen/2}
+ % check if it's american
+ \edef\pgf at circ@temp{\ctikzvalof{inductor}}
+ \edef\pgf at temp{american}
+ \ifx\pgf at circ@temp\pgf at temp
+ \pgfmathsetlength\pgf at x{-\stretto*\pgf at xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf at circ@scaled at Rlen/2}
+ \fi
+ % check if it's european
+ \edef\pgf at temp{european}
+ \ifx\pgf at circ@temp\pgf at temp
+ \pgfmathsetlength\pgf at x{-\stretto*\pgf at xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf at circ@scaled at Rlen/2}
+ \fi
+ \pgfmathsetlength\pgf at y{0.5*\pgf at circ@scaled at Rlen}
+ }
+ \savedanchor{\outerdot}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at xa=.5\pgf at circ@scaled at Rlen
+ \pgf at xa=-\ctikzvalof{quadpoles/#1/width}\pgf at xa
+ % by default use the cute inductor size
+ \pgfmathsetlength\pgf at x{-\stretto*\pgf at xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf at circ@scaled at Rlen/2}
+ % check if it's american
+ \edef\pgf at circ@temp{\ctikzvalof{inductor}}
+ \edef\pgf at temp{american}
+ \ifx\pgf at circ@temp\pgf at temp
+ \pgfmathsetlength\pgf at x{-\stretto*\pgf at xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf at circ@scaled at Rlen/2}
+ \fi
+ % check if it's european
+ \edef\pgf at temp{european}
+ \ifx\pgf at circ@temp\pgf at temp
+ \pgfmathsetlength\pgf at x{-\stretto*\pgf at xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf at circ@scaled at Rlen/2}
+ \fi
+ \pgfmathsetlength\pgf at y{0.5*\pgf at circ@scaled at Rlen}
+ }
+ \anchor{A2}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{B1}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{A1}{
+ \northwest
+ }
+ \anchor{B2}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ %% dot's anchors
+ \anchor{inner dot A1}{\innerdot\pgf at x=-\pgf at x}
+ \anchor{outer dot A1}{\outerdot\pgf at x=-\pgf at x}
+ \anchor{inner dot A2}{\innerdot\pgf at x=-\pgf at x\pgf at y=-\pgf at y}
+ \anchor{outer dot A2}{\outerdot\pgf at x=-\pgf at x\pgf at y=-\pgf at y}
+ \anchor{inner dot B1}{\innerdot}
+ \anchor{outer dot B1}{\outerdot}
+ \anchor{inner dot B2}{\innerdot\pgf at y=-\pgf at y}
+ \anchor{outer dot B2}{\outerdot\pgf at y=-\pgf at y}
+ % geographical
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \anchor{base}{
+ \northwest
+ \pgf at x=0pt
+ }
+ #3
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ #2
+ }
+ }
+}
+
+
+\def\pgf at circ@drawtransformerbasicanchor{
+ \ctikzvalof{quadpoles/trans/height}
+ \anchor{AA2}{
+ \northwest
+ \pgf at x=\ctikzvalof{quadpoles/transformer/width1}\pgf at x
+ \pgf at x=.7\pgf at x
+ \pgf at y=-\pgf at y
+ \pgf at y=\ctikzvalof{quadpoles/transformer/height1}\pgf at y
+ }
+ \anchor{BB1}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at x=\ctikzvalof{quadpoles/transformer/width1}\pgf at x
+ \pgf at x=.7\pgf at x
+ \pgf at y=\ctikzvalof{quadpoles/transformer/height1}\pgf at y
+ }
+ \anchor{AA1}{
+ \northwest
+ \pgf at x=\ctikzvalof{quadpoles/transformer/width1}\pgf at x
+ \pgf at x=.7\pgf at x
+ \pgf at y=\ctikzvalof{quadpoles/transformer/height1}\pgf at y
+ }
+ \anchor{BB2}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at x=\ctikzvalof{quadpoles/transformer/width1}\pgf at x
+ \pgf at x=.7\pgf at x
+ \pgf at y=-\pgf at y
+ \pgf at y=\ctikzvalof{quadpoles/transformer/height1}\pgf at y
+ }
+}
+
+%% Null styles that can be used to change individually the L1 and L2
+%% inductors of the transformer.
+
+\ctikzset{transformer L1/.style={}}
+\ctikzset{transformer L2/.style={}}
+
+\def\pgf at circ@drawtransformerbasicbody{
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgftransformlineattime{.5}{%
+ \pgfpoint%
+ {\stretto\pgf at circ@res at left}%
+ {\pgf at circ@res at up}%
+ }{%
+ \pgfpoint
+ {\stretto\pgf at circ@res at left}%
+ {\pgf at circ@res at down}%
+ }
+
+ \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
+ \edef\pgf at circ@temp{\ctikzvalof{inductor}}%
+ \def\pgf at temp{european}%
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
+ \else%
+ \def\pgf at temp{cute}
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
+ \else%
+ \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
+ \fi%
+ \fi%
+
+
+ \endpgfscope
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgftransformlineattime{.5}{%
+ \pgfpoint%
+ {\stretto\pgf at circ@res at right}%
+ {\pgf at circ@res at down}%
+ }{%
+ \pgfpoint
+ {\stretto\pgf at circ@res at right}%
+ {\pgf at circ@res at up}%
+ }
+
+ \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
+ \edef\pgf at circ@temp{\ctikzvalof{inductor}}%
+ \def\pgf at temp{european}%
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
+ \else%
+ \def\pgf at temp{cute}
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
+ \else%
+ \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
+ \fi%
+ \fi%
+
+ \endpgfscope
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
+
+ \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
+
+ \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+
+ \pgfusepath{draw}
+
+}
+
+
+\pgfcircdeclarequadpole{transformer}{
+ \pgf at circ@drawtransformerbasicbody
+}{\pgf at circ@drawtransformerbasicanchor}
+
+\pgfcircdeclarequadpole{transformer core}{
+
+ \pgf at circ@drawtransformerbasicbody
+
+ % use the chocke line thickness
+ \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
+
+ % Find the distance from center for the lines representing the core
+ % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
+ % of the whole component, now as a fraction of the distance between coils, to be
+ % compatible with the quadpoles "inner" style.
+ \pgfmathsetlength{\pgf at circ@res at other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf at circ@res at right}
+
+ \pgfmoveto{\pgfpoint%
+ {\pgf at circ@res at other}%
+ {\ctikzvalof{quadpoles/transformer core/core height}\pgf at circ@res at down}%
+ }
+ \pgflineto{
+ \pgfpoint%
+ {\pgf at circ@res at other}%
+ {\ctikzvalof{quadpoles/transformer core/core height}\pgf at circ@res at up}%
+ }
+
+ %% this should be just -\pgf at circ@res at other, but in case someone define an asymmetric trafo someday...
+ \pgfmathsetlength{\pgf at circ@res at other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf at circ@res at left}
+ \pgfmoveto{\pgfpoint%
+ {\pgf at circ@res at other}%
+ {\ctikzvalof{quadpoles/transformer core/core height}\pgf at circ@res at down}%
+ }
+ \pgflineto{
+ \pgfpoint%
+ {\pgf at circ@res at other}%
+ {\ctikzvalof{quadpoles/transformer core/core height}\pgf at circ@res at up}%
+ }
+
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ \pgfusepath{draw}
+}{\pgf at circ@drawtransformerbasicanchor}
+
+
+\pgfcircdeclarequadpole{gyrator}{
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+
+ \pgfusepath{draw}
+
+ \pgf at circ@setlinewidth{quadpoles}{\pgflinewidth}
+ \pgfmathsetlength{\pgf at circ@res at other}{min(.7*\stretto*\pgf at circ@res at up, .8*\pgf at circ@res at right)} % radius
+ \pgfpathmoveto{\pgfpoint{\stretto\pgf at circ@res at left}{-\pgf at circ@res at other}}
+ \pgfpatharc{-90}{90}{\pgf at circ@res at other}
+ \pgfpathclose
+ \pgf at circ@draworfill
+
+ \pgfpathmoveto{\pgfpoint{\stretto\pgf at circ@res at right}{\pgf at circ@res at other}}
+ \pgfpatharc{90}{270}{\pgf at circ@res at other}
+ \pgfpathclose
+ \pgf at circ@draworfill
+}{}
+
+%%%%%%%%%%%%%%%%%%%%
+%% Block elements
+%%%%%%%%%%%%%%%%%%%%
+
+\pgfdeclareshape{mixer}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \ifpgf at circuit@boxed
+ \pgf at y=\ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \else
+ \pgf at y=\ctikzvalof{tripoles/mixer/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/mixer/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \fi
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{left}{%
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{2}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{3}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{4}{
+ \northwest
+ \pgf at y=\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{in 1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in 2}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{in2}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{center}{
+ \pgf at y=0pt
+ \pgf at x=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \pgf at circ@res at step=\ctikzvalof{tripoles/mixer/width}\pgf at circ@scaled at Rlen
+
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+
+ % draw outer box
+ \ifpgf at circuit@boxed
+ \pgfnode{blockbox}{center}{}{pgf at box}{\pgfusepath{draw}}
+ \fi
+
+ % draw outer circle
+ \ifpgf at circuit@boxed
+ \pgf at circ@res at step=.7\pgf at circ@res at step
+ \pgfsetdash{}{0pt} % draw solid circle if boxed
+ \else
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \fi
+ \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf at circ@res at step}
+ \pgf at circ@draworfill
+
+ % draw inner stuff
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{adder}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \ifpgf at circuit@boxed
+ \pgf at y=\ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \else
+ \pgf at y=\ctikzvalof{tripoles/adder/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/adder/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \fi
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{left}{%
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{2}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{3}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{4}{
+ \northwest
+ \pgf at y=\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{in 1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{in 2}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{in2}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{out}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{center}{
+ \pgf at y=0pt
+ \pgf at x=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \pgf at circ@res at step=\ctikzvalof{tripoles/adder/width}\pgf at circ@scaled at Rlen
+
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+
+ % draw outer box
+ \ifpgf at circuit@boxed
+ \pgfnode{blockbox}{center}{}{pgf at box}{\pgfusepath{draw}}
+ \fi
+
+ % draw outer circle
+ \ifpgf at circuit@boxed
+ \pgf at circ@res at step=.7\pgf at circ@res at step{}
+ \pgfsetdash{}{0pt} % draw solid circle if boxed
+ \else
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \fi
+ \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf at circ@res at step}
+ \pgf at circ@draworfill
+
+ % draw inner stuff
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf at circ@res at step}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfusepath{draw}
+
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{oscillator}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \ifpgf at circuit@boxed
+ \pgf at y=\ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \else
+ \pgf at y=\ctikzvalof{tripoles/oscillator/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/oscillator/width}\pgf at circ@scaled at Rlen
+ \fi
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=.5\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0pt
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y}
+ \anchor{north east}{ \northwest \pgf at x=0pt\relax}
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{text}{
+ \pgf at x=-2\pgf at x
+ \advance \pgf at x by -.5\wd\pgfnodeparttextbox
+ \advance \pgf at y by -1.5\ht\pgfnodeparttextbox
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \pgf at circ@res at step=\ctikzvalof{tripoles/oscillator/width}\pgf at circ@scaled at Rlen{}
+
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+
+ \pgftransformxshift{-0.5\pgf at circ@res at step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east"
+
+ % draw outer box
+ \ifpgf at circuit@boxed{}
+ \pgfnode{blockbox}{center}{}{pgf at box}{\pgfusepath{draw}}
+ \fi
+
+ % draw outer circle
+ \ifpgf at circuit@boxed
+ \pgf at circ@res at step=.7\pgf at circ@res at step{}
+ \pgfsetdash{}{0pt} % draw solid circle if boxed
+ \else
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \fi
+ \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf at circ@res at step}
+ \pgf at circ@draworfill
+
+ % draw inner sine waves
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
+ \pgfpathmoveto{\pgfpoint{-0.3\pgf at circ@res at step}{0\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.15\pgf at circ@res at step}{.15\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.15\pgf at circ@res at step}{-.15\pgf at circ@res at step}}
+ \pgfpathsine{\pgfpoint{.15\pgf at circ@res at step}{-.15\pgf at circ@res at step}}
+ \pgfpathcosine{\pgfpoint{.15\pgf at circ@res at step}{.15\pgf at circ@res at step}}
+
+ \pgfusepath{draw}
+
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{circulator}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \ifpgf at circuit@boxed
+ \pgf at y=\ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \else
+ \pgf at y=\ctikzvalof{tripoles/circulator/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{tripoles/circulator/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \fi
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{left}{%
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{1}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{2}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{3}{
+ \northwest
+ \pgf at y=-\pgf at y
+ \pgf at x=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \pgf at circ@res at step=\ctikzvalof{tripoles/circulator/width}\pgf at circ@scaled at Rlen
+
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+
+ % draw outer box
+ \ifpgf at circuit@boxed
+ \pgfnode{blockbox}{center}{}{pgf at box}{\pgfusepath{draw}}
+ \fi
+
+ % draw outer circle
+ \ifpgf at circuit@boxed{}
+ \pgf at circ@res at step=.7\pgf at circ@res at step{}
+ \pgfsetdash{}{0pt} % draw solid circle if boxed
+ \else
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \fi
+ \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf at circ@res at step}
+ \pgf at circ@draworfill
+
+ % inner arrow
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ \pgfsetarrowsend{latex}
+ \pgfpathmoveto{\pgfpoint{-0.25\pgf at circ@res at step}{0}}
+ \pgfpatharc{180}{-90} {0.25\pgf at circ@res at step}
+ \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \endpgfscope
+ }
+}
+
+%% gridnode
+\pgfdeclareshape{gridnode}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{quadpoles/gridnode/width}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\ctikzvalof{quadpoles/gridnode/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{up}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{down}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{right}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{left}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \relax
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \anchor{text}{
+ \pgf at x=-2\pgf at x
+ \advance \pgf at x by -.5\wd\pgfnodeparttextbox
+ \advance \pgf at y by -1.5\ht\pgfnodeparttextbox
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \pgf at circ@res at step=\ctikzvalof{quadpoles/gridnode/width}\pgf at circ@scaled at Rlen
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgf at circ@res at step = \ctikzvalof{quadpoles/gridnode/width}\pgf at circ@scaled at Rlen
+ \divide \pgf at circ@res at step by 2
+
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at zero}}
+ \pgf at circ@res at other = \pgf at circ@res at left
+ \advance\pgf at circ@res at other by \pgf at circ@res at step
+
+ \ifpgf at circuit@dashed
+ \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
+ \fi
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+
+ \ifpgf at circuit@inputarrow
+ {
+ \advance \pgf at circ@res at left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{inputarrow}{tip}{}{pgf at inputarrow}{\pgfusepath{fill}}
+ }
+ \fi
+
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{0.05mm}
+
+ % draw grid
+ \foreach \line in {-1,-.5,...,1}
+ {
+ \pgfpathmoveto{\pgfpoint{\line\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\line\pgf at circ@res at up}}
+
+ \pgfpathmoveto{\pgfpoint{\line\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\line\pgf at circ@res at down}}
+ }
+
+ %prevent from draw the inner cross twice
+ \foreach \line in {-.5,0,...,.5}
+ {
+ \pgfpathmoveto{\pgfpoint{\line\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\line\pgf at circ@res at up}}
+
+ \pgfpathmoveto{\pgfpoint{\line\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\line\pgf at circ@res at down}}
+ }
+ \pgfusepath{draw}
+ }
+}
+
+
+% Wilkinson divider
+\pgfdeclareshape{wilkinson}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{tripoles/wilkinson/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x= \pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at x=-\ctikzvalof{tripoles/wilkinson/width}\pgf at x
+ }
+ \anchor{center}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=0pt
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \anchor{in}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{out1}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-0.5\pgf at y
+ }
+ \anchor{out2}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=0.5\pgf at y
+ }
+ \anchor{text}{
+ \northwest
+ \advance \pgf at y by 0.5\ht\pgfnodeparttextbox
+ \pgf at x=-.5\wd\pgfnodeparttextbox
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+
+ \pgfstartlinewidth=\pgflinewidth
+
+ % draw outer box
+ \pgf at circ@twoportbox
+
+ % draw inner stuff
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ \pgfsetarrows{-} %never draw arrows
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at left}{0pt}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at right}{0.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at right}{0.5\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0.5\pgf at circ@res at down}}
+
+ \pgfusepath{draw}
+
+ \pgfsetdash{}{0pt} % always draw solid line for inner symbol
+ % draw inner resisitor - european or american style is recognised
+ {
+ \pgftransformshift{\pgfpoint{0.5\pgf at circ@res at right}{0pt}}
+ \pgftransformrotate{90}
+
+ % calculate size of resistor
+ \ifpgf at circuit@europeanresistor
+ \pgfmathparse{\pgf at circ@res at up / \pgf at circ@scaled at Rlen / \ctikzvalof{bipoles/generic/width} / 2}
+ \pgftransformscale{\pgfmathresult}
+ \pgfnode{genericshape}{center}{}{wilk at int@R}{\pgfusepath{fill}}
+ \else
+ \pgfmathparse{\pgf at circ@res at up / \pgf at circ@scaled at Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
+ \pgftransformscale{\pgfmathresult}
+ \pgfnode{resistorshape}{center}{}{wilk at int@R}{\pgfusepath{fill}}
+ \fi
+ }
+
+ \pgfpathmoveto{\pgfpoint{0.5\pgf at circ@res at right}{0.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpointanchor{wilk at int@R}{right}}
+
+ \pgfpathmoveto{\pgfpointanchor{wilk at int@R}{left}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at right}{0.5\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ }
+}
+
+%% couplers generics
+\long\def\pgfcircdeclarefourport#1#2{
+
+ \pgfdeclareshape{#1}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=0pt
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at y=\ctikzvalof{quadpoles/#1/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=.5\pgf at circ@scaled at Rlen
+ \pgf at x=-\ctikzvalof{quadpoles/#1/width}\pgf at x
+ }
+ \anchor{north}{
+ \northwest
+ \pgf at x=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf at x=0pt
+ \pgf at y=-\pgf at y
+ }
+ \anchor{west}{
+ \northwest
+ \pgf at y=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-\pgf at x
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf at y=-\pgf at y
+ }
+ \anchor{north east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ }
+ \anchor{north west}{
+ \northwest
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-\pgf at y
+ }
+ \anchor{port1}{
+ \northwest
+ \pgf at y=-0.5\pgf at y
+ }
+ \anchor{port2}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-0.5\pgf at y
+ }
+ \anchor{port3}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=0.5\pgf at y
+ }
+ \anchor{port4}{
+ \northwest
+ \pgf at y=0.5\pgf at y
+ }
+ \anchor{1}{
+ \northwest
+ \pgf at y=-0.5\pgf at y
+ }
+ \anchor{2}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=-0.5\pgf at y
+ }
+ \anchor{3}{
+ \northwest
+ \pgf at x=-\pgf at x
+ \pgf at y=0.5\pgf at y
+ }
+ \anchor{4}{
+ \northwest
+ \pgf at y=0.5\pgf at y
+ }
+
+ \anchor{text}{
+ \northwest
+ \advance \pgf at y by 0.5\ht\pgfnodeparttextbox
+ \pgf at x=-.5\wd\pgfnodeparttextbox
+ }
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+
+ \pgfstartlinewidth=\pgflinewidth
+
+ % draw outer box
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@draworfill
+
+ % draw inner stuff
+ #2
+
+ % draw inner text
+ \pgftext[center,x=-0.15\pgf at circ@res at step,y=0]{\ctikzvalof{bipoles/twoport/text}}
+ }
+ }
+}
+
+% four-port
+\pgfcircdeclarefourport{fourport}{}
+
+% straight coupler
+\pgfcircdeclarefourport{coupler}{
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0.5\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0.5\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0.5\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{0.7\pgf at circ@res at left}{0.4\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at right}{0.4\pgf at circ@res at up}}
+ \pgfsetarrows{latex-latex}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.7\pgf at circ@res at left}{0.4\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf at circ@res at right}{0.4\pgf at circ@res at down}}
+ \pgfsetarrows{latex-latex}
+ \pgfusepath{draw}
+}
+
+% "bended" coupler
+\pgfcircdeclarefourport{coupler2}{
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0.5\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0.5\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0.5\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0.5\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{0.1\pgf at circ@res at left}{0pt}}
+ \pgfpatharc{0}{90} {0.4\pgf at circ@res at up}
+ \pgfsetarrowsend{latex}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{0.1\pgf at circ@res at left}{0pt}}
+ \pgfpatharc{0}{-90} {0.4\pgf at circ@res at up}
+ \pgfsetarrowsend{latex}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{0.1\pgf at circ@res at right}{0pt}}
+ \pgfpatharc{180}{90} {0.4\pgf at circ@res at up}
+ \pgfsetarrowsend{latex}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{0.1\pgf at circ@res at right}{0pt}}
+ \pgfpatharc{-180}{-90} {0.4\pgf at circ@res at up}
+ \pgfsetarrowsend{latex}
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+%%%---------- close: tex/pgfcircquadpoles
+%%%%%%%%%%% Springe nach tex/pgfcircmultipoles
+%%%---------- open: tex/pgfcircmultipoles.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Multipoles by Romano Giannetti
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%
+%% Chips
+%%%%%%%%%
+
+% let's use the same shifts everywhere, no magic numbers
+\def\pgf at circ@dip at pin@shift{0.5}
+\def\pgf at circ@qfp at pin@shift{0.25}
+
+% derived from https://tex.stackexchange.com/a/146753/38080
+% original author Mark Wibrow
+% Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
+% a lot of thanks to @marmot for the un-rotation hint
+% https://tex.stackexchange.com/a/473571/38080
+
+% DIP (dual in line package) chips
+
+\pgfdeclareshape{dipchip}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedmacro\numpins{%
+ \pgf at circ@count at a=\ctikzvalof{multipoles/dipchip/num pins}%
+ \def\numpins{\the\pgf at circ@count at a}
+ }
+ \savedanchor\centerpoint{%
+ \pgf at x=-.5\wd\pgfnodeparttextbox%
+ \pgf at y=-.5\ht\pgfnodeparttextbox%
+ \advance\pgf at y by+.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\origin{\pgfpoint{0pt}{0pt}}
+ \anchor{center}{\origin}
+ \anchor{text}{\centerpoint}% to adjust text
+ \saveddimen\height{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{((\numpins)
+ *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf at circ@scaled at Rlen/2}%
+ }%
+ \saveddimen{\chipspacing}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
+ \saveddimen{\width}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/dipchip/width}}}
+ \saveddimen{\extshift}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/external pins width}}}
+ % standard anchors
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at y{0.5*((\numpins)
+ *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf at circ@scaled at Rlen/2}%
+ \pgfmathsetlength\pgf at x{-0.5*\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/dipchip/width}}
+ }
+ \anchor{dot}{\northwest
+ \pgfmathsetlength\pgf at x{\pgf at x + 0.3*\chipspacing}
+ \pgfmathsetlength\pgf at y{\pgf at y - 0.3*\chipspacing}
+ }
+ \anchor{nw}{\northwest}
+ \anchor{ne}{\northwest\pgf at x=-\pgf at x}
+ \anchor{se}{\northwest\pgf at x=-\pgf at x\pgf at y=-\pgf at y}
+ \anchor{sw}{\northwest\pgf at y=-\pgf at y}
+ \anchor{north west}{\northwest}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{south east}{\northwest\pgf at x=-\pgf at x \pgf at y=-\pgf at y}
+ \anchor{south west}{\northwest\pgf at y=-\pgf at y}
+ \anchor{n}{\northwest\pgf at x=0pt }
+ \anchor{e}{\northwest\pgf at x=-\pgf at x\pgf at y=0pt }
+ \anchor{s}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{w}{\northwest\pgf at y=0pt }
+ \anchor{north}{\northwest\pgf at x=0pt }
+ \anchor{east}{\northwest\pgf at x=-\pgf at x\pgf at y=0pt }
+ \anchor{south}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{west}{\northwest\pgf at y=0pt }
+ % start drawing
+ \backgroundpath{%
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at other = \ctikzvalof{multipoles/external pins width}\pgf at circ@scaled at Rlen
+ \pgfscope% (for the line width)
+ \pgf at circ@setlinewidth{multipoles}{\pgflinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
+ \pgf at circ@draworfill
+ %% upside mark
+ \ifpgf at circuit@chip at topmark
+ \pgfpathmoveto{\pgfpoint{0.2*\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpatharc{0}{180}{0.2*\pgf at circ@res at left}
+ \fi
+ \pgfusepath{stroke}%
+ \pgfsetcolor{\ctikzvalof{color}}
+ % Adding the pin number
+ \ifpgf at circuit@chip at shownumbers
+ \pgf at circ@count at a=\numpins\relax
+ \divide\pgf at circ@count at a by 2 \pgf at circ@count at b=\pgf at circ@count at a
+ % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
+ \ifpgf at circuit@chip at straightnumbers
+ \pgfgettransformentries\a\b\temp\temp\temp\temp
+ \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
+ \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
+ \else
+ \pgfmathsetmacro{\rot}{0}
+ \pgfmathsetmacro{\quadrant}{0}
+ \fi
+ \def\pgf at circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
+ \def\mytext{\ctikzvalof{multipoles/font}\space\pgf at circ@strut\the\pgf at circ@count at c\space}
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ \ifcase\quadrant % rotation 0
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgftext[left,
+ at=\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgftext[right,
+ at=\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ \or % rotation -90
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgftext[top,
+ at=\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgftext[bottom,
+ at=\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ \or %rotation 180
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgftext[right,
+ at=\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgftext[left,
+ at=\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ \or % rotation +90
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgftext[bottom,
+ at=\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgftext[top,
+ at=\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ \fi
+ \advance\pgf at circ@count at a-1\relax%
+ \repeatpgfmathloop
+ \fi
+ \endpgfscope
+ \ifdim\pgf at circ@res at other>0pt
+ \pgfscope
+ \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
+ \pgf at circ@count at a=\numpins\relax
+ \divide\pgf at circ@count at a by 2 \pgf at circ@count at b=\pgf at circ@count at a
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
+ \ifnum\padfrac>0
+ \pgf at circ@res at temp=\pgf at circ@res at step\divide\pgf at circ@res at temp by \padfrac
+ % left side pads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgf at circ@res at other}{\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgf at circ@res at other}{-\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ % right side pads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at other}{\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at other}{-\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \else
+ % left side pins
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgf at circ@res at other}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ % right side pins
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at other}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \fi
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop
+ \pgfusepath{stroke}
+ \endpgfscope
+ \fi
+ }%
+ % \pgf at sh@s@<name of the shape here> contains all the code for the shape
+ % and is executed just before a node is drawn.
+ \pgfutil at g@addto at macro\pgf at sh@s at dipchip{%
+ % Start with the maximum pin number and go backwards.
+ \pgf at circ@count at a=\numpins\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@dipchip at pin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@dippinanchor{\the\pgf at circ@count at a}{1}%
+ }
+ \expandafter\xdef\csname pgf at anchor@dipchip at bpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@dippinanchor{\the\pgf at circ@count at a}{0}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ }%
+ }
+
+% QFP (quad flat package) chips
+
+\pgfdeclareshape{qfpchip}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedmacro\numpins{%
+ \pgf at circ@count at a=\ctikzvalof{multipoles/qfpchip/num pins}%
+ \def\numpins{\the\pgf at circ@count at a}
+ }
+ \savedanchor\centerpoint{%
+ \pgf at x=-.5\wd\pgfnodeparttextbox%
+ \pgf at y=-.5\ht\pgfnodeparttextbox%
+ \advance\pgf at y by+.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\origin{\pgfpoint{0pt}{0pt}}
+ \anchor{center}{\origin}
+ \anchor{text}{\centerpoint}% to adjust text
+ \saveddimen\height{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{((\numpins+2)
+ *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf at circ@scaled at Rlen/4}%
+ }%
+ \saveddimen\width{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{((\numpins+2)
+ *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf at circ@scaled at Rlen/4}%
+ }%
+ \saveddimen{\chipspacing}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
+ \saveddimen{\extshift}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/external pins width}}}
+ % standard anchors
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at y{0.5*((\numpins+2)
+ *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf at circ@scaled at Rlen/4}%
+ \pgf at x=-\pgf at y
+ }
+ \anchor{dot}{\northwest
+ \pgfmathsetlength\pgf at x{\pgf at x + 0.3*\chipspacing}
+ \pgfmathsetlength\pgf at y{\pgf at y - 0.3*\chipspacing}
+ }
+ \anchor{nw}{\northwest}
+ \anchor{ne}{\northwest\pgf at x=-\pgf at x}
+ \anchor{se}{\northwest\pgf at x=-\pgf at x\pgf at y=-\pgf at y}
+ \anchor{sw}{\northwest\pgf at y=-\pgf at y}
+ \anchor{north west}{\northwest}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{south east}{\northwest\pgf at x=-\pgf at x \pgf at y=-\pgf at y}
+ \anchor{south west}{\northwest\pgf at y=-\pgf at y}
+ \anchor{n}{\northwest\pgf at x=0pt }
+ \anchor{e}{\northwest\pgf at x=-\pgf at x\pgf at y=0pt }
+ \anchor{s}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{w}{\northwest\pgf at y=0pt }
+ \anchor{north}{\northwest\pgf at x=0pt }
+ \anchor{east}{\northwest\pgf at x=-\pgf at x\pgf at y=0pt }
+ \anchor{south}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{west}{\northwest\pgf at y=0pt }
+ % start drawing
+ \backgroundpath{%
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at other = \ctikzvalof{multipoles/external pins width}\pgf at circ@scaled at Rlen
+ \pgfscope% (for the line width)
+ \pgf at circ@setlinewidth{multipoles}{\pgflinewidth}
+ %% upside mark
+ \ifpgf at circuit@chip at topmark
+ \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf at circ@res at step/2}}
+ \pgfpathlineto{\pgfpoint{-\width/2+\pgf at circ@res at step/2}{\height/2}}
+ \else
+ \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
+ \fi
+ %% rest of the shape
+ \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
+ \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
+ \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ % Adding the pin number
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifpgf at circuit@chip at shownumbers
+ \pgf at circ@count at a=\numpins%
+ \divide\pgf at circ@count at a by 4 \pgf at circ@count at b=\pgf at circ@count at a
+ % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
+ \ifpgf at circuit@chip at straightnumbers
+ \pgfgettransformentries\a\b\temp\temp\temp\temp
+ \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
+ \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
+ \else
+ \pgfmathsetmacro{\rot}{0}
+ \pgfmathsetmacro{\quadrant}{0}
+ \fi
+ \def\pgf at circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
+ \def\mytext{\ctikzvalof{multipoles/font}\space\pgf at circ@strut\the\pgf at circ@count at c\space}
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ \ifcase\quadrant % rotation 0
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgftext[left,
+ at=\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % bottom
+ \pgf at circ@count at c=\numexpr\pgf at circ@count at b+\pgf at circ@count at a\relax
+ \pgftext[bottom,
+ at=\pgfpoint{\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr3*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgftext[right,
+ at=\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % top
+ \pgf at circ@count at c=\numexpr3*\pgf at circ@count at b+\pgf at circ@count at a\relax
+ \pgftext[top,
+ at=\pgfpoint{\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up},
+ rotate=\rot]{\mytext}
+ \or % rotation -90
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgftext[top,
+ at=\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % bottom
+ \pgf at circ@count at c=\numexpr\pgf at circ@count at b+\pgf at circ@count at a\relax
+ \pgftext[left,
+ at=\pgfpoint{\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr3*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgftext[bottom,
+ at=\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % top
+ \pgf at circ@count at c=\numexpr3*\pgf at circ@count at b+\pgf at circ@count at a\relax
+ \pgftext[right,
+ at=\pgfpoint{\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up},
+ rotate=\rot]{\mytext}
+ \or %rotation 180
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgftext[right,
+ at=\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % bottom
+ \pgf at circ@count at c=\numexpr\pgf at circ@count at b+\pgf at circ@count at a\relax
+ \pgftext[top,
+ at=\pgfpoint{\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr3*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgftext[left,
+ at=\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % top
+ \pgf at circ@count at c=\numexpr3*\pgf at circ@count at b+\pgf at circ@count at a\relax
+ \pgftext[bottom,
+ at=\pgfpoint{\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up},
+ rotate=\rot]{\mytext}
+ \or % rotation +90
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgftext[bottom,
+ at=\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % bottom
+ \pgf at circ@count at c=\numexpr\pgf at circ@count at b+\pgf at circ@count at a\relax
+ \pgftext[right,
+ at=\pgfpoint{\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr3*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgftext[top,
+ at=\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % top
+ \pgf at circ@count at c=\numexpr3*\pgf at circ@count at b+\pgf at circ@count at a\relax
+ \pgftext[left,
+ at=\pgfpoint{\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up},
+ rotate=\rot]{\mytext}
+ \fi
+ \advance\pgf at circ@count at a-1\relax%
+ \repeatpgfmathloop
+ \fi
+ \endpgfscope
+ \ifdim\pgf at circ@res at other>0pt
+ \pgfscope
+ \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
+ \pgf at circ@count at a=\numpins%
+ \divide\pgf at circ@count at a by 4 \pgf at circ@count at b=\pgf at circ@count at a
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
+ \ifnum\padfrac>0
+ \pgf at circ@res at temp=\pgf at circ@res at step\divide\pgf at circ@res at temp by \padfrac
+ % left side pads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgf at circ@res at other}{\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgf at circ@res at other}{-\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ % bottom side pads
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at temp+\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at temp+\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down-\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down-\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down}}
+ % right side pads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at other}{\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at other}{-\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-\pgf at circ@res at temp+\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ % top side pads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at temp+\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up+\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at temp+\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up+\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at temp+\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \else
+ % left side pins
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgf at circ@res at other}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ % bottom side pins
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at down-\pgf at circ@res at other}}
+ % right side pins
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at other}{\pgf at circ@res at up+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ % top side pins
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+(\pgf at circ@qfp at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}{\pgf at circ@res at up+\pgf at circ@res at other}}
+ \fi
+ \advance\pgf at circ@count at a-1\relax%
+ \repeatpgfmathloop
+ \pgfusepath{stroke}
+ \endpgfscope
+ \fi
+ }%
+ % \pgf at sh@s@<name of the shape here> contains all the code for the shape
+ % and is executed just before a node is drawn.
+ \pgfutil at g@addto at macro\pgf at sh@s at qfpchip{%
+ % Start with the maximum pin number and go backwards.
+ \pgf at circ@count at a=\numpins%
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ \expandafter\xdef\csname pgf at anchor@qfpchip at pin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@qfppinanchor{\the\pgf at circ@count at a}{1}%
+ }
+ \expandafter\xdef\csname pgf at anchor@qfpchip at bpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@qfppinanchor{\the\pgf at circ@count at a}{0}%
+ }
+ \advance\pgf at circ@count at a-1\relax%
+ \repeatpgfmathloop%
+ }%
+ }
+
+%% anchors for DIP
+\def\pgf at circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
+ \c at pgf@countc=\numpins\relax
+ \divide\c at pgf@countc by 2
+ \ifnum #1 > \the\c at pgf@countc
+ % right side
+ \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf at circ@dip at pin@shift-\c at pgf@countc+#1-1)*\chipspacing}
+ \else
+ \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf at circ@dip at pin@shift-#1)*\chipspacing}
+\fi
+}
+
+%% anchors for QFP
+\def\pgf at circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
+ \c at pgf@countc=\numpins\relax
+ \divide\c at pgf@countc by 4
+ \ifnum #1 > \the\c at pgf@countc
+ \c at pgf@countb=\c at pgf@countc \multiply \c at pgf@countb by 2
+ \ifnum #1 > \the\c at pgf@countb
+ \c at pgf@countb=\c at pgf@countc \multiply \c at pgf@countb by 3
+ \ifnum #1 > \the\c at pgf@countb
+ % 3*npins/4 < pin, top side
+ \pgfpoint{\width/2+(\pgf at circ@qfp at pin@shift+\c at pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
+ \else
+ % 2*npins/4 < pin <= 3*npins/4, right side
+ \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf at circ@qfp at pin@shift-\c at pgf@countb+#1-1)*\chipspacing}%
+ \fi
+ \else
+ % npins/4 < pin <= 2*npins/4, bottom side
+ \pgfpoint{\width/2+(\pgf at circ@qfp at pin@shift-\c at pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
+ \fi
+ \else
+ % <= npins/4, left side
+ \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf at circ@qfp at pin@shift-#1)*\chipspacing}%
+ \fi
+}
+
+%%%%%%%%%%%%%%%%%
+%% Rotary Switch
+%%%%%%%%%%%%%%%%%
+
+\pgfdeclareshape{rotaryswitch}
+{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor\northeast{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
+ % the magic number is 0.25/cos(35)
+ % try to recalculate it for the actual switch
+ \pgf at circ@res at temp=\ctikzvalof{tripoles/spdt/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at temp=.3052\pgf at circ@res at temp
+ \edef\a{\ctikzvalof{multipoles/rotary/angle}}
+ \edef\r{\ctikzvalof{nodes width}}
+ \pgfmathsetlength{\pgf at y}{\r*\pgf at circ@scaled at Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf at circ@res at temp}
+ \pgfmathsetlength{\pgf at x}{\r*\pgf at circ@scaled at Rlen + \pgf at circ@res at temp}
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
+ % the magic number is 0.25/cos(35)
+ % try to recalculate it for the actual switch
+ \pgf at circ@res at temp=\ctikzvalof{tripoles/spdt/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at temp=.3052\pgf at circ@res at temp
+ \edef\a{\ctikzvalof{multipoles/rotary/angle}}
+ \edef\r{\ctikzvalof{nodes width}}
+ \pgfmathsetlength{\pgf at y}{\r*\pgf at circ@scaled at Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf at circ@res at temp}
+ \pgfmathsetlength{\pgf at x}{-\r*\pgf at circ@scaled at Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf at circ@res at temp}
+ }
+ \savedanchor\central{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
+ % the magic number is 0.25/cos(35)
+ % try to recalculate it for the actual switch
+ \pgf at circ@res at temp=\ctikzvalof{tripoles/spdt/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at temp=.3052\pgf at circ@res at temp
+ \edef\a{\ctikzvalof{multipoles/rotary/angle}}
+ \edef\r{\ctikzvalof{nodes width}}
+ \pgfmathsetlength{\pgf at y}{\r*\pgf at circ@scaled at Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf at circ@res at temp}
+ \pgfmathsetlength{\pgf at x}{(\a<90 ? 0 : cos(\a))*\pgf at circ@res at temp}
+ }
+ % external square limits
+ \savedanchor\extnorthwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=-\ctikzvalof{tripoles/spdt/width}\pgf at circ@scaled at Rlen
+ % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
+ \pgf at x=.3052\pgf at x % the magic number is 0.25/cos(35)
+ \pgf at x=2.5\pgf at x % external square size
+ \pgf at y=-\pgf at x %square thing when angle=180?
+ }
+ \saveddimen{\width}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{0.3052*\pgf at circ@scaled at Rlen*\ctikzvalof{tripoles/spdt/width}}}
+ % radius of the connector
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ \saveddimen{\radius}{\pgfmathsetlength\pgf at x{\pgf at circ@Rlen*\ctikzvalof{nodes width}}}
+ % shapename
+ \savedmacro{\thisshape}{\def\thisshape{\tikz at fig@name}}
+ % shape type
+ \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
+ \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
+ \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
+ \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
+ \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
+ % mid of the lever, to stack switches
+ %\anchor{mid}{\midlever}
+ \anchor{mid}{\northwest
+ \pgf at circ@res at temp=-\pgf at x
+ \pgfmathsetlength{\pgf at x}{\pgf at circ@res at temp*(-1+cos(\wiper))}
+ \pgfmathsetlength{\pgf at y}{\pgf at circ@res at temp*sin(\wiper)}
+ }
+ % center anchors
+ \anchor{cin}{ \northwest \pgf at y=0pt\advance\pgf at x by \radius}
+ % horizontal angles
+ \anchor{in}{ \northwest \pgf at y=0pt}
+ \anchor{ain}{ \northwest \pgf at y=0pt}
+
+ \anchor{center}{ \central \pgf at y=0pt }
+ \anchor{east}{ \northeast \pgf at y=0pt }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \central \pgf at y=-\pgf at y }
+ \anchor{north}{ \central }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northeast }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northeast \pgf at y=-\pgf at y }
+
+ \anchor{ext center}{ \pgf at y=0pt \pgf at x=0pt \advance\pgf at x by -\width}
+ \anchor{ext east}{ \extnorthwest \pgf at y=0pt \pgf at x=-\pgf at x \advance\pgf at x by -\width}
+ \anchor{ext west}{ \extnorthwest \pgf at y=0pt \advance\pgf at x by -\width}
+ \anchor{ext south}{ \extnorthwest \pgf at x=0pt \pgf at y=-\pgf at y \advance\pgf at x by -\width}
+ \anchor{ext north}{ \extnorthwest \pgf at x=0pt \advance\pgf at x by -\width}
+ \anchor{ext south west}{ \extnorthwest \pgf at y=-\pgf at y \advance\pgf at x by -\width}
+ \anchor{ext north east}{ \extnorthwest \pgf at x=-\pgf at x \advance\pgf at x by -\width}
+ \anchor{ext north west}{ \extnorthwest \advance\pgf at x by -\width}
+ \anchor{ext south east}{ \extnorthwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y \advance\pgf at x by -\width}
+
+ \backgroundpath{
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@res at right = \width
+ \pgf at circ@res at left = -\width
+
+ \pgfscope %wiper
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ \pgf at circ@res at temp=\radius\relax
+ \pgf at circ@res at temp=\ctikzvalof{multipoles/rotary/thickness}\pgf at circ@res at temp
+ \pgfsetlinewidth{2\pgf at circ@res at temp}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf at circ@res at left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf at circ@res at right}}}
+ \pgfsetroundcap\pgfusepath{draw}
+ \endpgfscope
+
+ \ifpgf at circ@rotaryarrow
+ \pgfscope % arrow
+ \ifpgf at circ@rotaryarrow at ccw\pgfsetarrowsstart{latexslim}\fi
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}} % center of cin node
+ \pgftransformrotate{\wiper}
+ \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf at circ@res at right}}
+ \pgfpatharc{50}{-50}{1.0\pgf at circ@res at right}
+ \ifpgf at circ@rotaryarrow at cw\pgfsetarrowsend{latexslim}\fi
+ \pgfusepath{draw}
+ \endpgfscope
+ \fi
+
+ % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
+ \pgf at circ@count at a=\channels\relax
+ \pgfmathsetmacro{\currenta}{-\angle}
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % \typeout{LOOPIN\space\space\the\pgf at circ@count at a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf at circ@res at right}
+ \pgfscope
+ \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf at circ@res at left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf at circ@res at right}}}
+ \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf at circ@count at a}{\pgfusepath{stroke}}
+ \endpgfscope
+ \pgfmathsetmacro{\currenta}{\currenta+\stepa}
+ % \typeout{LOOPOUT\space\the\pgf at circ@count at a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf at circ@res at right}
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop
+
+ \pgfscope % input
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
+ \endpgfscope
+ }
+ % \pgf at sh@s@<name of the shape here> contains all the code for the shape
+ % and is executed just before a node is drawn.
+ \pgfutil at g@addto at macro\pgf at sh@s at rotaryswitch{%
+ % Start with the maximum pin number and go backwards.
+ \pgf at circ@count at a=\channels\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@rotaryswitch at out\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@rotaryanchor{\the\pgf at circ@count at a}{1}{0}%
+ }
+ \expandafter\xdef\csname pgf at anchor@rotaryswitch at cout\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@rotaryanchor{\the\pgf at circ@count at a}{0}{0}%
+ }
+ \expandafter\xdef\csname pgf at anchor@rotaryswitch at aout\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@rotaryanchor{\the\pgf at circ@count at a}{0}{1}%
+ }
+ \expandafter\xdef\csname pgf at anchor@rotaryswitch at sqout\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@rotarysqanchor{\the\pgf at circ@count at a}{0}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ }%
+}
+
+\def\pgf at circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
+ \pgf at circ@res at temp=\width
+ \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
+ \pgfmathsetlength{\pgf at x}{2*(\pgf at circ@res at temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
+ \pgfmathsetlength{\pgf at y}{2*(\pgf at circ@res at temp+#3*\radius/2)*sin(\myangle)}
+ \advance\pgf at x by -\pgf at circ@res at temp
+}
+
+\def\pgf at circ@rotarysqanchor#1{% external square anchors
+ \pgf at circ@res at temp=\width
+ \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
+ \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf at circ@res at temp}{2.5\pgf at circ@res at temp}}
+ \advance\pgf at x by -\pgf at circ@res at temp
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Seven segments displays
+%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\pgfdeclareshape{bare7seg}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedmacro{\dotstatus}{\edef\dotstatus{\pgf at circ@sevenseg at dotstate}}
+ \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
+ \ifpgf at circ@sevenseg at dot
+ \pgfmathsetlength{\pgf at x}{\ctikzvalof{seven seg/thickness}}
+ \else
+ \pgf at x=0pt
+ \fi
+ }
+ % The object extension is more or less (-width/2,-width) to (width/2,width)
+ % and adjusted for line thickness (both sides) and eventually the dot
+ \saveddimen{\width}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at x}{\ctikzvalof{seven seg/width}*\pgf at circ@scaled at Rlen}}
+ \saveddimen{\gap}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{seven seg/segment sep}}}
+ \saveddimen{\boxgap}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{seven seg/box sep}}}
+ \savedanchor{\southwest}{% both negative
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at x}{-0.5*\ctikzvalof{seven seg/width}*\pgf at circ@scaled at Rlen
+ -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
+ \pgfmathsetlength{\pgf at y}{-\ctikzvalof{seven seg/width}*\pgf at circ@scaled at Rlen
+ -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
+ }
+ \savedanchor{\northeast}{% both positive
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \ifpgf at circ@sevenseg at dot
+ \pgfmathsetlength{\pgf at circ@res at other}{\ctikzvalof{seven seg/thickness}}
+ \else
+ \pgf at circ@res at other=0pt
+ \fi
+ \pgfmathsetlength{\pgf at x}{0.5*\ctikzvalof{seven seg/width}*\pgf at circ@scaled at Rlen
+ +0.5*\ctikzvalof{seven seg/thickness}+\pgf at circ@res at other+\ctikzvalof{seven seg/box sep}}
+ \pgfmathsetlength{\pgf at y}{\ctikzvalof{seven seg/width}*\pgf at circ@scaled at Rlen
+ +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
+ }
+ \savedanchor{\topright}{% anchor without the box sep and the thickness
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at x}{0.5*\ctikzvalof{seven seg/width}*\pgf at circ@scaled at Rlen}
+ \pgfmathsetlength{\pgf at y}{\ctikzvalof{seven seg/width}*\pgf at circ@scaled at Rlen}
+ }
+ \anchor{center}{\pgfpointorigin}
+ \anchor{north west}{\southwest\pgf at y=-\pgf at y}
+ \anchor{north east}{\northeast}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\southwest}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{east}{\northeast\pgf at y=0pt}
+ \anchor{south}{\southwest\pgf at x=0pt}
+ \anchor{west}{\southwest\pgf at y=0pt}
+ \anchor{a}{\topright\pgf at x=0pt}
+ \anchor{b}{\topright\pgf at y=0.5\pgf at y}
+ \anchor{c}{\topright\pgf at y=-0.5\pgf at y}
+ \anchor{d}{\topright\pgf at y=-\pgf at y\pgf at x=0pt}
+ \anchor{e}{\topright\pgf at x=-\pgf at x\pgf at y=-0.5\pgf at y}
+ \anchor{f}{\topright\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{g}{\pgfpointorigin}
+ \anchor{dot}{\topright\pgf at y=-\pgf at y\advance\pgf at x by \dotspace}
+ \behindbackgroundpath{%
+ \southwest % I do not want the dot here, it will stick out
+ \pgf at circ@res at up = -\pgf at y
+ \pgf at circ@res at down = \pgf at y
+ \pgf at circ@res at right = \pgf at x
+ \pgf at circ@res at left = -\pgf at x
+ \pgfscope
+ \pgf at circ@setlinewidth{multipoles}{\pgflinewidth}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfpathrectanglecorners%
+ {\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ {\pgfpoint{\pgf at circ@res at left+\dotspace}{\pgf at circ@res at up}}
+ \ifpgf at circ@sevenseg at box
+ \pgf at circ@draworfill
+ \else
+ \pgf at circ@maybefill
+ \fi
+ \endpgfscope
+ \edef\bits{\ctikzvalof{seven seg/bits}}
+ \pgfscope
+ \pfg at circ@sseg at drawbits{\bits}
+ \endpgfscope
+ \pgfscope
+ \ifpgf at circ@sevenseg at dot
+ \pgf at circ@sseg at drawdots
+ \fi
+ \endpgfscope
+ }
+}
+
+\def\pgf at circ@sseg at splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
+ \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
+}
+\def\pgf at circ@sseg at drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
+ \ifnum #1 > 0\relax
+ \pgfsetcolor{\ctikzvalof{seven seg/color on}}
+ \else
+ \pgfsetcolor{\ctikzvalof{seven seg/color off}}
+ \fi
+ \pgfpathmoveto{\pgfpoint{#2}{#3}}
+ \pgfpathlineto{\pgfpoint{#4}{#5}}
+ \pgfusepath{draw}
+}
+\def\pfg at circ@sseg at drawbits#1{% #1 must be 7 bits
+ \expandafter\pgf at circ@sseg at splitbits#1\relax% a bit of magic...
+ \pgfmathsetlength{\pgf at circ@res at other}{0.5*\ctikzvalof{seven seg/thickness}}
+ \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
+ % \pgfsetroundcap
+ \pgfsetarrowsstart{Triangle Cap[]}
+ \pgfsetarrowsend{Triangle Cap[]}
+ % segments
+ \pgf at circ@sseg at drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
+ \pgf at circ@sseg at drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
+ \pgf at circ@sseg at drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
+ \pgf at circ@sseg at drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
+ \pgf at circ@sseg at drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
+ \pgf at circ@sseg at drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
+ \pgf at circ@sseg at drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
+}
+\def\pgf at circ@sseg at drawdots{% dots
+ \edef\what{empty}
+ \ifx\what\pgf at circ@sevenseg at dotstate
+ % do nothing
+ \else
+ \pgfmathsetlength{\pgf at circ@res at other}{0.5*\ctikzvalof{seven seg/thickness}}
+ \edef\what{off}
+ \ifx\what\pgf at circ@sevenseg at dotstate
+ % dot off
+ \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
+ \pgfsetcolor{\ctikzvalof{seven seg/color off}}
+ \else
+ % dot on
+ \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
+ \pgfsetcolor{\ctikzvalof{seven seg/color on}}
+ \fi
+ \pgfpathcircle{\pgfpoint{\width/2+2*\pgf at circ@res at other}{-\width}}{\pgf at circ@res at other}
+ \pgfusepath{draw,fill}
+ \fi
+}
+
+
+%%%%%%
+%%%%%% Flip-flops
+%%%%%%
+
+% Flip flops are a specialized kind of dipchip.
+% they have a class by themselves
+
+%% flip flop definitions --- by default empty
+%% pin texts
+\ctikzset{multipoles/flipflop/t1/.initial={}}
+\ctikzset{multipoles/flipflop/t2/.initial={}}
+\ctikzset{multipoles/flipflop/t3/.initial={}}
+\ctikzset{multipoles/flipflop/t4/.initial={}}
+\ctikzset{multipoles/flipflop/t5/.initial={}}
+\ctikzset{multipoles/flipflop/t6/.initial={}}
+\ctikzset{multipoles/flipflop/tu/.initial={}}
+\ctikzset{multipoles/flipflop/td/.initial={}}
+% pin clock wedge flags
+\ctikzset{multipoles/flipflop/c1/.initial={0}}
+\ctikzset{multipoles/flipflop/c2/.initial={0}}
+\ctikzset{multipoles/flipflop/c3/.initial={0}}
+\ctikzset{multipoles/flipflop/c4/.initial={0}}
+\ctikzset{multipoles/flipflop/c5/.initial={0}}
+\ctikzset{multipoles/flipflop/c6/.initial={0}}
+\ctikzset{multipoles/flipflop/cu/.initial={0}}
+\ctikzset{multipoles/flipflop/cd/.initial={0}}
+% pin negation circle flags
+\ctikzset{multipoles/flipflop/n1/.initial={0}}
+\ctikzset{multipoles/flipflop/n2/.initial={0}}
+\ctikzset{multipoles/flipflop/n3/.initial={0}}
+\ctikzset{multipoles/flipflop/n4/.initial={0}}
+\ctikzset{multipoles/flipflop/n5/.initial={0}}
+\ctikzset{multipoles/flipflop/n6/.initial={0}}
+\ctikzset{multipoles/flipflop/nu/.initial={0}}
+\ctikzset{multipoles/flipflop/nd/.initial={0}}
+
+
+% Thanks to @marmot
+\tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
+
+% default set of flip flops
+\tikzset{
+ % async
+ latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
+ flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
+ % sync
+ flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
+ flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
+ flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
+ % additional features
+ add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
+ dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
+}
+
+%
+% commodity macro to draw the clock wedges. They leave the size of the
+% wedge in \pgf at circ@res at temp so that a possible label can be displaced.
+%
+\def\pgf at circ@do at wedge@left{
+ \pgf at circ@res at temp=0pt\relax
+ \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf at circ@count at c}>0
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step+\wedge}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+\wedge}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step-\wedge}}
+ \pgfusepath{stroke}
+ \pgf at circ@res at temp=\wedge
+ \fi
+}
+\def\pgf at circ@do at wedge@right{
+ \pgf at circ@res at temp=0pt\relax
+ \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf at circ@count at c}>0
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step+\wedge}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\wedge}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step-\wedge}}
+ \pgfusepath{stroke}
+ \pgf at circ@res at temp=-\wedge
+ \fi
+}
+\def\pgf at circ@do at wedge@up{
+ \pgf at circ@res at temp=0pt\relax
+ \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
+ \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up-\wedge}}
+ \pgfpathlineto{\pgfpoint{\wedge}{\pgf at circ@res at up}}
+ \pgfusepath{stroke}
+ \pgf at circ@res at temp=-\wedge
+ \fi
+}
+\def\pgf at circ@do at wedge@down{
+ \pgf at circ@res at temp=0pt\relax
+ \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
+ \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down+\wedge}}
+ \pgfpathlineto{\pgfpoint{\wedge}{\pgf at circ@res at down}}
+ \pgfusepath{stroke}
+ \pgf at circ@res at temp=\wedge
+ \fi
+}
+% generic flip-flop shape
+\pgfdeclareshape{flipflop}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedmacro{\thisshape}{\def\thisshape{\tikz at fig@name}}
+ \savedmacro\numpins{\def\numpins{6}}
+ \savedanchor\centerpoint{%
+ \pgf at x=-.5\wd\pgfnodeparttextbox%
+ \pgf at y=-.5\ht\pgfnodeparttextbox%
+ \advance\pgf at y by+.5\dp\pgfnodeparttextbox%
+ }%
+ \savedanchor\origin{\pgfpoint{0pt}{0pt}}
+ \anchor{center}{\origin}
+ \anchor{text}{\centerpoint}% to adjust text
+ \saveddimen\height{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{((\numpins)
+ *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf at circ@scaled at Rlen/2}%
+ }%
+ \saveddimen{\chipspacing}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
+ \saveddimen{\width}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/flipflop/width}}}
+ \saveddimen{\extshift}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/external pins width}}}
+ % standard anchors
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at y{0.5*((\numpins)
+ *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf at circ@scaled at Rlen/2}%
+ \pgfmathsetlength\pgf at x{-0.5*\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/flipflop/width}}
+ }
+ \anchor{dot}{\northwest
+ \pgfmathsetlength\pgf at x{\pgf at x + 0.3*\chipspacing}
+ \pgfmathsetlength\pgf at y{\pgf at y - 0.3*\chipspacing}
+ }
+ \anchor{nw}{\northwest}
+ \anchor{ne}{\northwest\pgf at x=-\pgf at x}
+ \anchor{se}{\northwest\pgf at x=-\pgf at x\pgf at y=-\pgf at y}
+ \anchor{sw}{\northwest\pgf at y=-\pgf at y}
+ \anchor{north west}{\northwest}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{south east}{\northwest\pgf at x=-\pgf at x \pgf at y=-\pgf at y}
+ \anchor{south west}{\northwest\pgf at y=-\pgf at y}
+ \anchor{n}{\northwest\pgf at x=0pt }
+ \anchor{e}{\northwest\pgf at x=-\pgf at x\pgf at y=0pt }
+ \anchor{s}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{w}{\northwest\pgf at y=0pt }
+ \anchor{north}{\northwest\pgf at x=0pt }
+ \anchor{east}{\northwest\pgf at x=-\pgf at x\pgf at y=0pt }
+ \anchor{south}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{west}{\northwest\pgf at y=0pt }
+ % upper and lower pin
+ \anchor{up}{\northwest\pgf at x=0pt\advance\pgf at y by\extshift }
+ \anchor{down}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y\advance\pgf at y by-\extshift}
+ \anchor{bup}{\northwest\pgf at x=0pt }
+ \anchor{bdown}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ % start drawing
+ \backgroundpath{%
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at other = \ctikzvalof{multipoles/external pins width}\pgf at circ@scaled at Rlen
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfscope% (for the line width)
+ \pgf at circ@setlinewidth{multipoles}{\pgflinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
+ \pgf at circ@draworfill
+ \pgfusepath{stroke}%
+ \endpgfscope
+ % Adding the pin number
+ \pgf at circ@count at a=\numpins\relax
+ \divide\pgf at circ@count at a by 2 \pgf at circ@count at b=\pgf at circ@count at a
+ % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
+ \ifpgf at circuit@chip at straightnumbers
+ \pgfgettransformentries\a\b\temp\temp\temp\temp
+ \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
+ \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
+ \else
+ \pgfmathsetmacro{\rot}{0}
+ \pgfmathsetmacro{\quadrant}{0}
+ \fi
+ \def\pgf at circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
+ % text
+ \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
+ \ctikzvalof{multipoles/flipflop/t\the\pgf at circ@count at c}%
+ \pgf at circ@strut\space}
+ % \typeout{TEXT\space\mytext}
+ \pgfmathloop%
+ \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf at circ@res at step}
+ \pgf at circ@res at temp=0pt\relax
+ \ifnum\pgf at circ@count at a>0
+ \ifcase\quadrant % rotation 0
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgf at circ@do at wedge@left
+ % \typeout{TEXT Left Q1\space\mytext}
+ \pgftext[left,
+ at=\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at temp}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgf at circ@do at wedge@right
+ \pgftext[right,
+ at=\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at temp}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ \or % rotation -90
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgf at circ@do at wedge@left
+ \pgftext[top,
+ at=\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at temp}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgf at circ@do at wedge@right
+ \pgftext[bottom,
+ at=\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at temp}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ \or %rotation 180
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgf at circ@do at wedge@left
+ \pgftext[right,
+ at=\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at temp}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgf at circ@do at wedge@right
+ \pgftext[left,
+ at=\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at temp}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ \or % rotation +90
+ % left
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \pgf at circ@do at wedge@left
+ \pgftext[bottom,
+ at=\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at temp}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ % right
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \pgf at circ@do at wedge@right
+ \pgftext[top,
+ at=\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at temp}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step},
+ rotate=\rot]{\mytext}
+ \fi
+ \advance\pgf at circ@count at a-1\relax%
+ \repeatpgfmathloop
+ % Now the up and down text
+ % up
+ \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf at circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
+ \pgf at circ@do at wedge@up
+ \ifcase\quadrant % rotation 0
+ \pgftext[top,
+ at=\pgfpoint{0pt}{\pgf at circ@res at up+\pgf at circ@res at temp},
+ rotate=\rot]{\mytext}
+ \or % rotation -90
+ \pgftext[right,
+ at=\pgfpoint{0pt}{\pgf at circ@res at up+\pgf at circ@res at temp},
+ rotate=\rot]{\mytext}
+ \or %rotation 180
+ \pgftext[bottom,
+ at=\pgfpoint{0pt}{\pgf at circ@res at up+\pgf at circ@res at temp},
+ rotate=\rot]{\mytext}
+ \or % rotation +90
+ \pgftext[left,
+ at=\pgfpoint{0pt}{\pgf at circ@res at up+\pgf at circ@res at temp},
+ rotate=\rot]{\mytext}
+ \fi
+ % down
+ \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf at circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
+ \pgf at circ@do at wedge@down
+ \ifcase\quadrant % rotation 0
+ \pgftext[bottom,
+ at=\pgfpoint{0pt}{\pgf at circ@res at down+\pgf at circ@res at temp},
+ rotate=\rot]{\mytext}
+ \or % rotation -90
+ \pgftext[left,
+ at=\pgfpoint{0pt}{\pgf at circ@res at down+\pgf at circ@res at temp},
+ rotate=\rot]{\mytext}
+ \or %rotation 180
+ \pgftext[top,
+ at=\pgfpoint{0pt}{\pgf at circ@res at down+\pgf at circ@res at temp},
+ rotate=\rot]{\mytext}
+ \or % rotation +90
+ \pgftext[right,
+ at=\pgfpoint{0pt}{\pgf at circ@res at down+\pgf at circ@res at temp},
+ rotate=\rot]{\mytext}
+ \fi
+ % external pins
+ \ifdim\pgf at circ@res at other>0pt
+ \pgfscope
+ \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
+ \pgf at circ@count at a=\numpins\relax
+ \divide\pgf at circ@count at a by 2 \pgf at circ@count at b=\pgf at circ@count at a
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % left side pins
+ \pgf at circ@count at c=\pgf at circ@count at a
+ %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
+ %% Or'ing tests in core TeX is tough
+ \edef\@@or{0}
+ % Just expand the key the minimum needed
+ \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf at circ@count at c}}\edef\@@x{x}
+ \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf at circ@count at c}}
+ \ifnum\@@tmp>0\edef\@@or{1}\fi
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf at circ@count at c}}
+ \ifnum\@@tmp>0\edef\@@or{1}\fi
+ \ifnum\@@or>0
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pgf at circ@res at other}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfusepath{stroke}
+ \fi
+ % right side pins
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \edef\@@or{0}
+ \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf at circ@count at c}}\edef\@@x{x}
+ \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf at circ@count at c}}
+ \ifnum\@@tmp>0\edef\@@or{1}\fi
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf at circ@count at c}}
+ \ifnum\@@tmp>0\edef\@@or{1}\fi
+ % \typeout{TEST\space\@@tmp\space\@@x}
+ \ifnum\@@or>0
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\pgf at circ@res at other}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfusepath{stroke}
+ \fi
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop
+ % up side
+ \edef\@@or{0}
+ \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
+ \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
+ \ifnum\@@tmp>0\edef\@@or{1}\fi
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
+ \ifnum\@@tmp>0\edef\@@or{1}\fi
+ % \typeout{TEST\space\@@tmp\space\@@x}
+ \ifnum\@@or>0
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at up+\pgf at circ@res at other}}
+ \pgfusepath{stroke}
+ \fi
+ % down side
+ \edef\@@or{0}
+ \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
+ \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
+ \ifnum\@@tmp>0\edef\@@or{1}\fi
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
+ \ifnum\@@tmp>0\edef\@@or{1}\fi
+ % \typeout{TEST\space\@@tmp\space\@@x}
+ \ifnum\@@or>0
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down-\pgf at circ@res at other}}
+ \pgfusepath{stroke}
+ \fi
+ \endpgfscope
+ \fi % external pin width >0
+ %
+ % draw "inverting" circles on outputs, they must be last
+ %
+ \pgfscope
+ \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
+ \pgf at circ@count at a=\numpins\relax
+ \divide\pgf at circ@count at a by 2 \pgf at circ@count at b=\pgf at circ@count at a
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % left side pins
+ \pgf at circ@count at c=\pgf at circ@count at a
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf at circ@count at c}}
+ \ifnum\@@tmp>0\pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfnode{ocirc}{east}{}{\thisshape-N\the\pgf at circ@count at c}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ % right side pins
+ \pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf at circ@count at c}}
+ \ifnum\@@tmp>0\pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfnode{ocirc}{west}{}{\thisshape-N\the\pgf at circ@count at c}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop
+ % up side
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
+ \ifnum\@@tmp>0\pgfscope
+ \pgftransformshift{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfnode{ocirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ % down side
+ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
+ \ifnum\@@tmp>0\pgfscope
+ \pgftransformshift{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfnode{ocirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ \endpgfscope
+ }%
+ % \pgf at sh@s@<name of the shape here> contains all the code for the shape
+ % and is executed just before a node is drawn.
+ \pgfutil at g@addto at macro\pgf at sh@s at flipflop{%
+ % Start with the maximum pin number and go backwards.
+ \pgf at circ@count at a=\numpins\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@flipflop at pin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@dippinanchor{\the\pgf at circ@count at a}{1}%
+ }
+ \expandafter\xdef\csname pgf at anchor@flipflop at bpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@dippinanchor{\the\pgf at circ@count at a}{0}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ }%
+}
+
+%
+% MUX-DEMUXES
+%
+% Thanks to @marmot
+\tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
+\tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
+\tikzset{one bit adder/.style={muxdemux,
+ muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
+ inset w=0.5, inset Lh=2, inset Rh=1.5}}}
+\tikzset{ALU/.style={muxdemux,
+ muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
+ inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
+%generic mux-demux shape
+\pgfdeclareshape{muxdemux}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedmacro{\thisshape}{\def\thisshape{\tikz at fig@name}}
+ % pins on the four sides
+ % \savedmacro\NL{%
+ % \pgf at circ@count at a=\ctikzvalof{multipoles/muxdemux/NL}%
+ % \def\NL{\the\pgf at circ@count at a}
+ % }
+ \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
+ \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
+ \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
+ \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
+ \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
+ % topleft and topright sizes
+ \savedanchor{\topleft}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf at circ@scaled at Rlen/2}
+ \pgfmathsetlength\pgf at x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf at circ@scaled at Rlen/2}
+ }
+ \savedanchor{\topright}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf at circ@scaled at Rlen/2}
+ \pgfmathsetlength\pgf at x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf at circ@scaled at Rlen/2}
+ }
+ \savedanchor{\insetnortheast}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf at circ@scaled at Rlen/2}
+ \pgfmathsetlength\pgf at x{-\ctikzvalof{multipoles/muxdemux/base len}*
+ (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf at circ@scaled at Rlen/2}
+ }
+ \saveddimen{\insethright}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf at circ@scaled at Rlen/2}}
+ \saveddimen{\extshift}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\pgf at circ@scaled at Rlen*\ctikzvalof{multipoles/external pins width}}}
+ \savedanchor{\northwest}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf at circ@scaled at Rlen/2}
+ \pgfmathsetlength\pgf at x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf at circ@scaled at Rlen/2}
+ }
+ \anchor{nw}{\northwest}
+ \anchor{ne}{\northwest\pgf at x=-\pgf at x}
+ \anchor{se}{\northwest\pgf at x=-\pgf at x\pgf at y=-\pgf at y}
+ \anchor{sw}{\northwest\pgf at y=-\pgf at y}
+ \anchor{north west}{\northwest}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{south east}{\northwest\pgf at x=-\pgf at x \pgf at y=-\pgf at y}
+ \anchor{south west}{\northwest\pgf at y=-\pgf at y}
+ \anchor{n}{\northwest\pgf at x=0pt }
+ \anchor{e}{\northwest\pgf at x=-\pgf at x\pgf at y=0pt }
+ \anchor{s}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{w}{\northwest\pgf at y=0pt }
+ \anchor{north}{\northwest\pgf at x=0pt }
+ \anchor{east}{\northwest\pgf at x=-\pgf at x\pgf at y=0pt }
+ \anchor{south}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{west}{\northwest\pgf at y=0pt }
+ \anchor{center}{\pgfpointorigin}
+ \anchor{top right}{\topright}
+ \anchor{bottom right}{\topright\pgf at y=-\pgf at y}
+ \anchor{right}{\topright\pgf at y=0pt\relax}
+ \anchor{top left}{\topleft}
+ \anchor{bottom left}{\topleft\pgf at y=-\pgf at y}
+ \anchor{left}{\topleft\pgf at y=0pt\relax}
+ \anchor{top}{\topright\pgf at ya=\pgf at y \topleft \advance\pgf at y by \pgf at ya
+ \divide\pgf at y by 2 \pgf at x=0pt\relax}
+ \anchor{bottom}{\topright\pgf at ya=\pgf at y \topleft \advance\pgf at y by \pgf at ya
+ \divide\pgf at y by 2 \pgf at y=-\pgf at y \pgf at x=0pt\relax}
+ \anchor{inset top right}{\pgf at ya=\insethright\insetnortheast\advance\pgf at y by -0.5\pgf at ya}
+ \anchor{inset bottom right}{\pgf at ya=\insethright\insetnortheast\advance\pgf at y by -0.5\pgf at ya\pgf at y=-\pgf at y}
+ \anchor{inset right}{\insetnortheast\pgf at y=0pt\relax}
+ \anchor{inset top left}{\insetnortheast\pgf at ya=\pgf at y\topleft\pgf at y=\pgf at ya}
+ \anchor{inset bottom left}{\insetnortheast\pgf at ya=\pgf at y\topleft\pgf at y=-\pgf at ya}
+ \anchor{inset left}{\topleft\pgf at y=0pt\relax}
+ \anchor{inset bottom}{\topleft\pgf at xa=\pgf at x\pgf at ya=\insethright
+ \insetnortheast\pgf at xb=\pgf at x\pgf at yb=\pgf at x
+ \pgfpoint{(\pgf at xa+\pgf at xb)/2}{-\pgf at ya+\pgf at yb/2}}
+ \anchor{inset top}{\topleft\pgf at xa=\pgf at x\pgf at ya=\insethright
+ \insetnortheast\pgf at xb=\pgf at x\pgf at yb=\pgf at x
+ \pgfpoint{(\pgf at xa+\pgf at xb)/2}{\pgf at ya-\pgf at yb/2}}
+ \anchor{inset center}{\topleft\pgf at xa=\pgf at x\insetnortheast
+ \advance\pgf at x by \pgf at xa \divide\pgf at x by 2 \pgf at y=0pt\relax}
+ \anchor{narrow center}{\insetnortheast\pgf at xa=\pgf at x\topright
+ \advance\pgf at x by \pgf at xa \divide\pgf at x by 2\pgf at y=0pt\relax}
+ \anchor{center up}{\topright\pgf at ya=\pgf at y \topleft \advance\pgf at y by \pgf at ya
+ \divide\pgf at y by 2
+ \pgf at yb = \insethright \advance\pgf at y by \pgf at yb
+ \divide\pgf at y by 2 \pgf at x=0pt\relax}
+ \anchor{center down}{\topright\pgf at ya=\pgf at y \topleft \advance\pgf at y by \pgf at ya
+ \divide\pgf at y by 2
+ \pgf at yb = \insethright \advance\pgf at y by \pgf at yb
+ \divide\pgf at y by 2 \pgf at y=-\pgf at y \pgf at x=0pt\relax}
+ \anchor{text}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgfmathsetlength\pgf at x{\ctikzvalof{multipoles/muxdemux/base len}*
+ \ctikzvalof{multipoles/muxdemux/inset w}*\pgf at circ@scaled at Rlen/2}
+ \advance\pgf at x by -.5\wd\pgfnodeparttextbox%
+ \pgf at y=-.5\ht\pgfnodeparttextbox%
+ \advance\pgf at y by+.5\dp\pgfnodeparttextbox%
+ }%
+ \backgroundpath{%
+ \topleft
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at left = \pgf at x
+ \topright
+ \pgf at circ@res at other = \pgf at y
+ \pgf at circ@res at right = \pgf at x
+ \insetnortheast
+ \pgf at circ@res at step = \pgf at x
+ \pgf at circ@res at temp = \pgf at y
+ %
+ % external block
+ %
+ \pgfscope% (for the line width)
+ \pgf at circ@setlinewidth{multipoles}{\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{-\pgf at circ@res at other}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ % inset, starting down
+ \ifdim\pgf at circ@res at temp>0pt % inset
+ % \typeout{INSETw\space\the\pgf at circ@res at right\space x\space\the\pgf at circ@res at step\space y\space\the\pgf at circ@res at temp}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at temp}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{-\insethright}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{\insethright}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}
+ \fi
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+ % now we have to draw the pins, if needed
+ \ifdim\extshift>0pt\ifpgfcirc at draw@leads\pgfscope % let's avoid too much indent
+ % Ok, we have to draw the leads (a.k.a. pins)
+ \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
+ % We mimic the anchors here --- probably there is a better way
+ % left pins
+ \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
+ \pgf at circ@count at a=\NL\relax
+ \pgf at circ@count at b=\NL \divide\pgf at circ@count at b by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate
+ \topleft\pgf at circ@res at left=\pgf at x \pgf at circ@res at up=\pgf at y
+ \insetnortheast\pgf at circ@res at right=\pgf at x \pgf at circ@res at down=\pgf at y
+ \ifdim\pgf at circ@res at down>0pt % check if we have an inset
+ % we have to check oddity
+ \ifodd\NL
+ \ifnum\NL=1
+ % only centerpin, step should not be used, but anyway...
+ \pgfmathsetlength{\pgf at circ@res at step}{2*(\pgf at circ@res at up-\pgf at circ@res at down)/(\NL)}
+ \else
+ \pgfmathsetlength{\pgf at circ@res at step}{2*(\pgf at circ@res at up-\pgf at circ@res at down)/(\NL-1)}
+ \fi
+ \else
+ \pgfmathsetlength{\pgf at circ@res at step}{2*(\pgf at circ@res at up-\pgf at circ@res at down)/\NL}
+ \fi
+ \else % no inset
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at up/\NL}
+ \fi
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ %%%%%
+ \ifdim\pgf at circ@res at down>0pt % check if we have an inset
+ \ifnum\pgf at circ@count at a>\pgf at circ@count at b\relax
+ % for lower pins we have to shift them down
+ % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
+ \ifodd\NL
+ % odd number of pins
+ \ifnum\pgf at circ@count at a=\numexpr\the\pgf at circ@count at b+1\relax
+ % centerpin!
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \ifnum\squarepins>0
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\extshift}{0pt}}
+ \else
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right-\extshift}{0pt}}
+ \fi
+ \else
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a+1)*\pgf at circ@res at step-2*\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\extshift}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a+1)*\pgf at circ@res at step-2*\pgf at circ@res at down}}
+ \fi
+ \else
+ % even numer of pins: just go down
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step-2*\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\extshift}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step-2*\pgf at circ@res at down}}
+ \fi
+ \else
+ % nothing need for #1<=NL/2
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\extshift}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \fi
+ \else
+ % no inset
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\extshift}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \fi
+ %%%%%
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop\fi%
+ % right pins
+ \ifnum\NR>0\pgf at circ@count at a=\NR\relax
+ \pgfmathloop%
+ \topright\pgf at circ@res at right=\pgf at x \pgf at circ@res at up=\pgf at y
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at up/\NR}
+ \ifnum\pgf at circ@count at a>0
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right+\extshift}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop\fi%
+ % bottom pins
+ \ifnum\NB>0\pgf at circ@count at a=\NB\relax %%%
+ \pgfmathloop%
+ \topleft\pgf at circ@res at left=\pgf at x \pgf at circ@res at up=\pgf at y
+ \topright\pgf at circ@res at right=\pgf at x \pgf at circ@res at down=\pgf at y
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at right/\NB}
+ \pgfmathsetlength{\pgf at circ@res at other}{(\pgf at circ@res at down-\pgf at circ@res at up)/(\pgf at circ@res at right-\pgf at circ@res at left)*\pgf at circ@res at step}
+ \ifnum\pgf at circ@count at a>0
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left+(\pgf at circ@count at a-0.5)*\pgf at circ@res at step}
+ {-\pgf at circ@res at down+(\NB-\pgf at circ@count at a+0.5)*\pgf at circ@res at other}}
+ \ifnum\squarepins>0
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+(\pgf at circ@count at a-0.5)*\pgf at circ@res at step}
+ {-max(\pgf at circ@res at down, \pgf at circ@res at up)-\extshift}}
+ \else
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+(\pgf at circ@count at a-0.5)*\pgf at circ@res at step}
+ {-\pgf at circ@res at down+(\NB-\pgf at circ@count at a+0.5)*\pgf at circ@res at other-\extshift}}
+ \fi
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop\fi%
+ % top pins
+ \ifnum\NT>0\pgf at circ@count at a=\NT\relax
+ \pgfmathloop%
+ \topleft\pgf at circ@res at left=\pgf at x \pgf at circ@res at up=\pgf at y
+ \topright\pgf at circ@res at right=\pgf at x \pgf at circ@res at down=\pgf at y
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at right/\NT}
+ \pgfmathsetlength{\pgf at circ@res at other}{(\pgf at circ@res at down-\pgf at circ@res at up)/(\pgf at circ@res at right-\pgf at circ@res at left)*\pgf at circ@res at step}
+ \ifnum\pgf at circ@count at a>0
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left+(\pgf at circ@count at a-0.5)*\pgf at circ@res at step}
+ {\pgf at circ@res at down-(\NT-\pgf at circ@count at a+0.5)*\pgf at circ@res at other}}
+ \ifnum\squarepins>0
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+(\pgf at circ@count at a-0.5)*\pgf at circ@res at step}
+ {max(\pgf at circ@res at down, \pgf at circ@res at up)+\extshift}}
+ \else
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+(\pgf at circ@count at a-0.5)*\pgf at circ@res at step}
+ {\pgf at circ@res at down-(\NT-\pgf at circ@count at a+0.5)*\pgf at circ@res at other+\extshift}}
+ \fi
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop\fi%
+ % end drawing pins; stroke them
+ \pgfusepath{stroke}
+ \endpgfscope\fi\fi
+ }
+ % let's start adding anchors
+ \pgfutil at g@addto at macro\pgf at sh@s at muxdemux{%
+ % left side anchors
+ \pgf at circ@count at a=\NL\relax
+ % \typeout{STARTGENERATINGLEFT\space\the\pgf at circ@count at a\space FOR\space\thisshape\space\NL}
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % \typeout{GENERATINGLEFT\space\the\pgf at circ@count at a\space FOR\space\thisshape\space\NL}
+ % we will create two anchors per pin: the "normal one" like `lpin 1` for the
+ % external leads, and the "border one" like `blpin 1` for internal ones.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@muxdemux at lpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@muxdemux at L@anchor{\the\pgf at circ@count at a}{1}%
+ }
+ \expandafter\xdef\csname pgf at anchor@muxdemux at blpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@muxdemux at L@anchor{\the\pgf at circ@count at a}{0}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ % right anchors
+ \pgf at circ@count at a=\NR\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % we will create two anchors per pin: the "normal one" like `rpin 1` for the
+ % external leads, and the "border one" like `brpin 1` for internal ones.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@muxdemux at rpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@muxdemux at R@anchor{\the\pgf at circ@count at a}{1}%
+ }
+ \expandafter\xdef\csname pgf at anchor@muxdemux at brpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@muxdemux at R@anchor{\the\pgf at circ@count at a}{0}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ % bottom anchors
+ \pgf at circ@count at a=\NB\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % we will create two anchors per pin: the "normal one" like `bpin 1` for the
+ % external leads, and the "border one" like `bbpin 1` for internal ones.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@muxdemux at bpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@muxdemux at B@anchor{\the\pgf at circ@count at a}{1}%
+ }
+ \expandafter\xdef\csname pgf at anchor@muxdemux at bbpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@muxdemux at B@anchor{\the\pgf at circ@count at a}{0}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ % top anchors
+ \pgf at circ@count at a=\NT\relax
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ % we will create two anchors per pin: the "normal one" like `tpin 1` for the
+ % external leads, and the "border one" like `btpin 1` for internal ones.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf at anchor@muxdemux at tpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@muxdemux at T@anchor{\the\pgf at circ@count at a}{1}%
+ }
+ \expandafter\xdef\csname pgf at anchor@muxdemux at btpin\space\the\pgf at circ@count at a\endcsname{%
+ \noexpand\pgf at circ@muxdemux at T@anchor{\the\pgf at circ@count at a}{0}%
+ }
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop%
+ }%
+}
+
+%% left anchors for muxdemux
+
+\def\pgf at circ@muxdemux at L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
+ \topleft
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \insetnortheast
+ \pgf at xb=\pgf at x
+ \pgf at yb=\pgf at y
+ \ifnum#1>\NL
+ \PackageError{circuitikz}{%
+ You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
+ which has been defined with \NL\space left pins%
+ }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
+ \fi
+ \pgf at circ@count at a=\NL \divide\pgf at circ@count at a by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate
+ % \typeout{LEFT \the\pgf at xa \space \the\pgf at ya \space \NL}
+ \ifnum\NL>1
+ \ifdim\pgf at yb>0pt % check if we have an inset
+ % we have to check oddity
+ \ifodd\NL
+ \pgfmathsetlength{\pgf at circ@res at step}{2*(\pgf at ya-\pgf at yb)/(\NL-1)}
+ \else
+ \pgfmathsetlength{\pgf at circ@res at step}{2*(\pgf at ya-\pgf at yb)/\NL}
+ \fi
+ \else % no inset
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at ya/\NL}
+ \fi
+ \ifdim\pgf at yb>0pt % check if we have an inset
+ \ifnum#1>\pgf at circ@count at a\relax
+ % for lower pins we have to shift them down
+ % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
+ \ifodd\NL
+ % odd number of pins
+ \ifnum#1=\numexpr\the\pgf at circ@count at a+1\relax
+ % centerpin!
+ \ifnum#2=0\relax
+ \pgfpoint{\pgf at xb}{0pt}
+ \else
+ \ifnum\squarepins>0
+ \pgfpoint{\pgf at xa-#2*\extshift}{0pt}
+ \else
+ \pgfpoint{\pgf at xb-#2*\extshift}{0pt}
+ \fi
+ \fi
+ \else
+ \pgfpoint{\pgf at xa-#2*\extshift}{\pgf at ya+(0.5-#1+1)*\pgf at circ@res at step-2*\pgf at yb}
+ \fi
+ \else
+ % even numer of pins: just go down
+ \pgfpoint{\pgf at xa-#2*\extshift}{\pgf at ya+(0.5-#1)*\pgf at circ@res at step-2*\pgf at yb}
+ \fi
+ \else
+ % nothing need for #1<=NL/2
+ \pgfpoint{\pgf at xa-#2*\extshift}{\pgf at ya+(0.5-#1)*\pgf at circ@res at step}
+ \fi
+ \else
+ % no inset
+ \pgfpoint{\pgf at xa-#2*\extshift}{\pgf at ya+(0.5-#1)*\pgf at circ@res at step}
+ \fi
+ \else
+ \pgfpoint{\pgf at xa-#2*\extshift}{0pt}
+ \fi
+}
+
+% right anchors
+\def\pgf at circ@muxdemux at R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
+ \topright
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \ifnum#1>\NR
+ \PackageError{circuitikz}{%
+ You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
+ which has been defined with \NR\space right pins%
+ }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
+ \fi
+ \ifnum\NR>1
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at ya/\NR}
+ \pgfpoint{\pgf at xa+#2*\extshift}{\pgf at ya+(0.5-#1)*\pgf at circ@res at step}
+ \else
+ \pgfpoint{\pgf at xa+#2*\extshift}{0pt}
+ \fi
+}
+
+% bottom anchors
+\def\pgf at circ@muxdemux at B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
+ \topleft
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \topright
+ \pgf at xb=\pgf at x
+ \pgf at yb=\pgf at y
+ \ifnum#1>\NB
+ \PackageError{circuitikz}{%
+ You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
+ which has been defined with \NB\space bottom pins%
+ }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
+ \fi
+ \ifnum\NB>0
+ % \typeout{DEBUGTESTtopleft\space\the\pgf at ya \space topright\space\the\pgf at yb \space\NB}
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at xb/\NB}
+ \pgfmathsetlength{\pgf at circ@res at other}{(\pgf at yb-\pgf at ya)/(\pgf at xb-\pgf at xa)*\pgf at circ@res at step}
+ \pgfmathsetlength\pgf at x{\pgf at xa+(#1-0.5)*\pgf at circ@res at step}
+ \ifnum#2=0\relax
+ \pgfmathsetlength\pgf at y{-\pgf at yb+(\NB-#1+0.5)*\pgf at circ@res at other}
+ \else
+ \ifnum\squarepins>0\relax
+ \pgfmathsetlength\pgf at y{-max(\pgf at ya,\pgf at yb)-\extshift}
+ \else
+ \pgfmathsetlength\pgf at y{-\pgf at yb+(\NB-#1+0.5)*\pgf at circ@res at other-\extshift}
+ \fi
+ \fi
+ \else
+ % should not happen, give the same as pin 1 anyway
+ \ifnum#2=0\relax
+ \pgfpoint{0pt}{-\pgf at yb+(\pgf at yb-\pgf at ya)/2}
+ \else
+ \pgfpoint{0pt}{-max(\pgf at ya,\pgf at yb)-\extshift}
+ \fi
+ \fi
+}
+
+% top anchors
+\def\pgf at circ@muxdemux at T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
+ \topleft
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \topright
+ \pgf at xb=\pgf at x
+ \pgf at yb=\pgf at y
+ \ifnum#1>\NT
+ \PackageError{circuitikz}{%
+ You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
+ which has been defined with \NT\space top pins%
+ }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
+ \fi
+ \ifnum\NT>0
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at xb/\NT}
+ \pgfmathsetlength{\pgf at circ@res at other}{(\pgf at yb-\pgf at ya)/(\pgf at xb-\pgf at xa)*\pgf at circ@res at step}
+ \pgfmathsetlength\pgf at x{\pgf at xa+(#1-0.5)*\pgf at circ@res at step}
+ \ifnum#2=0\relax
+ \pgfmathsetlength\pgf at y{\pgf at yb-(\NT-#1+0.5)*\pgf at circ@res at other}
+ \else
+ \ifnum\squarepins>0
+ \pgfmathsetlength\pgf at y{max(\pgf at ya,\pgf at yb)+\extshift}
+ \else
+ \pgfmathsetlength\pgf at y{\pgf at yb-(\NT-#1+0.5)*\pgf at circ@res at other+\extshift}
+ \fi
+ \fi
+ \else
+ % should not happen, give the same as pin 1 anyway
+ \ifnum#2=0\relax
+ \pgfpoint{0pt}{\pgf at yb-(\pgf at yb-\pgf at ya)/2}
+ \else
+ \pgfpoint{0pt}{max(\pgf at ya,\pgf at yb)+\extshift}
+ \fi
+ \fi
+}
+
+%% IEEE standard logic ports module
+%%
+%% Original multi-input code from John Kormylo at tex.stackexchange.com
+%% Help by TheTeXnician <38565529+TheTeXnician at users.noreply.github.com>
+%% Suggested idea and example code by Jason Sachs <jmsachs at gmail.com>
+%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
+%% Most of the code, all errors and bugs by Romano Giannetti <romano.giannetti at gmail.com>
+%% Everything is in the same place here --- more or less; first step to move towards
+%% a module interface for circutikz
+%%
+
+% base parameters for ieeestd ports.
+
+\ctikzset{ieeestd ports/.is family}
+% baselen is relative to pgfcirc at Rlen as ever; scaled if the class says so.
+% the value of 0.4 is the standard pin distance for a port with height=num pins
+% and matches the chip distance
+\ctikzset{ieeestd ports/baselen/.initial=0.4}
+% these are in term of baselen; width depends on height (fixed proportions)
+\ctikzset{ieeestd ports/height/.initial=2}
+\ctikzset{ieeestd ports/pin length/.initial=0.7}
+% the standard "not" circle should be 1/6.5 of height (diameter);
+% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
+\ctikzset{ieeestd ports/not radius/.initial=0.154}
+\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
+% the suggested xnor distance is is 1.24, so 1.25/3.25/2
+% xor/xnor leads go full in in IEEE; let this be optional
+\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
+\ctikzset{ieeestd ports/xor leads in/.initial=1}%
+%
+% base size of a small external schmitt symbol
+%
+\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
+%
+% input management
+% we are using the same /tikz/number inputs than the legacy ports
+%
+\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
+%
+% integrate with the other logic ports
+%
+\ctikzset{logic ports/ieee/.code= {\pgf at circuit@europeanlogicportfalse
+ \tikzset{and port/.style={shape=ieeestd and port}}%
+ \tikzset{or port/.style={shape=ieeestd or port}}%
+ \tikzset{xor port/.style={shape=ieeestd xor port}}%
+ \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
+ \tikzset{not port/.style={shape=ieeestd not port}}%
+ \tikzset{nand port/.style={shape=ieeestd nand port}}%
+ \tikzset{nor port/.style={shape=ieeestd nor port}}%
+ \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
+ \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
+ \tikzset{inv schmitt port/.style={shape=ieeestd schmitt port}}%
+}}
+\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
+%
+% the base angle for the or port. See the drawings. This will not change with height
+%
+\pgfmathsetmacro{\pgf at circ@orangle}{atan(3.25/6.5)}
+% \typeout{ANGLE-IS\space\pgf at circ@orangle}
+\def\pgf at circ@ieeeport at input#1% #1 = \pgfmathcounter
+{%
+ \ifnum#1>\inputs
+ \PackageError{circuitikz}{%
+ You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
+ which has been defined with \inputs\space pins%
+ }{Please check the manual about logic ports; if you press return I'll try to continue}
+ \fi
+ \pgfmathsetlength{\pgf at circ@res at up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
+ \pgfextractx{\pgf at circ@res at left}{\bodyleft}
+ \pgf at circ@res at step=\pind
+ \pgf at y=\pgf at circ@res at up\advance\pgf at y by -#1\pgf at circ@res at step\relax
+ \pgf at x=\pgf at circ@res at left\advance\pgf at x by -\pinlen
+}%
+
+% #1 = \pgfmathcounter #2=type
+% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
+\def\pgf at circ@ieeeport at baseinput#1#2%
+{%
+ \ifnum#1>\inputs
+ \PackageError{circuitikz}{%
+ You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
+ which has been defined with \inputs\space pins%
+ }{Please check the manual about logic ports; if you press return I'll try to continue}
+ \fi
+ % Find the vertical position (this is the same for any port)
+ \pgfmathsetlength{\pgf at circ@res at up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
+ \pgf at circ@res at step=\pind\advance\pgf at circ@res at up by -#1\pgf at circ@res at step\relax
+ % rack (extended) pins; they are the same for all the ports
+ % call K = (inputs-inner)/2, rounded up; pins on the rack are:
+ % above: 1..K (included)
+ % below: inputs-K..inputs
+ % Find the pins on the rack; they are 1...
+ \pgf at circ@count at a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
+ \pgf at circ@count at b=\numexpr \inputs - \pgf at circ@count at a +1 \relax % =inputs - K +1
+ % border anchors for rack should be ok
+ \pgfextractx{\pgf at circ@res at left}{\topleft}
+ \pgfextractx{\pgf at circ@res at right}{\bodyleft}
+ \pgf at y=\pgf at circ@res at up\pgf at x=\pgf at circ@res at left
+ % we have finished if we are in the rack
+ \ifnum #1 > \pgf at circ@count at a \ifnum #1 < \pgf at circ@count at b
+ % we are on the inner ports; we have to do the hard work here
+ % and and nand
+ \ifnum #2=1
+ \relax % It's an and/nand, all border ports are on the rack line
+ \fi
+ % or and nor
+ \ifnum #2=2
+ \pgfmathsetlength{\pgf at x}{\pgf at circ@res at right-2*\stdH*(1-cos(atan(\pgf at circ@res at up/(2*\stdH))))}
+ \fi
+ % xor and xnor
+ \ifnum #2=3\relax
+ \pgfmathsetlength{\pgf at x}{\pgf at circ@res at right-\xorbar-2*\stdH*(1-cos(atan(\pgf at circ@res at up/(2*\stdH))))}
+ \fi
+ \fi\fi
+}%
+% inner base ports for xor types port
+% #1 = \pgfmathcounter #2=type
+% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
+\def\pgf at circ@ieeeport at innerbaseinput#1%
+{%
+ \ifnum#1>\inputs
+ \PackageError{circuitikz}{%
+ You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
+ which has been defined with \inputs\space pins%
+ }{Please check the manual about logic ports; if you press return I'll try to continue}
+ \fi
+ % Find the vertical position (this is the same for any port)
+ \pgfmathsetlength{\pgf at circ@res at up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
+ \pgf at circ@res at step=\pind\advance\pgf at circ@res at up by -#1\pgf at circ@res at step\relax
+ % rack (extended) pins; they are the same for all the ports
+ % call K = (inputs-inner)/2, rounded up; pins on the rack are:
+ % above: 1..K (included)
+ % below: inputs-K..inputs
+ % Find the pins on the rack; they are 1...
+ \pgf at circ@count at a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
+ \pgf at circ@count at b=\numexpr \inputs - \pgf at circ@count at a +1 \relax % =inputs - K +1
+ % border anchors for rack should be ok
+ \pgfextractx{\pgf at circ@res at left}{\topleft}
+ \pgfextractx{\pgf at circ@res at right}{\bodyleft}
+ \pgf at y=\pgf at circ@res at up\pgf at x=\pgf at circ@res at left
+ % we have finished if we are in the rack
+ \ifnum #1 > \pgf at circ@count at a \ifnum #1 < \pgf at circ@count at b
+ % we are on the inner ports; we have to do the hard work here
+ \pgfmathsetlength{\pgf at x}{\pgf at circ@res at right-2*\stdH*(1-cos(atan(\pgf at circ@res at up/(2*\stdH))))}
+ \fi\fi
+}%
+
+%%% macro to find basic lenghts --- they leave it in \pgf at circ@res at temp
+\def\pgf at circ@ieeestd at baselen{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf at circ@scaled at Rlen}
+}
+\def\pgf at circ@ieeestd at stdH{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at circ@res at temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
+ \ctikzvalof{ieeestd ports/height}*\pgf at circ@scaled at Rlen}
+}
+\def\pgf at circ@ieeestd at pinlen{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{ieeestd ports/baselen}*
+ \ctikzvalof{ieeestd ports/pin length}*\pgf at circ@scaled at Rlen}
+}
+\def\pgf at circ@ieeestd at xorbar{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf at circ@Rlen}
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{ieeestd ports/baselen}*
+ \ctikzvalof{ieeestd ports/xor bar distance}*\pgf at circ@scaled at Rlen}
+}
+%% Not circle
+\def\pgf at circ@notradius{
+ \pgf at circ@ieeestd at stdH % got the standard length. Notice that his is 3.25H for IEEE
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf at circ@res at temp}
+ % \typeout{NOTRADIUS\space\the\pgf at circ@res at temp}
+}
+%% Find (in ... at other) the height of the rack
+\def\pgf at circ@findrackH{%
+ \pgf at circ@count at a=\pgfkeysvalueof{/tikz/number inputs}\relax%
+ \pgf at circ@count at b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
+ \ifnum\pgf at circ@count at a=0 \pgf at circ@count at a=2\fi % default pins
+ \ifnum\pgf at circ@count at a<2 \pgf at circ@count at a=2\fi %
+ \ifnum\pgf at circ@count at b=0 \pgf at circ@count at b=\pgf at circ@count at a\fi%
+ \pgf at circ@ieeestd at stdH
+ \multiply\pgf at circ@res at temp by 2\relax% full height
+ \divide\pgf at circ@res at temp by \pgf at circ@count at b % the pin spacing
+ \pgfmathsetlength{\pgf at circ@res at other}{(\pgf at circ@count at a/2)*\pgf at circ@res at temp} %top of the rack/port
+ % \typeout{RACK-\thisshape\space\the\pgf at circ@res at other}
+}
+%%
+\def\pgf at circ@find at ieeeport@up{% leave it in up
+ % Normal port limits
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at circ@res at up}{\pgf at circ@res at temp}
+ % rack top size
+ \pgf at circ@findrackH
+ \ifdim\pgf at circ@res at other > \pgf at circ@res at up
+ \pgf at circ@res at up=\pgf at circ@res at other
+ \else
+ \fi
+}
+\def\pgf at circ@find at ieeeport@left#1{% leave it in left; #1 is type
+ % Normal port limits
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at circ@res at left}{8*\pgf at circ@res at temp/6.5}
+ \pgf at circ@res at right=\pgf at circ@res at left % save the border value
+ \pgf at circ@res at step=\pgf at circ@res at temp % save the stdH value
+ \pgf at circ@ieeestd at pinlen\advance\pgf at circ@res at left by \pgf at circ@res at temp
+ % \typeout{LEFT1-\thisshape\space L\space\the\pgf at circ@res at left\space R\space\the\pgf at circ@res at right}
+ % this is the normal left border
+ % For the or or xor port, the limit can be the pointy thing (in case the
+ % pinlen is zero or too small)
+ % add to the body margin the or/nor peak:
+ \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
+ \pgfmathsetlength{\pgf at circ@res at other}{2*\pgf at circ@res at step*(1-cos(\pgf at circ@orangle))}
+ \advance\pgf at circ@res at right by \pgf at circ@res at other
+ % \typeout{LEFT2-\thisshape\space L\space\the\pgf at circ@res at left\space R\space\the\pgf at circ@res at right}
+ \fi
+ % add to the body margin the xor/xnor distance
+ \ifnum #1 = 3\relax% "xor" or "xnor" gates.
+ \pgf at circ@ieeestd at xorbar
+ \advance\pgf at circ@res at right by \pgf at circ@res at temp
+ % \typeout{LEFT3-\thisshape\space L\space\the\pgf at circ@res at left\space R\space\the\pgf at circ@res at right}
+ \fi
+ % and if this exceeds the normal margin, this is it
+ % \typeout{LEFT4-\thisshape\space L\space\the\pgf at circ@res at left\space R\space\the\pgf at circ@res at right}
+ \ifdim \pgf at circ@res at right > \pgf at circ@res at left
+ \pgf at circ@res at left=\pgf at circ@res at right
+ \fi
+ % \typeout{LEFT5-\thisshape\space L\space\the\pgf at circ@res at left\space R\space\the\pgf at circ@res at right}
+ \pgf at circ@res at left=-\pgf at circ@res at left
+}
+\def\pgf at circ@find at ieeeport@right#1{% leave it in right; #1 is plain or negated
+ % Normal port limits
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at circ@res at right}{8*\pgf at circ@res at temp/6.5}
+ \pgf at circ@notradius
+ \pgfmathsetlength{\pgf at circ@res at other}{\pgf at circ@res at right+2*#1*\pgf at circ@res at temp}
+ \pgf at circ@ieeestd at pinlen\advance\pgf at circ@res at right by \pgf at circ@res at temp
+ \ifdim\pgf at circ@res at other > \pgf at circ@res at right
+ \pgf at circ@res at right=\pgf at circ@res at other
+ \fi
+}
+\def\pgf at circ@find at ieeeport@not at right#1{% leave it in right; #1 is plain or negated
+ % Normal port limits
+ \pgf at circ@ieeestd at stdH
+ % notice 0.8660254 is cos(30)
+ \pgfmathsetlength{\pgf at circ@res at right}{0.8660254*\pgf at circ@res at temp}
+ \pgf at circ@notradius
+ \pgfmathsetlength{\pgf at circ@res at other}{\pgf at circ@res at right+2*#1*\pgf at circ@res at temp}
+ \pgf at circ@ieeestd at pinlen\advance\pgf at circ@res at right by \pgf at circ@res at temp
+ \ifdim\pgf at circ@res at other > \pgf at circ@res at right
+ \pgf at circ@res at right=\pgf at circ@res at other
+ \fi
+}
+
+
+%%% ieeestd multi-input ports
+%%% #1: name
+%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
+%%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
+%%% #4: drawing for the port
+\long\def\pgfcircdeclareieeeport#1#2#3#4{%
+ \pgfdeclareshape{ieeestd #1 port}%
+ {%
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedmacro{\thisshape}{\def\thisshape{\tikz at fig@name}}
+ \saveddimen{\baselen}{%
+ \pgf at circ@ieeestd at baselen\pgf at x=\pgf at circ@res at temp
+ }
+ \saveddimen{\stdH}{% This is HALF the height of the inner port
+ \pgf at circ@ieeestd at stdH\pgf at x=\pgf at circ@res at temp
+ }
+ \saveddimen{\notdiameter}{
+ \pgf at circ@notradius\pgf at x=2\pgf at circ@res at temp
+ }
+ \saveddimen{\pind}{% pin distance;
+ \pgf at circ@count at a=\pgfkeysvalueof{/tikz/number inputs}\relax%
+ \pgf at circ@count at b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
+ \ifnum\pgf at circ@count at a=0 \pgf at circ@count at a=2\fi % default pins
+ \ifnum\pgf at circ@count at a<2 \pgf at circ@count at a=2\fi %
+ \ifnum\pgf at circ@count at b=0 \pgf at circ@count at b=\pgf at circ@count at a\fi%
+ \pgf at circ@ieeestd at stdH\pgf at x=2\pgf at circ@res at temp % full height
+ \divide\pgf at x by \pgf at circ@count at b
+ }
+ \saveddimen{\pinlen}{%
+ \pgf at circ@ieeestd at pinlen\pgf at x=\pgf at circ@res at temp
+ }
+ \saveddimen{\xorbar}{%
+ \pgf at circ@ieeestd at xorbar\pgf at x=\pgf at circ@res at temp
+ }
+ % anchors for the body (no pins included here)
+ \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at x}{-8*\pgf at circ@res at temp/6.5}
+ \pgfmathsetlength{\pgf at y}{\pgf at circ@res at temp}
+ }
+ \savedanchor{\topleft}{%
+ \pgf at circ@ieeestd at xorbar\pgf at circ@res at right=\pgf at circ@res at temp % save \xorbar
+ \pgf at circ@ieeestd at stdH
+ \pgf at circ@res at other=0pt\relax
+ \ifnum #2 = 2\relax% "or" or "nor" gates.
+ \pgfmathsetlength{\pgf at circ@res at other}{2*\pgf at circ@res at temp*(1-cos(\pgf at circ@orangle))}
+ \fi
+ \ifnum #2 = 3\relax% "xor" or "xnor" gates.
+ \pgfmathsetlength{\pgf at circ@res at other}{2*\pgf at circ@res at temp*(1-cos(\pgf at circ@orangle))
+ +\pgf at circ@res at right}
+ \fi
+ \pgfmathsetlength{\pgf at x}{-8*\pgf at circ@res at temp/6.5-\pgf at circ@res at other}
+ \pgfmathsetlength{\pgf at y}{\pgf at circ@res at temp}
+ }
+ \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at x}{8*\pgf at circ@res at temp/6.5}
+ \pgfmathsetlength{\pgf at y}{-\pgf at circ@res at temp}
+ }
+ \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
+ \pgf at circ@notradius\pgf at circ@res at other=\pgf at circ@res at temp
+ \pgf at circ@ieeestd at stdH
+ % #3 is =1 if the port is a negated output one
+ \pgfmathsetlength{\pgf at x}{8*\pgf at circ@res at temp/6.5+#3*2*\pgf at circ@res at other}
+ \pgfmathsetlength{\pgf at y}{-\pgf at circ@res at temp}
+ }
+ % geographical anchors --- must be rectangulars!
+ \savedanchor{\northwest}{%
+ \pgf at circ@find at ieeeport@up
+ \pgf at circ@find at ieeeport@left{#2}
+ % \typeout{ANCH5-\thisshape\space L\space\the\pgf at circ@res at left\space U\space\the\pgf at circ@res at up}
+ \pgf at x=\pgf at circ@res at left
+ \pgf at y=\pgf at circ@res at up
+ }
+ \savedanchor{\southwest}{%
+ \pgf at circ@find at ieeeport@up
+ \pgf at circ@find at ieeeport@left{#2}
+ \pgf at x=\pgf at circ@res at left
+ \pgf at y=-\pgf at circ@res at up
+ }
+ \savedanchor{\southeast}{%
+ \pgf at circ@find at ieeeport@up
+ \pgf at circ@find at ieeeport@right{#3}
+ \pgf at x=\pgf at circ@res at right
+ \pgf at y=-\pgf at circ@res at up
+ }
+ \savedanchor{\northeast}{%
+ \pgf at circ@find at ieeeport@up
+ \pgf at circ@find at ieeeport@right{#3}
+ \pgf at x=\pgf at circ@res at right
+ \pgf at y=\pgf at circ@res at up
+ }
+ \savedmacro\inputs{% get number of inputs
+ \pgf at circ@count at a=\pgfkeysvalueof{/tikz/number inputs}\relax
+ \ifnum\pgf at circ@count at a=0\pgf at circ@count at a=2\fi % default
+ \ifnum\pgf at circ@count at a<2 \pgf at circ@count at a=2\fi % minimum pins
+ % \ifnum\pgf at circ@count at a>16 \pgf at circ@count at a=16\fi
+ \def\inputs{\the\pgf at circ@count at a}%
+ }%
+ \savedmacro\inners{% get number of "inner" inputs (for racks)
+ \pgf at circ@count at a=\pgfkeysvalueof{/tikz/number inputs}\relax
+ \pgf at circ@count at b=\pgfkeysvalueof{/tikz/inner inputs}\relax
+ \ifnum\pgf at circ@count at a=0 \pgf at circ@count at a=2\fi % default pins
+ \ifnum\pgf at circ@count at a<2 \pgf at circ@count at a=2\fi % minimum pins
+ \ifnum\pgf at circ@count at b=0 \pgf at circ@count at b=\pgf at circ@count at a\fi
+ % \typeout{INNER is \the\pgf at circ@count at b}%
+ % \ifnum\pgf at circ@count at a>16 \pgf at circ@count at a=16\fi
+ \def\inners{\the\pgf at circ@count at b}%
+ }%
+ \anchor{center}{\pgfpointorigin}
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
+ \else
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at circ@res at left}{-8*\pgf at circ@res at temp/6.5} % left border
+ \pgfpoint{\pgf at circ@res at left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
+ \fi
+ }
+ % create input anchors
+ \expandafter\pgfutil at g@addto at macro\csname pgf at sh@s at ieeestd #1 port\endcsname{%
+ \pgf at circ@count at a=\inputs
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf at circ@count at a%
+ \else%
+ %\pgfutil at ifundefined{pgf at anchor@american #1 port at in \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf at anchor@ieeestd #1 port at in \pgfmathcounter\endcsname{%
+ \noexpand\pgf at circ@ieeeport at input{\pgfmathcounter}% defined above
+ }%
+ \expandafter\xdef\csname pgf at anchor@ieeestd #1 port at bin \pgfmathcounter\endcsname{%
+ \noexpand\pgf at circ@ieeeport at baseinput{\pgfmathcounter}{#2}% defined above
+ }%
+ \ifnum #2 = 3\relax % xor/xnor inner border pins
+ \expandafter\xdef\csname pgf at anchor@ieeestd #1 port at ibin \pgfmathcounter\endcsname{%
+ \noexpand\pgf at circ@ieeeport at innerbaseinput{\pgfmathcounter}% defined above
+ }%
+ \fi
+ %}{}%
+ \repeatpgfmathloop%
+ }
+ % output anchor
+ \anchor{out}{%
+ \pgfextractx{\pgf at circ@res at other}{\bodyright} %body border, without not ball
+ \advance\pgf at circ@res at other by\pinlen
+ \pgfextractx{\pgf at circ@res at temp}{\bottomright} %body + ball border
+ \ifdim \pgf at circ@res at temp > \pgf at circ@res at other
+ \pgf at circ@res at other = \pgf at circ@res at temp % do not enter in the ball...
+ \fi
+ \pgf at x=\pgf at circ@res at other\pgf at y=0pt
+ }
+ \anchor{bout}{\bottomright\pgf at y=0pt}
+
+ \anchor{body right}{\bodyright\pgf at y=0pt}
+ \anchor{right}{\bottomright\pgf at y=0pt}
+ \anchor{body left}{\bodyleft\pgf at y=0pt}% central edge of the body
+ \anchor{left}{% central edge of the component
+ \bodyleft\pgf at y=0pt
+ \ifnum #2=3\relax
+ \advance\pgf at x by -\xorbar
+ \fi
+ }
+ \anchor{up}{%
+ \bodyleft
+ \ifnum #2 > 1 % pointy shapes
+ \pgf at circ@ieeestd at stdH
+ % horizontal coordinate where the right semicircle starts
+ \pgfmathsetlength{\pgf at circ@res at other}{-8*\pgf at circ@res at temp/6.5+2*\pgf at circ@res at temp*cos(\pgf at circ@orangle)}
+ % vertical drop of the circle at the above coordinate
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at temp*(1-cos(atan(\pgf at circ@res at other/(2*\pgf at circ@res at temp))))}
+ \advance \pgf at y by -\pgf at circ@res at step
+ \fi
+ \pgf at x=0pt
+ }
+ \anchor{down}{%
+ \bodyleft
+ \ifnum #2 > 1 % pointy shapes
+ \pgf at circ@ieeestd at stdH
+ % horizontal coordinate where the right semicircle starts
+ \pgfmathsetlength{\pgf at circ@res at other}{-8*\pgf at circ@res at temp/6.5+2*\pgf at circ@res at temp*cos(\pgf at circ@orangle)}
+ % vertical drop of the circle at the above coordinate
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at temp*(1-cos(atan(\pgf at circ@res at other/(2*\pgf at circ@res at temp))))}
+ \advance \pgf at y by -\pgf at circ@res at step
+ \fi
+ \pgf at y=-\pgf at y\pgf at x=0pt
+ }
+
+ % geographical anchors
+ \anchor{nw}{\northwest}
+ \anchor{ne}{\northeast}
+ \anchor{se}{\southeast}
+ \anchor{sw}{\southwest}
+ \anchor{north west}{\northwest}
+ \anchor{north east}{\northeast}
+ \anchor{south east}{\southeast}
+ \anchor{south west}{\southwest}
+ % over 0,0 even if asymmetric
+ % will break if the geocoords are not rectangular
+ \anchor{n}{\northwest\pgf at x=0pt\relax}
+ \anchor{e}{\northeast\pgf at y=0pt\relax}
+ \anchor{s}{\southwest\pgf at x=0pt\relax}
+ \anchor{w}{\northwest\pgf at y=0pt\relax}
+ \anchor{north}{\northwest\pgf at x=0pt\relax}
+ \anchor{east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south}{\southwest\pgf at x=0pt\relax}
+ \anchor{west}{\northwest\pgf at y=0pt\relax}
+
+ \backgroundpath{
+ \pgfscope
+ \pgfsetcolor{\ctikzvalof{color}}
+ #4
+ \endpgfscope
+ % output lead:
+ \pgfextractx{\pgf at circ@res at right}{\bottomright} %body+ball border
+ \pgfextractx{\pgf at circ@res at other}{\bodyright} %body border, without "not" ball
+ \advance\pgf at circ@res at other by \pinlen\relax
+ \ifdim \pgf at circ@res at other > \pgf at circ@res at right
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \fi
+ \ifnum #3=1\relax\pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ }
+ }
+}
+
+%%% #1 direct name #2 negated name #3 type #4 drawing (without output)
+\long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
+ \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
+ \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
+}
+%
+% ieeestd "and" and "nand"
+%
+\pgfcircdeclareieeeportpair{and}{nand}{1}{%
+ \pgf at circ@count at a = \inputs\relax
+ \pgfmathsetlength{\pgf at circ@res at up}{(\inputs/2)*\pind} %top of the rack/port
+ \pgfmathsetlength{\pgf at circ@res at temp}{\pgf at circ@res at up+0.5*\pind}
+ \pgfextractx{\pgf at circ@res at left}{\bodyleft}
+ \pgfextracty{\pgf at circ@res at down}{\bodyleft}
+ \ifpgfcirc at draw@leads
+ %input leads --- all the same for AND ports
+ \loop\ifnum\pgf at circ@count at a>0
+ \advance\pgf at circ@res at temp by -\pind
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}%
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pinlen}{\pgf at circ@res at temp}}%
+ \advance\pgf at circ@count at a by -1
+ \repeat
+ \fi
+ \pgfusepath{draw}
+ %% Body. let's start from the top left
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
+ \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
+ \pgfpatharc{90}{-90}{\stdH}
+ \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ % rack now; skip if not needed.
+ % \typeout{WHAT\space \inputs\space \inners}
+ \ifnum\inputs>\inners
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \fi
+ \endpgfscope
+}
+%
+% or/nor and xor/xnor are practically the same. Let factor out everything
+% the argument #1 is put just before the drawing of the inner pins
+% the argument #2 is put after the drawing of the body
+%
+\long\def\pgf at circ@ieeeport at orxor#1#2{%
+ \pgf at circ@count at a = \inputs\relax
+ \pgfmathsetlength{\pgf at circ@res at up}{(\inputs/2)*\pind} %top of the rack/port
+ \pgfmathsetlength{\pgf at circ@res at temp}{\pgf at circ@res at up+0.5*\pind}
+ \pgfextractx{\pgf at circ@res at left}{\bodyleft}
+ \pgfextracty{\pgf at circ@res at down}{\bodyleft}
+ % rack (extended) pins; they are the same for all the ports
+ % call K = (inputs-inner)/2, rounded up; pins on the rack are:
+ % above: 1..K (included)
+ % below: inputs-K..inputs
+ % Find the pins on the rack; they are 1...
+ \pgf at circ@count at b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
+ \pgf at circ@count at c=\numexpr \inputs - \pgf at circ@count at b +1 \relax % =inputs - K +1
+ \ifpgfcirc at draw@leads
+ %input leads --- for or ports
+ \loop\ifnum\pgf at circ@count at a>0
+ \pgfextractx{\pgf at circ@res at right}{\topleft}
+ \advance\pgf at circ@res at temp by -\pind
+ % this is the height; let's find the "right" position
+ \ifnum \pgf at circ@count at a > \pgf at circ@count at b \ifnum \pgf at circ@count at a < \pgf at circ@count at c
+ % inner pins
+ % \typeout{INNER\space\pgf at circ@count at a}
+ \pgfmathsetlength{\pgf at circ@res at right}{\pgf at circ@res at left-2*\stdH*(1-cos(atan(\pgf at circ@res at temp/(2*\stdH))))}
+ % hook for xor/xnor
+ #1
+ \fi\fi
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at temp}}%
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pinlen}{\pgf at circ@res at temp}}%
+ \pgfusepath{draw}
+ \advance\pgf at circ@count at a by -1
+ \repeat
+ \fi
+ %% Body. let's start from the top left
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ % it should start here, but with this trick the close comes out better.
+ % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf at circ@orangle))}{\stdH}}
+ \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
+ \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf at circ@orangle)}{\stdH}} %
+ \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
+ \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf at circ@orangle)}{-\stdH}}
+ \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf at circ@orangle))}{-\stdH}}
+ %% this should be 2 and 2; but the round part is not a perfect circle that way
+ %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
+ \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf at circ@orangle))}{\stdH}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ % hook for xor/xnor
+ #2
+ % rack now; skip if not needed.
+ % \typeout{WHAT\space \inputs\space \inners}
+ \ifnum\inputs>\inners
+ \pgfextractx{\pgf at circ@res at left}{\topleft}
+ \pgfextracty{\pgf at circ@res at down}{\topleft}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at down}}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \fi
+ \endpgfscope
+}
+%
+% ieeestd "or" and "nor"
+%
+\pgfcircdeclareieeeportpair{or}{nor}{2}{%
+ \pgf at circ@ieeeport at orxor{}{}
+}
+\pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
+ \pgf at circ@ieeeport at orxor{
+ \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
+ \ifnum\@@tmp=0\relax
+ % move pin start to the left to leave the xor gap free (not standard)
+ \advance\pgf at circ@res at right by -\xorbar
+ \fi
+ }{%
+ % add the xor/xnor bar
+ \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf at circ@orangle))}{-\stdH}}
+ % see the comment on the main body about the 2.2
+ \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf at circ@orangle))}{\stdH}}
+ \pgfusepath{draw}
+ }
+}
+%
+% Buffer and inverters
+%
+% #1: name
+% #2: polarity
+% #3: content
+\long\def\pgfcircdeclareieeebufferport#1#2#3{%
+ \pgfdeclareshape{ieeestd #1 port}%
+ {%
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedmacro{\thisshape}{\def\thisshape{\tikz at fig@name}}
+ \saveddimen{\baselen}{%
+ \pgf at circ@ieeestd at baselen\pgf at x=\pgf at circ@res at temp
+ }
+ \saveddimen{\stdH}{% This is HALF the height of the inner port
+ \pgf at circ@ieeestd at stdH\pgf at x=\pgf at circ@res at temp
+ }
+ \saveddimen{\notdiameter}{
+ \pgf at circ@notradius\pgf at x=2\pgf at circ@res at temp
+ }
+ \saveddimen{\pinlen}{%
+ \pgf at circ@ieeestd at pinlen\pgf at x=\pgf at circ@res at temp
+ }
+ % anchors for the body (no pins included here)
+ % Notice that 0.8660254 is cos(30)
+ \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at x}{-0.8660254*\pgf at circ@res at temp}
+ \pgfmathsetlength{\pgf at y}{\pgf at circ@res at temp}
+ }
+ \savedanchor{\topleft}{%
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at x}{-0.8660254*\pgf at circ@res at temp}
+ \pgfmathsetlength{\pgf at y}{\pgf at circ@res at temp}
+ }
+ \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at x}{0.8660254*\pgf at circ@res at temp}
+ \pgfmathsetlength{\pgf at y}{\pgf at circ@res at temp}
+ }
+ \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
+ \pgf at circ@notradius\pgf at circ@res at other=\pgf at circ@res at temp
+ \pgf at circ@ieeestd at stdH
+ % #2 is =1 if the port is a negated output one
+ \pgfmathsetlength{\pgf at x}{0.8660254*\pgf at circ@res at temp+#2*2*\pgf at circ@res at other}
+ \pgfmathsetlength{\pgf at y}{-\pgf at circ@res at temp}
+ }
+ % geographical anchors --- must be rectangulars!
+ \savedanchor{\northwest}{%
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at x}{-0.8660254*\pgf at circ@res at temp}
+ \pgfmathsetlength{\pgf at y}{\pgf at circ@res at temp}
+ }
+ \savedanchor{\southwest}{%
+ \pgf at circ@ieeestd at stdH
+ \pgfmathsetlength{\pgf at x}{-0.8660254*\pgf at circ@res at temp}
+ \pgfmathsetlength{\pgf at y}{-\pgf at circ@res at temp}
+ }
+ \savedanchor{\southeast}{%
+ \pgf at circ@ieeestd at stdH
+ \pgf at circ@res at up=\pgf at circ@res at temp
+ \pgf at circ@find at ieeeport@not at right{#2}
+ \pgf at x=\pgf at circ@res at right
+ \pgf at y=-\pgf at circ@res at up
+ }
+ \savedanchor{\northeast}{%
+ \pgf at circ@ieeestd at stdH
+ \pgf at circ@res at up=\pgf at circ@res at temp
+ \pgf at circ@find at ieeeport@not at right{#2}
+ \pgf at x=\pgf at circ@res at right
+ \pgf at y=\pgf at circ@res at up
+ }
+ \anchor{center}{\pgfpointorigin}
+ \anchor{text}{
+ \ifpgf at circ@center at text
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
+ \else
+ \pgf at circ@ieeestd at stdH
+ \pgfpoint{-0.8660254*\pgf at circ@res at temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
+ \fi
+ }
+ % input anchors
+ \anchor{in}{\bodyleft\pgf at y=0pt\advance\pgf at x by-\pinlen}
+ \anchor{in 1}{\bodyleft\pgf at y=0pt\advance\pgf at x by-\pinlen}
+ \anchor{bin}{\bodyleft\pgf at y=0pt\relax}
+ \anchor{bin 1}{\bodyleft\pgf at y=0pt\relax}
+ % output anchors
+ \anchor{out}{%
+ \pgfextractx{\pgf at circ@res at other}{\bodyright} %body border, without not ball
+ \advance\pgf at circ@res at other by\pinlen
+ \pgfextractx{\pgf at circ@res at temp}{\bottomright} %body + ball border
+ \ifdim \pgf at circ@res at temp > \pgf at circ@res at other
+ \pgf at circ@res at other = \pgf at circ@res at temp % do not enter in the ball...
+ \fi
+ \pgf at x=\pgf at circ@res at other\pgf at y=0pt
+ }
+ \anchor{bout}{\bottomright\pgf at y=0pt}
+
+ \anchor{body right}{\bodyright\pgf at y=0pt}
+ \anchor{right}{\bottomright\pgf at y=0pt}
+ \anchor{body left}{\bodyleft\pgf at y=0pt}% central edge of the body
+ \anchor{left}{% central edge of the component
+ \pgf at circ@ieeestd at xorbar% save \xorbar in temp
+ \bodyleft\pgf at y=0pt\advance\pgf at x by -\pgf at circ@res at temp
+ }
+ \anchor{up}{%
+ \bodyleft
+ \pgf at y=+0.5\pgf at y\pgf at x=0pt
+ }
+ \anchor{down}{%
+ \bodyleft
+ \pgf at y=-0.5\pgf at y\pgf at x=0pt
+ }
+
+ % geographical anchors
+ \anchor{nw}{\northwest}
+ \anchor{ne}{\northeast}
+ \anchor{se}{\southeast}
+ \anchor{sw}{\southwest}
+ \anchor{north west}{\northwest}
+ \anchor{north east}{\northeast}
+ \anchor{south east}{\southeast}
+ \anchor{south west}{\southwest}
+ % over 0,0 even if asymmetric
+ % will break if the geocoords are not rectangular
+ \anchor{n}{\northwest\pgf at x=0pt\relax}
+ \anchor{e}{\northeast\pgf at y=0pt\relax}
+ \anchor{s}{\southwest\pgf at x=0pt\relax}
+ \anchor{w}{\northwest\pgf at y=0pt\relax}
+ \anchor{north}{\northwest\pgf at x=0pt\relax}
+ \anchor{east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south}{\southwest\pgf at x=0pt\relax}
+ \anchor{west}{\northwest\pgf at y=0pt\relax}
+
+ \backgroundpath{
+ \pgfscope
+ \pgfsetcolor{\ctikzvalof{color}}
+ #3
+ \endpgfscope
+ % output lead:
+ \pgfextractx{\pgf at circ@res at right}{\bottomright} %body+ball border
+ \pgfextractx{\pgf at circ@res at other}{\bodyright} %body border, without "not" ball
+ \advance\pgf at circ@res at other by \pinlen\relax
+ \ifdim \pgf at circ@res at other > \pgf at circ@res at right
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \fi
+ \ifnum #2=1\relax\pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ }
+ }
+}
+
+%%% #1 direct name #2 negated name #3 drawing (without output)
+\long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
+ \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
+ \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
+}
+
+\pgfcircdeclareieeebufferportpair{buffer}{not}{%
+ \pgfextractx{\pgf at circ@res at left}{\bodyleft}
+ \pgfextracty{\pgf at circ@res at up}{\bodyleft}
+ \pgfextractx{\pgf at circ@res at right}{\bodyright}
+ % \draw input pin
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pinlen}{0pt}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+}
+
+\pgfcircdeclareieeebufferportpair{schmitt}{inv schmitt}{%
+ \pgfextractx{\pgf at circ@res at left}{\bodyleft}
+ \pgfextracty{\pgf at circ@res at up}{\bodyleft}
+ \pgfextractx{\pgf at circ@res at right}{\bodyright}
+ % \draw input pin
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pinlen}{0pt}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+ % draw schmitt symbol in normal line thickness
+ \pgfpathmoveto{\pgfpoint{0.75*\pgf at circ@res at left}{-0.25*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.50*\pgf at circ@res at left}{-0.25*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.50*\pgf at circ@res at left}{0.25*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.00*\pgf at circ@res at left}{0.25*\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0.25*\pgf at circ@res at left}{0.25*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.25*\pgf at circ@res at left}{-0.25*\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0.5*\pgf at circ@res at left}{-0.25*\pgf at circ@res at up}}
+ \pgfusepath{draw}
+}
+
+
+\pgfdeclareshape{schmitt symbol}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgf at circ@ieeestd at stdH
+ \pgf at y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf at circ@res at temp
+ \pgf at x=-1.5\pgf at y
+ }
+ \anchor{center}{\pgf at y=0pt \pgf at x=0pt}
+ \anchor{east}{\northwest\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{e}{\northwest\pgf at y=0pt \pgf at x=-\pgf at x}
+ \anchor{west}{\northwest\pgf at y=0pt}
+ \anchor{w}{\northwest \pgf at y=0pt}
+ \anchor{south}{\northwest \pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{s}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{north}{\northwest\pgf at x=0pt}
+ \anchor{n}{\northwest\pgf at x=0pt}
+ \anchor{south west}{\northwest\pgf at y=-\pgf at y}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{north west}{\northwest}
+ \anchor{south east}{\northwest\pgf at x=-\pgf at x\pgf at y=-\pgf at y}
+ \backgroundpath{
+ \pgfscope
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgf at circ@res at left=0.7\pgf at circ@res at left
+ \pgf at circ@res at up=0.7\pgf at circ@res at up
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left/3}{-\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left/3}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at left/3}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at left/3}{-\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{notcirc}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgf at circ@notradius
+ \pgf at y=\pgf at circ@res at temp
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{\pgf at y=0pt \pgf at x=0pt}
+ \anchor{right}{\northwest\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{east}{\northwest\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{e}{\northwest\pgf at y=0pt \pgf at x=-\pgf at x}
+ \anchor{left}{\northwest\pgf at y=0pt}
+ \anchor{west}{\northwest\pgf at y=0pt}
+ \anchor{w}{\northwest \pgf at y=0pt}
+ \anchor{south}{\northwest \pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{s}{\northwest\pgf at x=0pt\pgf at y=-\pgf at y}
+ \anchor{north}{\northwest\pgf at x=0pt}
+ \anchor{n}{\northwest\pgf at x=0pt}
+ \anchor{south west}{\northwest\pgf at y=-\pgf at y}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{north west}{\northwest}
+ \anchor{south east}{\northwest\pgf at x=-\pgf at x\pgf at y=-\pgf at y}
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \northwest\pgf at circ@res at temp=\pgf at y
+ \pgfpointborderellipse{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}%
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \northwest\pgf at circ@res at temp=\pgf at y
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathcircle{\pgfpointorigin}{\pgf at circ@res at temp}
+ \ifx\tikz at fillcolor\pgfutil at empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ \pgf at circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \fi
+ \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+
+%%%---------- close: tex/pgfcircmultipoles
+
+%%%%%%%%%%% Springe nach tex/pgfcirclabel
+%%%---------- open: tex/pgfcirclabel.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Bipole label positioning
+
+%% bipole labels and annotation extra style
+
+\ctikzset{bipole label style/.style={}}
+\tikzset{bipole label style/.code={
+ \ctikzset{bipole label style/.style={#1}}
+}}
+\tikzset{bipole label append style/.code={
+ \ctikzset{bipole label style/.append style={#1}}
+}}
+\ctikzset{bipole annotation style/.style={}}
+\tikzset{bipole annotation style/.code={
+ \ctikzset{bipole annotation style/.style={#1}}
+}}
+\tikzset{bipole annotation append style/.code={
+ \ctikzset{bipole annotation style/.append style={#1}}
+}}
+
+%% Options
+\ctikzset{label/.style = { l=#1 } }
+\ctikzset{l/.code = {
+ \pgfkeys{/tikz/circuitikz/bipole/label/name=#1}
+ \ctikzsetvalof{bipole/label/unit}{}
+ \ifpgf at circ@siunitx
+ \pgf at circ@handleSI{#1}
+ \ifpgf at circ@siunitx at res
+ \edef\pgf at temp{\pgf at circ@handleSI at val}
+ \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf at temp}
+ \edef\pgf at temp{\pgf at circ@handleSI at unit}
+ \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf at temp}
+ \else
+ \fi
+ \else
+ \fi
+}}
+
+\ctikzset{label above/.code = {
+ l=#1,
+ \circuitikzbasekey/bipole/label/position=90 }
+}
+
+\ctikzset{l^/.style = {
+ l=#1,
+ \circuitikzbasekey/bipole/label/position=90 }
+}
+
+\ctikzset{label below/.code = {
+ l=#1,
+ \circuitikzbasekey/bipole/label/position=-90 }
+}
+
+\ctikzset{l_/.style = {
+ l=#1,
+ \circuitikzbasekey/bipole/label/position=-90 }
+}
+
+\ctikzset{annotation/.style = { a=#1 } }
+\ctikzset{a/.code = {
+ \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1}
+ \ctikzsetvalof{bipole/annotation/unit}{}
+ \ifpgf at circ@siunitx
+ \pgf at circ@handleSI{#1}
+ \ifpgf at circ@siunitx at res
+ \edef\pgf at temp{\pgf at circ@handleSI at val}
+ \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf at temp}
+ \edef\pgf at temp{\pgf at circ@handleSI at unit}
+ \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf at temp}
+ \else
+ \fi
+ \else
+ \fi
+}}
+
+\ctikzset{annotation above/.code = {
+ a=#1,
+ \circuitikzbasekey/bipole/annotation/position=90 }
+}
+
+\ctikzset{a^/.style = {
+ a=#1,
+ \circuitikzbasekey/bipole/annotation/position=90 }
+}
+
+\ctikzset{annotation below/.code = {
+ a=#1,
+ \circuitikzbasekey/bipole/annotation/position=-90 }
+}
+\ctikzset{a_/.style = {
+ a=#1,
+ \circuitikzbasekey/bipole/annotation/position=-90 }
+}
+
+% This is to adjust spacing for the labels so that they are not cramped on components
+\def\pgf at circ@ls{.75ex} % labelspace to have just one point to change
+
+\def\pgf at circ@drawlabels#1{
+ \pgfextra{
+ % This function will be called with argument #1 equal
+ % to "label" or "annotation" form pgfcircpath.tex.
+ % pgf at circ@direction is the direction of the path,
+ % its value is set in pgfcircpath.tex
+ \pgfmathsubtract{\pgf at circ@direction}{90}
+ \pgfmathround{\pgfmathresult} % avoid precision loss errors
+ \edef\pgf at circ@labanc{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+
+ \edef\pgf at circ@temp{\ctikzvalof{bipole/#1/position}}
+ \ifnum \pgf at circ@temp < 0
+ \pgfmathadd{\pgf at circ@labanc}{180}
+ \edef\pgf at circ@labanc{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ \fi
+ % \typeout{INI: TEMP\space\pgf at circ@temp\space LABANC\space\pgf at circ@labanc}
+ %
+ % normalize the angle values
+ %
+ \pgfmathmod{\pgf at circ@labanc}{360}
+ \edef\pgf at circ@labanc{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ %
+ \ifpgf at circuit@bipole at inverted
+ \pgfmathadd{\pgf at circ@temp}{180} %If shape is inverted, use opposite anchor
+ \edef\pgf at circ@temp{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ \fi
+ %
+ \ifnum \ctikzvalof{mirror value} = -1
+ \pgfmathadd{\pgf at circ@temp}{180} %If shape is mirrored, use opposite anchor
+ \edef\pgf at circ@temp{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ \fi
+ % \typeout{FIN: TEMP\space\pgf at circ@temp\space LABANC\space\pgf at circ@labanc}
+ }
+ %Firstly, place a coordinate directly at the edge of the shape
+ (\ctikzvalof{bipole/name}.\pgf at circ@temp) coordinate (labelcoor)
+ %now decide, which labels should be drawn
+ \pgfextra{
+ \edef\pgf at temp{\ctikzvalof{label/align}}
+ \def\pgf at circ@temp{straight}
+ }
+ \ifx\pgf at temp\pgf at circ@temp %straight
+ \pgf at circ@drawreglabels{#1}
+ \else
+ \pgfextra{\def\pgf at circ@temp{rotate}}
+ \ifx\pgf at temp\pgf at circ@temp %rotate
+ \pgf at circ@drawrotlabels{#1}
+ \else% smart
+ \pgf at circ@drawsmartlabels{#1}
+ \fi
+ \fi
+}
+
+
+\def\pgf at circ@drawsmartlabels#1{
+ \pgfextra{
+ \pgfmathmod{\pgf at circ@direction}{90}
+ \edef\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ }
+ \ifnum \pgfcircmathresult > 20
+ \ifnum \pgfcircmathresult < 70
+ \pgf at circ@drawrotlabels{#1}
+ \else
+ \pgf at circ@drawreglabels{#1}
+ \fi
+ \else
+ \pgf at circ@drawreglabels{#1}
+ \fi
+ }
+
+
+\def\pgf at circ@drawrotlabels#1{
+ \pgfextra{
+ % scale the distances in function of zoom, so that they are not
+ % dependent on it but on font size. Thanks to @marmot
+ % https://tex.stackexchange.com/a/476018/38080
+ % the coeffcient is adjusted so that the distance is more or less
+ % the same for rotated labels and straight ones (although it will
+ % depend on the font, so it's not exact).
+ \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
+ \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
+ % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
+ \pgfmathsetlength\pgf at circ@res at temp{1.5*\pgf at circ@ls/\myscale}
+ \ifnum \ctikzvalof{bipole/#1/position}>0
+ %we need some more space for placement below, due to mid-anchor
+ \else % we do not have <= in \ifnum...
+ \pgf at circ@res at temp=1.5\pgf at circ@res at temp
+ \fi
+ %Calculate rotation of the label from direction and strip decimals
+ \edef\pgfcirclabrot{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ % rotate the label at second or third quadrant:
+ \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
+ \pgfmathsubtract{\pgf at circ@direction}{180}
+ \edef\pgfcirclabrot{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ %invert the space relationships due to rotated strings
+ \ifnum \ctikzvalof{bipole/#1/position}>0
+ \pgf at circ@res at temp=1.5\pgf at circ@res at temp
+ \fi
+ \fi\fi
+ \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf at circ@direction+90:\pgf at circ@direction-90}
+ \edef\pgf at circ@labposangle{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ }
+ % reset cm is not working correctly here
+ (labelcoor)++(\pgf at circ@labposangle:\the\pgf at circ@res at temp) coordinate(labelcoor)
+ node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
+ (\ctikzvalof{bipole/name}#1){\pgf at circ@finallabels{#1}}
+}
+
+\def\pgf at circ@drawreglabels#1{
+ %Now calculate all shape positions
+ %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
+ %All points between will be addressed by angled-anchors:
+ \pgfextra{
+ % scale ex-distance to make it independent on scale
+ % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
+ \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
+ \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
+ % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
+ \pgfmathsetlength\pgf at circ@res at temp{\pgf at circ@ls/\myscale}
+ \pgfmathadd{\pgf at circ@labanc}{90}
+ \pgfmathround{\pgfmathresult}
+ \def\pgf at circ@labanctext{\pgf at circ@labanc}
+ \edef\pgf at circ@temp{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ \pgfmathparse{mod(\pgf at circ@temp,180)>135?mod(\pgf at circ@temp,180)-180:mod(\pgf at circ@temp,180)}
+ \edef\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ }
+ %Values around 90 are at both y-axis
+ \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
+ \pgfextra{\edef\pgf at circ@labpos{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}}
+ \ifnum \pgf at circ@labpos > 180
+ \ifnum \ctikzvalof{bipole/#1/position} > 0
+ \pgfextra{\def\pgf at circ@labanctext{mid west}}
+ \else
+ \pgfextra{\def\pgf at circ@labanctext{mid east}}
+ \fi
+ \else
+ \ifnum \ctikzvalof{bipole/#1/position} > 0
+ \pgfextra{\def\pgf at circ@labanctext{mid east}}
+ \else
+ \pgfextra{\def\pgf at circ@labanctext{mid west}}
+ \fi
+ \fi
+ \fi\fi
+ %Values between -5 and 5 are at pos /neg x-axis
+ \pgfextra{\def\uffa{}\newdimen\realshift\realshift=\dimexpr1pt\relax}
+ \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
+ \ifnum \ctikzvalof{bipole/#1/position} < 0
+ \ifnum \pgf at circ@labanc > 90
+ % using base coordinate instead of south to naturally align
+ % symbols with descendants; but this invalidate the effect of
+ % the inner sep, so recover it by shifting the anchor
+ % reset cm is not working sometime, use @marmot solution
+ % see https://tex.stackexchange.com/a/476018/38080
+ (labelcoor) ++(-\pgf at circ@labanc:\pgf at circ@res at temp) coordinate(labelcoor)
+ \pgfextra{\def\pgf at circ@labanctext{base}}%base
+ \else
+ \pgfextra{\def\pgf at circ@labanctext{north}}%north
+ \fi
+ \else
+ \ifnum \pgf at circ@labanc < 90
+ % shift, as above
+ (labelcoor) ++(-\pgf at circ@labanc:\pgf at circ@res at temp) coordinate(labelcoor)
+ \pgfextra{\def\pgf at circ@labanctext{base}}%base
+ \else
+ \ifnum \pgf at circ@labanc > 180
+ % this shouldn't happen, but somehow it does (270 degree anchors)
+ % shift, as above
+ (labelcoor) ++(-\pgf at circ@labanc:\pgf at circ@res at temp) coordinate(labelcoor)
+ \pgfextra{\def\pgf at circ@labanctext{base}}%base
+ \else
+ \pgfextra{\def\pgf at circ@labanctext{north}}%north
+ \fi
+ \fi
+ \fi
+ \fi\fi
+ (labelcoor) node[anchor=\pgf at circ@labanctext,
+ inner sep=0.5\pgf at circ@res at temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
+ ](\ctikzvalof{bipole/name}#1){\strut\pgf at circ@finallabels{#1}%
+ }
+}
+
+\def\pgf at circ@finallabels#1{%
+ \edef\pgf at temp{}%
+ \edef\pgf at circ@temp{\ctikzvalof{bipole/#1/unit}}%
+ \ifx\pgf at temp\pgf at circ@temp%
+ \ctikzvalof{bipole/#1/name}%
+ \else%
+ $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
+ \fi%
+}
+
+\ctikzset{text/.style={t=#1}}
+\ctikzset{t/.code={%
+ \ctikzsetvalof{bipoles/twoport/text}{#1}%
+}}
+
+%%%% Stacked labels
+%
+% stacked labels by Romano Giannetti romano at rgtti.com
+% heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
+% \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
+%
+% labels are in a tabular, globally aligned:
+% vertically with key l2 valign (default c)
+% c: center t: top b: bottom
+% horizontally with key l2 align (default l)
+% l: left c: centered r: right
+% you can switch sides using l2_=... and l2^=...
+% syntax is l2_ = line1 and line2 (same for l2^)
+%
+\ctikzset{%
+ l2 valign/.store in=\ltwo at valign, l2 valign=c,
+ l2 halign/.store in=\ltwo at halign, l2 halign=l,
+}
+\ctikzset{l2base/.code n args={2}{
+ \pgfkeys{/tikz/circuitikz/bipole/label/name=%
+ \bgroup
+ \setlength{\tabcolsep}{2pt}%
+ \def\ltwo at tabu{\tabular[\ltwo at valign]}%
+ \expandafter\ltwo at tabu\expandafter{\ltwo at halign}%
+ #1\\ #2%
+ \endtabular
+ \egroup
+ }%
+ \ctikzsetvalof{bipole/label/unit}{}
+ \ifpgf at circ@siunitx
+ \pgf at circ@handleSI{#2}
+ \ifpgf at circ@siunitx at res
+ \edef\pgf at temp{\pgf at circ@handleSI at val}
+ \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf at temp}
+ \edef\pgf at temp{\pgf at circ@handleSI at unit}
+ \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf at temp}
+ \else
+ \fi
+ \else
+ \fi
+}}
+\ctikzset{l2/.style args={#1 and #2}{
+ l2base={#1}{#2},
+ \circuitikzbasekey/bipole/label/position=90 }
+}
+\ctikzset{l2 above/.style args={#1 and #2}{
+ l2base={#1}{#2},
+ \circuitikzbasekey/bipole/label/position=90 }
+}
+\ctikzset{l2^/.style args={#1 and #2}{
+ l2base={#1}{#2},
+ \circuitikzbasekey/bipole/label/position=90 }
+}
+\ctikzset{l2 below/.style args={#1 and #2}{
+ l2base={#1}{#2},
+ \circuitikzbasekey/bipole/label/position=-90 }
+}
+\ctikzset{l2_/.style args={#1 and #2}{
+ l2base={#1}{#2},
+ \circuitikzbasekey/bipole/label/position=-90 }
+}
+
+%%%---------- close: tex/pgfcirclabel
+%%%%%%%%%%% Springe nach tex/pgfcircvoltage
+%%%---------- open: tex/pgfcircvoltage.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Voltage management
+
+%% styles
+\ctikzset{bipole voltage style/.style={}}
+\tikzset{bipole voltage style/.code={
+ \ctikzset{bipole voltage style/.style={#1}}
+}}
+\tikzset{bipole voltage append style/.code={
+ \ctikzset{bipole voltage style/.append style={#1}}
+}}
+
+\ctikzset{v^>/.style = {
+ v = #1,
+ \circuitikzbasekey/bipole/voltage/direction = forward,
+ \circuitikzbasekey/bipole/voltage/position = above
+ }
+}
+
+\ctikzset{v^</.style = {
+ v = #1,
+ \circuitikzbasekey/bipole/voltage/direction = backward,
+ \circuitikzbasekey/bipole/voltage/position = above
+ }
+}
+
+\ctikzset{v_>/.style = {
+ v = #1,
+ \circuitikzbasekey/bipole/voltage/direction = forward,
+ \circuitikzbasekey/bipole/voltage/position = below
+ }
+}
+
+\ctikzset{v_</.style = {
+ v = #1,
+ \circuitikzbasekey/bipole/voltage/direction = backward,
+ \circuitikzbasekey/bipole/voltage/position = below
+ }
+}
+
+\ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = below} }
+\ctikzset{v^/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = above} }
+\ctikzset{v>/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} }
+\ctikzset{v</.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = backward} }
+
+% Default position varies whether the component is a voltage source
+% or not
+\ctikzset{v/.code = {
+ \ifpgf at circuit@bipole at isvoltage
+ \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
+ \circuitikzbasekey/bipole/voltage/direction=forward}
+ \else
+ \ifpgf at circ@oldvoltagedirection
+ \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
+ \circuitikzbasekey/bipole/voltage/direction=backward}
+ \else
+ \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
+ \circuitikzbasekey/bipole/voltage/direction=forward}
+ \fi
+ \fi
+ \ifpgf at circ@oldvoltagedirection
+ \ifpgf at circuit@bipole at iscurrent\ifpgf at circ@fixbatteries
+ \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
+ \circuitikzbasekey/bipole/voltage/direction=forward}
+ \fi\fi
+ \else
+ \ifpgf at circuit@bipole at iscurrent
+ \ifpgf at circuit@bipole at current@backward
+ \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
+ \circuitikzbasekey/bipole/voltage/direction=forward}
+ \else
+ \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
+ \circuitikzbasekey/bipole/voltage/direction=backward}
+ \fi\fi\fi
+ \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name=#1}
+ \ctikzsetvalof{bipole/voltage/label/unit}{}
+ \ifpgf at circ@siunitx
+ \pgf at circ@handleSI{#1}
+ \ifpgf at circ@siunitx at res
+ \edef\pgf at temp{\pgf at circ@handleSI at val}
+ \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf at temp}
+ \edef\pgf at temp{\pgf at circ@handleSI at unit}
+ \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf at temp}
+ \else
+ \fi
+ \else
+ \fi
+ }
+}
+
+% american voltage font selection and symbol definition
+% the default font command is {} --- nothing
+\def\pgf at circ@avfont{\ctikzvalof{voltage/american font}}
+%
+% plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex)
+%
+\def\pgf at circ@avplus{\ctikzvalof{voltage/american plus}}
+\def\pgf at circ@avminus{\ctikzvalof{voltage/american minus}}
+
+%%
+\def\setscaledRlenforclass{%
+ \csname pgf at sh@ma@\ctikzvalof{bipole/name}\endcsname
+ \ifdefined\ctikzclass
+ \edef\pgf at temp{/tikz/circuitikz/\ctikzclass/scale}
+ \pgfkeysifdefined{\pgf at temp}
+ {\pgf at circ@scaled at Rlen=\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ {\pgf at circ@scaled at Rlen=\pgf at circ@Rlen}
+ \else
+ \pgf at circ@scaled at Rlen=\pgf at circ@Rlen
+ \fi
+}
+
+%% Output routine for generic bipoles
+
+\def\pgf at circ@drawvoltagegeneric{
+ \pgfextra{
+ % \typeout{NAME:\ctikzvalof{bipole/name}}
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
+ \pgfkeysifdefined{\pgf at temp}
+ {
+ \edef\partheight{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}
+ \edef\tmpdistfromline{(\partheight\pgf at circ@scaled at Rlen)}
+ }
+ {
+ \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance}
+ {
+ \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}}
+ \edef\tmpdistfromline{(\partheight\pgf at circ@scaled at Rlen)}
+ }
+ {%calculate default value from part height
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
+ \pgfkeysifdefined{\pgf at temp}
+ {
+ \edef\partheight{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
+ \edef\tmpdistfromline{(\partheight\pgf at circ@scaled at Rlen+0.2\pgf at circ@scaled at Rlen)}
+ }
+ {
+ \edef\tmpdistfromline{(.5\pgf at circ@scaled at Rlen)} %fallback to fixed value
+ }
+ }
+ }
+ % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf at circ@Rlen\space SCALED:\the\pgf at circ@scaled at Rlen}
+ \ifnum \ctikzvalof{mirror value}=-1
+ \ifpgf at circuit@bipole at inverted
+ \ifpgf at circuit@bipole at voltage@straight
+ \def\distfromline{\tmpdistfromline}
+ \else
+ \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf at circ@scaled at Rlen}
+ \fi
+ \else
+ \ifpgf at circuit@bipole at voltage@straight
+ \def\distfromline{-\tmpdistfromline}
+ \else
+ \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf at circ@scaled at Rlen}
+ \fi
+ \fi
+ \else
+ \ifpgf at circuit@bipole at inverted
+ \ifpgf at circuit@bipole at voltage@straight
+ \def\distfromline{-\tmpdistfromline}
+ \else
+ \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf at circ@scaled at Rlen}
+ \fi
+ \else
+ \ifpgf at circuit@bipole at voltage@straight
+ \def\distfromline{\tmpdistfromline}
+ \else
+ \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf at circ@scaled at Rlen}
+ \fi
+ \fi
+ \fi
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@voltage at angle{90}
+ \else
+ \def\pgf at circ@voltage at angle{-90}
+ \fi
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
+ \pgfkeysifdefined{\pgf at temp}
+ { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
+ { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
+ \pgfkeysifdefined{\pgf at temp}
+ { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
+ { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
+ \edef\shiftv{\ctikzvalof{voltage/shift}}
+ % additional per-bipole voltage shift (internal)
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}
+ \pgfkeysifdefined{\pgf at temp}
+ {
+ \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}}
+ }
+ {
+ \edef\addvshift{0}
+ }
+ \newdimen{\absvshift}
+ \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
+ % put this to true to see the voltage label coordinate anchors
+ \newif\ifpgf at circ@debugv\pgf at circ@debugvfalse
+ }
+ % %\pgf at circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
+ coordinate (pgfcirc at midtmp) at ($(\tikztostart) ! \pgf at circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead
+ coordinate (pgfcirc at midtmp) at ($(pgfcirc at midtmp) ! \distancefromnode ! (anchorstartnode)$)
+ coordinate (pgfcirc at Vfrom@flat) at (pgfcirc at midtmp)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at midtmp) ! -\distfromline ! \pgf at circ@voltage at angle:(anchorstartnode)$)
+
+ coordinate (pgfcirc at midtmp) at ($(\tikztotarget) ! \pgf at circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead
+ coordinate (pgfcirc at midtmp) at ($(pgfcirc at midtmp) ! \distancefromnode ! (anchorendnode)$)
+ coordinate (pgfcirc at Vto@flat) at (pgfcirc at midtmp)
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at midtmp) ! \distfromline ! \pgf at circ@voltage at angle : (anchorendnode)$)
+
+ \ifpgf at circuit@bipole at voltage@below
+ \ifpgf at circ@debugv
+ node [ocirc, fill=red] at (anchorstartnode) {}
+ node [ocirc, fill=blue] at (anchorendnode) {}
+ node [ocirc, fill=green] at (pgfcirc at Vto) {}
+ node [ocirc, fill=yellow] at (pgfcirc at Vfrom) {}
+ node [odiamondpole, fill=green!50!black] at (pgfcirc at Vto@flat) {}
+ node [odiamondpole, fill=orange] at (pgfcirc at Vfrom@flat) {}
+ \fi
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!90 : (anchorendnode)$)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
+ coordinate (pgfcirc at Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
+ coordinate (pgfcirc at Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
+ coordinate (pgfcirc at Vcont1) at ($(pgfcirc at Vcont1t) ! -\absvshift!90 : (pgfcirc at Vcont2t)$)
+ coordinate (pgfcirc at Vcont2) at ($(pgfcirc at Vcont2t) ! -\absvshift!-90 : (pgfcirc at Vcont1t)$)
+ \ifpgf at circ@debugv
+ node [odiamondpole, fill=green] at (pgfcirc at Vto) {}
+ node [odiamondpole, fill=yellow] at (pgfcirc at Vfrom) {}
+ node [osquarepole, fill=red] at (pgfcirc at Vcont1) {}
+ node [osquarepole, fill=blue] at (pgfcirc at Vcont2) {}
+ \fi
+ \else
+ \ifpgf at circ@debugv
+ node [ocirc, fill=red] at (anchorstartnode) {}
+ node [ocirc, fill=blue] at (anchorendnode) {}
+ node [ocirc, fill=green] at (pgfcirc at Vto) {}
+ node [ocirc, fill=yellow] at (pgfcirc at Vfrom) {}
+ node [odiamondpole, fill=green] at (pgfcirc at Vto@flat) {}
+ node [odiamondpole, fill=yellow] at (pgfcirc at Vfrom@flat) {}
+ \fi
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! -\absvshift!90 : (anchorendnode)$)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$)
+ coordinate (pgfcirc at Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
+ coordinate (pgfcirc at Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
+ coordinate (pgfcirc at Vcont1) at ($(pgfcirc at Vcont1t) ! \absvshift!90 : (pgfcirc at Vcont2t)$)
+ coordinate (pgfcirc at Vcont2) at ($(pgfcirc at Vcont2t) ! \absvshift!-90 : (pgfcirc at Vcont1t)$)
+ \ifpgf at circ@debugv
+ node [odiamondpole, fill=green] at (pgfcirc at Vto) {}
+ node [odiamondpole, fill=yellow] at (pgfcirc at Vfrom) {}
+ node [osquarepole, fill=red] at (pgfcirc at Vcont1) {}
+ node [osquarepole, fill=blue] at (pgfcirc at Vcont2) {}
+ \fi
+ \fi
+
+ \ifpgf at circuit@europeanvoltage
+ \ifpgf at circuit@bipole at voltage@straight
+ \ifpgf at circuit@bipole at voltage@backward
+ (pgfcirc at Vto) --(pgfcirc at Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
+ \else
+ (pgfcirc at Vfrom) --(pgfcirc at Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
+ \fi
+ \else
+ \ifpgf at circuit@bipole at voltage@backward
+ (pgfcirc at Vto) .. controls (pgfcirc at Vcont2) and (pgfcirc at Vcont1) ..
+ node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
+ (pgfcirc at Vfrom)
+ \else
+ (pgfcirc at Vfrom) .. controls (pgfcirc at Vcont1) and (pgfcirc at Vcont2) ..
+ node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
+ (pgfcirc at Vto)
+ \fi
+ \fi
+ \else % american
+ \ifx\@@kind\@@open % open circuit; put + and - directly on it
+ \ifpgf at circuit@bipole at voltage@backward
+ \ifpgf at circ@oldvoltagedirection
+ (pgfcirc at Vfrom@flat) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=center]{\pgf at circ@avplus}
+ (pgfcirc at Vto@flat) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=center]{\pgf at circ@avminus}
+ \else
+ (pgfcirc at Vfrom@flat) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=center]{\pgf at circ@avminus}
+ (pgfcirc at Vto@flat) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=center]{\pgf at circ@avplus}
+ \fi
+ \else
+ \ifpgf at circ@oldvoltagedirection
+ (pgfcirc at Vfrom@flat) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=center]{\pgf at circ@avminus}
+ (pgfcirc at Vto@flat) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=center]{\pgf at circ@avplus}
+ \else
+ (pgfcirc at Vfrom@flat) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=center]{\pgf at circ@avplus}
+ (pgfcirc at Vto@flat) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=center]{\pgf at circ@avminus}
+ \fi
+ \fi
+ \else % not open circuit
+ \ifpgf at circuit@bipole at voltage@backward
+ \ifpgf at circ@oldvoltagedirection
+ (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
+ (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
+ \else
+ (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
+ (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
+ \fi
+ \else
+ \ifpgf at circ@oldvoltagedirection
+ (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
+ (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
+ \else
+ (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
+ (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+%% Output routine for voltage sources
+\def\pgf at circ@drawvoltagegenerator{
+ % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
+ % it's not perfect, but I can't find the way to do it correctly...
+ \pgfextra{
+ \edef\shiftv{\ctikzvalof{voltage/shift}}
+ \edef\bumpa{\ctikzvalof{voltage/bump a}}
+ \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
+ }
+ \ifpgf at circuit@bipole at voltage@below
+ coordinate (pgfcirc at Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
+ coordinate (pgfcirc at Vto) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
+ \else
+ coordinate (pgfcirc at Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
+ coordinate (pgfcirc at Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
+ \fi
+ % fix the (unused in this case) Vcont1/2 coords for label placement along the line
+ coordinate (pgfcirc at Vcont1) at (pgfcirc at Vto)
+ coordinate (pgfcirc at Vcont2) at (pgfcirc at Vfrom)
+ \ifpgf at circuit@europeanvoltage
+ \ifpgf at circuit@bipole at voltage@backward
+ (pgfcirc at Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc at Vfrom)
+ \else
+ (pgfcirc at Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc at Vto)
+ \fi
+ \else% american voltage
+ \ifpgf at circuit@bipole at voltageoutsideofsymbol
+ % if it is a battery, must put + and -
+
+ \ifpgf at circ@fixbatteries
+ \ifpgf at circuit@bipole at voltage@backward
+ (pgfcirc at Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
+ (pgfcirc at Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
+ \else
+ (pgfcirc at Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
+ (pgfcirc at Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
+ \fi
+ \else
+ \ifpgf at circuit@bipole at voltage@backward
+ (pgfcirc at Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
+ (pgfcirc at Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
+ \else
+ (pgfcirc at Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
+ (pgfcirc at Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+%% Output routine
+%% this is the entry point
+%%
+\def\pgf at circ@drawvoltage{% node name
+ \pgfextra{ %WARNING: indentation is probably wrong
+ \edef\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
+ \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{north west}
+ \else
+ \def\pgf at circ@bipole at voltage@label at anchor{south east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{west}
+ \else
+ \def\pgf at circ@bipole at voltage@label at anchor{east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{south west}
+ \else \def\pgf at circ@bipole at voltage@label at anchor{north east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{south}
+ \else\def\pgf at circ@bipole at voltage@label at anchor{north}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{south east}
+ \else\def\pgf at circ@bipole at voltage@label at anchor{north west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{east}
+ \else \def\pgf at circ@bipole at voltage@label at anchor{west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{north east}
+ \else\def\pgf at circ@bipole at voltage@label at anchor{south west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{north}
+ \else\def\pgf at circ@bipole at voltage@label at anchor{south}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at anchor{north}
+ \else\def\pgf at circ@bipole at voltage@label at anchor{south}
+ \fi
+ \fi\fi
+
+ % this must be set *before* changing for mirroring and inverting; in that case
+ % the xscale/yscale parameters take it into account
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at where{-90}
+ \else
+ \def\pgf at circ@bipole at voltage@label at where{90}
+ \fi
+
+ % magic to counteract the scale and yscale effects (there should be a better way...)
+ \ifnum \ctikzvalof{mirror value}=-1
+ \ifpgf at circuit@bipole at voltage@below
+ \pgf at circuit@bipole at voltage@belowfalse
+ \else
+ \pgf at circuit@bipole at voltage@belowtrue
+ \fi
+ \fi
+
+ \ifpgf at circuit@bipole at inverted
+ \ifpgf at circuit@bipole at voltage@below
+ \pgf at circuit@bipole at voltage@belowfalse
+ \else
+ \pgf at circuit@bipole at voltage@belowtrue
+ \fi
+ \fi
+
+ % take into account scaling
+ \setscaledRlenforclass
+
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
+ \pgfkeysifdefined{\pgf at temp}
+ { \edef\eudist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}} }
+ { \edef\eudist{\ctikzvalof{voltage/european label distance}} }
+ % find the height of the bipole or use a default value
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
+ \pgfkeysifdefined{\pgf at temp}
+ {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
+ \edef\partheight{\partheightf\pgf at circ@scaled at Rlen}}
+ {\edef\partheight{(.5\pgf at circ@scaled at Rlen)}} %fallback to fixed value
+ \newdimen{\alshift}
+ % this is more or less the same of the legacy code; we shift the american label a bit
+ % outside the (+) -- (-) line
+ \pgfmathsetlength{\alshift}{(\ctikzvalof{voltage/american label distance}-0.6)*\partheight}
+ \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
+ % set the macro for detecting open
+ \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
+ \ifpgf at adjust@open at voltage\else\edef\@@open{this-will-nEver-match}\fi
+ % \typeout{KIND\space\@@kind}
+ }%end pgfextra
+
+ \ifpgf at circuit@bipole at isvoltage
+ \pgf at circ@drawvoltagegenerator
+ \else
+ \pgf at circ@drawvoltagegeneric
+ \fi
+
+ % \pgfextra{\typeout{LABEL\space KIND:\@@kind\space OPEN:\@@open}}
+
+ \ifpgf at circuit@bipole at voltage@straight
+ coordinate (Vlab) at ($(pgfcirc at Vto)!0.5!(pgfcirc at Vfrom) $)
+ node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
+ \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
+ at (Vlab) {\pgf at circ@finallabels{voltage/label}}
+ \else
+ \ifpgf at circuit@europeanvoltage
+ coordinate (Vlab) at ($(pgfcirc at Vcont1)!0.5!(pgfcirc at Vcont2)$)
+ \else
+ coordinate (Vlab) at ($(pgfcirc at Vfrom)!0.5!(pgfcirc at Vto)$)
+ \ifpgf at circuit@bipole at isvoltage\else
+ % add a bit of space for american labels above their symbols in the normal case. You can avoid that
+ % with voltage/american label distance=0.5 (it's measured from the center of the component, in heights)
+ coordinate (Vlab) at ($(Vlab) ! \alshift ! \pgf at circ@bipole at voltage@label at where :(pgfcirc at Vto)$)
+ \fi
+ \fi
+
+ \ifpgf at circuit@europeanvoltage
+ node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
+ \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
+ at (Vlab) {\pgf at circ@finallabels{voltage/label}}
+ \else % american voltages
+ \ifx\@@kind\@@open
+ coordinate (Vlab) at ($(pgfcirc at Vfrom@flat)!0.5!(pgfcirc at Vto@flat)$)
+ node [anchor=center, inner sep=2pt,
+ \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
+ at (Vlab) {\pgf at circ@finallabels{voltage/label}}
+ \else
+ node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
+ \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
+ at (Vlab) {\pgf at circ@finallabels{voltage/label}}
+ \fi
+ \fi
+ \fi
+}%end drawvoltages
+%%%---------- close: tex/pgfcircvoltage
+%%%%%%%%%%% Springe nach tex/pgfcirccurrent
+%%%---------- open: tex/pgfcirccurrent.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Current handling
+
+%% styles
+\ctikzset{bipole current style/.style={}}
+\tikzset{bipole current style/.code={
+ \ctikzset{bipole current style/.style={#1}}
+}}
+\tikzset{bipole current append style/.code={
+ \ctikzset{bipole current style/.append style={#1}}
+}}
+
+%% Options
+\ctikzset{i^>/.style = {
+ i = #1,
+ \circuitikzbasekey/bipole/current/direction = forward,
+ \circuitikzbasekey/bipole/current/x position = after,
+ \circuitikzbasekey/bipole/current/y position = above
+ }
+}
+
+\ctikzset{i_>/.style = {
+ i = #1,
+ \circuitikzbasekey/bipole/current/direction = forward,
+ \circuitikzbasekey/bipole/current/x position = after,
+ \circuitikzbasekey/bipole/current/y position = below
+ }
+}
+
+\ctikzset{i>^/.style = {
+ i = #1,
+ \circuitikzbasekey/bipole/current/direction = forward,
+ \circuitikzbasekey/bipole/current/x position = before,
+ \circuitikzbasekey/bipole/current/y position = above
+ }
+}
+
+\ctikzset{i>_/.style = {
+ i = #1,
+ \circuitikzbasekey/bipole/current/direction = forward,
+ \circuitikzbasekey/bipole/current/x position = before,
+ \circuitikzbasekey/bipole/current/y position = below
+ }
+}
+
+\ctikzset{i^</.style = {
+ i = #1,
+ \circuitikzbasekey/bipole/current/direction = backward,
+ \circuitikzbasekey/bipole/current/x position = after,
+ \circuitikzbasekey/bipole/current/y position = above
+ }
+}
+
+\ctikzset{i_</.style = {
+ i = #1,
+ \circuitikzbasekey/bipole/current/direction = backward,
+ \circuitikzbasekey/bipole/current/x position = after,
+ \circuitikzbasekey/bipole/current/y position = below
+ }
+}
+
+\ctikzset{i<^/.style = {
+ i = #1,
+ \circuitikzbasekey/bipole/current/direction = backward,
+ \circuitikzbasekey/bipole/current/x position = before,
+ \circuitikzbasekey/bipole/current/y position = above
+ }
+}
+
+\ctikzset{i<_/.style = {
+ i = #1,
+ \circuitikzbasekey/bipole/current/direction = backward,
+ \circuitikzbasekey/bipole/current/x position = before,
+ \circuitikzbasekey/bipole/current/y position = below
+ }
+}
+
+\ctikzset{i/.code = {
+ \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
+ \circuitikzbasekey/bipole/current/x position = after,
+ \circuitikzbasekey/bipole/current/y position = above }
+ \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1}
+ \ctikzsetvalof{bipole/current/label/unit}{}
+ \ifpgf at circ@siunitx
+ \pgf at circ@handleSI{#1}
+ \ifpgf at circ@siunitx at res
+ \edef\pgf at temp{\pgf at circ@handleSI at val}
+ \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf at temp}
+ \edef\pgf at temp{\pgf at circ@handleSI at unit}
+ \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf at temp}
+ \else
+ \fi
+ \else
+ \fi
+ %reverse current direction for voltage sources
+ \ifpgf at circ@oldvoltagedirection\else
+ \ifpgf at circuit@bipole at isvoltage
+ \ifpgf at circuit@bipole at voltage@backward
+ \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
+ \circuitikzbasekey/bipole/current/x position = after,
+ \circuitikzbasekey/bipole/current/y position = below }
+ \else
+ \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
+ \circuitikzbasekey/bipole/current/x position = before,
+ \circuitikzbasekey/bipole/current/y position = above }
+ \fi\fi\fi
+ }
+}
+
+\ifpgf at circ@oldvoltagedirection
+ \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward } }
+\else
+ \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
+\fi
+\ctikzset{i_/.style = { i = #1, \circuitikzbasekey/bipole/current/y position = below } }
+\ctikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } }
+\ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } }
+
+%% Output routine
+\def\pgf at circ@drawcurrent{
+ \pgfextra{
+ \edef\pgf at circ@ffffff{\pgf at circ@direction}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@ffffff\pgf at nil}
+
+ \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{north west} \else \def\pgf at circ@dir{south east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{west} \else \def\pgf at circ@dir{east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{south west}\else \def\pgf at circ@dir{north east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{south}\else\def\pgf at circ@dir{north}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{south east}\else\def\pgf at circ@dir{north west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{east}\else \def\pgf at circ@dir{west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{north east}\else\def\pgf at circ@dir{south west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult <5
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{north}\else\def\pgf at circ@dir{south}
+ \fi
+ \fi
+ \ifnum\pgfcircmathresult >355
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@dir{north}\else\def\pgf at circ@dir{south}
+ \fi
+ \fi
+
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@bipole at current@label at where{-90}
+ \else
+ \def\pgf at circ@bipole at current@label at where{+90}
+ \fi
+ }
+
+ \pgfextra{\def\pgf at temp{short}\edef\pgf at circ@temp{\ctikzvalof{bipole/kind}}}
+ \ifx\pgf at circ@temp\pgf at temp%draw current at a short at middle of the line
+ (\tikztostart)--(\tikztotarget)
+ \else% normal bipole or source
+ \ifpgf at circuit@bipole at current@before
+ (\tikztostart)--(anchorstartnode)
+ \else
+ (anchorendnode)--(\tikztotarget)
+ \fi
+ \fi
+ \ifpgf at circuit@bipole at current@backward
+ \pgfextra{
+ \pgfmathsubtract{\pgf at circ@ffffff}{180}
+ \edef\pgf at circ@ffffff{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ }
+ \fi
+ coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf at circ@ffffff,
+ anchor=center](Iarrow)
+ (Iarrow.\pgf at circ@bipole at current@label at where)
+ node[anchor=\pgf at circ@dir, \circuitikzbasekey/bipole current style]
+ (\ctikzvalof{bipole/name}current){\pgf at circ@finallabels{current/label}}
+}
+
+%%%---------- close: tex/pgfcirccurrent
+%%%%%%%%%%% Springe nach tex/pgfcircflow
+%%%---------- open: tex/pgfcircflow.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% flow handling
+
+%% styles
+\ctikzset{bipole flow style/.style={}}
+\tikzset{bipole flow style/.code={
+ \ctikzset{bipole flow style/.style={#1}}
+}}
+\tikzset{bipole flow append style/.code={
+ \ctikzset{bipole flow style/.append style={#1}}
+}}
+
+%% Options
+\ctikzset{f^>/.style = {
+ f = #1,
+ \circuitikzbasekey/bipole/flow/direction = forward,
+ \circuitikzbasekey/bipole/flow/x position = after,
+ \circuitikzbasekey/bipole/curflowrent/y position = above
+ }
+}
+
+\ctikzset{f_>/.style = {
+ f = #1,
+ \circuitikzbasekey/bipole/flow/direction = forward,
+ \circuitikzbasekey/bipole/flow/x position = after,
+ \circuitikzbasekey/bipole/flow/y position = below
+ }
+}
+
+\ctikzset{f>^/.style = {
+ f = #1,
+ \circuitikzbasekey/bipole/flow/direction = forward,
+ \circuitikzbasekey/bipole/flow/x position = before,
+ \circuitikzbasekey/bipole/flow/y position = above
+ }
+}
+
+\ctikzset{f>_/.style = {
+ f = #1,
+ \circuitikzbasekey/bipole/flow/direction = forward,
+ \circuitikzbasekey/bipole/flow/x position = before,
+ \circuitikzbasekey/bipole/flow/y position = below
+ }
+}
+
+\ctikzset{f^</.style = {
+ f = #1,
+ \circuitikzbasekey/bipole/flow/direction = backward,
+ \circuitikzbasekey/bipole/flow/x position = after,
+ \circuitikzbasekey/bipole/flow/y position = above
+ }
+}
+
+\ctikzset{f_</.style = {
+ f = #1,
+ \circuitikzbasekey/bipole/flow/direction = backward,
+ \circuitikzbasekey/bipole/flow/x position = after,
+ \circuitikzbasekey/bipole/flow/y position = below
+ }
+}
+
+\ctikzset{f<^/.style = {
+ f = #1,
+ \circuitikzbasekey/bipole/flow/direction = backward,
+ \circuitikzbasekey/bipole/flow/x position = before,
+ \circuitikzbasekey/bipole/flow/y position = above
+ }
+}
+
+\ctikzset{f<_/.style = {
+ f = #1,
+ \circuitikzbasekey/bipole/flow/direction = backward,
+ \circuitikzbasekey/bipole/flow/x position = before,
+ \circuitikzbasekey/bipole/flow/y position = below
+ }
+}
+
+\ctikzset{f</.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = backward} }
+\ctikzset{f_/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = below } }
+\ctikzset{f>/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } }
+\ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } }
+
+\ctikzset{f/.code = {
+ \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
+ \circuitikzbasekey/bipole/flow/x position = after,
+ \circuitikzbasekey/bipole/flow/y position = above }
+ \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1}
+ \ctikzsetvalof{bipole/flow/label/unit}{}
+ \ifpgf at circ@siunitx
+ \pgf at circ@handleSI{#1}
+ \ifpgf at circ@siunitx at res
+ \edef\pgf at temp{\pgf at circ@handleSI at val}
+ \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf at temp}
+ \edef\pgf at temp{\pgf at circ@handleSI at unit}
+ \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf at temp}
+ \else
+ \fi
+ \else
+ \fi
+}
+}
+
+%% Output routine
+\def\pgf at circ@drawflow{
+ \pgfextra{
+ \edef\pgf at circ@ffffff{\pgf at circ@direction}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@ffffff\pgf at nil}
+
+ \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{north west} \else \def\pgf at circ@dir{south east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{west} \else \def\pgf at circ@dir{east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{south west}\else \def\pgf at circ@dir{north east}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{south}\else\def\pgf at circ@dir{north}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{south east}\else\def\pgf at circ@dir{north west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{east}\else \def\pgf at circ@dir{west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{north east}\else\def\pgf at circ@dir{south west}
+ \fi
+ \fi\fi
+ \ifnum\pgfcircmathresult <5
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{north}\else\def\pgf at circ@dir{south}
+ \fi
+ \fi
+ \ifnum\pgfcircmathresult >355
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@dir{north}\else\def\pgf at circ@dir{south}
+ \fi
+ \fi
+
+ \ifpgf at circuit@bipole at flow@below
+ \def\pgf at circ@bipole at flow@label at where{-90}
+ \else
+ \def\pgf at circ@bipole at flow@label at where{+90}
+ \fi
+ }
+
+ \pgfextra{\def\pgf at temp{short}\edef\pgf at circ@temp{\ctikzvalof{bipole/kind}}}
+ \ifx\pgf at circ@temp\pgf at temp%draw flow at a short at middle of the line
+ (\tikztostart)--(\tikztotarget)
+ \else% normal bipole or source
+ \ifpgf at circuit@bipole at flow@before
+ (\tikztostart)--(anchorstartnode)
+ \else
+ (anchorendnode)--(\tikztotarget)
+ \fi
+ \fi
+ \pgfextra{
+ \ifpgf at circuit@bipole at flow@backward
+ \ifpgf at circuit@bipole at flow@below
+ \def\flow at offset{\ctikzvalof{flow/offset}\pgf at circ@Rlen}
+ \else
+ \def\flow at offset{-\ctikzvalof{flow/offset}\pgf at circ@Rlen}
+ \fi
+ \pgfmathsubtract{\pgf at circ@ffffff}{180}
+ \edef\pgf at circ@ffffff{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ \else
+ \ifpgf at circuit@bipole at flow@below
+ \def\flow at offset{-\ctikzvalof{flow/offset}\pgf at circ@Rlen}
+ \else
+ \def\flow at offset{\ctikzvalof{flow/offset}\pgf at circ@Rlen}
+ \fi
+ \fi
+ }
+ coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf at circ@ffffff,yshift=\flow at offset, anchor=center](Farrowpos)
+ (Farrowpos.\pgf at circ@bipole at flow@label at where) node[anchor=\pgf at circ@dir, \circuitikzbasekey/bipole flow style]
+ (\ctikzvalof{bipole/name}flow){\pgf at circ@finallabels{flow/label}}
+}
+
+%%%---------- close: tex/pgfcircflow
+
+% defaults
+
+\setupmodule
+ [current=european,
+ voltage=european,
+ resistor=american,
+ inductor=cute,
+ logic=american,
+ siunitx=true,
+ arrowmos=false]
+
+\processaction
+ [\currentmoduleparameter{voltage}]
+ [european=>\ctikzset{voltage=european},
+ american=>\ctikzset{voltage=american}]
+
+\processaction
+ [\currentmoduleparameter{current}]
+ [european=>\ctikzset{ current=european},
+ american=>\ctikzset{ current=american}]
+
+\processaction
+ [\currentmoduleparameter{label}]
+ [straight=>\ctikzset{label/align = straight},
+ align=>\ctikzset{label/align = rotate},
+ smart=>\ctikzset{label/align = smart}]
+
+\processaction
+ [\currentmoduleparameter{resistor}]
+ [european=>\ctikzset{ resistor=european},
+ american=>\ctikzset{ resistor=american}]
+
+\processaction
+ [\currentmoduleparameter{inductor}]
+ [european=>\ctikzset{ inductor=european},
+ american=>\ctikzset{ inductor=american},
+ cute=>\ctikzset{ inductor=cute}]
+
+\processaction
+ [\currentmoduleparameter{diode}]
+ [full=>\ctikzset{ diode=full},
+ empty=>\ctikzset{ diode=empty}]
+
+\processaction
+ [\currentmoduleparameter{logic}]
+ [european=>\ctikzset{ logic ports=european},
+ american=>\ctikzset{ logic ports=american}]
+
+\processaction
+ [\currentmoduleparameter{siunitx}]
+ [true=>\def\SI#1#2{#1\,#2}
+ \def\ampere{\rm{A}}
+ \def\volt{\rm{V}}
+ \def\ohm{\Omega}
+ \def\siemens{\rm{S}}
+ \def\farad{\rm{F}}
+ \def\henry{\rm{H}}
+ \def\second{\rm{s}}
+ \def\coulomb{\rm{C}}
+ \def\siemens{\rm{S}}
+ \def\radians{\rm{rad}}
+ \def\milli{\rm{m}}
+ \def\micro{\mu}
+ \def\nano{\rm{n}}
+ \def\pico{\rm{p}}
+ \def\kilo{\rm{k}}
+ \def\mega{\rm{M}}
+ \def\giga{\rm{G}}
+ \def\tera{\rm{T}},
+ false=>]
+% \s!default=>\pgf at circ@siunitxtrue,
+
+\processaction
+ [\currentmoduleparameter{arrowmos}]
+ [true=>\pgf at circuit@mos at arrowstrue,
+ false=>\pgf at circuit@mos at arrowsfalse]
+% \s!default=>\pgf at circuit@mos at arrowstrue,
+
+
+\ifpgf at circ@siunitx
+ % nothing! siunitx and xstrings don't work in context
+\fi
+
+
+% Context specific
+
+\ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}
+
+%%%%%%%%%%% Springe nach tex/pgfcircpath
+%%%---------- open: tex/pgfcircpath.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+
+\def\pgf at circ@direction{0.0}
+
+% Names
+\ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
+\ctikzset{n/.code = {
+ \pgfkeys{/tikz/circuitikz/bipole/name=#1}
+}}
+
+% Reflect the node along
+\ctikzset{mirrored/.is choice}
+\ctikzset{mirror value/.initial=1}
+\ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
+\ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
+\ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
+
+% Invert node along path
+\ctikzset{inverted/.is choice}
+\ctikzset{invert value/.initial=1}
+\ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf at circuit@bipole at invertedtrue}}
+\ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf at circuit@bipole at invertedfalse}}
+\ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
+\newif\ifpgf at circuit@bipole at inverted
+\ctikzset{bipole/inverted/.is if=pgf at circuit@bipole at inverted}
+
+\newif\ifpgf at circuit@bipole at voltage@backward
+\ctikzset{bipole/voltage/direction/.is choice}
+\ctikzset{bipole/voltage/direction/forward/.code={\pgf at circuit@bipole at voltage@backwardfalse}}
+\ctikzset{bipole/voltage/direction/backward/.code={\pgf at circuit@bipole at voltage@backwardtrue}}
+
+% Initialize paths
+\def\pgfcircresetpath{
+ \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
+ bipole/inverted=false, bipole/kind=,
+ bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
+ bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
+ bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
+ bipole/current/y position=above, bipole/current/direction=forward,
+ mirrored=false
+ }
+}
+
+%% Helper function for path-function to ensure using anchors between nodes
+\def\set at explicit@center at anchor#1{
+ \pgfutil at ifundefined{pgf at sh@ns@#1}
+ {
+ %This coordinate is no node(but a relative position or a coordinate), no further handling needed
+ }{
+ \pgfutil at in@.{#1}
+ \ifpgfutil at in@
+ % Anchor is used, do nothing!
+ \else%
+ \let\tikz at moveto@waiting=\relax
+ \pgfpathmoveto{\tikz at last@position}%force movement, because tikz at moveto@waiting
+ \edef#1{#1.center}%ensure using center anchor
+ \fi
+}
+}
+
+
+%% Generic bipole path
+%% I am not user what the second argument is needed for
+\def\pgf at circ@bipole at path#1#2{
+
+ \pgfextra{
+ \set at explicit@center at anchor{\tikztostart}
+ \set at explicit@center at anchor{\tikztotarget}
+ \pgfsyssoftpath at getcurrentpath{\myp at th}%% save current path to extend after calculation of correct start/end coordinates
+ \ctikzset{bipole/kind = #1}
+ \edef\pgf at temp{\ctikzvalof{bipole/name}}
+ \def\pgf at circ@temp{}
+ \ifx\pgf at temp\pgf at circ@temp % if it has not a name
+ \pgfmathrandominteger{\pgf at circ@rand}{1000}{9999}
+ \ctikzset{bipole/name = #1\pgf at circ@rand} % create it (re-usage should not create problem, but...)
+ \fi
+ }
+
+ (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relative start/end or constructions like ((node1)-|(node2))
+ (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end)
+ \pgfextra{
+ \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
+ {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
+ % DO NOT ROUND HERE! pgfcirclabel.tex will do that when needed
+ % \pgfmathround{\pgfmathresult}
+ \edef\pgf at circ@direction{\pgfmathresult}%Calculate direction(angle) of path
+ % \typeout{DIRECTION:\pgf at circ@direction}
+ \pgfsyssoftpath at setcurrentpath{\myp at th}
+ }
+ \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#1}}
+ \ifx\pgf at temp\pgf at circ@temp % if it is an open
+ \else
+ --($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?)
+ \fi
+ ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node
+ node[#1shape, rotate=\pgf at circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
+ (\ctikzvalof{bipole/name}) {}
+ \ifpgf at circuit@bipole at inverted
+ \ifcsname pgf at anchor@#1shape at pathstart\endcsname%if special path-anchors are defined, use them!
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
+ \else
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left)
+ \fi
+ \else
+ \ifcsname pgf at anchor@#1shape at pathstart\endcsname%if special path-anchors are defined, use them!
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
+ \else
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
+ \fi
+ \fi
+ \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#1}}
+ \ifx\pgf at temp\pgf at circ@temp % if it is an open
+ \else
+ (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode)
+ (anchorendnode) -- (\ctikzvalof{bipole/name}end.center)
+ \fi
+
+ \drawpoles
+ \pgf at circ@ifkeyempty{bipole/label/name}\else\pgf at circ@drawlabels{label}\fi
+ \pgf at circ@ifkeyempty{bipole/annotation/name}\else\pgf at circ@drawlabels{annotation}\fi
+ \pgf at circ@ifkeyempty{bipole/voltage/label/name}\else\pgf at circ@drawvoltage\fi
+ \pgf at circ@ifkeyempty{bipole/current/label/name}\else\pgf at circ@drawcurrent\fi
+ \pgf at circ@ifkeyempty{bipole/flow/label/name}\else\pgf at circ@drawflow\fi
+ \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#1}}
+ \ifx\pgf at temp\pgf at circ@temp % if it is an open
+ (\ctikzvalof{bipole/name}end)%Move to end of path
+ \else
+ ($(\ctikzvalof{bipole/name}end) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}start)$) -- (\ctikzvalof{bipole/name}end)%ugly workaround to get correct linejoins(node breaks path?)
+ %tikztostart and tikztotarget could not be used, because it would break if target coordinate is something like (node1-|node2)
+
+ \fi
+ % reset
+ \pgfextra{
+ \pgfcircresetpath
+ }
+ \tikztonodes%draw pending nodes an path
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Handling of terminals
+
+\ctikzset{bipole/nodes/.is family}
+\ctikzset{bipole/nodes/left/.initial=none}
+\ctikzset{bipole/nodes/right/.initial=none}
+\tikzset{bipole nodes/.style n args={2}{%
+ \circuitikzbasekey/bipole/nodes/left=#1,
+ \circuitikzbasekey/bipole/nodes/right=#2
+ }
+}
+
+%% Easily usable styles
+
+\ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
+\ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+\ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
+\ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
+\ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+\ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+\ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+
+% rectjoinfill workarounds
+
+\ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
+\ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+\ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+\ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+\ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+\ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+\ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+
+\tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
+
+\def\drawpoles{
+ \pgfextra{ \edef\pgf at circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf at temp{none}}
+ \ifx\pgf at temp\pgf at circ@temp\else(\tikztostart) node[\pgf at circ@temp] {}\fi
+ \pgfextra{ \edef\pgf at circ@temp{\ctikzvalof{bipole/nodes/right}} }
+ \ifx\pgf at temp\pgf at circ@temp\else(\tikztotarget) node[\pgf at circ@temp] {}\fi
+}
+
+%% Path definitions
+\def\pgf at circ@resistor at path#1{\ifpgf at circuit@europeanresistor\pgf at circ@bipole at path{generic}{#1}\else\pgf at circ@bipole at path{resistor}{#1}\fi}
+\def\pgf at circ@vresistor at path#1{\ifpgf at circuit@europeanresistor\pgf at circ@bipole at path{tgeneric}{#1}\else\pgf at circ@bipole at path{vresistor}{#1}\fi}
+\def\pgf at circ@sresistor at path#1{\ifpgf at circuit@europeanresistor\pgf at circ@bipole at path{thermistor}{#1}\else\pgf at circ@bipole at path{resistivesens}{#1}\fi}
+\def\pgf at circ@potentiometer at path#1{\ifpgf at circuit@europeanresistor\pgf at circ@bipole at path{genericpotentiometer}{#1}\else\pgf at circ@bipole at path{potentiometer}{#1}\fi}
+\def\pgf at circ@thermistor at path#1{\pgf at circ@bipole at path{thermistor}{#1}}
+\def\pgf at circ@thermistorptc at path#1{\pgf at circ@bipole at path{thermistorptc}{#1}}
+\def\pgf at circ@thermistorntc at path#1{\pgf at circ@bipole at path{thermistorntc}{#1}}
+\def\pgf at circ@varistor at path#1{\pgf at circ@bipole at path{varistor}{#1}}
+\def\pgf at circ@capacitor at path#1{\pgf at circ@bipole at path{capacitor}{#1}}
+\def\pgf at circ@capacitivesens at path#1{\pgf at circ@bipole at path{capacitivesens}{#1}}
+\def\pgf at circ@ecapacitor at path#1{\pgf at circ@bipole at path{ecapacitor}{#1}}
+%% polar capacitor is deprectaed, use curved capacitor instead
+\def\pgf at circ@polarcapacitor at path#1{\pgf at circ@bipole at path{polarcapacitor}{#1}}
+\def\pgf at circ@ccapacitor at path#1{\pgf at circ@bipole at path{ccapacitor}{#1}}
+\def\pgf at circ@vcapacitor at path#1{\pgf at circ@bipole at path{vcapacitor}{#1}}
+\def\pgf at circ@piezoelectric at path#1{\pgf at circ@bipole at path{piezoelectric}{#1}}
+\def\pgf at circ@battery at path#1{\pgf at circ@bipole at path{battery}{#1}}
+\def\pgf at circ@batteryone at path#1{\pgf at circ@bipole at path{battery1}{#1}}
+\def\pgf at circ@batterytwo at path#1{\pgf at circ@bipole at path{battery2}{#1}}
+\def\pgf at circ@europeaninductor at path#1{\pgf at circ@bipole at path{fullgeneric}{#1}}
+\def\pgf at circ@americaninductor at path#1{\pgf at circ@bipole at path{americaninductor}{#1}}
+\def\pgf at circ@cuteinductor at path#1{\pgf at circ@bipole at path{cuteinductor}{#1}}
+\def\pgf at circ@cutechoke at path#1{\pgf at circ@bipole at path{cutechoke}{#1}}
+\def\pgf at circ@inductor at path#1{%
+ \pgfextra{
+ \edef\pgf at circ@temp{\ctikzvalof{inductor}}%
+ \def\pgf at temp{european}%
+ }
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgf at circ@europeaninductor at path{#1}%
+ \else%
+ \pgfextra{ \def\pgf at temp{cute} }%
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgf at circ@cuteinductor at path{#1}%
+ \else%
+ \pgf at circ@americaninductor at path{#1}%
+ \fi%
+ \fi%
+}
+\def\pgf at circ@vinductor at path#1{
+ \pgfextra{
+ \edef\pgf at circ@temp{\ctikzvalof{inductor}}%
+ \def\pgf at temp{european}%
+ }
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgf at circ@veuropeaninductor at path{#1}%
+ \else%
+ \pgfextra{ \def\pgf at temp{cute} }%
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgf at circ@vcuteinductor at path{#1}%
+ \else%
+ \pgf at circ@vamericaninductor at path{#1}%
+ \fi%
+ \fi%
+}
+\def\pgf at circ@inductivesens at path#1{%
+ \pgfextra{
+ \edef\pgf at circ@temp{\ctikzvalof{inductor}}%
+ \def\pgf at temp{european}%
+ }
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgf at circ@europeaninductivesens at path{#1}%
+ \else%
+ \pgfextra{ \def\pgf at temp{cute} }%
+ \ifx\pgf at temp\pgf at circ@temp%
+ \pgf at circ@cuteinductivesens at path{#1}%
+ \else%
+ \pgf at circ@americaninductivesens at path{#1}%
+ \fi%
+ \fi%
+}
+\def\pgf at circ@veuropeaninductor at path#1{\pgf at circ@bipole at path{tfullgeneric}{#1}}
+\def\pgf at circ@vamericaninductor at path#1{\pgf at circ@bipole at path{vamericaninductor}{#1}}
+\def\pgf at circ@vcuteinductor at path#1{\pgf at circ@bipole at path{vcuteinductor}{#1}}
+\def\pgf at circ@europeaninductivesens at path#1{\pgf at circ@bipole at path{sfullgeneric}{#1}}
+\def\pgf at circ@americaninductivesens at path#1{\pgf at circ@bipole at path{samericaninductor}{#1}}
+\def\pgf at circ@cuteinductivesens at path#1{\pgf at circ@bipole at path{scuteinductor}{#1}}
+\def\pgf at circ@lamp at path#1{\pgf at circ@bipole at path{lamp}{#1}}
+\def\pgf at circ@bulb at path#1{\pgf at circ@bipole at path{bulb}{#1}}
+\def\pgf at circ@esource at path#1{\pgf at circ@bipole at path{esource}{#1}}
+\def\pgf at circ@pvsource at path#1{\pgf at circ@bipole at path{pvsource}{#1}}
+\def\pgf at circ@vsource at path#1{\pgf at circ@bipole at path{vsource}{#1}}
+\def\pgf at circ@dcvsource at path#1{\pgf at circ@bipole at path{dcvsource}{#1}}
+\def\pgf at circ@vsourceam at path#1{\pgf at circ@bipole at path{vsourceAM}{#1}}
+\def\pgf at circ@vsourcesin at path#1{\pgf at circ@bipole at path{vsourcesin}{#1}}
+\def\pgf at circ@isource at path#1{\pgf at circ@bipole at path{isource}{#1}}
+\def\pgf at circ@oosource at path#1{\pgf at circ@bipole at path{oosource}{#1}}
+\def\pgf at circ@oosourcetrans at path#1{\pgf at circ@bipole at path{oosourcetrans}{#1}}
+\def\pgf at circ@ooosource at path#1{\pgf at circ@bipole at path{ooosource}{#1}}
+\def\pgf at circ@dcisource at path#1{\pgf at circ@bipole at path{dcisource}{#1}}
+\def\pgf at circ@isourcesin at path#1{\pgf at circ@bipole at path{isourcesin}{#1}}
+\def\pgf at circ@vsourcesquare at path#1{\pgf at circ@bipole at path{vsourcesquare}{#1}}
+\def\pgf at circ@vsourcetri at path#1{\pgf at circ@bipole at path{vsourcetri}{#1}}
+\def\pgf at circ@isourceam at path#1{\pgf at circ@bipole at path{isourceAM}{#1}}
+\def\pgf at circ@ecsource at path#1{\pgf at circ@bipole at path{ecsource}{#1}}
+\def\pgf at circ@cvsource at path#1{\pgf at circ@bipole at path{cvsource}{#1}}
+\def\pgf at circ@cvsourceam at path#1{\pgf at circ@bipole at path{cvsourceAM}{#1}}
+\def\pgf at circ@cvsourcesin at path#1{\pgf at circ@bipole at path{cvsourcesin}{#1}}
+\def\pgf at circ@cisource at path#1{\pgf at circ@bipole at path{cisource}{#1}}
+\def\pgf at circ@cisourceam at path#1{\pgf at circ@bipole at path{cisourceAM}{#1}}
+\def\pgf at circ@cisourcesin at path#1{\pgf at circ@bipole at path{cisourcesin}{#1}}
+\def\pgf at circ@short at path#1{\pgf at circ@bipole at path{short}{#1}}
+\def\pgf at circ@cspst at path#1{\pgf at circ@bipole at path{cspst}{#1}}
+\def\pgf at circ@ospst at path#1{\pgf at circ@bipole at path{ospst}{#1}}
+\def\pgf at circ@nos at path#1{\pgf at circ@bipole at path{nos}{#1}}
+\def\pgf at circ@ncs at path#1{\pgf at circ@bipole at path{ncs}{#1}}
+\def\pgf at circ@pushbutton at path#1{\pgf at circ@bipole at path{pushbutton}{#1}}
+\def\pgf at circ@ncpushbutton at path#1{\pgf at circ@bipole at path{ncpushbutton}{#1}}
+\def\pgf at circ@open at path#1{\pgf at circ@bipole at path{open}{#1}}
+\def\pgf at circ@generic at path#1{\pgf at circ@bipole at path{generic}{#1}}
+\def\pgf at circ@ageneric at path#1{\pgf at circ@bipole at path{ageneric}{#1}}
+\def\pgf at circ@tgeneric at path#1{\pgf at circ@bipole at path{tgeneric}{#1}}
+\def\pgf at circ@xgeneric at path#1{\pgf at circ@bipole at path{xgeneric}{#1}}
+\def\pgf at circ@fullgeneric at path#1{\pgf at circ@bipole at path{fullgeneric}{#1}}
+\def\pgf at circ@tfullgeneric at path#1{\pgf at circ@bipole at path{tfullgeneric}{#1}}
+\def\pgf at circ@ammeter at path#1{\pgf at circ@bipole at path{ammeter}{#1}}
+\def\pgf at circ@ohmmeter at path#1{\pgf at circ@bipole at path{ohmmeter}{#1}}
+\def\pgf at circ@voltmeter at path#1{\pgf at circ@bipole at path{voltmeter}{#1}}
+\def\pgf at circ@oscope at path#1{\pgf at circ@bipole at path{oscope}{#1}}
+\def\pgf at circ@empty at path#1{}
+\def\pgf at circ@photoresistor at path#1{\pgf at circ@bipole at path{photoresistor}{#1}}
+\def\pgf at circ@emptythyristor at path#1{\pgf at circ@bipole at path{emptythyristor}{#1}}
+\def\pgf at circ@fullthyristor at path#1{\pgf at circ@bipole at path{fullthyristor}{#1}}
+\def\pgf at circ@toggleswitch at path#1{\pgf at circ@bipole at path{toggleswitch}{#1}}
+\def\pgf at circ@memristor at path#1{\pgf at circ@bipole at path{memristor}{#1}}
+\def\pgf at circ@emptytriac at path#1{\pgf at circ@bipole at path{emptytriac}{#1}}
+\def\pgf at circ@fulltriac at path#1{\pgf at circ@bipole at path{fulltriac}{#1}}
+\def\pgf at circ@tline at path#1{\pgf at circ@bipole at path{tline}{#1}}
+\def\pgf at circ@mstline at path#1{\pgf at circ@bipole at path{mstline}{#1}}
+\def\pgf at circ@squid at path#1{\pgf at circ@bipole at path{squid}{#1}}
+\def\pgf at circ@barrier at path#1{\pgf at circ@bipole at path{barrier}{#1}}
+\def\pgf at circ@openbarrier at path#1{\pgf at circ@bipole at path{openbarrier}{#1}}
+\def\pgf at circ@thermocouple at path#1{\pgf at circ@bipole at path{thermocouple}{#1}}
+\def\pgf at circ@fuse at path#1{\pgf at circ@bipole at path{fuse}{#1}}
+\def\pgf at circ@afuse at path#1{\pgf at circ@bipole at path{afuse}{#1}}
+
+\def\pgf at circ@gfsurgearrester at path#1{\ifpgf at circuit@europeangfsurgearrester\pgf at circ@europeangfsurgearrester at path{#1}\else\pgf at circ@americangfsurgearrester at path{#1}\fi}
+\def\pgf at circ@europeangfsurgearrester at path#1{\pgf at circ@bipole at path{european gas filled surge arrester}{#1}}
+\def\pgf at circ@americangfsurgearrester at path#1{\pgf at circ@bipole at path{american gas filled surge arrester}{#1}}
+
+\def\pgf at circ@twoport at path#1{\pgf at circ@bipole at path{twoport}{#1}}
+\def\pgf at circ@vco at path#1{\pgf at circ@bipole at path{vco}{#1}}
+\def\pgf at circ@bandpass at path#1{\pgf at circ@bipole at path{bandpass}{#1}}
+\def\pgf at circ@bandstop at path#1{\pgf at circ@bipole at path{bandstop}{#1}}
+\def\pgf at circ@highpass at path#1{\pgf at circ@bipole at path{highpass}{#1}}
+\def\pgf at circ@lowpass at path#1{\pgf at circ@bipole at path{lowpass}{#1}}
+\def\pgf at circ@adc at path#1{\pgf at circ@bipole at path{adc}{#1}}
+\def\pgf at circ@dac at path#1{\pgf at circ@bipole at path{dac}{#1}}
+\def\pgf at circ@dsp at path#1{\pgf at circ@bipole at path{dsp}{#1}}
+\def\pgf at circ@fft at path#1{\pgf at circ@bipole at path{fft}{#1}}
+\def\pgf at circ@amp at path#1{\pgf at circ@bipole at path{amp}{#1}}
+\def\pgf at circ@vamp at path#1{\pgf at circ@bipole at path{vamp}{#1}}
+\def\pgf at circ@piattenuator at path#1{\pgf at circ@bipole at path{piattenuator}{#1}}
+\def\pgf at circ@vpiattenuator at path#1{\pgf at circ@bipole at path{vpiattenuator}{#1}}
+\def\pgf at circ@tattenuator at path#1{\pgf at circ@bipole at path{tattenuator}{#1}}
+\def\pgf at circ@vtattenuator at path#1{\pgf at circ@bipole at path{vtattenuator}{#1}}
+\def\pgf at circ@phaseshifter at path#1{\pgf at circ@bipole at path{phaseshifter}{#1}}
+\def\pgf at circ@vphaseshifter at path#1{\pgf at circ@bipole at path{vphaseshifter}{#1}}
+\def\pgf at circ@detector at path#1{\pgf at circ@bipole at path{detector}{#1}}
+%
+\def\pgf at circ@sacdc at path#1{\pgf at circ@bipole at path{sacdc}{#1}}
+\def\pgf at circ@sdcac at path#1{\pgf at circ@bipole at path{sdcac}{#1}}
+\def\pgf at circ@tacdc at path#1{\pgf at circ@bipole at path{tacdc}{#1}}
+\def\pgf at circ@tdcac at path#1{\pgf at circ@bipole at path{tdcac}{#1}}
+
+%%Mechanical
+\def\pgf at circ@spring at path#1{\pgf at circ@bipole at path{spring}{#1}}
+\def\pgf at circ@inerter at path#1{\pgf at circ@bipole at path{inerter}{#1}}
+\def\pgf at circ@mass at path#1{\pgf at circ@bipole at path{mass}{#1}}
+\def\pgf at circ@damper at path#1{\pgf at circ@bipole at path{damper}{#1}}
+\def\pgf at circ@viscoe at path#1{\pgf at circ@bipole at path{viscoe}{#1}}
+
+%% Styles
+
+\def\comnpatname{\ifpgf at circuit@compat *\else\fi}
+\def\compattikzset#1{\tikzset{\comnpatname#1}}
+
+%\def\ctikzsetbipole#1#2{%
+% \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}%
+%}
+
+\compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@spring at path, l=#1}}
+\compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@inerter at path, l=#1}}
+\compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@mass at path, l=#1}}
+\compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@damper at path, l=#1}}
+\compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@viscoe at path, l=#1}}
+\compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf at circ@resistor at path, l=#1}}
+\compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf at circ@bipole at path{resistor}{#1}, l=#1}}
+\compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf at circ@bipole at path{generic}{#1}, l=#1}}
+\compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@potentiometer at path, l=#1}}
+\compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@varistor at path, l=#1}}
+\compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@photoresistor at path, l=#1}}
+\compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@thermistor at path, l=#1}}
+\compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@thermistorptc at path, l=#1}}
+\compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@thermistorntc at path, l=#1}}
+\compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@bipole at path{potentiometer}{#1}, l=#1}}
+\compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@bipole at path{genericpotentiometer}{#1}, l=#1}}
+\compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vresistor at path, l=#1}}
+\compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf at circ@bipole at path{vresistor}{#1}, l=#1}}
+\compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf at circ@bipole at path{tgeneric}{#1}, l=#1}}
+\compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@capacitor at path, l=#1}}
+\compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ecapacitor at path, l=#1}}
+\compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ecapacitor at path, l=#1}}
+% polar capacitor is deprecated, use curved capacitor instead
+\compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@polarcapacitor at path, l=#1}}
+\compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ccapacitor at path, l=#1}}
+\compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vcapacitor at path, l=#1}}
+\compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@piezoelectric at path, l=#1}}
+\compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@battery at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@batteryone at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@batterytwo at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@inductor at path, l=#1}}
+\compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@gfsurgearrester at path, l=#1}}
+\compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@americangfsurgearrester at path, l=#1}}
+\compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@europeangfsurgearrester at path, l=#1}}
+\compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@gfsurgearrester at path, l=#1}}
+\compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@americaninductor at path, l=#1}}
+\compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cuteinductor at path, l=#1}}
+\compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cutechoke at path, l=#1}}
+\compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@europeaninductor at path, l=#1}}
+\compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vinductor at path, l=#1}}
+\compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@veuropeaninductor at path, l=#1}}
+\compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vamericaninductor at path, l=#1}}
+\compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vcuteinductor at path, l=#1}}
+\compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@tline at path, l=#1}}
+\compattikzset{transmission line/.style = {tline = #1}}
+\compattikzset{TL/.style = {tline = #1}}
+\compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@mstline at path, l=#1}}
+\compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vsource at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vsourceam at path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
+\compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@isource at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+\compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@isourceam at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+\compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ecsource at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cvsource at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cvsourceam at path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
+\compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cisource at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+\compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cisourceam at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+\compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vsourcesin at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
+\compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vsourcesquare at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
+\compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vsourcetri at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
+\compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@isourcesin at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+\compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cvsourcesin at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cisourcesin at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+
+\compattikzset{voltage source/.style = {\comnpatname \ifpgf at circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
+\compattikzset{current source/.style = {\comnpatname \ifpgf at circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}}
+\compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf at circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
+\compattikzset{controlled current source/.style = {\comnpatname \ifpgf at circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}}
+
+
+\compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@generic at path, l=#1}}
+\compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@xgeneric at path, l=#1}}
+\compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ageneric at path, l=#1}}
+\compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@tgeneric at path, l=#1}}
+\compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fullgeneric at path, l=#1}}
+\compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@tfullgeneric at path, l=#1}}
+\compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@short at path}}
+\compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@open at path}}
+
+\compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@lamp at path}}
+\compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@bulb at path, l=#1}}
+
+\compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@squid at path}}
+\compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@barrier at path}}
+\compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@openbarrier at path}}
+\compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@thermocouple at path}}
+\compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fuse at path}}
+\compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@afuse at path}}
+
+\compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@twoport at path}}
+\compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vco at path}}
+\compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@bandpass at path}}
+\compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@bandstop at path}}
+\compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@highpass at path}}
+\compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@lowpass at path}}
+\compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@adc at path}}
+\compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@dac at path}}
+\compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@dsp at path}}
+\compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fft at path}}
+\compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@amp at path}}
+\compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vamp at path}}
+\compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@piattenuator at path}}
+\compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vpiattenuator at path}}
+\compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@tattenuator at path}}
+\compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vtattenuator at path}}
+\compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@phaseshifter at path}}
+\compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vphaseshifter at path}}
+\compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@detector at path}}
+%
+\compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@sacdc at path, l=#1}}
+\compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@sdcac at path, l=#1}}
+\compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@tacdc at path, l=#1}}
+\compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@tdcac at path, l=#1}}
+
+% % % % % %
+% % Begin of Diodes
+% % % % % %
+
+\def\pgf at circ@fulldiode at path#1{\pgf at circ@bipole at path{fulldiode}{#1}}
+\def\pgf at circ@fullzdiode at path#1{\pgf at circ@bipole at path{fullzdiode}{#1}}
+\def\pgf at circ@fullzzdiode at path#1{\pgf at circ@bipole at path{fullzzdiode}{#1}}
+\def\pgf at circ@fullsdiode at path#1{\pgf at circ@bipole at path{fullsdiode}{#1}}
+\def\pgf at circ@fulltdiode at path#1{\pgf at circ@bipole at path{fulltdiode}{#1}}
+\def\pgf at circ@fulllediode at path#1{\pgf at circ@bipole at path{fulllediode}{#1}}
+\def\pgf at circ@fullpdiode at path#1{\pgf at circ@bipole at path{fullpdiode}{#1}}
+\def\pgf at circ@fullvarcap at path#1{\pgf at circ@bipole at path{fullvarcap}{#1}}
+\def\pgf at circ@fullbidirectionaldiode at path#1{\pgf at circ@bipole at path{fullbidirectionaldiode}{#1}}
+\def\pgf at circ@emptydiode at path#1{\pgf at circ@bipole at path{emptydiode}{#1}}
+\def\pgf at circ@emptyzdiode at path#1{\pgf at circ@bipole at path{emptyzdiode}{#1}}
+\def\pgf at circ@emptyzzdiode at path#1{\pgf at circ@bipole at path{emptyzzdiode}{#1}}
+\def\pgf at circ@emptysdiode at path#1{\pgf at circ@bipole at path{emptysdiode}{#1}}
+\def\pgf at circ@emptytdiode at path#1{\pgf at circ@bipole at path{emptytdiode}{#1}}
+\def\pgf at circ@emptylediode at path#1{\pgf at circ@bipole at path{emptylediode}{#1}}
+\def\pgf at circ@emptypdiode at path#1{\pgf at circ@bipole at path{emptypdiode}{#1}}
+\def\pgf at circ@emptyvarcap at path#1{\pgf at circ@bipole at path{emptyvarcap}{#1}}
+\def\pgf at circ@emptybidirectionaldiode at path#1{\pgf at circ@bipole at path{emptybidirectionaldiode}{#1}}
+
+\compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fulldiode at path}}
+\compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fullsdiode at path}}
+\compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fullzdiode at path}}
+\compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fullzzdiode at path}}
+\compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fulltdiode at path}}
+\compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fullpdiode at path}}
+\compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fulllediode at path}}
+\compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fullvarcap at path}}
+\compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fullbidirectionaldiode at path}}
+\compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fullthyristor at path}}
+\compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@fulltriac at path}}
+
+\compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptydiode at path}}
+\compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptysdiode at path}}
+\compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptyzdiode at path}}
+\compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptyzzdiode at path}}
+\compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptytdiode at path}}
+\compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptypdiode at path}}
+\compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptylediode at path}}
+\compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptyvarcap at path}}
+\compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptybidirectionaldiode at path}}
+\compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptythyristor at path}}
+\compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@emptytriac at path}}
+
+\compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptydiode at path}}
+\compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptysdiode at path}}
+\compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptyzdiode at path}}
+\compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptyzzdiode at path}}
+\compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptytdiode at path}}
+\compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptypdiode at path}}
+\compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptylediode at path}}
+\compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptyvarcap at path}}
+\compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptythyristor at path}}
+%\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf at circ@emptytriac at path}}
+
+\def\pgfcircdiodestylemacro{\ifpgf at circuit@strokediode stroke \else\ifpgf at circuit@fulldiode full \else empty \fi\fi}
+
+\compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}}
+\compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}}
+\compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}}
+\compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}}
+\compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}}
+\compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}}
+\compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}}
+\compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}}
+\compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}}
+\compattikzset{triac/.style = {\comnpatname \ifpgf at circuit@fulldiode full \else empty \fi triac}}%no stroke triac!
+\compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf at circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
+
+%% Define Shortcuts
+\compattikzset{Do/.style = {\comnpatname empty diode}}
+\compattikzset{tDo/.style = {\comnpatname empty tunnel diode}}
+\compattikzset{zDo/.style = {\comnpatname empty Zener diode}}
+\compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}}
+\compattikzset{sDo/.style = {\comnpatname empty Schottky diode}}
+\compattikzset{pDo/.style = {\comnpatname empty photodiode}}
+\compattikzset{leDo/.style = {\comnpatname empty led}}
+\compattikzset{VCo/.style = {\comnpatname empty varcap}}
+\compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}}
+\compattikzset{Tyo/.style = {\comnpatname empty thyristor}}
+\compattikzset{Tro/.style = {\comnpatname empty triac}}
+
+\compattikzset{D*/.style = {\comnpatname full diode}}
+\compattikzset{tD*/.style = {\comnpatname full tunnel diode}}
+\compattikzset{zD*/.style = {\comnpatname full Zener diode}}
+\compattikzset{zzD*/.style = {\comnpatname full ZZener diode}}
+\compattikzset{sD*/.style = {\comnpatname full Schottky diode}}
+\compattikzset{pD*/.style = {\comnpatname full photodiode}}
+\compattikzset{leD*/.style = {\comnpatname full led}}
+\compattikzset{VC*/.style = {\comnpatname full varcap}}
+\compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}}
+\compattikzset{Ty*/.style = {\comnpatname full thyristor}}
+\compattikzset{Tr*/.style = {\comnpatname full triac}}
+
+\compattikzset{D/.style = {\comnpatname diode}}
+\compattikzset{tD/.style = {\comnpatname tunnel diode}}
+\compattikzset{zD/.style = {\comnpatname Zener diode}}
+\compattikzset{zzD/.style = {\comnpatname ZZener diode}}
+\compattikzset{sD/.style = {\comnpatname Schottky diode}}
+\compattikzset{pD/.style = {\comnpatname photodiode}}
+\compattikzset{leD/.style = {\comnpatname led}}
+\compattikzset{VC/.style = {\comnpatname varcap}}
+\compattikzset{biD/.style = {\comnpatname bidirectionaldiode}}
+\compattikzset{Ty/.style = {\comnpatname thyristor}}
+\compattikzset{Tr/.style = {\comnpatname triac}}
+
+\compattikzset{D-/.style = {\comnpatname stroke diode}}
+\compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}}
+\compattikzset{zD-/.style = {\comnpatname stroke Zener diode}}
+\compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}}
+\compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}}
+\compattikzset{pD-/.style = {\comnpatname stroke photodiode}}
+\compattikzset{leD-/.style = {\comnpatname stroke led}}
+\compattikzset{VC-/.style = {\comnpatname stroke varcap}}
+\compattikzset{Ty-/.style = {\comnpatname stroke thyristor}}
+\compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac!
+\compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
+
+% % % % % %
+% % End of Diodes
+% % % % % %
+
+
+\compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@memristor at path}}
+\compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cspst at path, l=#1}}
+\compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ospst at path, l=#1}}
+\compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ncs at path, l=#1}}
+\compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@nos at path, l=#1}}
+\compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ncs at path, l=#1}}
+\compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@nos at path, l=#1}}
+\compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cspst at path, l=#1}}
+\compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@pushbutton at path, l=#1}}
+\compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@pushbutton at path, l=#1}}
+\compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@pushbutton at path, l=#1}}
+\compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ncpushbutton at path, l=#1}}
+\compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ncpushbutton at path, l=#1}}
+\compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@toggleswitch at path}}
+
+\compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ammeter at path}}
+\compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@voltmeter at path}}
+\compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@ohmmeter at path}}
+\tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@oscope at path, l=#1}}
+
+% cute switches
+%% closed cute switch
+\def\pgf at circ@cuteclosedswitch at path#1{\pgf at circ@bipole at path{cuteclosedswitch}{#1}}
+\compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cuteclosedswitch at path, l=#1}}
+\compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}}
+
+%% open cute switch
+\def\pgf at circ@cuteopenswitch at path#1{\pgf at circ@bipole at path{cuteopenswitch}{#1}}
+\compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cuteopenswitch at path, l=#1}}
+\compattikzset{cosw/.style= {\comnpatname cute open switch= #1}}
+
+%% closing cute switch
+\def\pgf at circ@cuteclosingswitch at path#1{\pgf at circ@bipole at path{cuteclosingswitch}{#1}}
+\compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cuteclosingswitch at path, l=#1}}
+\compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}}
+
+%% opening cute switch
+\def\pgf at circ@cuteopeningswitch at path#1{\pgf at circ@bipole at path{cuteopeningswitch}{#1}}
+\compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cuteopeningswitch at path, l=#1}}
+\compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}}
+
+
+% short forms
+\compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@esource at path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@pvsource at path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@dcvsource at path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@dcisource at path, \circuitikzbasekey/bipole/is current=true, l=#1}}
+
+\compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf at circ@oosource at path, i=#1}}
+\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf at circ@oosource at path, v=#1}}
+\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf at circ@oosourcetrans at path, v=#1}}
+\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf at circ@ooosource at path, v=#1}}
+
+\compattikzset{vsource/.style = {\comnpatname voltage source = #1}}
+\compattikzset{isource/.style = {\comnpatname current source = #1}}
+\compattikzset{cisource/.style = {\comnpatname controlled current source = #1}}
+\compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}}
+\compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}}
+\compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}}
+\compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}}
+\compattikzset{vsourcetri/.style = {triangle voltage source = #1}}
+\compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}}
+\compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
+\compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
+
+\compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}}
+\compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}}
+\compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
+\compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
+
+\compattikzset{R/.style= {\comnpatname resistor = #1}}
+\compattikzset{vR/.style= {\comnpatname variable resistor = #1}}
+\compattikzset{phR/.style= {\comnpatname photoresistor = #1}}
+\compattikzset{thR/.style= {\comnpatname thermistor = #1}}
+\compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}}
+\compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}}
+\compattikzset{pR/.style= {\comnpatname potentiometer = #1}}
+\compattikzset{C/.style = {\comnpatname capacitor = #1}}
+\compattikzset{eC/.style = {\comnpatname ecapacitor = #1}}
+%% pC is deprecated, use cC instead
+\compattikzset{pC/.style = {\comnpatname polar capacitor = #1}}
+\compattikzset{cC/.style = {\comnpatname curved capacitor = #1}}
+\compattikzset{vC/.style = {\comnpatname variable capacitor = #1}}
+\compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}}
+\compattikzset{L/.style = {\comnpatname inductor = #1}}
+\compattikzset{vL/.style = {\comnpatname variable inductor = #1}}
+\compattikzset{V/.style = {\comnpatname voltage source = #1}}
+\compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}}
+\compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}}
+\compattikzset{sqV/.style = {\comnpatname square voltage source = #1}}
+\compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}}
+\compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
+\def\pgf at temp#1{
+ \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} }
+ \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} }
+ \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} }
+ \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} }
+}
+\pgf at temp{_>} \pgf at temp{_<} \pgf at temp{^>} \pgf at temp{^<}
+\pgf at temp{>} \pgf at temp{<} \pgf at temp{^} \pgf at temp{_}
+
+%current sources
+\compattikzset{I/.style = {\comnpatname current source = #1}}
+\compattikzset{cI/.style = {\comnpatname controlled current source = #1}}
+\compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}}
+\compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}}
+\def\pgf at temp#1{
+ \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} }
+ \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} }
+ \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} }
+ \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} }
+}
+\pgf at temp{_>} \pgf at temp{_<} \pgf at temp{^>} \pgf at temp{^<}
+\pgf at temp{>_} \pgf at temp{<_} \pgf at temp{>^} \pgf at temp{<^}
+\pgf at temp{>} \pgf at temp{<} \pgf at temp{^} \pgf at temp{_}
+
+% cute sources
+\def\pgf at circ@vsourceC at path#1{\pgf at circ@bipole at path{vsourceC}{#1}}
+\compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vsourceC at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}}
+\compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}}
+
+\def\pgf at circ@isourceC at path#1{\pgf at circ@bipole at path{isourceC}{#1}}
+\compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@isourceC at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+\compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}}
+\compattikzset{ceI/.style= {\comnpatname cute european current source= #1}}
+
+\def\pgf at circ@cvsourceC at path#1{\pgf at circ@bipole at path{cvsourceC}{#1}}
+\compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cvsourceC at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}}
+\compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}}
+
+\def\pgf at circ@cisourceC at path#1{\pgf at circ@bipole at path{cisourceC}{#1}}
+\compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cisourceC at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+\compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}}
+\compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}}
+
+% noise sources
+\def\pgf at circ@vsourceN at path#1{\pgf at circ@bipole at path{vsourceN}{#1}}
+\compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@vsourceN at path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}}
+\compattikzset{nV/.style= {\comnpatname noise voltage source= #1}}
+
+\def\pgf at circ@isourceN at path#1{\pgf at circ@bipole at path{isourceN}{#1}}
+\compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@isourceN at path, \circuitikzbasekey/bipole/is current=true, i=#1}}
+\compattikzset{isourceN/.style= {\comnpatname noise current source= #1}}
+\compattikzset{nI/.style= {\comnpatname noise current source= #1}}
+
+% resistive sensor american style
+\def\pgf at circ@resistivesens at path#1{\pgf at circ@bipole at path{resistivesens}{#1}}
+\compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@resistivesens at path, l=#1}}
+\compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@thermistorntc at path, l=#1}}
+\compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf at circ@sresistor at path, l=#1}}
+\compattikzset{sR/.style= {\comnpatname resistive sensor= #1}}
+
+\compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf at circ@capacitivesens at path, l=#1}}
+\compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}}
+
+\compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@cuteinductivesens at path, l=#1}}
+\compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@europeaninductivesens at path, l=#1}}
+\compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@americaninductivesens at path, l=#1}}
+\compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf at circ@inductivesens at path, l=#1}}
+\compattikzset{sL/.style= {\comnpatname inductive sensor= #1}}
+
+\compattikzset{Mr/.style = {\comnpatname memristor}}
+
+\compattikzset{cspst/.style = {\comnpatname closing switch = #1}}
+\compattikzset{ospst/.style = {\comnpatname opening switch = #1}}
+\compattikzset{spst/.style = {\comnpatname switch = #1}}
+
+\compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}}
+
+\compattikzset{vdd/.style = {\comnpatname vcc = #1}}
+\compattikzset{vss/.style = {\comnpatname vee = #1}}
+
+% activate the to-style crossing
+\def\pgf at circ@crossing at path#1{\pgf at circ@bipole at path{crossing}{#1}}
+\compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@crossing at path, l=#1}}
+\compattikzset{xing/.style= {\comnpatname crossing= #1}}
+
+%% loudspeaker and microphone
+
+\def\pgf at circ@loudspeaker at path#1{\pgf at circ@bipole at path{loudspeaker}{#1}}
+\compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@loudspeaker at path, l=#1}}
+
+\def\pgf at circ@mic at path#1{\pgf at circ@bipole at path{mic}{#1}}
+\compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@mic at path, l=#1}}
+
+% more instrument
+\def\pgf at circ@rmeter at path#1{\pgf at circ@bipole at path{rmeter}{#1}}
+\compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@rmeter at path, l=#1}}
+\def\pgf at circ@rmeterwa at path#1{\pgf at circ@bipole at path{rmeterwa}{#1}}
+\compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@rmeterwa at path, l=#1}}
+\def\pgf at circ@smeter at path#1{\pgf at circ@bipole at path{smeter}{#1}}
+\compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@smeter at path, l=#1}}
+% current loop probes
+\def\pgf at circ@iloop at path#1{\pgf at circ@bipole at path{iloop}{#1}}
+\compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@iloop at path, l=#1}}
+\def\pgf at circ@iloop2 at path#1{\pgf at circ@bipole at path{iloop2}{#1}}
+\compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@iloop2 at path, l=#1}}
+% qucs-style probes
+\def\pgf at circ@qiprobe at path#1{\pgf at circ@bipole at path{qiprobe}{#1}}
+\compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@qiprobe at path, l=#1}}
+\def\pgf at circ@qvprobe at path#1{\pgf at circ@bipole at path{qvprobe}{#1}}
+\compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@qvprobe at path, l=#1}}
+\def\pgf at circ@qpprobe at path#1{\pgf at circ@bipole at path{qpprobe}{#1}}
+\compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@qpprobe at path, l=#1}}
+% multiwire(s)
+\def\pgf at circ@bmultiwire at path#1{\pgf at circ@bipole at path{bmultiwire}{#1}}
+\compattikzset{bmultiwire/.style = {\circuitikzbasekey,
+/tikz/to path=\pgf at circ@bmultiwire at path, l=#1}}
+\def\pgf at circ@multiwire at path#1{\pgf at circ@bipole at path{multiwire}{#1}}
+\compattikzset{multiwire/.style = {\circuitikzbasekey,
+/tikz/to path=\pgf at circ@multiwire at path, l=#1}}
+\def\pgf at circ@tmultiwire at path#1{\pgf at circ@bipole at path{tmultiwire}{#1}}
+\compattikzset{tmultiwire/.style = {\circuitikzbasekey,
+/tikz/to path=\pgf at circ@tmultiwire at path, l=#1}}
+
+% reed switches
+\def\pgf at circ@reed at path#1{\pgf at circ@bipole at path{reed}{#1}}
+\compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@reed at path, l=#1}}
+
+% Transistor like bipoles
+
+\def\pgf at circ@trans at path#1#2{
+ \pgfextra{
+ \edef\pgf at temp{\ctikzvalof{bipole/name}}
+ \def\pgf at circ@temp{#2}
+ \ifx\pgf at temp\pgf at circ@temp % if it has not a name
+ \pgfmathrandominteger{\pgf at circ@rand}{1000}{9999}
+ \ctikzset{bipole/name = trans\pgf at circ@rand} % create it
+ \fi
+ }
+ \ifpgf at circuit@bipole at inverted
+ (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
+ (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
+ \else
+ (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
+ (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
+ \fi
+ \pgfextra{
+ \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
+ {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
+ \pgfmathadd{\pgfmathresult}{-90}
+ \pgfmathround{\pgfmathresult}
+ \edef\pgf at circ@direction{\pgfmathresult}
+ }
+ ($(\tikztostart) ! .5 ! (\tikztotarget)$)
+ node[#1, /tikz/rotate=\pgf at circ@direction, xscale=\ctikzvalof{mirror value}]
+ (\ctikzvalof{bipole/name}) {}
+ node {\ctikzvalof{bipole/label/name}}
+ \ifcsname pgf at anchor@#1 at pathstart\endcsname%if special path-anchors are defined, use them!
+ (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
+ (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
+ \else
+ (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
+ (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
+ \fi
+ \drawpoles
+ \pgfextra{
+ \pgfcircresetpath
+ }
+ (\tikztotarget) \tikztonodes % e si continua
+}
+
+
+\def\pgf at circ@definetranspath#1{
+ \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@trans at path{#1}{}, l=##1}}
+}
+
+\pgf at circ@definetranspath{elmech}
+\pgf at circ@definetranspath{nmos}
+\pgf at circ@definetranspath{pmos}
+\pgf at circ@definetranspath{hemt}
+\pgf at circ@definetranspath{npn}
+\pgf at circ@definetranspath{pnp}
+\pgf at circ@definetranspath{nfet}
+\pgf at circ@definetranspath{nigfete}
+\pgf at circ@definetranspath{nigfetd}
+\pgf at circ@definetranspath{nigfetebulk}
+\pgf at circ@definetranspath{pfet}
+\pgf at circ@definetranspath{pigfete}
+\pgf at circ@definetranspath{pigfetd}
+\pgf at circ@definetranspath{pigfetebulk}
+\pgf at circ@definetranspath{njfet}
+\pgf at circ@definetranspath{pjfet}
+\pgf at circ@definetranspath{pigbt}
+\pgf at circ@definetranspath{nigbt}
+\pgf at circ@definetranspath{Lpigbt}
+\pgf at circ@definetranspath{Lnigbt}
+%%%---------- close: tex/pgfcircpath
+
+\catcode`\@=\tikzatcode
+\catcode`\|=\tikzbarcode
+\catcode`\!=\tikzexclaimcode
+
+% define the environment
+\long\def\startcircuitikz#1\stopcircuitikz{\starttikzpicture#1\stoptikzpicture}
+
+\protect
+
+\stopmodule
+
+\endinput
Property changes on: trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.1.2.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -10,8 +10,8 @@
%
% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
-\def\pgfcircversion{1.1.2}
-\def\pgfcircversiondate{2020/05/17}
+\def\pgfcircversion{1.2.0}
+\def\pgfcircversiondate{2020/06/21}
\writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
\usemodule[tikz]
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -438,7 +438,7 @@
\ctikzset{bipoles/loudspeaker/depth/.initial=.3}
\ctikzset{bipoles/loudspeaker/width/.initial=.8}
\ctikzset{bipoles/mic/height/.initial=1.2}
-\ctikzset{bipoles/mic/depth/.initial=.0}
+\ctikzset{bipoles/mic/depth/.initial=.1}
\ctikzset{bipoles/mic/width/.initial=.8}
% Zig Zag resistors
@@ -722,10 +722,8 @@
\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
\ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
\ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
-\ctikzset{bipoles/short/height/.initial=0} %dummy height for voltage positioning
-\ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning
-%\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2}
-%\ctikzset{bipoles/short/voltage/distance from node/.initial=.5}
+\ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning
+\ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning
% multiwire
\ctikzset{bipoles/multiwire/height/.initial=0.4}
\ctikzset{bipoles/multiwire/width/.initial=0.2}
@@ -739,20 +737,20 @@
\ctikzset{bipoles/voltmeter/width/.initial=.60}
\ctikzset{bipoles/smeter/height/.initial=.60}
\ctikzset{bipoles/smeter/width/.initial=.60}
-\ctikzset{bipoles/smeter/voltage/additional label shift/.initial=1}
+\ctikzset{bipoles/smeter/voltage/additional shift/.initial=1}
\ctikzset{bipoles/qmeter/depth/.initial=.40}
\ctikzset{bipoles/qmeter/height/.initial=.80}
\ctikzset{bipoles/qmeter/width/.initial=.60}
% this must be specified for each one
-\ctikzset{bipoles/qvprobe/voltage/additional label shift/.initial=.5}
-\ctikzset{bipoles/qiprobe/voltage/additional label shift/.initial=.5}
-\ctikzset{bipoles/qpprobe/voltage/additional label shift/.initial=.5}
+\ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5}
+\ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5}
+\ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5}
\ctikzset{bipoles/iloop/width/.initial=.40}
\ctikzset{bipoles/iloop/height/.initial=.60}
\ctikzset{bipoles/oscope/height/.initial=.60}
\ctikzset{bipoles/oscope/width/.initial=.60}
-\ctikzset{bipoles/oscope/voltage/additional label shift/.initial=1}
+\ctikzset{bipoles/oscope/voltage/additional shift/.initial=1}
% option to not rotate the new (Romano's) instruments
@@ -1207,6 +1205,7 @@
%% transistors stop here
%% Logic ports
+%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex
\newif\ifpgf at circuit@europeanlogicport
\ctikzset{logic ports/.is choice}
@@ -1219,6 +1218,9 @@
\tikzset{nand port/.style={shape=european nand port}}%
\tikzset{nor port/.style={shape=european nor port}}%
\tikzset{xnor port/.style={shape=european xnor port}}%
+ % there is no Schmitt ports in european style (yet)
+ \tikzset{schmitt port/.style={shape=schmitt}}%
+ \tikzset{invschmitt port/.style={shape=invschmitt}}%
}}
\ctikzset{logic ports/american/.code= {\pgf at circuit@europeanlogicportfalse
\tikzset{and port/.style={shape=american and port}}%
@@ -1229,6 +1231,8 @@
\tikzset{nand port/.style={shape=american nand port}}%
\tikzset{nor port/.style={shape=american nor port}}%
\tikzset{xnor port/.style={shape=american xnor port}}%
+ \tikzset{schmitt port/.style={shape=schmitt}}%
+ \tikzset{invschmitt port/.style={shape=invschmitt}}%
}}
\ctikzset{logic ports origin/.is choice}
@@ -1272,13 +1276,27 @@
\ctikzset{american or shape/roundy/.code={\pgfcirc at roundy@or at shapestrue}}
\ctikzset{american or shape/pointy/.code={\pgfcirc at roundy@or at shapesfalse}}
-\newif\ifpgfcirc at draw@leads\pgfcirc at draw@leadstrue
+\newif\ifpgfcirc at draw@input at leads\pgfcirc at draw@input at leadstrue
\ctikzset{logic ports draw input leads/.is choice}
-\ctikzset{logic ports draw input leads/true/.code={\pgfcirc at draw@leadstrue}}
-\ctikzset{logic ports draw input leads/false/.code={\pgfcirc at draw@leadsfalse}}
-\tikzset{input leads/.code={\pgfcirc at draw@leadstrue}}
-\tikzset{no input leads/.code={\pgfcirc at draw@leadsfalse}}
+\ctikzset{logic ports draw input leads/true/.code={\pgfcirc at draw@input at leadstrue}}
+\ctikzset{logic ports draw input leads/false/.code={\pgfcirc at draw@input at leadsfalse}}
+\tikzset{input leads/.code={\pgfcirc at draw@input at leadstrue}}
+\tikzset{no input leads/.code={\pgfcirc at draw@input at leadsfalse}}
+\newif\ifpgfcirc at draw@output at leads\pgfcirc at draw@output at leadstrue
+\ctikzset{logic ports draw output leads/.is choice}
+\ctikzset{logic ports draw output leads/true/.code={\pgfcirc at draw@output at leadstrue}}
+\ctikzset{logic ports draw output leads/false/.code={\pgfcirc at draw@output at leadsfalse}}
+\tikzset{output leads/.code={\pgfcirc at draw@output at leadstrue}}
+\tikzset{no output leads/.code={\pgfcirc at draw@output at leadsfalse}}
+
+\ctikzset{logic ports draw leads/.is choice}
+\ctikzset{logic ports draw leads/true/.code={\pgfcirc at draw@output at leadstrue\pgfcirc at draw@input at leadstrue}}
+\ctikzset{logic ports draw leads/false/.code={\pgfcirc at draw@output at leadsfalse\pgfcirc at draw@input at leadsfalse}}
+\tikzset{all leads/.code={\pgfcirc at draw@output at leadstrue\pgfcirc at draw@input at leadstrue}}
+\tikzset{no leads/.code={\pgfcirc at draw@output at leadsfalse\pgfcirc at draw@input at leadsfalse}}
+
+
\ctikzset{tripoles/american and port/width/.initial=1.1}
\ctikzset{tripoles/american and port/height/.initial=.8}
\ctikzset{tripoles/american and port/port width/.initial=.7}
@@ -1869,7 +1887,7 @@
\ctikzset{voltage/american/.code = {\pgf at circuit@europeanvoltagefalse\pgf at circuit@bipole at voltage@straightfalse}}
\ctikzset{voltage/european/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straightfalse}}
\ctikzset{voltage/straight/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straighttrue}}
-\ctikzset{voltage/curved/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straighttrue}}
+\ctikzset{voltage/curved/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straightfalse}}
\ctikzset{current/.is choice}
\ctikzset{current/american/.code = \pgf at circuit@europeancurrentfalse}
@@ -1880,62 +1898,101 @@
\ctikzset{straight/true/.code = {\pgf at circuit@bipole at voltage@straighttrue}}
\ctikzset{straight/false/.code = {\pgf at circuit@bipole at voltage@straightfalse}}
\ctikzset{bipole/straight/.is if=pgf at circuit@bipole at voltage@straight}
-% never used, removed (RG 2020-05-17)
-% \ctikzset{straightvoltage value/.initial=true}
-% \ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}}
-
%
% voltage is used also to set parameters, apart for the /.is choice
% above. I hope it is ok --- would be a mess otherwise
%
-
-\ctikzset{voltage/distance from node/.initial=.5} %\pgf at circ@Rlen units
-\ctikzset{voltage/distance from line/.initial=.08} % pos, tra 0 e 1
-\ctikzset{voltage/bump a/.initial=1.2}
-\ctikzset{voltage/bump b/.initial=1.5}
\ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
\ctikzset{voltage shift/.style={voltage/shift=#1}}
\tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
-\ctikzset{voltage/european label distance/.initial=1.4}
-\ctikzset{voltage/american label distance/.initial=1.1}
+
% shaping the +/- sign, see pgfcircvoltage.tex
\ctikzset{voltage/american font/.initial={}}
\ctikzset{voltage/american plus/.initial={$+$}}
\ctikzset{voltage/american minus/.initial={$-$}}
-
+% here we start the voltage adjustments for special components.
+% default values:
+%
+% this is the distance of the "point" marking the voltage along the line
+% 0.0 is on the external nodes of the to path
+% 1.0 is cramped on the object
+% this can be overriden component by component
+\ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1
+%
+% this is the distance from the line (perpendicular to) where the voltage is drawn.
+% It is global, and not adjustable by component (use the "label distance" or locally
+% if you need it)
+\ctikzset{voltage/distance from line/.initial=.08}% in \pgf at circ@scaled at Rlen units
+%
+% bend paramenters for european arc. You can override them component-based
+\ctikzset{voltage/bump b/.initial=1.5}
+%
+% generator voltages symbols or arrows (always straight) are put along the
+% 60 ... 120 angles of the symbol (don't ask why). The distance here is on the
+% center..angle line. It's called bump a because I don't know...
+%
+\ctikzset{voltage/bump a/.initial=1.2}
+%
+% these are the label distances FROM the drawings.
+% You can override them component by component.
+\ctikzset{voltage/european label distance/.initial=1.4}
+\ctikzset{voltage/straight label distance/.initial=1.4}
+\ctikzset{voltage/american label distance/.initial=1.4}
+%
+% the KIND is the node name without SHAPE
+% See the definition above for meaning
+% if bipoles/KIND/voltage/straight label distance is not defined, it uses the height
+% if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance)
+%
% special cases for voltage positions
-\ctikzset{bipoles/generic/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4}
\ctikzset{bipoles/generic/voltage/bump b/.initial=2}
-\ctikzset{bipoles/generic/voltage/european label distance/.initial=1.8}
-%\ctikzset{bipoles/thermocouple/voltage/distance from node/.initial=.3}
-\ctikzset{bipoles/thermocouple/voltage/bump b/.initial=2.2}
-\ctikzset{bipoles/thermocouple/voltage/european label distance/.initial=1.5}
+%
\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
-\ctikzset{bipoles/ageneric/voltage/european label distance/.initial=1.8}
+%
\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
-\ctikzset{bipoles/fullgeneric/voltage/european label distance/.initial=1.8}
+%
\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
\ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
-\ctikzset{bipoles/memristor/voltage/european label distance/.initial=1.8}
-%\ctikzset{bipoles/tline/voltage/distance from node/.initial=.2}
+%
\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
-\ctikzset{bipoles/tline/voltage/european label distance/.initial=2.1}
-%\ctikzset{bipoles/varistor/voltage/distance from node/.initial=.2}
+%
\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
-\ctikzset{bipoles/varistor/voltage/european label distance/.initial=2}
-%\ctikzset{bipoles/photoresistor/voltage/distance from node/.initial=.2}
-\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=2}
-\ctikzset{bipoles/photoresistor/voltage/european label distance/.initial=1.8}
-%\ctikzset{bipoles/thermistor/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8}
+%
+\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6}
+%
\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
-\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=2}
-%\ctikzset{bipoles/thermistorntc/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8}
\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
-%\ctikzset{bipoles/thermistorptc/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8}
\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
+\ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8}
%
+\ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2}
+%
+\ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5}
+\ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0}
+\ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5}
+\ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0}
+\ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0}
+\ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2}
+\ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0}
+\ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2}
+\ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8}
+\ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8}
+\ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8}
+\ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8}
+%
+\ctikzset{bipoles/short/voltage/american label distance/.initial=2.8}
+\ctikzset{bipoles/open/voltage/distance from node/.initial=0.3}
+%
+\ctikzset{bipoles/battery/voltage/bump a/.initial=1.4}
+\ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2}
+\ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2}
+%
% american open voltage adjusting
%
\newif\ifpgf at adjust@open at voltage\pgf at adjust@open at voltagetrue
@@ -1942,7 +1999,6 @@
\ctikzset{american open voltage/.is choice}
\ctikzset{american open voltage/center/.code={\pgf at adjust@open at voltagetrue}}
\ctikzset{american open voltage/legacy/.code={\pgf at adjust@open at voltagefalse}}
-
%
% currents
%
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -170,16 +170,16 @@
\anchorborder{%
\ifpgf at circuit@bipole at inverted
\pgf at circ@res at left=-\pgf at x
- \pgf at circ@res at right=-\pgf at y
+ \pgf at circ@res at up=-\pgf at y
\else
\pgf at circ@res at left=\pgf at x
- \pgf at circ@res at right=\pgf at y
+ \pgf at circ@res at up=\pgf at y
\fi
- \ifdim\pgf at circ@res at right>0cm
- \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at right}}{\northeastborder}
+ \ifdim\pgf at circ@res at up>0cm
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\northeastborder}
\else
\southwestborder
- \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at right}}{\pgfpoint{-\pgf at x}{-\pgf at y}}
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{-\pgf at x}{-\pgf at y}}
\fi
}
@@ -218,12 +218,34 @@
%%% NOTICE that the short is really NOT drawn; we trust the fact that its
%%% natural length is zero.
\pgfcircdeclarebipole
-{}
+{% fix the anchor border to add a bit of space for voltage and labels
+ % it uses the dummy width and height
+ \anchorborder{%
+ \ifpgf at circuit@bipole at inverted
+ \pgf at circ@res at left=-\pgf at x
+ \pgf at circ@res at up=-\pgf at y
+ \else
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \fi
+ \ifdim\pgf at circ@res at up>0cm
+ \pgf at x=\ctikzvalof{bipoles/short/width}\pgf at circ@Rlen
+ \pgf at y=\ctikzvalof{bipoles/short/height}\pgf at circ@Rlen
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ {\pgfpoint{\pgf at x}{\pgf at y}}
+ \else
+ \pgf at x=-\ctikzvalof{bipoles/short/width}\pgf at circ@Rlen
+ \pgf at y=-\ctikzvalof{bipoles/short/height}\pgf at circ@Rlen
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ {\pgfpoint{-\pgf at x}{-\pgf at y}}
+ \fi
+ }
+}
{0}
{short}
{0}
{0}
-{ }
+{}
%% Open circuit
\pgfcircdeclarebipole
@@ -232,7 +254,7 @@
{open}
{\ctikzvalof{bipoles/open/height}}
{\ctikzvalof{bipoles/open/width}}
-{ }
+{}
% multiwire(s)
\pgfcircdeclarebipole
@@ -2414,7 +2436,24 @@
%% Black alternative zigzag Zener diode
\pgfcircdeclarebipolescaled{diodes}
-{}
+{% fix the anchor border
+ \anchorborder{%
+ \ifpgf at circuit@bipole at inverted
+ \pgf at circ@res at left=-\pgf at x
+ \pgf at circ@res at up=-\pgf at y
+ \else
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \fi
+ \ifdim\pgf at circ@res at up>0cm
+ \northeastborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at x}{1.3\pgf at y}}
+ \else
+ \southwestborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{-\pgf at x}{-1.3\pgf at y}}
+ \fi
+ }
+}
{\ctikzvalof{bipoles/diode/height}}
{fullzzdiode}
{\ctikzvalof{bipoles/diode/height}}
@@ -2540,7 +2579,24 @@
}
%% Black light emitting diode
\pgfcircdeclarebipolescaled{diodes}
-{}
+{% fix the anchor border
+ \anchorborder{%
+ \ifpgf at circuit@bipole at inverted
+ \pgf at circ@res at left=-\pgf at x
+ \pgf at circ@res at up=-\pgf at y
+ \else
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \fi
+ \ifdim\pgf at circ@res at up>0cm
+ \northeastborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at x}{1.8\pgf at y}}
+ \else
+ \southwestborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{-\pgf at x}{-\pgf at y}}
+ \fi
+ }
+}
{\ctikzvalof{bipoles/diode/height}}
{fulllediode}
{\ctikzvalof{bipoles/diode/height}}
@@ -2565,7 +2621,24 @@
%% Black photodiode
\pgfcircdeclarebipolescaled{diodes}
-{}
+{% fix the anchor border
+ \anchorborder{%
+ \ifpgf at circuit@bipole at inverted
+ \pgf at circ@res at left=-\pgf at x
+ \pgf at circ@res at up=-\pgf at y
+ \else
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \fi
+ \ifdim\pgf at circ@res at up>0cm
+ \northeastborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at x}{1.8\pgf at y}}
+ \else
+ \southwestborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{-\pgf at x}{-\pgf at y}}
+ \fi
+ }
+}
{\ctikzvalof{bipoles/diode/height}}
{fullpdiode}
{\ctikzvalof{bipoles/diode/height}}
@@ -2671,7 +2744,24 @@
%% Empty alternative zigzag Zener diode
\pgfcircdeclarebipolescaled{diodes}
-{}
+{% fix the anchor border
+ \anchorborder{%
+ \ifpgf at circuit@bipole at inverted
+ \pgf at circ@res at left=-\pgf at x
+ \pgf at circ@res at up=-\pgf at y
+ \else
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \fi
+ \ifdim\pgf at circ@res at up>0cm
+ \northeastborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at x}{1.3\pgf at y}}
+ \else
+ \southwestborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{-\pgf at x}{-1.3\pgf at y}}
+ \fi
+ }
+}
{\ctikzvalof{bipoles/diode/height}}
{emptyzzdiode}
{\ctikzvalof{bipoles/diode/height}}
@@ -2735,7 +2825,24 @@
%% Empty light emitting diode
\pgfcircdeclarebipolescaled{diodes}
-{}
+{% fix the anchor border
+ \anchorborder{%
+ \ifpgf at circuit@bipole at inverted
+ \pgf at circ@res at left=-\pgf at x
+ \pgf at circ@res at up=-\pgf at y
+ \else
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \fi
+ \ifdim\pgf at circ@res at up>0cm
+ \northeastborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at x}{1.8\pgf at y}}
+ \else
+ \southwestborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{-\pgf at x}{-\pgf at y}}
+ \fi
+ }
+}
{\ctikzvalof{bipoles/diode/height}}
{emptylediode}
{\ctikzvalof{bipoles/diode/height}}
@@ -2755,7 +2862,24 @@
%% Empty photodiode
\pgfcircdeclarebipolescaled{diodes}
-{}
+{% fix the anchor border
+ \anchorborder{%
+ \ifpgf at circuit@bipole at inverted
+ \pgf at circ@res at left=-\pgf at x
+ \pgf at circ@res at up=-\pgf at y
+ \else
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \fi
+ \ifdim\pgf at circ@res at up>0cm
+ \northeastborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at x}{1.8\pgf at y}}
+ \else
+ \southwestborder
+ \pgfpointborderrectangle{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{-\pgf at x}{-\pgf at y}}
+ \fi
+ }
+}
{\ctikzvalof{bipoles/diode/height}}
{emptypdiode}
{\ctikzvalof{bipoles/diode/height}}
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -1229,6 +1229,11 @@
% draw "inverting" circles on outputs, they must be last
%
\pgfscope
+ \ifpgf at circuit@ieeelogicport
+ \def\@@notcirc{notcirc}
+ \else
+ \def\@@notcirc{ocirc}
+ \fi
\pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
\pgf at circ@count at a=\numpins\relax
\divide\pgf at circ@count at a by 2 \pgf at circ@count at b=\pgf at circ@count at a
@@ -1239,7 +1244,7 @@
\edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf at circ@count at c}}
\ifnum\@@tmp>0\pgfscope
\pgftransformshift{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
- \pgfnode{ocirc}{east}{}{\thisshape-N\the\pgf at circ@count at c}{\pgfusepath{stroke}}
+ \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf at circ@count at c}{\pgfusepath{stroke}}
\endpgfscope\fi
% right side pins
\pgf at circ@count at c=\numexpr2*\pgf at circ@count at b-\pgf at circ@count at a+1\relax
@@ -1246,7 +1251,7 @@
\edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf at circ@count at c}}
\ifnum\@@tmp>0\pgfscope
\pgftransformshift{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(\pgf at circ@dip at pin@shift-\the\pgf at circ@count at a)*\pgf at circ@res at step}}
- \pgfnode{ocirc}{west}{}{\thisshape-N\the\pgf at circ@count at c}{\pgfusepath{stroke}}
+ \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf at circ@count at c}{\pgfusepath{stroke}}
\endpgfscope\fi
\advance\pgf at circ@count at a by -1\relax%
\repeatpgfmathloop
@@ -1254,13 +1259,13 @@
\edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
\ifnum\@@tmp>0\pgfscope
\pgftransformshift{\pgfpoint{0pt}{\pgf at circ@res at up}}
- \pgfnode{ocirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
+ \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
\endpgfscope\fi
% down side
\edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
\ifnum\@@tmp>0\pgfscope
\pgftransformshift{\pgfpoint{0pt}{\pgf at circ@res at down}}
- \pgfnode{ocirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
+ \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
\endpgfscope\fi
\endpgfscope
}%
@@ -1431,7 +1436,7 @@
\pgf at circ@draworfill
\endpgfscope
% now we have to draw the pins, if needed
- \ifdim\extshift>0pt\ifpgfcirc at draw@leads\pgfscope % let's avoid too much indent
+ \ifdim\extshift>0pt\ifpgfcirc at draw@input at leads\pgfscope % let's avoid too much indent
% Ok, we have to draw the leads (a.k.a. pins)
\pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
% We mimic the anchors here --- probably there is a better way
@@ -1814,7 +1819,11 @@
%
% integrate with the other logic ports
%
-\ctikzset{logic ports/ieee/.code= {\pgf at circuit@europeanlogicportfalse
+%
+\newif\ifpgf at circuit@ieeelogicport\pgf at circuit@ieeelogicportfalse
+\ctikzset{logic ports/ieee/.code= {%
+ \pgf at circuit@ieeelogicporttrue
+ \pgf at circuit@europeanlogicportfalse
\tikzset{and port/.style={shape=ieeestd and port}}%
\tikzset{or port/.style={shape=ieeestd or port}}%
\tikzset{xor port/.style={shape=ieeestd xor port}}%
@@ -1824,8 +1833,11 @@
\tikzset{nor port/.style={shape=ieeestd nor port}}%
\tikzset{xnor port/.style={shape=ieeestd xnor port}}%
\tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
- \tikzset{inv schmitt port/.style={shape=ieeestd schmitt port}}%
+ \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}%
}}
+% add code to be compatible with the other ports
+\ctikzset{logic ports/european/.add code={\pgf at circuit@ieeelogicportfalse}}
+\ctikzset{logic ports/american/.add code={\pgf at circuit@ieeelogicportfalse}}
\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
%
% the base angle for the or port. See the drawings. This will not change with height
@@ -2244,9 +2256,11 @@
\pgfextractx{\pgf at circ@res at other}{\bodyright} %body border, without "not" ball
\advance\pgf at circ@res at other by \pinlen\relax
\ifdim \pgf at circ@res at other > \pgf at circ@res at right
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
- \pgfusepath{draw}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \fi
\fi
\ifnum #3=1\relax\pgfscope
\pgftransformshift{\pgfpoint{\pgf at circ@res at right}{0pt}}
@@ -2270,7 +2284,7 @@
\pgfmathsetlength{\pgf at circ@res at temp}{\pgf at circ@res at up+0.5*\pind}
\pgfextractx{\pgf at circ@res at left}{\bodyleft}
\pgfextracty{\pgf at circ@res at down}{\bodyleft}
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads --- all the same for AND ports
\loop\ifnum\pgf at circ@count at a>0
\advance\pgf at circ@res at temp by -\pind
@@ -2318,7 +2332,7 @@
% Find the pins on the rack; they are 1...
\pgf at circ@count at b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
\pgf at circ@count at c=\numexpr \inputs - \pgf at circ@count at b +1 \relax % =inputs - K +1
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads --- for or ports
\loop\ifnum\pgf at circ@count at a>0
\pgfextractx{\pgf at circ@res at right}{\topleft}
@@ -2490,10 +2504,7 @@
\anchor{body right}{\bodyright\pgf at y=0pt}
\anchor{right}{\bottomright\pgf at y=0pt}
\anchor{body left}{\bodyleft\pgf at y=0pt}% central edge of the body
- \anchor{left}{% central edge of the component
- \pgf at circ@ieeestd at xorbar% save \xorbar in temp
- \bodyleft\pgf at y=0pt\advance\pgf at x by -\pgf at circ@res at temp
- }
+ \anchor{left}{\bodyleft\pgf at y=0pt}
\anchor{up}{%
\bodyleft
\pgf at y=+0.5\pgf at y\pgf at x=0pt
@@ -2502,7 +2513,57 @@
\bodyleft
\pgf at y=-0.5\pgf at y\pgf at x=0pt
}
-
+ % this is for when it's used as a bipole
+ % we use the enclosing rectangle (see below)
+ \anchorborder{%
+ %% This (commented out) is the correct border anchor. But if we use the correct
+ %% border anchor there is no horizontal space for the label ;-) because
+ %% the triangle is too steep. So we will use a simple square border
+ %%
+ %% find the border anchor of a triangle (like a not port or an
+ %% amplifier) ---
+ %%
+ %% -----^ up
+ %% I --- |
+ %% I -|--
+ %%left I | --- right
+ %% ----I-----|-------I-----
+ %%
+ %%
+ %\pgf at xa=\pgf at x
+ %% it's simmetrical w/ vertical side, use only positive y
+ %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf at y>0,1,-1)}
+ %\pgfmathsetlength{\pgf at ya}{abs(\pgf at y)}
+ %\pgfextracty{\pgf at circ@res at up}{\bodyleft}
+ %\pgfextractx{\pgf at circ@res at left}{\bodyleft}
+ %\pgfextractx{\pgf at circ@res at right}{\bodyright}
+ %% limit angle for the left (vertical) side
+ %\pgfmathsetmacro{\@@phimax}{atan2(\pgf at circ@res at up,\pgf at circ@res at left)}
+ %\pgfmathsetmacro{\@@phi}{atan2(\pgf at ya,\pgf at xa)}
+ %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)}
+ %% find the border
+ %\ifnum\@@leftside>0
+ % % vertical side
+ % \pgfpointborderrectangle{\pgfpoint{\pgf at xa}{\pgf at ya}}
+ % {\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ %\else
+ % % triangle upper line
+ % \pgfpointintersectionoflines
+ % {\pgfpointorigin}{\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ % {\pgfqpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfqpoint{\pgf at circ@res at right}{0pt}}
+ %\fi
+ %% readjust y sign
+ %\pgf at y=\@@switchy\pgf at y
+ %
+ % this is the square border to position the path label with a bit of horizontal space
+ %
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\bodyleft}
+ \pgfextractx{\pgf at circ@res at left}{\bodyleft}
+ \pgfpointborderrectangle{\pgfpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ }
% geographical anchors
\anchor{nw}{\northwest}
\anchor{ne}{\northeast}
@@ -2533,9 +2594,11 @@
\pgfextractx{\pgf at circ@res at other}{\bodyright} %body border, without "not" ball
\advance\pgf at circ@res at other by \pinlen\relax
\ifdim \pgf at circ@res at other > \pgf at circ@res at right
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
- \pgfusepath{draw}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \fi
\fi
\ifnum #2=1\relax\pgfscope
\pgftransformshift{\pgfpoint{\pgf at circ@res at right}{0pt}}
@@ -2556,9 +2619,11 @@
\pgfextracty{\pgf at circ@res at up}{\bodyleft}
\pgfextractx{\pgf at circ@res at right}{\bodyright}
% \draw input pin
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pinlen}{0pt}}
- \pgfusepath{draw}
+ \ifpgfcirc at draw@input at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pinlen}{0pt}}
+ \pgfusepath{draw}
+ \fi
\pgfscope
\pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
\pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
@@ -2569,14 +2634,16 @@
\endpgfscope
}
-\pgfcircdeclareieeebufferportpair{schmitt}{inv schmitt}{%
+\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{%
\pgfextractx{\pgf at circ@res at left}{\bodyleft}
\pgfextracty{\pgf at circ@res at up}{\bodyleft}
\pgfextractx{\pgf at circ@res at right}{\bodyright}
% \draw input pin
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pinlen}{0pt}}
- \pgfusepath{draw}
+ \ifpgfcirc at draw@input at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left-\pinlen}{0pt}}
+ \pgfusepath{draw}
+ \fi
\pgfscope
\pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
\pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -69,21 +69,57 @@
}
}
-
%% Generic bipole path
-%% I am not user what the second argument is needed for
\def\pgf at circ@bipole at path#1#2{
-
+ % Create a bipole path from the shapes defined with \pgfcircdeclarebipole
+ % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape"
+ % appended to the main (path-style) name
+ % #1 path-style node name
+ % #2 the argument passed from the to-path structure; don't touch
+ %
+ % Example:
+ % \def\pgf at circ@capacitor at path#1{\pgf at circ@bipole at path{capacitor}{#1}}
+ %
+ \pgf at circ@bipole at path@base{shape}{}{#1}{#2}
+}
+%
+% this is used for components that are mainly node-style but have a path-style form
+%
+\def\pgfcirc at node@to at path#1#2#3{%
+ % add a path-style component based on a node-style one without mangling the name
+ % of the shape.
+ % #1: node-type shape name (existing)
+ % #2: path-type name (to be created)
+ % #3: additional options to add to the path style
+ %
+ \expandafter\def\csname pgf at circ@#1 at path\endcsname##1{\pgf at circ@bipole at path@base{}{##1}{#1}{}}%
+ \compattikzset{#2/.style = {\circuitikzbasekey,
+ /tikz/to path=\csname pgf at circ@#1 at path\endcsname{##1},
+ #3}}%
+ \ctikzset{bipoles/#1/height/.initial=1}%
+}
+%%
+%% ultra-generic bipole path
+%% I am not sure what the last argument is needed for, but don't touch it or everything explodes
+%%
+\def\pgf at circ@bipole at path@base#1#2#3#4{%
+ %
+ % Create a path-style component based on a node-style shape
+ % #1: postfix to be added to the name path to obtain the main shape name
+ % #2: text to be passed as text to the node
+ % #3: name of the bipole component
+ % #4: this will be filled by the argument of the to-path
+ %
\pgfextra{
\set at explicit@center at anchor{\tikztostart}
\set at explicit@center at anchor{\tikztotarget}
\pgfsyssoftpath at getcurrentpath{\myp at th}%% save current path to extend after calculation of correct start/end coordinates
- \ctikzset{bipole/kind = #1}
+ \ctikzset{bipole/kind = #3}
\edef\pgf at temp{\ctikzvalof{bipole/name}}
\def\pgf at circ@temp{}
\ifx\pgf at temp\pgf at circ@temp % if it has not a name
\pgfmathrandominteger{\pgf at circ@rand}{1000}{9999}
- \ctikzset{bipole/name = #1\pgf at circ@rand} % create it (re-usage should not create problem, but...)
+ \ctikzset{bipole/name = #3\pgf at circ@rand} % create it (re-usage should not create problem, but...)
\fi
}
@@ -98,16 +134,16 @@
% \typeout{DIRECTION:\pgf at circ@direction}
\pgfsyssoftpath at setcurrentpath{\myp at th}
}
- \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#1}}
+ \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#3}}
\ifx\pgf at temp\pgf at circ@temp % if it is an open
\else
--($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?)
\fi
($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node
- node[#1shape, rotate=\pgf at circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
- (\ctikzvalof{bipole/name}) {}
+ node[#3#1, rotate=\pgf at circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
+ (\ctikzvalof{bipole/name}) {#2}
\ifpgf at circuit@bipole at inverted
- \ifcsname pgf at anchor@#1shape at pathstart\endcsname%if special path-anchors are defined, use them!
+ \ifcsname pgf at anchor@#3#1 at pathstart\endcsname%if special path-anchors are defined, use them!
coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
\else
@@ -115,7 +151,7 @@
coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left)
\fi
\else
- \ifcsname pgf at anchor@#1shape at pathstart\endcsname%if special path-anchors are defined, use them!
+ \ifcsname pgf at anchor@#3#1 at pathstart\endcsname%if special path-anchors are defined, use them!
coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
\else
@@ -123,7 +159,7 @@
coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
\fi
\fi
- \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#1}}
+ \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#3}}
\ifx\pgf at temp\pgf at circ@temp % if it is an open
\else
(\ctikzvalof{bipole/name}start.center) -- (anchorstartnode)
@@ -136,7 +172,7 @@
\pgf at circ@ifkeyempty{bipole/voltage/label/name}\else\pgf at circ@drawvoltage\fi
\pgf at circ@ifkeyempty{bipole/current/label/name}\else\pgf at circ@drawcurrent\fi
\pgf at circ@ifkeyempty{bipole/flow/label/name}\else\pgf at circ@drawflow\fi
- \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#1}}
+ \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#3}}
\ifx\pgf at temp\pgf at circ@temp % if it is an open
(\ctikzvalof{bipole/name}end)%Move to end of path
\else
@@ -378,7 +414,9 @@
%% Styles
\def\comnpatname{\ifpgf at circuit@compat *\else\fi}
-\def\compattikzset#1{\tikzset{\comnpatname#1}}
+\def\compattikzset#1{%
+ % \typeout{BIPOLEDEF:\space \detokenize{#1}}%
+ \tikzset{\comnpatname#1}}
%\def\ctikzsetbipole#1#2{%
% \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}%
@@ -672,9 +710,9 @@
\compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf at circ@dcisource at path, \circuitikzbasekey/bipole/is current=true, l=#1}}
\compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf at circ@oosource at path, i=#1}}
-\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf at circ@oosource at path, v=#1}}
-\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf at circ@oosourcetrans at path, v=#1}}
-\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf at circ@ooosource at path, v=#1}}
+\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf at circ@oosource at path, v=#1}}
+\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf at circ@oosourcetrans at path, v=#1}}
+\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf at circ@ooosource at path, v=#1}}
\compattikzset{vsource/.style = {\comnpatname voltage source = #1}}
\compattikzset{isource/.style = {\comnpatname current source = #1}}
@@ -913,3 +951,19 @@
\pgf at circ@definetranspath{nigbt}
\pgf at circ@definetranspath{Lpigbt}
\pgf at circ@definetranspath{Lnigbt}
+%
+% Path-style logical ports
+%
+% create path-style element for one input --- one output logical ports
+%
+\def\pgfcirc at port@node at to@path#1#2{%
+ %
+ % add a logic port path style component --- we need to suppress leads
+ % and use the correct center
+ %
+ \pgfcirc at node@to at path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}%
+}
+\pgfcirc at port@node at to@path{not port}{inline not}
+\pgfcirc at port@node at to@path{buffer port}{inline buffer}
+\pgfcirc at port@node at to@path{schmitt port}{inline schmitt}
+\pgfcirc at port@node at to@path{invschmitt port}{inline invschmitt}
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -283,7 +283,7 @@
\pgfextracty{\pgf at circ@res at up}{\northwest}
\pgfpointborderrectangle
{\pgfqpoint{\pgf at xa}{\pgf at ya}}
- {\pgfqpoint{\pgf at circ@res at up}{\pgfqpoint{\pgf at circ@res at up}}}
+ {\pgfqpoint{\pgf at circ@res at up}{\pgf at circ@res at up}}
}
\behindforegroundpath{
\pgfscope
@@ -326,7 +326,7 @@
\pgfextracty{\pgf at circ@res at up}{\northwest}
\pgfpointborderrectangle
{\pgfqpoint{\pgf at xa}{\pgf at ya}}
- {\pgfqpoint{\pgf at circ@res at up}{\pgfqpoint{\pgf at circ@res at up}}}
+ {\pgfqpoint{\pgf at circ@res at up}{\pgf at circ@res at up}}
}
\behindforegroundpath{
\pgfscope
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -449,7 +449,7 @@
\pgfextracty{\pgf at circ@res at temp}{\step}%
\pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
\pgf at circ@res at count = \inputs\relax
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\loop\ifnum\pgf at circ@res at count>0
\advance\pgf at circ@res at temp by -\pgf at circ@res at step
@@ -461,11 +461,11 @@
\repeat
\fi
% output lead
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint
- {\ctikzvalof{tripoles/american and port/port width}\pgf at circ@res at right}
- {0pt}}
- \pgfusepath{draw}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf at circ@res at right} {0pt}}
+ \pgfusepath{draw}
+ \fi
\pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
@@ -482,7 +482,7 @@
\pgfextracty{\pgf at circ@res at temp}{\step}%
\pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
\pgf at circ@res at count = \inputs\relax
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\loop\ifnum\pgf at circ@res at count>0
\advance\pgf at circ@res at temp by -\pgf at circ@res at step
@@ -494,11 +494,12 @@
\repeat
\fi
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint
- {\ctikzvalof{tripoles/american nand port/port width}\pgf at circ@res at right} {0pt}}
-
- \pgfusepath{draw}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/american nand port/port width}\pgf at circ@res at right} {0pt}}
+ \pgfusepath{draw}
+ \fi
\pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
\pgf at circ@res at step = \ctikzvalof{tripoles/american nand port/circle width}\pgf at circ@res at right
\pgf at circ@res at other = \ctikzvalof{tripoles/american nand port/port width}\pgf at circ@res at right
@@ -528,7 +529,7 @@
\pgfextracty{\pgf at circ@res at temp}{\step}%
\pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
\pgf at circ@res at count = \inputs\relax
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\loop\ifnum\pgf at circ@res at count>0
\advance\pgf at circ@res at temp by -\pgf at circ@res at step
@@ -541,11 +542,12 @@
\fi
\pgf at circ@res at other=\ctikzvalof{tripoles/american nor port/port width}\pgf at circ@res at right
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \fi
- \pgfusepath{draw}
-
\pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
\edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american nor port/angle}}%
@@ -589,7 +591,7 @@
\pgfextracty{\pgf at circ@res at temp}{\step}%
\pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
\pgf at circ@res at count = \inputs\relax
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\loop\ifnum\pgf at circ@res at count>0
\advance\pgf at circ@res at temp by -\pgf at circ@res at step
@@ -602,11 +604,12 @@
\fi
\pgf at circ@res at other=\ctikzvalof{tripoles/american or port/port width}\pgf at circ@res at right
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \fi
- \pgfusepath{draw}
-
\pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
\edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american or port/angle}}%
@@ -646,7 +649,7 @@
\pgfextracty{\pgf at circ@res at temp}{\step}%
\pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
\pgf at circ@res at count = \inputs\relax
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\loop\ifnum\pgf at circ@res at count>0
\advance\pgf at circ@res at temp by -\pgf at circ@res at step
@@ -660,11 +663,12 @@
\fi
\pgf at circ@res at other=\ctikzvalof{tripoles/american xor port/port width}\pgf at circ@res at right
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \fi
- \pgfusepath{draw}
-
\pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
\edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american xor port/angle}}%
@@ -710,7 +714,7 @@
\pgfextracty{\pgf at circ@res at temp}{\step}%
\pgf at circ@res at step = \dimexpr 2\pgf at circ@res at temp -2\pgf at circ@res at up\relax
\pgf at circ@res at count = \inputs\relax
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\loop\ifnum\pgf at circ@res at count>0
\advance\pgf at circ@res at temp by -\pgf at circ@res at step
@@ -724,11 +728,12 @@
\fi
\pgf at circ@res at other=\ctikzvalof{tripoles/american xnor port/port width}\pgf at circ@res at right
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \fi
- \pgfusepath{draw}
-
\pgf at circ@setlinewidth{tripoles}{\pgflinewidth}
\edef\pgf at circ@math at angle{\ctikzvalof{tripoles/american xnor port/angle}}%
@@ -788,8 +793,14 @@
\northwest
\pgf at y=0pt
}
+ \anchor{left}{
+ \northwest
+ \pgf at x=0.7\pgf at x
+ \pgf at y=0pt
+ }
\anchor{bin}{
\northwest
+ \pgf at x=0.7\pgf at x
\pgf at y=0pt
}
\anchor{bin 1}{
@@ -802,6 +813,11 @@
\pgf at y=0pt
\pgf at x=-\pgf at x
}
+ \anchor{right}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-0.7\pgf at x
+ }
\anchor{bout}{
\northwest
\pgf at y=0pt
@@ -844,6 +860,19 @@
\pgf at x=-\pgf at x
\pgf at y=-\pgf at y
}
+ \anchorborder{% this is used when the node is used as a path element
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfpointborderrectangle{\pgfpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ }
+ \anchor{text}{%
+ % centered and a bit to the left (it's a triangle)!
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -874,14 +903,16 @@
\pgf at circ@draworfill
\endpgfscope
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
\pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
\fi
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+ \fi
\pgfusepath{draw}
}
@@ -906,8 +937,14 @@
\northwest
\pgf at y=0pt
}
+ \anchor{left}{
+ \northwest
+ \pgf at x=0.7\pgf at x
+ \pgf at y=0pt
+ }
\anchor{bin}{
\northwest
+ \pgf at x=0.7\pgf at x
\pgf at y=0pt
}
\anchor{bin 1}{
@@ -920,6 +957,11 @@
\pgf at y=0pt
\pgf at x=-\pgf at x
}
+ \anchor{right}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-0.7\pgf at x
+ }
\anchor{bout}{
\northwest
\pgf at y=0pt
@@ -962,6 +1004,19 @@
\pgf at x=-\pgf at x
\pgf at y=-\pgf at y
}
+ \anchorborder{% this is used when the node is used as a path element
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfpointborderrectangle{\pgfpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ }
+ \anchor{text}{%
+ % centered and a bit to the left (it's a triangle)!
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -985,14 +1040,16 @@
\pgf at circ@draworfill
\endpgfscope
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
\pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
\fi
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+ \fi
\pgfusepath{draw}
}
@@ -1016,6 +1073,11 @@
\northwest
\pgf at y=0pt
}
+ \anchor{left}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
\anchor{bin}{
\northwest
\pgf at y=0pt
@@ -1031,6 +1093,11 @@
\pgf at y=0pt
\pgf at x=-\pgf at x
}
+ \anchor{right}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-0.7\pgf at x
+ }
\anchor{bout}{
\northwest
\pgf at y=0pt
@@ -1073,6 +1140,19 @@
\pgf at x=-\pgf at x
\pgf at y=-\pgf at y
}
+ \anchorborder{% this is used when the node is used as a path element
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfpointborderrectangle{\pgfpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ }
+ \anchor{text}{%
+ % centered and a bit to the left (it's a triangle)!
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -1103,14 +1183,16 @@
\pgf at circ@draworfill
\endpgfscope
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
\pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
\fi
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right}{0pt}}
+ \fi
\pgfusepath{draw}
%draw inner shape
@@ -1147,6 +1229,11 @@
\northwest
\pgf at y=0pt
}
+ \anchor{left}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=0.7\pgf at x
+ }
\anchor{bin}{
\northwest
\pgf at y=0pt
@@ -1162,6 +1249,11 @@
\pgf at y=0pt
\pgf at x=-\pgf at x
}
+ \anchor{right}{
+ \northwest
+ \pgf at y=0pt
+ \pgf at x=-.7\pgf at x
+ }
\anchor{bout}{
\northwest
\pgf at y=0pt
@@ -1204,6 +1296,19 @@
\pgf at x=-\pgf at x
\pgf at y=-\pgf at y
}
+ \anchorborder{% this is used when the node is used as a path element
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfpointborderrectangle{\pgfpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfpoint{-\pgf at circ@res at left}{\pgf at circ@res at up}}
+ }
+ \anchor{text}{%
+ % centered and a bit to the left (it's a triangle)!
+ \pgf at x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \pgf at y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -1228,14 +1333,16 @@
\pgf at circ@draworfill
\endpgfscope
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
\pgfpathlineto{\pgfpoint{.7\pgf at circ@res at left}{0pt}}
\fi
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right-\pgf at circ@res at other}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{\pgfpoint{.7\pgf at circ@res at right-\pgf at circ@res at other}{0pt}}
+ \fi
\pgfusepath{draw}
%draw inner shape
@@ -1282,15 +1389,21 @@
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
\saveddimen{\boutshift}{%
- \ifpgf at circ@european at port@circle
- \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
- \edef\pgf at temp{ocirc}
- \edef\pgf at circ@temp{\ctikzvalof{tripoles/european not shape}}
- \ifx\pgf at temp\pgf at circ@temp % it's ocirc
- \pgfmathsetlength{\pgf at x}{2*\ctikzvalof{nodes width}*\pgf at circ@Rlen}
- \else % it's ieee not circ
- \pgf at circ@notradius % defined together with ieeestd ports
- \pgf at x=2\pgf at circ@res at temp
+ \edef\pgf at temp{not}
+ \edef\pgf at circ@temp{#4}
+ \ifx\pgf at temp\pgf at circ@temp % is a not
+ \ifpgf at circ@european at port@circle
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \edef\pgf at temp{ocirc}
+ \edef\pgf at circ@temp{\ctikzvalof{tripoles/european not shape}}
+ \ifx\pgf at temp\pgf at circ@temp % it's ocirc
+ \pgfmathsetlength{\pgf at x}{2*\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \else % it's ieee not circ
+ \pgf at circ@notradius % defined together with ieeestd ports
+ \pgf at x=2\pgf at circ@res at temp
+ \fi
+ \else
+ \pgf at x=0pt
\fi
\else
\pgf at x=0pt
@@ -1355,7 +1468,7 @@
\anchor{bout}{\right\advance\pgf at x by \boutshift\pgf at y=0pt}
\anchor{left}{\left}% edges of component minus leads
- \anchor{right}{\right}
+ \anchor{right}{\right\advance\pgf at x by \boutshift\pgf at y=0pt}
\anchor{north east}{\northeast}% see \Compass macro
\anchor{south west}{\southwest}
@@ -1374,6 +1487,14 @@
\anchor{east}{\pgfextractx{\pgf at circ@res at right}{\northeast}%
\pgfpoint{\pgf at circ@res at right}{0cm}}
+ \anchorborder{% this is used when the node is used as a path element
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northeast}
+ \pgfextractx{\pgf at circ@res at right}{\northeast}
+ \pgfpointborderrectangle{\pgfpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
\pgfstartlinewidth=\pgflinewidth
@@ -1384,7 +1505,7 @@
{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at right}{\pgf at circ@res at down}}
\pgf at circ@draworfill
\endpgfscope
- \ifpgfcirc at draw@leads
+ \ifpgfcirc at draw@input at leads
%input leads
\ifnum#3=1\relax
\pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}%
@@ -1402,14 +1523,15 @@
\advance\pgf at circ@res at count by -1
\repeat
\fi
+ \pgfusepath{draw}
\fi
%
- \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
- \pgfpathlineto{%
- \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at right}{0pt}}
+ \ifpgfcirc at draw@output at leads
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf at circ@res at right}{0pt}}
+ \pgfusepath{draw}
+ \fi
%
- \pgfusepath{draw}
- %
\edef\pgf at temp{not}
\edef\pgf at circ@temp{#4}
\ifx\pgf at temp\pgf at circ@temp % is a not
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -71,13 +71,22 @@
%% this code has been contributed by Schrödinger's cat
%% https://tex.stackexchange.com/a/529159/38080
%%
-\tikzset{use fpu reciprocal/.code={%
-\def\pgfmathreciprocal@##1{%
- \begingroup
- \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
- \pgfmathparse{1/##1}%
- \pgfmath at smuggleone\pgfmathresult
- \endgroup
-}}}%
+%% Use the official key to use the fpu if installed, see
+%% https://github.com/pgf-tikz/pgf/issues/861
+%%
+%% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080
+%%
+\pgfkeysifdefined{/pgf/fpu/install only/. at cmd}{%
+ \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}%
+ }{%
+ \pgfqkeys{/pgf}{use fpu reciprocal/.code={%
+ \def\pgfmathreciprocal@##1{%
+ \begingroup
+ \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
+ \pgfmathparse{1/##1}%
+ \pgfmath at smuggleone\pgfmathresult
+ \endgroup
+ }}}%
+}
\endinput
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex 2020-06-21 20:41:48 UTC (rev 55619)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex 2020-06-21 20:42:13 UTC (rev 55620)
@@ -123,62 +123,23 @@
}
%% Output routine for generic bipoles
+% put this to true to see the voltage label coordinate anchors
+\newif\ifpgf at circ@debugv\pgf at circ@debugvfalse
\def\pgf at circ@drawvoltagegeneric{
\pgfextra{
- % \typeout{NAME:\ctikzvalof{bipole/name}}
- \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
- \pgfkeysifdefined{\pgf at temp}
- {
- \edef\partheight{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}
- \edef\tmpdistfromline{(\partheight\pgf at circ@scaled at Rlen)}
- }
- {
- \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance}
- {
- \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}}
- \edef\tmpdistfromline{(\partheight\pgf at circ@scaled at Rlen)}
- }
- {%calculate default value from part height
- \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
- \pgfkeysifdefined{\pgf at temp}
- {
- \edef\partheight{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
- \edef\tmpdistfromline{(\partheight\pgf at circ@scaled at Rlen+0.2\pgf at circ@scaled at Rlen)}
- }
- {
- \edef\tmpdistfromline{(.5\pgf at circ@scaled at Rlen)} %fallback to fixed value
- }
- }
- }
% \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf at circ@Rlen\space SCALED:\the\pgf at circ@scaled at Rlen}
\ifnum \ctikzvalof{mirror value}=-1
- \ifpgf at circuit@bipole at inverted
- \ifpgf at circuit@bipole at voltage@straight
- \def\distfromline{\tmpdistfromline}
- \else
+ \ifpgf at circuit@bipole at inverted
\def\distfromline{\ctikzvalof{voltage/distance from line}\pgf at circ@scaled at Rlen}
- \fi
\else
- \ifpgf at circuit@bipole at voltage@straight
- \def\distfromline{-\tmpdistfromline}
- \else
\def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf at circ@scaled at Rlen}
\fi
- \fi
\else
\ifpgf at circuit@bipole at inverted
- \ifpgf at circuit@bipole at voltage@straight
- \def\distfromline{-\tmpdistfromline}
- \else
\def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf at circ@scaled at Rlen}
- \fi
\else
- \ifpgf at circuit@bipole at voltage@straight
- \def\distfromline{\tmpdistfromline}
- \else
\def\distfromline{\ctikzvalof{voltage/distance from line}\pgf at circ@scaled at Rlen}
- \fi
\fi
\fi
\ifpgf at circuit@bipole at voltage@below
@@ -196,10 +157,10 @@
{ \edef\bumpb{\ctikzvalof{voltage/bump b}} }
\edef\shiftv{\ctikzvalof{voltage/shift}}
% additional per-bipole voltage shift (internal)
- \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
\pgfkeysifdefined{\pgf at temp}
{
- \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}}
+ \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
}
{
\edef\addvshift{0}
@@ -206,61 +167,111 @@
}
\newdimen{\absvshift}
\pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
- % put this to true to see the voltage label coordinate anchors
- \newif\ifpgf at circ@debugv\pgf at circ@debugvfalse
+ % reset anchor if american and open
+ \ifpgf at circuit@europeanvoltage
+ \else
+ \ifx\@@kind\@@open
+ \def\pgf at circ@bipole at voltage@label at anchor{center}
+ \fi
+ \fi
}
% %\pgf at circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
- coordinate (pgfcirc at midtmp) at ($(\tikztostart) ! \pgf at circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead
+ %absolute move, minimum space is length of arrowhead
+ coordinate (pgfcirc at midtmp) at ($(\tikztostart) ! \pgf at circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorstartnode)$)
coordinate (pgfcirc at midtmp) at ($(pgfcirc at midtmp) ! \distancefromnode ! (anchorstartnode)$)
coordinate (pgfcirc at Vfrom@flat) at (pgfcirc at midtmp)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at midtmp) ! -\distfromline ! \pgf at circ@voltage at angle:(anchorstartnode)$)
-
- coordinate (pgfcirc at midtmp) at ($(\tikztotarget) ! \pgf at circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead
+ %absolute move, minimum space is length of arrowhead
+ coordinate (pgfcirc at midtmp) at ($(\tikztotarget) ! \pgf at circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorendnode)$)
coordinate (pgfcirc at midtmp) at ($(pgfcirc at midtmp) ! \distancefromnode ! (anchorendnode)$)
coordinate (pgfcirc at Vto@flat) at (pgfcirc at midtmp)
- coordinate (pgfcirc at Vto) at ($(pgfcirc at midtmp) ! \distfromline ! \pgf at circ@voltage at angle : (anchorendnode)$)
+ coordinate (pgfcirc at mid) at ($(pgfcirc at Vfrom@flat)!0.5!(pgfcirc at Vto@flat)$)
\ifpgf at circuit@bipole at voltage@below
- \ifpgf at circ@debugv
- node [ocirc, fill=red] at (anchorstartnode) {}
- node [ocirc, fill=blue] at (anchorendnode) {}
- node [ocirc, fill=green] at (pgfcirc at Vto) {}
- node [ocirc, fill=yellow] at (pgfcirc at Vfrom) {}
- node [odiamondpole, fill=green!50!black] at (pgfcirc at Vto@flat) {}
- node [odiamondpole, fill=orange] at (pgfcirc at Vfrom@flat) {}
+ % see comments for the "above" part (similar)
+ \ifpgf at circuit@europeanvoltage
+ \ifpgf at circuit@bipole at voltage@straight
+ coordinate (pgfcirc at bottom) at (\ctikzvalof{bipole/name}.-90)
+ coordinate (pgfcirc at Vto1) at ($(pgfcirc at mid)+(pgfcirc at bottom)-(pgfcirc at Vfrom@flat)$)
+ coordinate (pgfcirc at Vfrom1) at ($(pgfcirc at mid)+(pgfcirc at bottom)-(pgfcirc at Vto@flat)$)
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto1) ! \absvshift!90 : (pgfcirc at Vfrom1)$)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom1) ! \absvshift!-90 : (pgfcirc at Vto1)$)
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vto)!0.5!(pgfcirc at Vfrom) $)
+ coordinate (pgfcirc at Vdir) at (pgfcirc at Vto)
+ \else
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!90 : (anchorendnode)$)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
+ coordinate (pgfcirc at Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
+ coordinate (pgfcirc at Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
+ coordinate (pgfcirc at Vcont1) at ($(pgfcirc at Vcont1t) ! -\absvshift!90 : (pgfcirc at Vcont2t)$)
+ coordinate (pgfcirc at Vcont2) at ($(pgfcirc at Vcont2t) ! -\absvshift!-90 : (pgfcirc at Vcont1t)$)
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vcont2)!0.5!(pgfcirc at Vcont1)$)
+ coordinate (pgfcirc at Vdir) at (pgfcirc at Vcont2)
+ \fi
+ \else % we are here in case of american here
+ % we are in case of american here
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!90 : (anchorendnode)$)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
+ coordinate (pgfcirc at bottom) at (\ctikzvalof{bipole/name}.-90)
+ coordinate (pgfcirc at Vdir0) at ($(pgfcirc at mid)+(pgfcirc at bottom)-(pgfcirc at Vfrom@flat)$)
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at bottom) ! \absvshift!-90 : (pgfcirc at Vdir0)$)
+ coordinate (pgfcirc at Vdir) at ($(pgfcirc at mid)+(pgfcirc at Vlab)-(pgfcirc at Vfrom@flat)$)
\fi
- coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!90 : (anchorendnode)$)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
- coordinate (pgfcirc at Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
- coordinate (pgfcirc at Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
- coordinate (pgfcirc at Vcont1) at ($(pgfcirc at Vcont1t) ! -\absvshift!90 : (pgfcirc at Vcont2t)$)
- coordinate (pgfcirc at Vcont2) at ($(pgfcirc at Vcont2t) ! -\absvshift!-90 : (pgfcirc at Vcont1t)$)
- \ifpgf at circ@debugv
- node [odiamondpole, fill=green] at (pgfcirc at Vto) {}
- node [odiamondpole, fill=yellow] at (pgfcirc at Vfrom) {}
- node [osquarepole, fill=red] at (pgfcirc at Vcont1) {}
- node [osquarepole, fill=blue] at (pgfcirc at Vcont2) {}
- \fi
\else
- \ifpgf at circ@debugv
- node [ocirc, fill=red] at (anchorstartnode) {}
- node [ocirc, fill=blue] at (anchorendnode) {}
- node [ocirc, fill=green] at (pgfcirc at Vto) {}
- node [ocirc, fill=yellow] at (pgfcirc at Vfrom) {}
- node [odiamondpole, fill=green] at (pgfcirc at Vto@flat) {}
- node [odiamondpole, fill=yellow] at (pgfcirc at Vfrom@flat) {}
+ \ifpgf at circuit@europeanvoltage
+ \ifpgf at circuit@bipole at voltage@straight
+ coordinate (pgfcirc at top) at (\ctikzvalof{bipole/name}.90)
+ % move parallel to the component line at pgfcirc at top distance
+ coordinate (pgfcirc at Vto1) at ($(pgfcirc at mid)+(pgfcirc at top)-(pgfcirc at Vfrom@flat)$)
+ coordinate (pgfcirc at Vfrom1) at ($(pgfcirc at mid)+(pgfcirc at top)-(pgfcirc at Vto@flat)$)
+ % add the extra distance
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto1) ! \absvshift!-90 : (pgfcirc at Vfrom1)$)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom1) ! \absvshift!90 : (pgfcirc at Vto1)$)
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vto)!0.5!(pgfcirc at Vfrom) $)
+ % direction line to shift the label later
+ coordinate (pgfcirc at Vdir) at (pgfcirc at Vto)
+ \else
+ % european voltages here
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! -\absvshift!90 : (anchorendnode)$)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$)
+ % identify the two control points for the "arc" of the voltage
+ coordinate (pgfcirc at Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
+ coordinate (pgfcirc at Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
+ % and shift them a bit
+ coordinate (pgfcirc at Vcont1) at ($(pgfcirc at Vcont1t) ! \absvshift!90 : (pgfcirc at Vcont2t)$)
+ coordinate (pgfcirc at Vcont2) at ($(pgfcirc at Vcont2t) ! \absvshift!-90 : (pgfcirc at Vcont1t)$)
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vcont2)!0.5!(pgfcirc at Vcont1)$)
+ % direction line to shift the label later
+ coordinate (pgfcirc at Vdir) at (pgfcirc at Vcont2)
+ \fi
+ \else
+ % we are in case of american here
+ coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!-90 : (anchorendnode)$)
+ coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!90 : (anchorstartnode)$)
+ coordinate (pgfcirc at top) at (\ctikzvalof{bipole/name}.90)
+ % move parallel to the component line
+ coordinate (pgfcirc at Vdir0) at ($(pgfcirc at mid)+(pgfcirc at top)-(pgfcirc at Vfrom@flat)$)
+ % and add the extra distance
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at top) ! \absvshift!90 : (pgfcirc at Vdir0)$)
+ coordinate (pgfcirc at Vdir) at ($(pgfcirc at mid)+(pgfcirc at Vlab)-(pgfcirc at Vfrom@flat)$)
\fi
- coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! -\absvshift!90 : (anchorendnode)$)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$)
- coordinate (pgfcirc at Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
- coordinate (pgfcirc at Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
- coordinate (pgfcirc at Vcont1) at ($(pgfcirc at Vcont1t) ! \absvshift!90 : (pgfcirc at Vcont2t)$)
- coordinate (pgfcirc at Vcont2) at ($(pgfcirc at Vcont2t) ! \absvshift!-90 : (pgfcirc at Vcont1t)$)
- \ifpgf at circ@debugv
- node [odiamondpole, fill=green] at (pgfcirc at Vto) {}
- node [odiamondpole, fill=yellow] at (pgfcirc at Vfrom) {}
- node [osquarepole, fill=red] at (pgfcirc at Vcont1) {}
- node [osquarepole, fill=blue] at (pgfcirc at Vcont2) {}
+ \fi
+ \ifx\@@kind\@@open
+ coordinate (pgfcirc at Vto) at (pgfcirc at Vto@flat)
+ coordinate (pgfcirc at Vfrom) at (pgfcirc at Vfrom@flat)
+ \fi
+ \ifpgf at circ@debugv
+ node [ocirc, fill=red] at (anchorstartnode) {}
+ node [ocirc, fill=blue] at (anchorendnode) {}
+ node [ocirc, fill=green] at (pgfcirc at Vto) {}
+ node [ocirc, fill=yellow] at (pgfcirc at Vfrom) {}
+ node [odiamondpole, fill=green!50!black] at (pgfcirc at Vto@flat) {}
+ node [odiamondpole, fill=orange] at (pgfcirc at Vfrom@flat) {}
+ \ifpgf at circuit@europeanvoltage
+ \ifpgf at circuit@bipole at voltage@straight
+ \else
+ node [osquarepole, fill=red] at (pgfcirc at Vcont1) {}
+ node [osquarepole, fill=blue] at (pgfcirc at Vcont2) {}
+ \fi
\fi
\fi
@@ -283,57 +294,29 @@
\fi
\fi
\else % american
- \ifx\@@kind\@@open % open circuit; put + and - directly on it
- \ifpgf at circuit@bipole at voltage@backward
- \ifpgf at circ@oldvoltagedirection
- (pgfcirc at Vfrom@flat) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=center]{\pgf at circ@avplus}
- (pgfcirc at Vto@flat) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=center]{\pgf at circ@avminus}
- \else
- (pgfcirc at Vfrom@flat) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=center]{\pgf at circ@avminus}
- (pgfcirc at Vto@flat) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=center]{\pgf at circ@avplus}
- \fi
- \else
- \ifpgf at circ@oldvoltagedirection
- (pgfcirc at Vfrom@flat) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=center]{\pgf at circ@avminus}
- (pgfcirc at Vto@flat) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=center]{\pgf at circ@avplus}
- \else
- (pgfcirc at Vfrom@flat) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=center]{\pgf at circ@avplus}
- (pgfcirc at Vto@flat) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=center]{\pgf at circ@avminus}
- \fi
+ \ifpgf at circuit@bipole at voltage@backward
+ \ifpgf at circ@oldvoltagedirection
+ (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
+ (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
+ \else
+ (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
+ (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
\fi
- \else % not open circuit
- \ifpgf at circuit@bipole at voltage@backward
- \ifpgf at circ@oldvoltagedirection
- (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
- (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
- \else
- (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
- (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
- \fi
- \else
- \ifpgf at circ@oldvoltagedirection
- (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
- (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
- \else
- (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
- (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
- anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
- \fi
+ \else
+ \ifpgf at circ@oldvoltagedirection
+ (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
+ (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
+ \else
+ (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
+ (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
\fi
\fi
\fi
@@ -345,19 +328,39 @@
% it's not perfect, but I can't find the way to do it correctly...
\pgfextra{
\edef\shiftv{\ctikzvalof{voltage/shift}}
- \edef\bumpa{\ctikzvalof{voltage/bump a}}
+ % distance along the 60-120 axis
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}
+ \pgfkeysifdefined{\pgf at temp}
+ {
+ \edef\bumpa{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}}
+ }
+ {
+ \edef\bumpa{\ctikzvalof{voltage/bump a}}
+ }
+ % additional per-bipole voltage shift (internal)
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
+ \pgfkeysifdefined{\pgf at temp}
+ {
+ \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
+ }
+ {
+ \edef\addvshift{0}
+ }
\pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
}
\ifpgf at circuit@bipole at voltage@below
- coordinate (pgfcirc at Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
- coordinate (pgfcirc at Vto) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
+ coordinate (pgfcirc at Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
+ coordinate (pgfcirc at Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
+ coordinate (pgfcirc at Vfrom) at ($ (pgfcirc at Vfrom0) ! \addvshift! -90: (pgfcirc at Vto0) $)
+ coordinate (pgfcirc at Vto) at ($ (pgfcirc at Vto0) ! \addvshift! 90: (pgfcirc at Vfrom0) $)
\else
- coordinate (pgfcirc at Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
- coordinate (pgfcirc at Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
+ coordinate (pgfcirc at Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
+ coordinate (pgfcirc at Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
+ coordinate (pgfcirc at Vfrom) at ($ (pgfcirc at Vfrom0) ! \addvshift! 90: (pgfcirc at Vto0) $)
+ coordinate (pgfcirc at Vto) at ($ (pgfcirc at Vto0) ! \addvshift! -90: (pgfcirc at Vfrom0) $)
\fi
- % fix the (unused in this case) Vcont1/2 coords for label placement along the line
- coordinate (pgfcirc at Vcont1) at (pgfcirc at Vto)
- coordinate (pgfcirc at Vcont2) at (pgfcirc at Vfrom)
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vto)!0.5!(pgfcirc at Vfrom) $)
+ coordinate (pgfcirc at Vdir) at (pgfcirc at Vto)
\ifpgf at circuit@europeanvoltage
\ifpgf at circuit@bipole at voltage@backward
(pgfcirc at Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc at Vfrom)
@@ -392,6 +395,8 @@
%% Output routine
%% this is the entry point
%%
+%% locally used dimensions
+\newdimen{\pgfcirc at labelshift}
\def\pgf at circ@drawvoltage{% node name
\pgfextra{ %WARNING: indentation is probably wrong
\edef\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
@@ -454,11 +459,11 @@
% this must be set *before* changing for mirroring and inverting; in that case
% the xscale/yscale parameters take it into account
- \ifpgf at circuit@bipole at voltage@below
- \def\pgf at circ@bipole at voltage@label at where{-90}
- \else
- \def\pgf at circ@bipole at voltage@label at where{90}
- \fi
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at where{-90}
+ \else
+ \def\pgf at circ@bipole at voltage@label at where{90}
+ \fi
% magic to counteract the scale and yscale effects (there should be a better way...)
\ifnum \ctikzvalof{mirror value}=-1
@@ -480,10 +485,33 @@
% take into account scaling
\setscaledRlenforclass
- \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
- \pgfkeysifdefined{\pgf at temp}
- { \edef\eudist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}} }
- { \edef\eudist{\ctikzvalof{voltage/european label distance}} }
+ \ifpgf at circuit@europeanvoltage
+ \ifpgf at circuit@bipole at voltage@straight
+ % check for straight
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
+ \pgfkeysifdefined{\pgf at temp}{%
+ \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}%
+ % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist}
+ }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}}
+ \ifpgf at circ@debugv\edef\whichtypeshift{STR}\fi
+ \else
+ % check for european
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
+ \pgfkeysifdefined{\pgf at temp}{%
+ \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}%
+ % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist}
+ }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}}
+ \ifpgf at circ@debugv\edef\whichtypeshift{EUR}\fi
+ \fi
+ \else
+ % check for american
+ \edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}
+ \pgfkeysifdefined{\pgf at temp}{%
+ \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
+ % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist}
+ }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}}
+ \ifpgf at circ@debugv\edef\whichtypeshift{AME}\fi
+ \fi
% find the height of the bipole or use a default value
\edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
\pgfkeysifdefined{\pgf at temp}
@@ -490,10 +518,13 @@
{\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
\edef\partheight{\partheightf\pgf at circ@scaled at Rlen}}
{\edef\partheight{(.5\pgf at circ@scaled at Rlen)}} %fallback to fixed value
- \newdimen{\alshift}
- % this is more or less the same of the legacy code; we shift the american label a bit
- % outside the (+) -- (-) line
- \pgfmathsetlength{\alshift}{(\ctikzvalof{voltage/american label distance}-0.6)*\partheight}
+
+ \ifpgf at circuit@bipole at isvoltage
+ \pgfmathsetlength{\pgfcirc at labelshift}{(\labeldist-1.2)*\partheight}
+ \else
+ \pgfmathsetlength{\pgfcirc at labelshift}{(\labeldist-1.4)*\partheight}
+ \fi
+ % the value for the european was by default 1.4
\pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
% set the macro for detecting open
\edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
@@ -506,42 +537,33 @@
\else
\pgf at circ@drawvoltagegeneric
\fi
+ % % debugging
+ % \pgfextra{%
+ % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc at eushift\space AL:\the\pgfcirc at alshift\space
+ % DIRECTION:\pgf at circ@bipole at voltage@label at where}
+ % \pgf at circ@debugvtrue}
- % \pgfextra{\typeout{LABEL\space KIND:\@@kind\space OPEN:\@@open}}
+ % move a bit if requested
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vlab) ! \pgfcirc at labelshift ! \pgf at circ@bipole at voltage@label at where :(pgfcirc at Vdir)$)
- \ifpgf at circuit@bipole at voltage@straight
- coordinate (Vlab) at ($(pgfcirc at Vto)!0.5!(pgfcirc at Vfrom) $)
- node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
- \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
- at (Vlab) {\pgf at circ@finallabels{voltage/label}}
+ % check for the case of american AND open
+ \ifpgf at circuit@europeanvoltage
\else
- \ifpgf at circuit@europeanvoltage
- coordinate (Vlab) at ($(pgfcirc at Vcont1)!0.5!(pgfcirc at Vcont2)$)
- \else
- coordinate (Vlab) at ($(pgfcirc at Vfrom)!0.5!(pgfcirc at Vto)$)
- \ifpgf at circuit@bipole at isvoltage\else
- % add a bit of space for american labels above their symbols in the normal case. You can avoid that
- % with voltage/american label distance=0.5 (it's measured from the center of the component, in heights)
- coordinate (Vlab) at ($(Vlab) ! \alshift ! \pgf at circ@bipole at voltage@label at where :(pgfcirc at Vto)$)
- \fi
- \fi
+ \ifx\@@kind\@@open
+ % override pgfcirc at Vlab
+ coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vfrom@flat)!0.5!(pgfcirc at Vto@flat)$)\fi
+ \fi
- \ifpgf at circuit@europeanvoltage
- node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
- \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
- at (Vlab) {\pgf at circ@finallabels{voltage/label}}
- \else % american voltages
- \ifx\@@kind\@@open
- coordinate (Vlab) at ($(pgfcirc at Vfrom@flat)!0.5!(pgfcirc at Vto@flat)$)
- node [anchor=center, inner sep=2pt,
- \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
- at (Vlab) {\pgf at circ@finallabels{voltage/label}}
- \else
- node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
- \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
- at (Vlab) {\pgf at circ@finallabels{voltage/label}}
- \fi
- \fi
+ \ifpgf at circ@debugv
+ node [odiamondpole, color=blue] at (pgfcirc at Vlab) {}
+ node [odiamondpole, color=red] at (pgfcirc at Vdir) {}
+ node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc at Vdir)
+ {\whichtypeshift:\the\pgfcirc at labelshift\\ DIR:\pgf at circ@bipole at voltage@label at where}
\fi
+
+ node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
+ \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
+ at (pgfcirc at Vlab) {\pgf at circ@finallabels{voltage/label}}
+
}%end drawvoltages
\endinput
Added: trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz-1.1.2.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz-1.1.2.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz-1.1.2.sty 2020-06-21 20:42:13 UTC (rev 55620)
@@ -0,0 +1,22433 @@
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+\NeedsTeXFormat{LaTeX2e}
+
+\def\pgfcircversion{1.1.2}
+\def\pgfcircversiondate{2020/05/17}
+
+\ProvidesPackage{circuitikz-1.1.2}
+[\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion]
+
+%% Version 3.0 of pgf/TikZ is required
+\RequirePackage{tikz}
+\usetikzlibrary{calc}
+%
+% "arrows" library is deprecated, and behave badly with
+% arrows on short paths. Change to the new arrows.meta
+% In pfgcirc.define, we will add the old definition of
+% latex' which we have lost in the transition
+%
+\usetikzlibrary{arrows.meta, bending}
+\usetikzlibrary{fpu} % may be needed for use fpu reciprocal (v1.0.1)
+
+% The options are listed in the manual in this order
+
+\DeclareOption{europeanvoltage}{
+ \ctikzset{voltage=european}
+}
+
+\DeclareOption{straightvoltages}{
+ \pgf at circuit@bipole at voltage@straighttrue
+}
+
+\DeclareOption{americanvoltage}{
+ \ctikzset{voltage=american}
+}
+
+\DeclareOption{europeancurrent}{
+ \ctikzset{current = european}
+}
+
+\DeclareOption{americancurrent}{
+ \ctikzset{current = american}
+}
+
+
+
+\DeclareOption{americanresistor}{
+ \ctikzset{resistor = american}
+}
+
+\DeclareOption{europeanresistor}{
+ \ctikzset{resistor = european}
+}
+
+\DeclareOption{americaninductor}{
+ \ctikzset{inductor = american}
+}
+
+\DeclareOption{europeaninductor}{
+ \ctikzset{inductor = european}
+}
+
+\DeclareOption{cuteinductor}{
+ \ctikzset{inductor = cute}
+}
+
+\DeclareOption{americanport}{
+ \ctikzset{logic ports = american}
+}
+
+\DeclareOption{europeanport}{
+ \ctikzset{logic ports = european}
+}
+
+\DeclareOption{european}{
+ \ctikzset{voltage=european} \ctikzset{current=european} \ctikzset{inductor=european}
+ \ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european}
+}
+
+\DeclareOption{american}{
+ \ctikzset{voltage=american} \ctikzset{current=american} \ctikzset{resistor=american} \ctikzset{inductor=american} \ctikzset{gas filled surge arrester choice = american}
+ \ctikzset{logic ports = american}
+}
+
+\DeclareOption{fulldiodes}{
+ \ctikzset{diode = full}
+}
+
+\DeclareOption{emptydiodes}{
+ \ctikzset{diode = empty}
+}
+
+\DeclareOption{europeanvoltages}{
+ \ctikzset{voltage=european}
+}
+
+\DeclareOption{americanvoltages}{
+ \ctikzset{voltage=american}
+}
+
+\DeclareOption{europeancurrents}{
+ \ctikzset{current = european}
+}
+
+\DeclareOption{americancurrents}{
+ \ctikzset{current = american}
+}
+
+\DeclareOption{americanresistors}{
+ \ctikzset{resistor = american}
+}
+
+\DeclareOption{europeanresistors}{
+ \ctikzset{resistor = european}
+}
+
+\DeclareOption{americaninductors}{
+ \ctikzset{inductor = american}
+}
+
+\DeclareOption{europeaninductors}{
+ \ctikzset{inductor = european}
+}
+
+\DeclareOption{cuteinductors}{
+ \ctikzset{inductor = cute}
+}
+
+\DeclareOption{americanports}{
+ \ctikzset{logic ports = american}
+}
+
+\DeclareOption{europeanports}{
+ \ctikzset{logic ports = european}
+}
+
+\DeclareOption{americangfsurgearrester}{
+ \ctikzset{gas filled surge arrester choice = american}
+}
+
+\DeclareOption{europeangfsurgearrester}{
+ \ctikzset{gas filled surge arrester choice = european}
+}
+
+\DeclareOption{siunitx}{
+ \pgf at circ@siunitxtrue
+}
+
+\DeclareOption{nosiunitx}{
+ \pgf at circ@siunitxfalse
+}
+
+\DeclareOption{fulldiode}{
+ \ctikzset{diode = full}
+}
+
+\DeclareOption{emptydiode}{
+ \ctikzset{diode = empty}
+}
+
+\DeclareOption{strokediode}{
+ \ctikzset{diode = stroke}
+}
+
+\DeclareOption{arrowmos}{
+ \pgf at circuit@mos at arrowstrue
+}
+
+\DeclareOption{noarrowmos}{
+ \pgf at circuit@mos at arrowsfalse
+}
+
+\DeclareOption{fetbodydiode}{
+ \pgf at circuit@fet at bodydiodetrue
+}
+
+\DeclareOption{nofetbodydiode}{
+ \pgf at circuit@fet at bodydiodefalse
+}
+
+\DeclareOption{fetsolderdot}{
+ \pgf at circuit@fet at solderdottrue
+}
+
+\DeclareOption{nofetsolderdot}{
+ \pgf at circuit@fet at solderdotfalse
+}
+
+\DeclareOption{emptypmoscircle}{
+ \pgf at circuit@pmos at emptycircletrue
+}
+
+
+\DeclareOption{lazymos}{
+ \ctikzset{tripoles/nmos/width=.5}
+ \ctikzset{tripoles/nmos/gate height=.35}
+ \ctikzset{tripoles/nmos/base height=.35}
+ \ctikzset{tripoles/nmos/height/.initial=1.2}
+ \ctikzset{tripoles/nmos/base width=.5}
+ \ctikzset{tripoles/nmos/gate width=.65}
+
+ \ctikzset{tripoles/pmos/width=.5}
+ \ctikzset{tripoles/pmos/gate height=.35}
+ \ctikzset{tripoles/pmos/base height=.35}
+ \ctikzset{tripoles/pmos/height/.initial=1.2}
+ \ctikzset{tripoles/pmos/base width=.5}
+ \ctikzset{tripoles/pmos/gate width=.65}
+
+ \pgf at circuit@pmos at emptycircletrue
+}
+
+\DeclareOption{straightlabels}{
+ \ctikzset{label/align = straight}
+}
+
+\DeclareOption{rotatelabels}{
+ \ctikzset{label/align = rotate}
+}
+
+\DeclareOption{smartlabels}{
+ \ctikzset{label/align = smart}
+}
+
+\DeclareOption{compatibility}{
+ \pgf at circuit@compattrue
+}
+
+\DeclareOption{oldvoltagedirection}{
+ \pgf at circ@oldvoltagedirectiontrue
+ \pgf at circ@explicitvdirtrue
+ \pgf at circ@fixbatteriesfalse
+}
+\DeclareOption{nooldvoltagedirection}{
+ \pgf at circ@oldvoltagedirectionfalse
+ \pgf at circ@explicitvdirtrue
+ \pgf at circ@fixbatteriesfalse
+}
+
+\DeclareOption{RPvoltages}{
+ \pgf at circ@oldvoltagedirectiontrue
+ \pgf at circ@explicitvdirtrue
+ \pgf at circ@fixbatteriestrue
+}
+\DeclareOption{EFvoltages}{
+ \pgf at circ@oldvoltagedirectionfalse
+ \pgf at circ@explicitvdirtrue
+ \pgf at circ@fixbatteriestrue
+}
+
+\DeclareOption{legacytransistorstext}{
+ \pgf at circuit@transisors at fixlabelsfalse
+}
+
+\DeclareOption{nolegacytransistorstext}{
+ \pgf at circuit@transisors at fixlabelstrue
+}
+
+\DeclareOption{centertransistorstext}{
+ \pgf at circuit@transisors at fixlabelstrue
+}
+
+\DeclareOption{betterproportions}{
+ \ctikzset{monopoles/ground/width/.initial=.15}
+
+ \ctikzset{bipoles/resistor/height/.initial=.23}
+ \ctikzset{bipoles/resistor/width/.initial=.6}
+ \ctikzset{bipoles/capacitor/height/.initial=.4}
+ \ctikzset{bipoles/capacitor/width/.initial=.1}
+ \ctikzset{bipoles/potentiometer/height/.initial=.6}
+ \ctikzset{bipoles/potentiometer/height 2/.initial=.23}
+ \ctikzset{bipoles/potentiometer/width/.initial=.6}
+ \ctikzset{bipoles/photoresistor/height/.initial=.6}
+ \ctikzset{bipoles/photoresistor/height 2/.initial=.23}
+ \ctikzset{bipoles/photoresistor/width/.initial=.6}
+ \ctikzset{bipoles/thermistor/main/.initial=.7}
+ \ctikzset{bipoles/thermistor/height/.initial=.328}%.23/.7
+ \ctikzset{bipoles/thermistor/width/.initial=.6}
+ \ctikzset{bipoles/thermistorntc/width/.initial=.6}
+ \ctikzset{bipoles/thermistorntc/main/.initial=.7}
+ \ctikzset{bipoles/thermistorntc/height/.initial=.328}%.23/.7
+ \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.23/.7
+ \ctikzset{bipoles/thermistorptc/width/.initial=.6}
+ \ctikzset{bipoles/thermistorptc/main/.initial=.7}
+ \ctikzset{bipoles/thermistorptc/height/.initial=.328}%.23/.7
+ \ctikzset{bipoles/varistor/main/.initial=.7}
+ \ctikzset{bipoles/varistor/height/.initial=.328}%.23/.7
+ \ctikzset{bipoles/varistor/width/.initial=.6}
+ \ctikzset{bipoles/vresistor/height/.initial=.45}
+ \ctikzset{bipoles/vresistor/width/.initial=.6}
+ \ctikzset{bipoles/generic/height/.initial=.23}
+ \ctikzset{bipoles/generic/width/.initial=.6}
+ \ctikzset{bipoles/generic potentiometer/height/.initial=.6}
+ \ctikzset{bipoles/generic potentiometer/height 2/.initial=.23}
+ \ctikzset{bipoles/generic potentiometer/width/.initial=.6}
+ \ctikzset{bipoles/ageneric/height/.initial=.23}
+ \ctikzset{bipoles/ageneric/width/.initial=.6}
+ \ctikzset{bipoles/memristor/height/.initial=.23}
+ \ctikzset{bipoles/memristor/wave height/.initial=.375}
+ \ctikzset{bipoles/memristor/width/.initial=.60}
+ \ctikzset{bipoles/tgeneric/height/.initial=.525}
+ \ctikzset{bipoles/tgeneric/width/.initial=.6}
+ \ctikzset{bipoles/tfullgeneric/height/.initial=.525}
+ \ctikzset{bipoles/tfullgeneric/width/.initial=.60}
+ \ctikzset{bipoles/fullgeneric/height/.initial=.23}
+ \ctikzset{bipoles/fullgeneric/width/.initial=.6}
+ \ctikzset{bipoles/diode/height/.initial=.3}
+ \ctikzset{bipoles/diode/width/.initial=.25}
+ \ctikzset{bipoles/bidirectionaldiode/height/.initial=.66}
+ \ctikzset{bipoles/bidirectionaldiode/width/.initial=.6}
+ \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
+ \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
+
+ \ctikzset{tripoles/thyristor/height/.initial=.66}
+ \ctikzset{tripoles/thyristor/height 2/.initial=.3}
+ \ctikzset{tripoles/thyristor/width/.initial=.6}
+ \ctikzset{tripoles/thyristor/diode height/.initial=.3}
+ \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
+ \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
+
+ \ctikzset{tripoles/triac/height/.initial=.66}
+ \ctikzset{tripoles/triac/width/.initial=.6}
+ \ctikzset{tripoles/triac/diode width left/.initial=.3}
+ \ctikzset{tripoles/triac/diode width right/.initial=.3}
+}
+
+% This is a nice hack that prints all the shapes declared
+% by the package. Very useful for coverage testing and debugging.
+%
+% \let\origpgfdeclareshape=\pgfdeclareshape
+% \def\pgfdeclareshape#1{%
+% \typeout{SHAPE:\space"#1"}%
+% \origpgfdeclareshape{#1}
+% }
+
+
+%%%%%%%%%
+%%%%%%%%%%% Springe nach tex/pgfcirc.defines
+%%%---------- open: tex/pgfcirc.defines.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%
+%% Key managements
+
+\long\def\pgf at circ@comment#1{}
+
+\def\circuitikzbasekey{/tikz/circuitikz}
+
+\pgfkeys{\circuitikzbasekey/.is family}
+
+\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
+\let\ctikzset\circuitikzset
+\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
+\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
+
+%% Temporary Counters
+
+\newcount\pgf at circ@count at a
+\newcount\pgf at circ@count at b
+\newcount\pgf at circ@count at c
+%%%%%%%%%%%%
+%% Dimensions
+
+% coordinates
+\newdimen\pgf at circ@res at up
+\newdimen\pgf at circ@res at down
+\newdimen\pgf at circ@res at zero
+\newdimen\pgf at circ@res at left
+\newdimen\pgf at circ@res at right
+\newdimen\pgf at circ@res at other
+\newdimen\pgf at circ@res at step
+\newdimen\pgf at circ@res at temp
+% inital thickness
+\newdimen \pgfstartlinewidth
+
+% arrow tips, ported over old arrows library (deprecated)
+% see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
+% this was the original definition of latex' tips, renamed to avoid clashes
+%
+\pgfarrowsdeclare{latexslim}{latexslim}
+{
+ \pgfutil at tempdima=0.28pt%
+ \advance\pgfutil at tempdima by.3\pgflinewidth%
+ \pgfarrowsleftextend{+-4\pgfutil at tempdima}
+ \pgfarrowsrightextend{+6\pgfutil at tempdima}
+}
+{
+ \pgfutil at tempdima=0.28pt%
+ \advance\pgfutil at tempdima by.3\pgflinewidth%
+ \pgfpathmoveto{\pgfqpoint{6\pgfutil at tempdima}{0\pgfutil at tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{3.5\pgfutil at tempdima}{.5\pgfutil at tempdima}}
+ {\pgfqpoint{-1\pgfutil at tempdima}{1.5\pgfutil at tempdima}}
+ {\pgfqpoint{-4\pgfutil at tempdima}{3.75\pgfutil at tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-1.5\pgfutil at tempdima}{1\pgfutil at tempdima}}
+ {\pgfqpoint{-1.5\pgfutil at tempdima}{-1\pgfutil at tempdima}}
+ {\pgfqpoint{-4\pgfutil at tempdima}{-3.75\pgfutil at tempdima}}
+ \pgfpathcurveto
+ {\pgfqpoint{-1\pgfutil at tempdima}{-1.5\pgfutil at tempdima}}
+ {\pgfqpoint{3.5\pgfutil at tempdima}{-.5\pgfutil at tempdima}}
+ {\pgfqpoint{6\pgfutil at tempdima}{0\pgfutil at tempdima}}
+ \pgfpathclose
+ \pgfusepathqfill
+}
+
+\pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
+
+\def\pgf at circ@setifdefinedfill#1#2{%
+ % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
+ % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
+ \ifdefined\ctikzclass
+ \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
+ {% yes, it's defined
+ \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
+ \ifx\@@tmp\@@none % but it's none
+ \pgfusepath{#2}%
+ \else
+ \pgfsetfillcolor{\@@tmp}%
+ \pgfusepath{#1}%
+ \fi
+ }{% the class is defined but the fill key not; use #2
+ \pgfusepath{#2}%
+ }
+ \else
+ \pgfusepath{#2}%
+ \fi
+}
+
+%% Macro to fill or draw
+
+\def\pgf at circ@draworfill{%
+ \ifx\tikz at fillcolor\pgfutil at empty
+ \pgf at circ@setifdefinedfill{draw,fill}{draw}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \pgfusepath{draw, fill}
+ \fi
+}
+
+\def\pgf at circ@draworfillandclip{%
+ \ifx\tikz at fillcolor\pgfutil at empty
+ \pgf at circ@setifdefinedfill{draw, clip, fill}{draw, clip}
+ \pgfusepath{draw, clip}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \pgfusepath{draw, clip, fill}
+ \fi
+}
+
+\def\pgf at circ@maybefill{%
+ \ifx\tikz at fillcolor\pgfutil at empty
+ \pgf at circ@setifdefinedfill{fill}{discard}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \pgfusepath{fill}
+ \fi
+}
+
+%% Macros for setting linewidth
+% #1 is the legacy class (bipoles, tripoles) etc
+% #2 is the reference linewidth
+\def\pgf at circ@setlinewidth#1#2{%
+ \ifdefined\ctikzclass
+ \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
+ {% yes, it's defined
+ \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
+ \ifx\@@tmp\@@none % but it's none
+ \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
+ \else
+ \pgfsetlinewidth{\@@tmp #2}%
+ \fi
+ }{ % key not defined, do the legacy thing
+ \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
+ }% Ok, do nothing
+ \else % no class
+ \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
+ \fi
+}
+% use \pgf at circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
+\ctikzset{none/thickness/.initial=1.0} % do not touch
+
+%% font changes compatible with plain/LaTeX/ConTeXt
+%% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
+
+\ifpgfutil at format@is at latex
+ \long\def\pgf at circ@font at tiny{\tiny}
+ \long\def\pgf at circ@font at small{\small}
+ \long\def\pgf at circ@font at bold{\textbf}
+ \long\def\pgf at circ@font at boldmath{\boldmath}
+ \long\def\pgf at circ@font at sixbm{\fontsize{6}{7}\selectfont\boldmath}
+ \long\def\pgf at circ@font at tenbm{\fontsize{10}{12}\selectfont\boldmath}
+ \long\def\pgf at circ@font at twelve{\fontsize{12}{14}\selectfont}
+\else\ifpgfutil at format@is at plain
+ \long\def\pgf at circ@font at tiny{\fiverm}
+ \long\def\pgf at circ@font at small{\sevenrm}
+ \long\def\pgf at circ@font at bold#1{{\bf#1}}
+ \long\def\pgf at circ@font at boldmath{\bf} % to be tested
+ \long\def\pgf at circ@font at sixbm{\sevenrm\bf} %
+ \long\def\pgf at circ@font at tenbm{\tenrm\bf} %
+ \long\def\pgf at circ@font at twelve{\twelverm} %
+\else\ifpgfutil at format@is at context
+ \long\def\pgf at circ@font at tiny{\tfxx}
+ \long\def\pgf at circ@font at small{\tfx}
+ \long\def\pgf at circ@font at bold{\bold}
+ \long\def\pgf at circ@font at boldmath{\bold} % to be tested
+ \long\def\pgf at circ@font at sixbm{\tfx\bold} %
+ \long\def\pgf at circ@font at tenbm{\normal\bold}%
+ \long\def\pgf at circ@font at twelve{\tfa} %
+\fi\fi\fi
+
+
+%
+% Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
+%
+% this is needed to avoid problems with \ConTeXt
+\ifcsname normalunexpanded\endcsname
+ \let\pgfcircutil at unexpanded\normalunexpanded
+\else
+ \let\pgfcircutil at unexpanded\unexpanded
+\fi
+% minimally expand a pgfkey to check if it's {}/undefined or filled.
+\def\unexpandedvalueof#1{%
+ \pgfcircutil at unexpanded\expandafter\expandafter
+ \expandafter\pgf at circ@valueof at chk\pgfkeysvalueof{#1}}
+\def\pgf at circ@valueof at chk#1{%
+ \ifx\relax#1%
+ \expandafter\pgfutil at firstoftwo
+ \else
+ \expandafter\pgfutil at secondoftwo
+ \fi
+ {{}}% #1 is \relax, so consider empty
+ {\expandafter{#1}}% otherwise, leave the key after one more expansion
+}%
+%
+% text position (added with ieeestd logic ports. Maybe to be extended to other components,
+% like amplifiers)
+%
+\newif\ifpgf at circ@center at text\pgf at circ@center at texttrue
+\tikzset{component text/.is choice}%
+\tikzset{component text/center/.code={\pgf at circ@center at texttrue}}%
+\tikzset{component text/left/.code={\pgf at circ@center at textfalse}}%
+\ctikzset{component text/.is choice}%
+\ctikzset{component text/center/.code={\pgf at circ@center at texttrue}}%
+\ctikzset{component text/left/.code={\pgf at circ@center at textfalse}}%
+\ctikzset{left text distance/.initial=0.3em}%
+
+% voltage options
+
+\newif\ifpgf at circ@siunitx
+\newif\ifpgf at circuit@compat
+\newif\ifpgf at circ@oldvoltagedirection % default false
+\newif\ifpgf at circ@explicitvdir
+\newif\ifpgf at circ@fixbatteries
+
+\ctikzset{voltage dir/.is choice}
+\ctikzset{voltage dir/old/.code={\pgf at circ@oldvoltagedirectiontrue\pgf at circ@fixbatteriesfalse}}
+\ctikzset{voltage dir/noold/.code={\pgf at circ@oldvoltagedirectionfalse\pgf at circ@fixbatteriesfalse}}
+\ctikzset{voltage dir/RP/.code={\pgf at circ@oldvoltagedirectiontrue\pgf at circ@fixbatteriestrue}}
+\ctikzset{voltage dir/EF/.code={\pgf at circ@oldvoltagedirectionfalse\pgf at circ@fixbatteriestrue}}
+\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}
+
+% Option ">" for twoports
+\newif\ifpgf at circuit@inputarrow
+\ctikzset{>/.add code={}{\pgf at circuit@inputarrowtrue}}
+\ctikzset{inputarrow/.is choice}
+\ctikzset{inputarrow/true/.code={\pgf at circuit@inputarrowtrue}}
+\ctikzset{inputarrow/false/.code={\pgf at circuit@inputarrowfalse}}
+
+% Option "boxed" for nodes and twoports
+\newif\ifpgf at circuit@boxed
+\pgfkeys{/tikz/boxed/.add code={}{\pgf at circuit@boxedtrue}}
+\ctikzset{boxed/.add code={}{\pgf at circuit@boxedtrue}}
+\pgfkeys{/tikz/box/.add code={}{\pgf at circuit@boxedtrue}}
+\ctikzset{box/.add code={}{\pgf at circuit@boxedtrue}}
+
+% Option "dashed" for nodes and twoports
+\newif\ifpgf at circuit@dashed
+\pgfkeys{/tikz/dashed/.add code={}{\pgf at circuit@dashedtrue}}
+\ctikzset{dashed/.add code={}{\pgf at circuit@dashedtrue}}
+
+% Option "t=*" for nodes
+\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
+
+\ctikzset{current arrow scale/.initial=16}
+
+\ctikzset{bipoles/.is family}
+\ctikzset{bipoles/border margin/.initial=1.1}
+\ctikzset{bipoles/thickness/.initial=2}
+\ctikzset{tripoles/thickness/.initial=2}
+\ctikzset{quadpoles/thickness/.initial=2}
+\ctikzset{nodes width/.initial=.04}
+
+% Base len for all circuitikz
+\newdimen\pgf at circ@Rlen
+% scaled length for internal use in scalable shapes
+\newdimen\pgf at circ@scaled at Rlen
+\ctikzset{bipoles/length/.code={\pgf at circ@Rlen = #1\pgf at circ@scaled at Rlen=\pgf at circ@Rlen}}
+\pgf at circ@Rlen = 1.4cm
+% by default scale is 1.0
+\pgf at circ@scaled at Rlen=\pgf at circ@Rlen
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% main style definitions
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+% load a style file: search ctikzstyle-NAME.tex in path
+\def\ctikzloadstyle#1{%
+ \pgfutil at InputIfFileExists{ctikzstyle-#1}{}{%
+ \tikzerror{I did not find the circuitikz style #1}}%
+}
+
+% load and enact a style
+\def\ctikzsetstyle#1{%
+ \ctikzloadstyle{#1}%
+ \tikzset{#1 circuit style}%
+}
+
+% global style parameters
+\ctikzset{default/scale/.initial=1.0} % do not touch
+\ctikzset{default/fill/.initial=none} % do not touch
+\ctikzset{default/thickness/.initial=none} % do not touch
+% default is use as the generic default style for bipoles
+
+% mostly bipoles:
+
+\ctikzset{resistors/scale/.initial=1.0}
+\ctikzset{resistors/fill/.initial=none}
+\ctikzset{resistors/thickness/.initial=none}
+
+\ctikzset{capacitors/scale/.initial=1.0}
+\ctikzset{capacitors/fill/.initial=none}
+\ctikzset{capacitors/thickness/.initial=none}
+
+\ctikzset{inductors/scale/.initial=1.0}
+\ctikzset{inductors/fill/.initial=none}
+\ctikzset{inductors/thickness/.initial=none}
+
+\ctikzset{diodes/scale/.initial=1.0}
+\ctikzset{diodes/fill/.initial=none}
+\ctikzset{diodes/thickness/.initial=none}
+
+\ctikzset{batteries/scale/.initial=1.0}
+\ctikzset{batteries/fill/.initial=none}
+\ctikzset{batteries/thickness/.initial=none}
+
+\ctikzset{sources/scale/.initial=1.0}
+\ctikzset{sources/fill/.initial=none}
+\ctikzset{sources/thickness/.initial=none}
+
+\ctikzset{csources/scale/.initial=1.0}
+\ctikzset{csources/fill/.initial=none}
+\ctikzset{csources/thickness/.initial=none}
+
+\ctikzset{instruments/scale/.initial=1.0}
+\ctikzset{instruments/fill/.initial=none}
+\ctikzset{instruments/thickness/.initial=none}
+
+\ctikzset{mechanicals/scale/.initial=1.0}
+\ctikzset{mechanicals/fill/.initial=none}
+\ctikzset{mechanicals/thickness/.initial=none}
+
+\ctikzset{misc/scale/.initial=1.0}
+\ctikzset{misc/fill/.initial=none}
+\ctikzset{misc/thickness/.initial=none}
+
+\ctikzset{blocks/scale/.initial=1.0}
+\ctikzset{blocks/fill/.initial=none}
+\ctikzset{blocks/thickness/.initial=none}
+
+% mostly nodes
+
+\ctikzset{grounds/scale/.initial=1.0}
+\ctikzset{grounds/fill/.initial=none}
+\ctikzset{grounds/thickness/.initial=none}
+
+\ctikzset{power supplies/scale/.initial=1.0}
+\ctikzset{power supplies/fill/.initial=none}
+\ctikzset{power supplies/thickness/.initial=none}
+
+\ctikzset{transistors/scale/.initial=1.0}
+\ctikzset{transistors/fill/.initial=none}
+\ctikzset{transistors/thickness/.initial=none}
+
+\ctikzset{tubes/scale/.initial=1.0}
+\ctikzset{tubes/fill/.initial=none}
+\ctikzset{tubes/thickness/.initial=none}
+
+\ctikzset{RF/scale/.initial=1.0}
+\ctikzset{RF/fill/.initial=none}
+\ctikzset{RF/thickness/.initial=none}
+
+\ctikzset{electromechanicals/scale/.initial=1.0}
+\ctikzset{electromechanicals/fill/.initial=none}
+\ctikzset{electromechanicals/thickness/.initial=none}
+
+% transformers go with inductors
+\ctikzset{amplifiers/scale/.initial=1.0}
+\ctikzset{amplifiers/fill/.initial=none}
+\ctikzset{amplifiers/thickness/.initial=none}
+
+\ctikzset{switches/scale/.initial=1.0}
+\ctikzset{switches/fill/.initial=none}
+\ctikzset{switches/thickness/.initial=none}
+
+\ctikzset{logic ports/scale/.initial=1.0}
+\ctikzset{logic ports/fill/.initial=none}
+\ctikzset{logic ports/thickness/.initial=none}
+
+\ctikzset{flipflops/scale/.initial=1.0}
+\ctikzset{flipflops/fill/.initial=none}
+\ctikzset{flipflops/thickness/.initial=none}
+
+\ctikzset{muxdemuxes/scale/.initial=1.0}
+\ctikzset{muxdemuxes/fill/.initial=none}
+\ctikzset{muxdemuxes/thickness/.initial=none}
+
+\ctikzset{chips/scale/.initial=1.0}
+\ctikzset{chips/fill/.initial=none}
+\ctikzset{chips/thickness/.initial=none}
+
+\ctikzset{displays/scale/.initial=1.0}
+\ctikzset{displays/fill/.initial=none}
+\ctikzset{displays/thickness/.initial=none}
+
+% grounds and power supplies
+
+\ctikzset{monopoles/.is family}
+\ctikzset{monopoles/ground/width/.initial=.25}
+\ctikzset{monopoles/ground/connectionthickness/.initial=1}
+\ctikzset{monopoles/ground/thickness/.initial=2}
+\ctikzset{monopoles/rground/thickness/.initial=2}
+\ctikzset{monopoles/tground/thickness/.initial=3}
+\ctikzset{monopoles/vcc/width/.initial=.2}
+\ctikzset{monopoles/vcc/arrow/.initial=legacy}
+\ctikzset{monopoles/vee/arrow/.initial=legacy}
+\ctikzset{monopoles/match/width/.initial=.4}
+\ctikzset{monopoles/chassis/width/.initial=.25}
+\ctikzset{monopoles/alternative chassis/width/.initial=.25}
+\ctikzset{monopoles/equipotentiality/width/.initial=.25}
+\ctikzset{monopoles/antenna/width/.initial=.25}
+\ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
+\ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
+\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
+\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
+\ctikzset{monopoles/txantenna/width/.initial=.25}
+\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
+\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
+\ctikzset{monopoles/rxantenna/width/.initial=.25}
+\ctikzset{monopoles/bareantenna/width/.initial=.25}
+\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
+\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
+\ctikzset{monopoles/waves/width/.initial=0.5}
+
+% microstrips
+\ctikzset{bipoles/mstline/height/.initial=0.3}
+\ctikzset{bipoles/mstline/width/.initial=1.2}
+\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
+\ctikzset{monopoles/msport/width/.initial=.5}
+\ctikzset{monopoles/msrstub/height/.initial=1.0}
+\ctikzset{monopoles/msrstub/width/.initial=0.6}
+
+% microphone and loudspeaker
+\ctikzset{bipoles/loudspeaker/height/.initial=.8}
+\ctikzset{bipoles/loudspeaker/depth/.initial=.3}
+\ctikzset{bipoles/loudspeaker/width/.initial=.8}
+\ctikzset{bipoles/mic/height/.initial=1.2}
+\ctikzset{bipoles/mic/depth/.initial=.0}
+\ctikzset{bipoles/mic/width/.initial=.8}
+
+% Zig Zag resistors
+\ctikzset{resistors/zigs/.initial=3}
+\ctikzset{resistors/width/.code={%
+ \ctikzset{bipoles/resistor/width=#1}%
+ \ctikzset{bipoles/vresistor/width=#1}%
+ \ctikzset{bipoles/potentiometer/width=#1}%
+ \ctikzset{bipoles/resistivesens/width=#1}%
+ \ctikzset{bipoles/photoresistor/width=#1}%
+ \ctikzset{bipoles/thermistor/width=#1}%
+ \ctikzset{bipoles/thermistorntc/width=#1}%
+ \ctikzset{bipoles/thermistorptc/width=#1}%
+ \ctikzset{bipoles/varistor/width=#1}%
+ \ctikzset{bipoles/generic/width=#1}%
+ \ctikzset{bipoles/generic potentiometer/width=#1}%
+ \ctikzset{bipoles/ageneric/width=#1}%
+ \ctikzset{bipoles/tgeneric/width=#1}%
+}}
+\ctikzset{wiper pos/.code={%
+ \ctikzset{bipoles/potentiometer/wiper pos=#1}%
+ \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
+}}
+% zigzag resistor
+\ctikzset{bipoles/resistor/height/.initial=.3}
+\ctikzset{bipoles/resistor/width/.initial=.8}
+\ctikzset{bipoles/potentiometer/height/.initial=.8}
+\ctikzset{bipoles/potentiometer/height 2/.initial=.3}
+\ctikzset{bipoles/potentiometer/width/.initial=.8}
+\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
+\ctikzset{bipoles/vresistor/height/.initial=.6}
+\ctikzset{bipoles/vresistor/width/.initial=.8}
+\ctikzset{bipoles/resistivesens/height/.initial=.6}
+\ctikzset{bipoles/resistivesens/width/.initial=.8}
+% square resistors
+\ctikzset{bipoles/photoresistor/height/.initial=.6}
+\ctikzset{bipoles/photoresistor/height 2/.initial=.3}
+\ctikzset{bipoles/photoresistor/width/.initial=.8}
+\ctikzset{bipoles/thermistor/main/.initial=.7}
+\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
+\ctikzset{bipoles/thermistorntc/width/.initial=.8}
+\ctikzset{bipoles/thermistorntc/main/.initial=.7}
+\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
+\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
+\ctikzset{bipoles/thermistorptc/width/.initial=.8}
+\ctikzset{bipoles/thermistorptc/main/.initial=.7}
+\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
+\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
+\ctikzset{bipoles/thermistor/width/.initial=.8}
+\ctikzset{bipoles/varistor/main/.initial=.7}
+\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
+\ctikzset{bipoles/varistor/width/.initial=.8}
+\ctikzset{bipoles/generic/height/.initial=.30}
+\ctikzset{bipoles/generic/width/.initial=.80}
+\ctikzset{bipoles/generic potentiometer/height/.initial=.80}
+\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
+\ctikzset{bipoles/generic potentiometer/width/.initial=.80}
+\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
+\ctikzset{bipoles/ageneric/height/.initial=.30}
+\ctikzset{bipoles/tgeneric/height/.initial=.70}
+\ctikzset{bipoles/tgeneric/width/.initial=.80}
+\ctikzset{bipoles/ageneric/width/.initial=.80}
+
+%% Capacitors
+\ctikzset{bipoles/capacitor/height/.initial=.6}
+\ctikzset{bipoles/capacitor/width/.initial=.2}
+\ctikzset{bipoles/ecapacitor/height/.initial=.5}
+\ctikzset{bipoles/ecapacitor/width/.initial=.2}
+\ctikzset{bipoles/ecapacitor/font/.initial=\pgf at circ@font at sixbm}
+%%% pcapacitor is deprecated
+\ctikzset{bipoles/pcapacitor/height/.initial=.6}
+\ctikzset{bipoles/pcapacitor/width/.initial=.2}
+\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
+\ctikzset{bipoles/ccapacitor/height/.initial=.6}
+\ctikzset{bipoles/ccapacitor/width/.initial=.12}
+\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
+\ctikzset{bipoles/vcapacitor/height/.initial=.6}
+\ctikzset{bipoles/vcapacitor/width/.initial=.5}
+\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
+\ctikzset{bipoles/piezoelectric/height/.initial=.7}
+\ctikzset{bipoles/piezoelectric/width/.initial=.5}
+
+% Inductors
+\ctikzset{inductors/coils/.code={%
+ \ctikzset{bipoles/cuteinductor/coils=#1}%
+ \ctikzset{bipoles/cutechoke/coils=#1}%
+ \ctikzset{bipoles/americaninductor/coils=#1}%
+ \ctikzset{bipoles/vcuteinductor/coils=#1}%
+ \ctikzset{bipoles/vamericaninductor/coils=#1}%
+}}
+\ctikzset{inductors/width/.code={%
+ \ctikzset{bipoles/cuteinductor/width=#1}%
+ \ctikzset{bipoles/cutechoke/width=#1}%
+ \ctikzset{bipoles/americaninductor/width=#1}%
+ \ctikzset{bipoles/vcuteinductor/width=#1}%
+ \ctikzset{bipoles/vamericaninductor/width=#1}%
+ \ctikzset{bipoles/fullgeneric/width=#1}%
+ \ctikzset{bipoles/tfullgeneric/width=#1}%
+}}
+\ctikzset{bipoles/cuteinductor/height/.initial=.3}
+\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
+\ctikzset{bipoles/cuteinductor/width/.initial=.6}
+\ctikzset{bipoles/cuteinductor/coils/.initial=5}
+\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
+%% Cute choke settings
+\ctikzset{bipoles/cutechoke/height/.initial=.3}
+\ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
+\ctikzset{bipoles/cutechoke/width/.initial=.6}
+\ctikzset{bipoles/cutechoke/coils/.initial=5}
+\ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
+\ctikzset{bipoles/cutechoke/cstep/.initial=.3}
+\ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
+\ctikzset{bipoles/cutechoke/cthick/.initial=1}
+\newif\ifpgf at circuit@bipole at twolineschoke
+\pgf at circuit@bipole at twolineschokefalse
+\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf at circuit@bipole at twolineschokefalse}}
+\ctikzset{onelinechoke/.add code={}{\pgf at circuit@bipole at twolineschokefalse}}
+\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf at circuit@bipole at twolineschoketrue}}
+\ctikzset{twolineschoke/.add code={}{\pgf at circuit@bipole at twolineschoketrue}}
+%
+\ctikzset{bipoles/americaninductor/height/.initial=.3}
+\ctikzset{bipoles/americaninductor/height 2/.initial=.1}
+\ctikzset{bipoles/americaninductor/width/.initial=.8}
+\ctikzset{bipoles/americaninductor/coils/.initial=4}
+\ctikzset{bipoles/americaninductor/coil height/.initial=.15}
+\ctikzset{bipoles/vcuteinductor/height/.initial=.6}
+\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
+\ctikzset{bipoles/vcuteinductor/width/.initial=.6}
+\ctikzset{bipoles/vcuteinductor/coils/.initial=5}
+\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
+\ctikzset{bipoles/vamericaninductor/height/.initial=.6}
+\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
+\ctikzset{bipoles/vamericaninductor/width/.initial=.8}
+\ctikzset{bipoles/vamericaninductor/coils/.initial=4}
+\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
+\ctikzset{bipoles/tfullgeneric/height/.initial=.70}
+\ctikzset{bipoles/tfullgeneric/width/.initial=.80}
+\ctikzset{bipoles/fullgeneric/height/.initial=.30}
+\ctikzset{bipoles/fullgeneric/width/.initial=.80}
+
+% Sources
+
+\ctikzset{bipoles/esource/height/.initial=.60}
+\ctikzset{bipoles/esource/width/.initial=.60}
+\ctikzset{bipoles/pvsource/height/.initial=.60}
+\ctikzset{bipoles/pvsource/width/.initial=.60}
+\ctikzset{bipoles/isource/height/.initial=.60}
+\ctikzset{bipoles/isource/width/.initial=.60}
+\ctikzset{bipoles/oosource/height/.initial=.60}
+\ctikzset{bipoles/oosource/width/.initial=.60}
+\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/dcisource/angle/.initial=80}
+\ctikzset{bipoles/dcisource/height/.initial=.60}
+\ctikzset{bipoles/dcisource/width/.initial=.60}
+\ctikzset{bipoles/dcvsource/height/.initial=.60}
+\ctikzset{bipoles/dcvsource/width/.initial=.60}
+\ctikzset{bipoles/vsourcetri/height/.initial=.60}
+\ctikzset{bipoles/vsourcetri/width/.initial=.60}
+\ctikzset{bipoles/isourceam/height/.initial=.60}
+\ctikzset{bipoles/isourceam/width/.initial=.60}
+\ctikzset{bipoles/vsource/height/.initial=.60}
+\ctikzset{bipoles/vsource/width/.initial=.60}
+\ctikzset{bipoles/vsourceam/height/.initial=.60}
+\ctikzset{bipoles/vsourceam/width/.initial=.60}
+\ctikzset{bipoles/vsourceam/margin/.initial=.7}
+\ctikzset{bipoles/isourcesin/height/.initial=.60}
+\ctikzset{bipoles/isourcesin/width/.initial=.60}
+\ctikzset{bipoles/vsourcesin/height/.initial=.60}
+\ctikzset{bipoles/vsourcesin/width/.initial=.60}
+\ctikzset{bipoles/vsourcesquare/height/.initial=.60}
+\ctikzset{bipoles/vsourcesquare/width/.initial=.60}
+\ctikzset{bipoles/cisource/height/.initial=.7}
+\ctikzset{bipoles/cisource/width/.initial=.7}
+\ctikzset{bipoles/cisourceam/height/.initial=.7}
+\ctikzset{bipoles/cisourceam/width/.initial=.7}
+\ctikzset{bipoles/ecsource/height/.initial=.7}
+\ctikzset{bipoles/ecsource/width/.initial=.7}
+\ctikzset{bipoles/cvsource/height/.initial=.7}
+\ctikzset{bipoles/cvsource/width/.initial=.7}
+\ctikzset{bipoles/cvsourceam/height/.initial=.7}
+\ctikzset{bipoles/cvsourceam/width/.initial=.7}
+\ctikzset{bipoles/cvsourceam/margin/.initial=.7}
+\ctikzset{bipoles/cvsourceam/text scale/.initial=1}
+\ctikzset{bipoles/cisourcesin/width/.initial=.7}
+\ctikzset{bipoles/cvsourcesin/height/.initial=.7}
+\ctikzset{bipoles/cvsourcesin/width/.initial=.7}
+\ctikzset{bipoles/battery/height/.initial=.6}
+\ctikzset{bipoles/battery/width/.initial=.3}
+\ctikzset{bipoles/battery1/height/.initial=.6}
+\ctikzset{bipoles/battery1/width/.initial=.3}
+\ctikzset{bipoles/battery2/height/.initial=.6}
+\ctikzset{bipoles/battery2/width/.initial=.3}
+
+% % % ootransformer
+\ctikzset{bipoles/oosourcetrans/height/.initial=.6}
+\ctikzset{bipoles/oosourcetrans/width/.initial=.6}
+\ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
+
+% % % oootransformer
+\ctikzset{bipoles/ooosource/height/.initial=.6}
+\ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
+
+% % % primary windings
+\newif\ifpgf at circ@prim at delta
+\newif\ifpgf at circ@prim at wye
+\newif\ifpgf at circ@prim at zig
+\pgfkeys{tikz/prim/.is choice}
+\pgfkeys{tikz/prim/delta/.add code={}{\pgf at circ@prim at deltatrue}}
+\pgfkeys{tikz/prim/wye/.add code={}{\pgf at circ@prim at wyetrue}}
+\pgfkeys{tikz/prim/zig/.add code={}{\pgf at circ@prim at zigtrue}}
+
+% % % secondary windings
+\newif\ifpgf at circ@sec at delta
+\newif\ifpgf at circ@sec at wye
+\newif\ifpgf at circ@sec at zig
+\pgfkeys{tikz/sec/.is choice}
+\pgfkeys{tikz/sec/delta/.add code={}{\pgf at circ@sec at deltatrue}}
+\pgfkeys{tikz/sec/wye/.add code={}{\pgf at circ@sec at wyetrue}}
+\pgfkeys{tikz/sec/zig/.add code={}{\pgf at circ@sec at zigtrue}}
+
+% % % tertiary windings (ooosource)
+\newif\ifpgf at circ@tert at delta
+\newif\ifpgf at circ@tert at wye
+\newif\ifpgf at circ@tert at zig
+\pgfkeys{tikz/tert/.is choice}
+\pgfkeys{tikz/tert/delta/.add code={}{\pgf at circ@tert at deltatrue}}
+\pgfkeys{tikz/tert/wye/.add code={}{\pgf at circ@tert at wyetrue}}
+\pgfkeys{tikz/tert/zig/.add code={}{\pgf at circ@tert at zigtrue}}
+
+% diodes
+
+\ctikzset{bipoles/diode/height/.initial=.50}
+\ctikzset{bipoles/diode/width/.initial=.40}
+\ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
+\ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
+\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
+\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
+\ctikzset{bipoles/varcap/height/.initial=.50}
+\ctikzset{bipoles/varcap/width/.initial=.45}
+
+% switches
+
+\ctikzset{bipoles/spst/height/.initial=.35}
+\ctikzset{bipoles/spst/width/.initial=.35}
+\ctikzset{bipoles/spst/depth/.initial=.2}
+\ctikzset{bipoles/nos/height/.initial=.3}
+\ctikzset{bipoles/nos/width/.initial=.35}
+\ctikzset{bipoles/nos/depth/.initial=.2}
+\ctikzset{bipoles/ncs/height/.initial=.35}
+\ctikzset{bipoles/ncs/width/.initial=.35}
+\ctikzset{bipoles/ncs/depth/.initial=.2}
+%%% reed switch
+\ctikzset{bipoles/reed/height/.initial=.4}
+\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
+\ctikzset{bipoles/reed/depth/.initial=.4}
+
+% misc
+
+\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
+\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
+\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
+\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
+\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
+\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
+\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
+\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
+\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
+\ctikzset{bipoles/fuse/height/.initial=.20}
+\ctikzset{bipoles/fuse/width/.initial=.50}
+\ctikzset{bipoles/afuse/height/.initial=.20}
+\ctikzset{bipoles/afuse/width/.initial=.50}
+\ctikzset{bipoles/memristor/height/.initial=.30}
+\ctikzset{bipoles/memristor/wave height/.initial=.5}
+\ctikzset{bipoles/memristor/width/.initial=.80}
+\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
+\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
+\ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
+\ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/short/height/.initial=0} %dummy height for voltage positioning
+\ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning
+%\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2}
+%\ctikzset{bipoles/short/voltage/distance from node/.initial=.5}
+% multiwire
+\ctikzset{bipoles/multiwire/height/.initial=0.4}
+\ctikzset{bipoles/multiwire/width/.initial=0.2}
+\ctikzset{bipoles/multiwire/spacing/.initial=0.05}
+
+\ctikzset{bipoles/ammeter/height/.initial=.60}
+\ctikzset{bipoles/ammeter/width/.initial=.60}
+\ctikzset{bipoles/ohmmeter/height/.initial=.60}
+\ctikzset{bipoles/ohmmeter/width/.initial=.60}
+\ctikzset{bipoles/voltmeter/height/.initial=.60}
+\ctikzset{bipoles/voltmeter/width/.initial=.60}
+\ctikzset{bipoles/smeter/height/.initial=.60}
+\ctikzset{bipoles/smeter/width/.initial=.60}
+\ctikzset{bipoles/smeter/voltage/additional label shift/.initial=1}
+\ctikzset{bipoles/qmeter/depth/.initial=.40}
+\ctikzset{bipoles/qmeter/height/.initial=.80}
+\ctikzset{bipoles/qmeter/width/.initial=.60}
+% this must be specified for each one
+\ctikzset{bipoles/qvprobe/voltage/additional label shift/.initial=.5}
+\ctikzset{bipoles/qiprobe/voltage/additional label shift/.initial=.5}
+\ctikzset{bipoles/qpprobe/voltage/additional label shift/.initial=.5}
+\ctikzset{bipoles/iloop/width/.initial=.40}
+\ctikzset{bipoles/iloop/height/.initial=.60}
+
+\ctikzset{bipoles/oscope/height/.initial=.60}
+\ctikzset{bipoles/oscope/width/.initial=.60}
+\ctikzset{bipoles/oscope/voltage/additional label shift/.initial=1}
+
+
+% option to not rotate the new (Romano's) instruments
+\newif\ifpgf at circuit@straightinstruments\pgf at circuit@straightinstrumentstrue
+\pgfkeys{/tikz/straight instruments/.add code={}{\pgf at circuit@straightinstrumentstrue}}
+\ctikzset{straight instruments/.add code={}{\pgf at circuit@straightinstrumentstrue}}
+\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf at circuit@straightinstrumentsfalse}}
+\ctikzset{rotated instruments/.add code={}{\pgf at circuit@straightinstrumentsfalse}}
+
+
+\ctikzset{bipoles/buffer/height/.initial=1}
+\ctikzset{bipoles/buffer/width/.initial=1}
+\ctikzset{bipoles/not port/width/.initial=1}
+\ctikzset{bipoles/not port/height/.initial=.8}
+\ctikzset{bipoles/not port/circle width/.initial=.15}
+\ctikzset{bipoles/lamp/height/.initial=.60}
+\ctikzset{bipoles/lamp/width/.initial=.60}
+\ctikzset{bipoles/bulb/height/.initial=.8}
+\ctikzset{bipoles/bulb/width/.initial=.8}
+\ctikzset{bipoles/tline/height/.initial=.3}
+\ctikzset{bipoles/tline/width/.initial=.8}
+\ctikzset{bipoles/squid/height/.initial=.60}
+\ctikzset{bipoles/squid/width/.initial=.60}
+\ctikzset{bipoles/barrier/height/.initial=.60}
+\ctikzset{bipoles/barrier/width/.initial=.60}
+\ctikzset{bipoles/openbarrier/gap/.initial=0.5}
+\ctikzset{bipoles/thermocouple/height/.initial=.250}
+\ctikzset{bipoles/thermocouple/height 2/.initial=.60}
+\ctikzset{bipoles/thermocouple/width/.initial=.140}
+\ctikzset{bipoles/pushbutton/height/.initial=.5}
+\ctikzset{bipoles/pushbutton/height 2/.initial=.2}
+\ctikzset{bipoles/pushbutton/width/.initial=.50}
+
+\ctikzset{bipoles/twoport/width/.initial=.7}
+\ctikzset{bipoles/twoport/height/.initial=.7}
+\ctikzset{bipoles/twoport/text/.initial=}
+\ctikzset{bipoles/vco/width/.initial=.7}
+\ctikzset{bipoles/bandpass/width/.initial=.7}
+\ctikzset{bipoles/bandstop/width/.initial=.7}
+\ctikzset{bipoles/highpass/width/.initial=.7}
+\ctikzset{bipoles/lowpass/width/.initial=.7}
+\ctikzset{bipoles/adc/width/.initial=.7}
+\ctikzset{bipoles/dac/width/.initial=.7}
+\ctikzset{bipoles/dsp/width/.initial=.7}
+\ctikzset{bipoles/fft/width/.initial=.7}
+\ctikzset{bipoles/amp/width/.initial=.7}
+\ctikzset{bipoles/vamp/width/.initial=.7}
+\ctikzset{bipoles/piattenuator/width/.initial=.7}
+\ctikzset{bipoles/vpiattenuator/width/.initial=.7}
+\ctikzset{bipoles/tattenuator/width/.initial=.7}
+\ctikzset{bipoles/vtattenuator/width/.initial=.7}
+\ctikzset{bipoles/phaseshifter/width/.initial=.7}
+\ctikzset{bipoles/vphaseshifter/width/.initial=.7}
+\ctikzset{bipoles/detector/width/.initial=.7}
+
+% crossing wires
+\ctikzset{bipoles/crossing/size/.initial=.2}
+
+% Transistors starts here
+
+\newif\ifpgf at circuit@trans at depletiontype
+\pgf at circuit@trans at depletiontypefalse
+
+\newif\ifpgf at circuit@mos at arrows
+\ctikzset{tripoles/mos style/.is choice}
+\ctikzset{tripoles/mos style/no arrows/.code={\pgf at circuit@mos at arrowsfalse}}
+\ctikzset{tripoles/mos style/arrows/.code={\pgf at circuit@mos at arrowstrue}}
+\pgfkeys{/tikz/arrowmos/.add code={}{\pgf at circuit@mos at arrowstrue}}
+\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf at circuit@mos at arrowsfalse}}
+
+% Fixed label positions
+\newif\ifpgf at circuit@transisors at fixlabels
+\pgf at circuit@transisors at fixlabelstrue
+\pgfkeys{/tikz/center transistors text/.add code={}{\pgf at circuit@transisors at fixlabelstrue}}
+\ctikzset{fix transistors text/.add code={}{\pgf at circuit@transisors at fixlabelstrue}}
+\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf at circuit@transisors at fixlabelsfalse}}
+\ctikzset{legacy transistors text/.add code={}{\pgf at circuit@transisors at fixlabelsfalse}}
+
+% Option solderdot for fet
+\newif\ifpgf at circuit@fet at solderdot
+\pgfkeys{/tikz/solderdot/.add code={}{\pgf at circuit@fet at solderdottrue}}
+\ctikzset{solderdot/.add code={}{\pgf at circuit@fet at solderdottrue}}
+\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf at circuit@fet at solderdotfalse}}
+\ctikzset{nosolderdot/.add code={}{\pgf at circuit@fet at solderdotfalse}}
+
+% Option bodydiode for fet
+\newif\ifpgf at circuit@fet at bodydiode
+\pgfkeys{/tikz/bodydiode/.add code={}{\pgf at circuit@fet at bodydiodetrue}}
+\ctikzset{bodydiode/.add code={}{\pgf at circuit@fet at bodydiodetrue}}
+\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf at circuit@fet at bodydiodefalse}}
+\ctikzset{nobodydiode/.add code={}{\pgf at circuit@fet at bodydiodefalse}}
+
+% Option draw fet without gate connection
+\newif\ifpgf at circuit@bpt at drawgate
+\pgf at circuit@bpt at drawgatetrue
+\pgfkeys{/tikz/nogate/.add code={}{\pgf at circuit@bpt at drawgatefalse}}
+\ctikzset{nogate/.add code={}{\pgf at circuit@bpt at drawgatefalse}}
+\pgfkeys{/tikz/nobase/.add code={}{\pgf at circuit@bpt at drawgatefalse}}
+\ctikzset{nobase/.add code={}{\pgf at circuit@bpt at drawgatefalse}}
+
+% Option draw bpt with schottky base
+\newif\ifpgf at circuit@bpt at schottky
+\pgf at circuit@bpt at schottkyfalse
+\pgfkeys{/tikz/schottky base/.add code={}{\pgf at circuit@bpt at schottkytrue}}
+\ctikzset{schottky base/.add code={}{\pgf at circuit@bpt at schottkytrue}}
+\pgfkeys{/tikz/no schottky base/.add code={}{\pgf at circuit@bpt at schottkyfalse}}
+\ctikzset{no schottky base/.add code={}{\pgf at circuit@bpt at schottkyfalse}}
+\ctikzset{tripoles/schottky base size/.initial=0.07}
+
+% Option draw bpt without base connection
+\newif\ifpgf at circuit@bpt at drawbase
+\pgf at circuit@bpt at drawbasetrue
+\pgfkeys{/tikz/nobase/.add code={}{\pgf at circuit@bpt at drawbasefalse}}
+\ctikzset{nobase/.add code={}{\pgf at circuit@bpt at drawbasefalse}}
+\pgfkeys{/tikz/nogate/.add code={}{\pgf at circuit@bpt at drawbasefalse}}
+\ctikzset{nogate/.add code={}{\pgf at circuit@bpt at drawbasefalse}}
+
+% Option draw bpt with optical input
+\newif\ifpgf at circuit@bpt at drawphoto
+\pgf at circuit@bpt at drawphotofalse
+\pgfkeys{/tikz/photo/.add code={}{\pgf at circuit@bpt at drawphototrue}}
+\ctikzset{photo/.add code={}{\pgf at circuit@bpt at drawphototrue}}
+\pgfkeys{/tikz/photo/.add code={}{\pgf at circuit@bpt at drawphototrue}}
+\ctikzset{photo/.add code={}{\pgf at circuit@bpt at drawphototrue}}
+
+% Option draw fet without bulk connection -- Added by Burak Kelleci
+\newif\ifpgf at circuit@bpt at drawbulk
+\pgfkeys{/tikz/bulk/.add code={}{\pgf at circuit@bpt at drawbulktrue}}
+\ctikzset{bulk/.add code={}{\pgf at circuit@bpt at drawbulktrue}}
+\pgfkeys{/tikz/nobulk/.add code={}{\pgf at circuit@bpt at drawbulkfalse}}
+\ctikzset{nobulk/.add code={}{\pgf at circuit@bpt at drawbulkfalse}}
+
+% Option draw pmos with empty circle
+\newif\ifpgf at circuit@pmos at emptycircle
+\pgf at circuit@pmos at emptycirclefalse
+\ctikzset{tripoles/pmos style/.is choice}
+\pgfkeys{/tikz/emptycircle/.add code={}{\pgf at circuit@pmos at emptycircletrue}}
+\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf at circuit@pmos at emptycircletrue}}
+% Option draw pmos with no circle
+\newif\ifpgf at circuit@pmos at nocircle
+\pgf at circuit@pmos at nocirclefalse
+\pgfkeys{/tikz/nocircle/.add code={}{\pgf at circuit@pmos at nocircletrue}}
+\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf at circuit@pmos at nocircletrue}}
+% back to normal
+\pgfkeys{/tikz/fullcircle/.add code={}{\pgf at circuit@pmos at emptycirclefalse\pgf at circuit@pmos at nocirclefalse}}
+\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf at circuit@pmos at emptycirclefalse\pgf at circuit@pmos at nocirclefalse}}
+% arrows at the end, the correct way
+\newif\ifpgf at circuit@trans at arrowatend
+\pgf at circuit@trans at arrowatendfalse
+\ctikzset{transistors/arrow pos/.is choice}
+\ctikzset{transistors/arrow pos/legacy/.code={\pgf at circuit@trans at arrowatendfalse}}
+\ctikzset{transistors/arrow pos/end/.code={\pgf at circuit@trans at arrowatendtrue}}
+
+\newif\ifpgf at circuit@trans at ntype
+\pgf at circuit@trans at ntypetrue %default true
+%\newif\ifpgf at circuit@trans at ptype
+%\ctikzset{tripoles/nmos/.add code={\pgf at circuit@trans at ntypetrue}}
+\ctikzset{tripoles/nmos/width/.initial=.7}
+\ctikzset{tripoles/nmos/gate height/.initial=.35}
+\ctikzset{tripoles/nmos/base height/.initial=.5}
+\ctikzset{tripoles/nmos/conn height/.initial=0}
+\ctikzset{tripoles/nmos/height/.initial=1.1}
+\ctikzset{tripoles/nmos/base width/.initial=.5}
+\ctikzset{tripoles/nmos/gate width/.initial=.62}
+\ctikzset{tripoles/nmos/arrow pos/.initial=.6}
+\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nmos/curr direction/.initial=1}
+
+\ctikzset{tripoles/pmos/width/.initial=.7}
+\ctikzset{tripoles/pmos/gate height/.initial=.35}
+\ctikzset{tripoles/pmos/base height/.initial=.5}
+\ctikzset{tripoles/pmos/conn height/.initial=0}
+\ctikzset{tripoles/pmos/height/.initial=1.1}
+\ctikzset{tripoles/pmos/base width/.initial=.5}
+\ctikzset{tripoles/pmos/gate width/.initial=.62}
+\ctikzset{tripoles/pmos/arrow pos/.initial=.4}
+\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pmos/curr direction/.initial=-1}
+
+\ctikzset{tripoles/hemt/width/.initial=.7}
+\ctikzset{tripoles/hemt/gate height/.initial=.35}
+\ctikzset{tripoles/hemt/base height/.initial=.5}
+\ctikzset{tripoles/hemt/conn height/.initial=0}
+\ctikzset{tripoles/hemt/height/.initial=1.1}
+\ctikzset{tripoles/hemt/base width/.initial=.5}
+\ctikzset{tripoles/hemt/gate width/.initial=.62}
+\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/hemt/curr direction/.initial=1}
+
+\ctikzset{tripoles/nfet/width/.initial=.7}
+\ctikzset{tripoles/nfet/gate height/.initial=.35}
+\ctikzset{tripoles/nfet/base height/.initial=.5}
+\ctikzset{tripoles/nfet/conn height/.initial=0}
+\ctikzset{tripoles/nfet/height/.initial=1.1}
+\ctikzset{tripoles/nfet/base width/.initial=.5}
+\ctikzset{tripoles/nfet/gate width/.initial=.62}
+\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nfet/curr direction/.initial=1}
+
+\ctikzset{tripoles/pfet/width/.initial=.7}
+\ctikzset{tripoles/pfet/gate height/.initial=.35}
+\ctikzset{tripoles/pfet/base height/.initial=.5}
+\ctikzset{tripoles/pfet/conn height/.initial=0}
+\ctikzset{tripoles/pfet/height/.initial=1.1}
+\ctikzset{tripoles/pfet/base width/.initial=.5}
+\ctikzset{tripoles/pfet/gate width/.initial=.62}
+\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pfet/curr direction/.initial=-1}
+
+\ctikzset{tripoles/nigfete/width/.initial=.7}
+\ctikzset{tripoles/nigfete/gate height/.initial=.35}
+\ctikzset{tripoles/nigfete/base height/.initial=.5}
+\ctikzset{tripoles/nigfete/conn height/.initial=.35}
+\ctikzset{tripoles/nigfete/height/.initial=1.1}
+\ctikzset{tripoles/nigfete/base width/.initial=.5}
+\ctikzset{tripoles/nigfete/gate width/.initial=.62}
+\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nigfete/curr direction/.initial=1}
+
+\ctikzset{tripoles/nigfetd/width/.initial=.7}
+\ctikzset{tripoles/nigfetd/gate height/.initial=.35}
+\ctikzset{tripoles/nigfetd/base height/.initial=.5}
+\ctikzset{tripoles/nigfetd/conn height/.initial=.35}
+\ctikzset{tripoles/nigfetd/height/.initial=1.1}
+\ctikzset{tripoles/nigfetd/base width/.initial=.5}
+\ctikzset{tripoles/nigfetd/gate width/.initial=.62}
+\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nigfetd/curr direction/.initial=1}
+
+\ctikzset{tripoles/nigfetebulk/width/.initial=.7}
+\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
+\ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
+\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
+\ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
+\ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
+\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
+\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
+
+\ctikzset{tripoles/pigfete/width/.initial=.7}
+\ctikzset{tripoles/pigfete/gate height/.initial=.35}
+\ctikzset{tripoles/pigfete/base height/.initial=.5}
+\ctikzset{tripoles/pigfete/conn height/.initial=.35}
+\ctikzset{tripoles/pigfete/height/.initial=1.1}
+\ctikzset{tripoles/pigfete/base width/.initial=.5}
+\ctikzset{tripoles/pigfete/gate width/.initial=.62}
+\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pigfete/curr direction/.initial=-1}
+
+\ctikzset{tripoles/pigfetd/width/.initial=.7}
+\ctikzset{tripoles/pigfetd/gate height/.initial=.35}
+\ctikzset{tripoles/pigfetd/base height/.initial=.5}
+\ctikzset{tripoles/pigfetd/conn height/.initial=.35}
+\ctikzset{tripoles/pigfetd/height/.initial=1.1}
+\ctikzset{tripoles/pigfetd/base width/.initial=.5}
+\ctikzset{tripoles/pigfetd/gate width/.initial=.62}
+\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
+
+\ctikzset{tripoles/pigfetebulk/width/.initial=.7}
+\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
+\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
+\ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
+\ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
+\ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
+\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
+\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
+
+\ctikzset{tripoles/npn/width/.initial=.6}
+\ctikzset{tripoles/npn/base height/.initial=.45}
+\ctikzset{tripoles/npn/base height 2/.initial=.15}
+\ctikzset{tripoles/npn/base height/.initial=.4}
+\ctikzset{tripoles/npn/conn height/.initial=0}
+\ctikzset{tripoles/npn/height/.initial=1.1}
+\ctikzset{tripoles/npn/base width/.initial=.5}
+\ctikzset{tripoles/npn/arrow pos/.initial=.5}
+\ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/npn/curr direction/.initial=1}
+
+\ctikzset{tripoles/pnp/width/.initial=.6}
+\ctikzset{tripoles/pnp/base height/.initial=.45}
+\ctikzset{tripoles/pnp/base height 2/.initial=.15}
+\ctikzset{tripoles/pnp/base height/.initial=.4}
+\ctikzset{tripoles/pnp/conn height/.initial=0}
+\ctikzset{tripoles/pnp/height/.initial=1.1}
+\ctikzset{tripoles/pnp/base width/.initial=.5}
+\ctikzset{tripoles/pnp/arrow pos/.initial=.5}
+\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pnp/curr direction/.initial=-1}
+
+\ctikzset{tripoles/pigbt/width/.initial=.6}
+\ctikzset{tripoles/pigbt/gate height/.initial=.45}
+\ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
+\ctikzset{tripoles/pigbt/base height/.initial=.4}
+\ctikzset{tripoles/pigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
+\ctikzset{tripoles/pigbt/conn height/.initial=0}
+\ctikzset{tripoles/pigbt/height/.initial=1.1}
+\ctikzset{tripoles/pigbt/gate width/.initial=.62}
+\ctikzset{tripoles/pigbt/base width/.initial=.5}
+\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pigbt/curr direction/.initial=-1}
+
+\ctikzset{tripoles/nigbt/width/.initial=.6}
+\ctikzset{tripoles/nigbt/gate height/.initial=.45}
+\ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
+\ctikzset{tripoles/nigbt/base height/.initial=.4}
+\ctikzset{tripoles/nigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
+\ctikzset{tripoles/nigbt/conn height/.initial=0}
+\ctikzset{tripoles/nigbt/height/.initial=1.1}
+\ctikzset{tripoles/nigbt/gate width/.initial=.62}
+\ctikzset{tripoles/nigbt/base width/.initial=.5}
+\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/nigbt/curr direction/.initial=1}
+
+\ctikzset{tripoles/Lpigbt/width/.initial=.6}
+\ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
+\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
+\ctikzset{tripoles/Lpigbt/base height/.initial=.4}
+\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
+\ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
+\ctikzset{tripoles/Lpigbt/height/.initial=1.1}
+\ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
+\ctikzset{tripoles/Lpigbt/base width/.initial=.5}
+\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
+
+\ctikzset{tripoles/Lnigbt/width/.initial=.6}
+\ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
+\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
+\ctikzset{tripoles/Lnigbt/base height/.initial=.4}
+\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
+\ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
+\ctikzset{tripoles/Lnigbt/height/.initial=1.1}
+\ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
+\ctikzset{tripoles/Lnigbt/base width/.initial=.5}
+\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
+
+\ctikzset{tripoles/igbt/outer base height/.code={
+ \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
+ \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
+}}
+\ctikzset{tripoles/igbt/outer base thickness/.code={
+ \ctikzset{tripoles/nigbt/outer base thickness=#1}
+ \ctikzset{tripoles/pigbt/outer base thickness=#1}
+ \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
+ \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
+}}
+
+\ctikzset{tripoles/njfet/width/.initial=.7}
+\ctikzset{tripoles/njfet/gate height/.initial=.5}
+\ctikzset{tripoles/njfet/gate height 2/.initial=.35}
+\ctikzset{tripoles/njfet/gate width/.initial=.5}
+\ctikzset{tripoles/njfet/conn height/.initial=.35}
+\ctikzset{tripoles/njfet/height/.initial=1.1}
+\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/njfet/curr direction/.initial=1}
+
+\ctikzset{tripoles/pjfet/width/.initial=.7}
+\ctikzset{tripoles/pjfet/gate height/.initial=.5}
+\ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
+\ctikzset{tripoles/pjfet/gate width/.initial=.5}
+\ctikzset{tripoles/pjfet/conn height/.initial=.35}
+\ctikzset{tripoles/pjfet/height/.initial=1.1}
+\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/pjfet/curr direction/.initial=-1}
+
+\ctikzset{tripoles/isfet/width/.initial=1}
+\ctikzset{tripoles/isfet/gate height/.initial=.35}
+\ctikzset{tripoles/isfet/base height/.initial=.5}
+\ctikzset{tripoles/isfet/height/.initial=1.1}
+\ctikzset{tripoles/isfet/base width/.initial=.3}
+\ctikzset{tripoles/isfet/gate width/.initial=.5}
+\ctikzset{tripoles/isfet/conn height/.initial=0}
+\ctikzset{tripoles/isfet/wave width/.initial=.16}
+\ctikzset{tripoles/isfet/wave amp/.initial=.06}
+\ctikzset{tripoles/isfet/waves y sep/.initial=.22}
+\ctikzset{tripoles/isfet/waves x sep/.initial=.8}
+\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
+\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
+\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
+\ctikzset{tripoles/isfet/curr direction/.initial=1}
+%
+% multi-emitter and multi-collector BJTs by Romano Giannetti
+%
+\ctikzset{tripoles/bjt/emitters/.initial=1}
+\ctikzset{tripoles/bjt/collectors/.initial=1}
+\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
+\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
+\ctikzset{tripoles/bjt/pins width/.initial=0.3}
+\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
+\ctikzset{tripoles/bjt/multi height/.initial=.5}
+\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
+%
+\ctikzset{tripoles/bjt/width/.initial=.3}
+\ctikzset{tripoles/bjt/base height 2/.initial=.4}
+\ctikzset{tripoles/bjt/base height/.initial=1.1}
+\ctikzset{tripoles/bjt/height/.initial=.4}
+\ctikzset{tripoles/bjt/base width/.initial=1}
+\ctikzset{tripoles/bjt/arrow pos/.initial=.5}
+% do NOT touch these two!
+\ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
+\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
+
+%% transistors stop here
+
+%% Logic ports
+
+\newif\ifpgf at circuit@europeanlogicport
+\ctikzset{logic ports/.is choice}
+\ctikzset{logic ports/european/.code= {\pgf at circuit@europeanlogicporttrue
+ \tikzset{and port/.style={shape=european and port}}%
+ \tikzset{or port/.style={shape=european or port}}%
+ \tikzset{xor port/.style={shape=european xor port}}%
+ \tikzset{buffer port/.style={shape=european buffer port}}%
+ \tikzset{not port/.style={shape=european not port}}%
+ \tikzset{nand port/.style={shape=european nand port}}%
+ \tikzset{nor port/.style={shape=european nor port}}%
+ \tikzset{xnor port/.style={shape=european xnor port}}%
+}}
+\ctikzset{logic ports/american/.code= {\pgf at circuit@europeanlogicportfalse
+ \tikzset{and port/.style={shape=american and port}}%
+ \tikzset{or port/.style={shape=american or port}}%
+ \tikzset{xor port/.style={shape=american xor port}}%
+ \tikzset{buffer port/.style={shape=american buffer port}}%
+ \tikzset{not port/.style={shape=american not port}}%
+ \tikzset{nand port/.style={shape=american nand port}}%
+ \tikzset{nor port/.style={shape=american nor port}}%
+ \tikzset{xnor port/.style={shape=american xnor port}}%
+}}
+
+\ctikzset{logic ports origin/.is choice}
+\ctikzset{logic ports origin/legacy/.code={
+ \ctikzset{tripoles/american and port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american or port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european and port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european or port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
+ \ctikzset{tripoles/european not port/origin/.initial=0.8}%
+ }%
+}
+\ctikzset{logic ports origin/center/.code={%
+ \ctikzset{tripoles/american and port/origin/.initial=0}%
+ \ctikzset{tripoles/american nand port/origin/.initial=0}%
+ \ctikzset{tripoles/american nor port/origin/.initial=0}%
+ \ctikzset{tripoles/american or port/origin/.initial=0}%
+ \ctikzset{tripoles/american xor port/origin/.initial=0}%
+ \ctikzset{tripoles/american xnor port/origin/.initial=0}%
+ \ctikzset{tripoles/european and port/origin/.initial=0}%
+ \ctikzset{tripoles/european nand port/origin/.initial=0}%
+ \ctikzset{tripoles/european or port/origin/.initial=0}%
+ \ctikzset{tripoles/european nor port/origin/.initial=0}%
+ \ctikzset{tripoles/european xor port/origin/.initial=0}%
+ \ctikzset{tripoles/european xnor port/origin/.initial=0}%
+ \ctikzset{tripoles/european buffer port/origin/.initial=0}%
+ \ctikzset{tripoles/european not port/origin/.initial=0}%
+ }%
+}
+
+\newif\ifpgfcirc at roundy@or at shapes\pgfcirc at roundy@or at shapesfalse
+\ctikzset{american or shape/.is choice}
+\ctikzset{american or shape/roundy/.code={\pgfcirc at roundy@or at shapestrue}}
+\ctikzset{american or shape/pointy/.code={\pgfcirc at roundy@or at shapesfalse}}
+
+\newif\ifpgfcirc at draw@leads\pgfcirc at draw@leadstrue
+\ctikzset{logic ports draw input leads/.is choice}
+\ctikzset{logic ports draw input leads/true/.code={\pgfcirc at draw@leadstrue}}
+\ctikzset{logic ports draw input leads/false/.code={\pgfcirc at draw@leadsfalse}}
+\tikzset{input leads/.code={\pgfcirc at draw@leadstrue}}
+\tikzset{no input leads/.code={\pgfcirc at draw@leadsfalse}}
+
+\ctikzset{tripoles/american and port/width/.initial=1.1}
+\ctikzset{tripoles/american and port/height/.initial=.8}
+\ctikzset{tripoles/american and port/port width/.initial=.7}
+\ctikzset{tripoles/american and port/input height/.initial=.5}
+\ctikzset{tripoles/american nand port/width/.initial=1.1}
+\ctikzset{tripoles/american nand port/height/.initial=.8}
+\ctikzset{tripoles/american nand port/port width/.initial=.7}
+\ctikzset{tripoles/american nand port/circle width/.initial=.15}
+\ctikzset{tripoles/american nand port/input height/.initial=.5}
+\ctikzset{tripoles/american or port/width/.initial=1.1}
+\ctikzset{tripoles/american or port/height/.initial=.8}
+\ctikzset{tripoles/american or port/port width/.initial=.7}
+\ctikzset{tripoles/american or port/input height/.initial=.5}
+\ctikzset{tripoles/american or port/input skip/.initial=.25}
+\ctikzset{tripoles/american or port/aaa/.initial=.6}
+\ctikzset{tripoles/american or port/bbb/.initial=.4}
+\ctikzset{tripoles/american or port/ccc/.initial=.5}
+\ctikzset{tripoles/american or port/ddd/.initial=.0}
+\ctikzset{tripoles/american nor port/width/.initial=1.1}
+\ctikzset{tripoles/american nor port/height/.initial=.8}
+\ctikzset{tripoles/american nor port/port width/.initial=.7}
+\ctikzset{tripoles/american nor port/input height/.initial=.5}
+\ctikzset{tripoles/american nor port/input skip/.initial=.25}
+\ctikzset{tripoles/american nor port/circle width/.initial=.15}
+\ctikzset{tripoles/american nor port/aaa/.initial=.6}
+\ctikzset{tripoles/american nor port/bbb/.initial=.4}
+\ctikzset{tripoles/american nor port/ccc/.initial=.5}
+\ctikzset{tripoles/american nor port/ddd/.initial=.0}
+\ctikzset{tripoles/american xor port/width/.initial=1.1}
+\ctikzset{tripoles/american xor port/height/.initial=.8}
+\ctikzset{tripoles/american xor port/port width/.initial=.7}
+\ctikzset{tripoles/american xor port/input height/.initial=.5}
+\ctikzset{tripoles/american xor port/input skip/.initial=.15}
+\ctikzset{tripoles/american xor port/distance/.initial=.1}
+\ctikzset{tripoles/american xnor port/width/.initial=1.1}
+\ctikzset{tripoles/american xnor port/height/.initial=.8}
+\ctikzset{tripoles/american xnor port/port width/.initial=.7}
+\ctikzset{tripoles/american xnor port/input height/.initial=.5}
+\ctikzset{tripoles/american xnor port/input skip/.initial=.15}
+\ctikzset{tripoles/american xnor port/distance/.initial=.1}
+\ctikzset{tripoles/american xnor port/circle width/.initial=.15}
+\ctikzset{tripoles/american and port/origin/.initial=0.8}
+\ctikzset{tripoles/american and port/inputs/.initial=2}
+% variable number of inputs
+\ctikzset{tripoles/american nand port/origin/.initial=0.8}
+\ctikzset{tripoles/american nand port/inputs/.initial=2}
+\ctikzset{tripoles/american nor port/origin/.initial=0.8}
+\ctikzset{tripoles/american nor port/inputs/.initial=2}
+\ctikzset{tripoles/american nor port/angle/.initial=70}
+\ctikzset{tripoles/american nor port/inner/.initial=0.3}
+\ctikzset{tripoles/american or port/origin/.initial=0.8}
+\ctikzset{tripoles/american or port/inputs/.initial=2}
+\ctikzset{tripoles/american or port/angle/.initial=70}
+\ctikzset{tripoles/american or port/inner/.initial=0.3}
+\ctikzset{tripoles/american xor port/origin/.initial=0.8}
+\ctikzset{tripoles/american xor port/inputs/.initial=2}
+\ctikzset{tripoles/american xor port/angle/.initial=70}
+\ctikzset{tripoles/american xor port/inner/.initial=0.3}
+\ctikzset{tripoles/american xnor port/origin/.initial=0.8}
+\ctikzset{tripoles/american xnor port/inputs/.initial=2}
+\ctikzset{tripoles/american xnor port/angle/.initial=70}
+\ctikzset{tripoles/american xnor port/inner/.initial=0.3}
+
+\ctikzset{tripoles/european and port/width/.initial=1.4}
+\ctikzset{tripoles/european and port/height/.initial=.65}
+\ctikzset{tripoles/european and port/reserved/.initial=.6}
+\ctikzset{tripoles/european and port/input height/.initial=.6}
+\ctikzset{tripoles/european or port/width/.initial=1.4}
+\ctikzset{tripoles/european or port/height/.initial=.65}
+\ctikzset{tripoles/european or port/reserved/.initial=.6}
+\ctikzset{tripoles/european or port/input height/.initial=.6}
+\ctikzset{tripoles/european xor port/width/.initial=1.4}
+\ctikzset{tripoles/european xor port/height/.initial=.65}
+\ctikzset{tripoles/european xor port/reserved/.initial=.6}
+\ctikzset{tripoles/european xor port/input height/.initial=.6}
+\ctikzset{tripoles/european nand port/width/.initial=1.4}
+\ctikzset{tripoles/european nand port/not height/.initial=.3}
+\ctikzset{tripoles/european nand port/not width/.initial=.8}
+\ctikzset{tripoles/european nand port/height/.initial=.65}
+\ctikzset{tripoles/european nand port/reserved/.initial=.6}
+\ctikzset{tripoles/european nand port/input height/.initial=.6}
+\ctikzset{tripoles/european buffer port/width/.initial=1.4}
+\ctikzset{tripoles/european buffer port/not height/.initial=.3}
+\ctikzset{tripoles/european buffer port/not width/.initial=.8}
+\ctikzset{tripoles/european buffer port/height/.initial=.65}
+\ctikzset{tripoles/european buffer port/reserved/.initial=.6}
+\ctikzset{tripoles/european buffer port/input height/.initial=0}
+\ctikzset{tripoles/european not port/width/.initial=1.4}
+\ctikzset{tripoles/european not port/not height/.initial=.3}
+\ctikzset{tripoles/european not port/not width/.initial=.8}
+\ctikzset{tripoles/european not port/height/.initial=.65}
+\ctikzset{tripoles/european not port/reserved/.initial=.6}
+\ctikzset{tripoles/european not port/input height/.initial=0}
+\ctikzset{tripoles/european xnor port/width/.initial=1.4}
+\ctikzset{tripoles/european xnor port/not height/.initial=.3}
+\ctikzset{tripoles/european xnor port/not width/.initial=.8}
+\ctikzset{tripoles/european xnor port/height/.initial=.65}
+\ctikzset{tripoles/european xnor port/reserved/.initial=.6}
+\ctikzset{tripoles/european xnor port/input height/.initial=.6}
+\ctikzset{tripoles/european nor port/width/.initial=1.4}
+\ctikzset{tripoles/european nor port/not height/.initial=.3}
+\ctikzset{tripoles/european nor port/not width/.initial=.8}
+\ctikzset{tripoles/european nor port/height/.initial=.65}
+\ctikzset{tripoles/european nor port/reserved/.initial=.6}
+\ctikzset{tripoles/european nor port/input height/.initial=.6}
+% variable number of inputs
+\ctikzset{tripoles/european and port/origin/.initial=0.8}
+\ctikzset{tripoles/european and port/inputs/.initial=2}
+\ctikzset{tripoles/european nand port/origin/.initial=0.8}
+\ctikzset{tripoles/european nand port/inputs/.initial=2}
+\ctikzset{tripoles/european or port/origin/.initial=0.8}
+\ctikzset{tripoles/european or port/inputs/.initial=2}
+\ctikzset{tripoles/european nor port/origin/.initial=0.8}
+\ctikzset{tripoles/european nor port/inputs/.initial=2}
+\ctikzset{tripoles/european xor port/origin/.initial=0.8}
+\ctikzset{tripoles/european xor port/inputs/.initial=2}
+\ctikzset{tripoles/european xnor port/origin/.initial=0.8}
+\ctikzset{tripoles/european xnor port/inputs/.initial=2}
+\ctikzset{tripoles/european buffer port/origin/.initial=0.8}
+\ctikzset{tripoles/european buffer port/inputs/.initial=1}%
+\ctikzset{tripoles/european not port/origin/.initial=0.8}
+\ctikzset{tripoles/european not port/inputs/.initial=1}%
+%%% parameters that are not used anymore after multi-input
+%%% gates --- left for compatibility of source code.
+\ctikzset{tripoles/american xor port/aaa/.initial=.6}
+\ctikzset{tripoles/american xor port/bbb/.initial=.4}
+\ctikzset{tripoles/american xor port/ccc/.initial=.5}
+\ctikzset{tripoles/american xor port/ddd/.initial=.0}
+\ctikzset{tripoles/american xnor port/aaa/.initial=.6}
+\ctikzset{tripoles/american xnor port/bbb/.initial=.4}
+\ctikzset{tripoles/american xnor port/ccc/.initial=.5}
+\ctikzset{tripoles/american xnor port/ddd/.initial=.0}
+% switches for logic gates
+%
+\pgfkeys{/tikz/number inputs/.initial=0}
+\pgfkeys{/tikz/number inputs/.default=0}
+
+%% flip-flop specific keys (most others are the same as chips)
+
+\ctikzset{multipoles/flipflop/font/.initial=\pgf at circ@font at small}
+\ctikzset{multipoles/flipflop/fontud/.initial=\pgf at circ@font at tiny}
+\ctikzset{multipoles/flipflop/width/.initial=1.2}
+\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
+\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
+
+%% muxdemuxes keys
+
+\ctikzset{multipoles/muxdemux/base len/.initial=0.4}
+\ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
+\ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
+\ctikzset{multipoles/muxdemux/w/.initial=3.0}
+\ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
+\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
+\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
+\ctikzset{multipoles/muxdemux/NL/.initial=8}
+\ctikzset{multipoles/muxdemux/NR/.initial=1}
+\ctikzset{multipoles/muxdemux/NB/.initial=3}
+\ctikzset{multipoles/muxdemux/NT/.initial=0}
+\ctikzset{multipoles/muxdemux/square pins/.initial=0}
+%
+% switches for op amps
+% changing input polarity
+%
+\newif\ifpgf at circuit@oa at iplusup\pgf at circuit@oa at iplusupfalse
+\pgfkeys{/tikz/noinv input up/.add code={}{\pgf at circuit@oa at iplusuptrue}}
+\ctikzset{noinv input up/.add code={}{\pgf at circuit@oa at iplusuptrue}}
+\pgfkeys{/tikz/noinv input down/.add code={}{\pgf at circuit@oa at iplusupfalse}}
+\ctikzset{noinv input down/.add code={}{\pgf at circuit@oa at iplusupfalse}}
+%
+% changing output polarity (for fully diff objects)
+%
+\newif\ifpgf at circuit@oa at oplusup\pgf at circuit@oa at oplusuptrue
+\pgfkeys{/tikz/noinv output up/.add code={}{\pgf at circuit@oa at oplusuptrue}}
+\ctikzset{noinv output up/.add code={}{\pgf at circuit@oa at oplusuptrue}}
+\pgfkeys{/tikz/noinv output down/.add code={}{\pgf at circuit@oa at oplusupfalse}}
+\ctikzset{noinv output down/.add code={}{\pgf at circuit@oa at oplusupfalse}}
+
+% Operational amplifier
+\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
+\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
+\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
+\ctikzset{tripoles/op amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Fully differential operational amplifier
+\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
+\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
+\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
+\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
+\ctikzset{tripoles/fd op amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+\ctikzset{tripoles/en amp/width/.initial=1.7}
+\ctikzset{tripoles/en amp/port width/.initial=.7}
+\ctikzset{tripoles/en amp/height/.initial=1.6}
+\ctikzset{tripoles/en amp/input height/.initial=.3}
+\ctikzset{tripoles/en amp/up pos/.initial=.45}
+\ctikzset{tripoles/en amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+\ctikzset{tripoles/en amp/font2/.initial=\pgf at circ@font at twelve} % Absolute font size needed!
+\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
+\tikzset{
+ en amp text/.code = {%
+ \ctikzsetvalof{tripoles/en amp/text}{#1}%
+ },
+ en amp text A/.code = {%
+ \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
+ },
+}
+
+% Transconductance amplifier
+\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
+\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
+\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
+\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
+\ctikzset{tripoles/gm amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Instrumentation amplifier
+\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
+\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
+\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
+\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
+\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
+\ctikzset{tripoles/inst amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Instrumentation amplifier with differential output
+\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
+\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
+\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
+\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
+\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
+\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
+\ctikzset{tripoles/fd inst amp/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Instrumentation amplifier with gain resistor terminals
+\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
+\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
+\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
+\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
+\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
+\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
+\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
+\ctikzset{tripoles/inst amp ra/font/.initial=\pgf at circ@font at tenbm} % Absolute font size needed!
+
+% Plain amplifier
+\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
+\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
+\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
+\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
+\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
+
+% changing fonts and symbols of amplifiers
+\ctikzset{amplifiers/symbol font/.code={%
+ \ctikzset{tripoles/inst amp ra/font=#1}%
+ \ctikzset{tripoles/fd inst amp/font=#1}%
+ \ctikzset{tripoles/inst amp/font=#1}%
+ \ctikzset{tripoles/gm amp/font=#1}%
+ \ctikzset{tripoles/en amp/font=#1}%
+ \ctikzset{tripoles/fd op amp/font=#1}%
+ \ctikzset{tripoles/op amp/font=#1}%
+}}
+\ctikzset{amplifiers/plus/.initial={$+$}}
+\ctikzset{amplifiers/minus/.initial={$-$}}
+\tikzset{amp symbol font/.code={%
+ \ctikzset{amplifiers/symbol font={#1}}%
+ }
+}
+\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
+\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
+\def\pgf at circ@ampli at plus{\ctikzvalof{amplifiers/plus}}
+\def\pgf at circ@ampli at minus{\ctikzvalof{amplifiers/minus}}
+
+\ctikzset{tripoles/thyristor/height/.initial=1.10}
+\ctikzset{tripoles/thyristor/height 2/.initial=.5}
+\ctikzset{tripoles/thyristor/width/.initial=1.0}
+\ctikzset{tripoles/thyristor/diode height/.initial=.5}
+\ctikzset{tripoles/thyristor/diode width left/.initial=.4}
+\ctikzset{tripoles/thyristor/diode width right/.initial=.3}
+
+\ctikzset{tripoles/triac/height/.initial=1.1}
+\ctikzset{tripoles/triac/width/.initial=1}
+\ctikzset{tripoles/triac/diode width left/.initial=.3}
+\ctikzset{tripoles/triac/diode width right/.initial=.3}
+
+%% Cute switches
+\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
+\ctikzset{bipoles/cuteswitch/height/.initial=.6}
+\ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
+\ctikzset{bipoles/cuteswitch/width/.initial=.50}
+\ctikzset{bipoles/cuteswitch/thickness/.initial=1}
+
+\ctikzset{tripoles/spdt/width/.initial=.85}
+\ctikzset{tripoles/spdt/height/.initial=.45}
+\ctikzset{tripoles/spdt/margin/.initial=.45}
+
+\ctikzset{tripoles/toggleswitch/height/.initial=.8}
+\ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
+\ctikzset{tripoles/toggleswitch/width/.initial=.80}
+
+\ctikzset{tripoles/mixer/width/.initial=0.7}
+\ctikzset{tripoles/adder/width/.initial=0.7}
+\ctikzset{tripoles/circulator/width/.initial=.7}
+\ctikzset{tripoles/oscillator/width/.initial=.7}
+
+
+\ctikzset{tripoles/wilkinson/height/.initial=1.3}
+\ctikzset{tripoles/wilkinson/width/.initial=1.3}
+
+\ctikzset{quadpoles/transformer/inner/.initial=0.4}
+\ctikzset{quadpoles/transformer/width/.initial=1.5}
+\ctikzset{quadpoles/transformer/width1/.initial=.4}
+\ctikzset{quadpoles/transformer/height/.initial=1.5}
+\ctikzset{quadpoles/transformer/height1/.initial=.8}
+\ctikzset{quadpoles/transformer core/inner/.initial=0.4}
+\ctikzset{quadpoles/transformer core/width/.initial=1.5}
+\ctikzset{quadpoles/transformer core/height/.initial=1.5}
+\ctikzset{quadpoles/transformer core/core height/.initial=.5}
+\ctikzset{quadpoles/transformer core/core width/.initial=.05}
+\ctikzset{quadpoles/gyrator/inner/.initial=0.4}
+\ctikzset{quadpoles/gyrator/width/.initial=1.5}
+\ctikzset{quadpoles/gyrator/height/.initial=1.5}
+\ctikzset{quadpoles/fourport/width/.initial=1.3}
+\ctikzset{quadpoles/fourport/height/.initial=1.3}
+\ctikzset{quadpoles/coupler/width/.initial=1.3}
+\ctikzset{quadpoles/coupler/height/.initial=1.3}
+\ctikzset{quadpoles/coupler2/width/.initial=1.3}
+\ctikzset{quadpoles/coupler2/height/.initial=1.3}
+
+\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
+
+\ctikzset{quadpoles style/.is choice}
+\ctikzset{quadpoles style/inward/.code={% default value
+ \ctikzset{quadpoles/transformer/inner=0.4}%
+ \ctikzset{quadpoles/transformer/width=1.5}%
+ \ctikzset{quadpoles/transformer core/inner=0.4}%
+ \ctikzset{quadpoles/transformer core/width=1.5}%
+ \ctikzset{quadpoles/gyrator/inner=0.4}%
+ \ctikzset{quadpoles/gyrator/width=1.5}%
+ }%
+}
+\ctikzset{quadpoles style/inline/.code={% now horizontal baffle
+ \ctikzset{quadpoles/transformer/inner=1}%
+ \ctikzset{quadpoles/transformer/width=0.6}%
+ \ctikzset{quadpoles/transformer core/inner=1}%
+ \ctikzset{quadpoles/transformer core/width=0.6}%
+ \ctikzset{quadpoles/gyrator/inner=1} % FIXME
+ \ctikzset{quadpoles/gyrator/width=0.6}%
+ }%
+}
+
+%
+% multipoles
+%
+\ctikzset{multipoles/thickness/.initial=2}
+\ctikzset{multipoles/font/.initial=\pgf at circ@font at tiny}
+% DIP (dual in line package) chips
+\ctikzset{multipoles/dipchip/width/.initial=1.2}
+\ctikzset{multipoles/dipchip/num pins/.initial=8}
+\ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
+\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
+% QFP (quad flat package) chips
+\ctikzset{multipoles/qfpchip/num pins/.initial=8}
+\ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
+\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
+% chip numbers
+\newif\ifpgf at circuit@chip at shownumbers\pgf at circuit@chip at shownumberstrue
+\pgfkeys{/tikz/show numbers/.add code={}{\pgf at circuit@chip at shownumberstrue}}
+\ctikzset{show numbers/.add code={}{\pgf at circuit@chip at shownumberstrue}}
+\pgfkeys{/tikz/hide numbers/.add code={}{\pgf at circuit@chip at shownumbersfalse}}
+\ctikzset{hide numbers/.add code={}{\pgf at circuit@chip at shownumbersfalse}}
+\newif\ifpgf at circuit@chip at straightnumbers\pgf at circuit@chip at straightnumberstrue
+\pgfkeys{/tikz/straight numbers/.add code={}{\pgf at circuit@chip at straightnumberstrue}}
+\ctikzset{straight numbers/.add code={}{\pgf at circuit@chip at straightnumberstrue}}
+\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf at circuit@chip at straightnumbersfalse}}
+\ctikzset{rotated numbers/.add code={}{\pgf at circuit@chip at straightnumbersfalse}}
+% external chip pins
+\ctikzset{multipoles/external pins thickness/.initial=1}
+\ctikzset{multipoles/external pins width/.initial=0.2}
+\ctikzset{multipoles/external pad fraction/.initial=0}
+\pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
+\pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
+% topmarks
+\newif\ifpgf at circuit@chip at topmark\pgf at circuit@chip at topmarktrue
+\pgfkeys{/tikz/topmark/.add code={}{\pgf at circuit@chip at topmarktrue}}
+\ctikzset{topmark/.add code={}{\pgf at circuit@chip at topmarktrue}}
+\pgfkeys{/tikz/no topmark/.add code={}{\pgf at circuit@chip at topmarkfalse}}
+\ctikzset{no topmark/.add code={}{\pgf at circuit@chip at topmarkfalse}}
+
+% rotary switch by Romano
+\ctikzset{multipoles/rotary/thickness/.initial=1}
+\ctikzset{multipoles/rotary/shape/.initial=ocirc}
+\ctikzset{multipoles/rotary/channels/.initial=5}
+\ctikzset{multipoles/rotary/angle/.initial=60}
+\ctikzset{multipoles/rotary/wiper/.initial=20}
+\ctikzset{multipoles/rotary/arrow/.is choice}
+\newif\ifpgf at circ@rotaryarrow\pgf at circ@rotaryarrowfalse
+\newif\ifpgf at circ@rotaryarrow at cw\pgf at circ@rotaryarrow at cwfalse
+\newif\ifpgf at circ@rotaryarrow at ccw\pgf at circ@rotaryarrow at ccwfalse
+\ctikzset{multipoles/rotary/arrow/none/.code={\pgf at circ@rotaryarrowfalse\pgf at circ@rotaryarrow at cwfalse\pgf at circ@rotaryarrow at ccwfalse}}
+\ctikzset{multipoles/rotary/arrow/both/.code={\pgf at circ@rotaryarrowtrue\pgf at circ@rotaryarrow at cwtrue\pgf at circ@rotaryarrow at ccwtrue}}
+\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf at circ@rotaryarrowtrue\pgf at circ@rotaryarrow at cwtrue\pgf at circ@rotaryarrow at ccwfalse}}
+\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf at circ@rotaryarrowtrue\pgf at circ@rotaryarrow at cwfalse\pgf at circ@rotaryarrow at ccwtrue}}
+
+\tikzset{%
+ rotary switch/.style args={#1in#2wiper#3}{%
+ shape=rotaryswitch,
+ /tikz/circuitikz/multipoles/rotary/channels=#1,
+ /tikz/circuitikz/multipoles/rotary/angle=#2,
+ /tikz/circuitikz/multipoles/rotary/wiper=#3,
+ },
+ rotary switch -/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=none,
+ },
+ rotary switch <-/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=ccw,
+ },
+ rotary switch ->/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=cw,
+ },
+ rotary switch <->/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=both,
+ },
+ % Notice that these should be the same as the initial values of the keys
+ rotary switch/.default={5 in 60 wiper 20},
+ rotary switch -/.default={5 in 60 wiper 20},
+ rotary switch <-/.default={5 in 60 wiper 20},
+ rotary switch ->/.default={5 in 60 wiper 20},
+ rotary switch <->/.default={5 in 60 wiper 20},
+}
+
+% %Mechanical section
+\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
+\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
+\ctikzset{bipoles/spring/height/.initial=.5}
+\ctikzset{bipoles/spring/width/.initial=.5}
+\ctikzset{bipoles/inerter/height/.initial=.7}
+\ctikzset{bipoles/inerter/width/.initial=.175}
+\ctikzset{bipoles/mass/height/.initial=.55}
+\ctikzset{bipoles/mass/box height/.initial=.4}
+\ctikzset{bipoles/mass/width/.initial=.5}
+
+\ctikzset{bipoles/damper/height/.initial=.35}
+\ctikzset{bipoles/damper/length/.initial=.3}
+\ctikzset{bipoles/damper/width/.initial=.4}
+
+
+\ctikzset{bipole/.is family}
+\ctikzset{bipole/kind/.initial=}
+\ctikzset{bipole/name/.initial=}
+\newif\ifpgf at circuit@bipole at isvoltage
+\ctikzset{bipole/is voltage/.is if=pgf at circuit@bipole at isvoltage}
+\newif\ifpgf at circuit@bipole at voltageoutsideofsymbol
+\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf at circuit@bipole at voltageoutsideofsymbol}
+\newif\ifpgf at circuit@bipole at strokedsymbol
+\ctikzset{bipole/is strokedsymbol/.is if=pgf at circuit@bipole at strokedsymbol}
+\newif\ifpgf at circuit@bipole at iscurrent
+\ctikzset{bipole/is current/.is if=pgf at circuit@bipole at iscurrent}
+
+\ctikzset{bipole/voltage/.is family}
+\newif\ifpgf at circuit@bipole at voltage@backward
+\ctikzset{bipole/voltage/direction/.is choice}
+\ctikzset{bipole/voltage/direction/forward/.code={\pgf at circuit@bipole at voltage@backwardfalse}}
+\ctikzset{bipole/voltage/direction/backward/.code={\pgf at circuit@bipole at voltage@backwardtrue}}
+\newif\ifpgf at circuit@bipole at voltage@below
+\ctikzset{bipole/voltage/position/.is choice}
+\ctikzset{bipole/voltage/position/above/.code={\pgf at circuit@bipole at voltage@belowfalse}}
+\ctikzset{bipole/voltage/position/below/.code={\pgf at circuit@bipole at voltage@belowtrue}}
+
+\ctikzset{bipole/voltage/label/unit/.initial=}
+\ctikzset{bipole/voltage/label/name/.initial=}
+
+\ctikzset{bipole/current/.is family}
+\newif\ifpgf at circuit@bipole at current@backward
+\ctikzset{bipole/current/direction/.is choice}
+\ctikzset{bipole/current/direction/forward/.code={\pgf at circuit@bipole at current@backwardfalse}}
+\ctikzset{bipole/current/direction/backward/.code={\pgf at circuit@bipole at current@backwardtrue}}
+\newif\ifpgf at circuit@bipole at current@before
+\ctikzset{bipole/current/x position/.is choice}
+\ctikzset{bipole/current/x position/after/.code={\pgf at circuit@bipole at current@beforefalse}}
+\ctikzset{bipole/current/x position/before/.code={\pgf at circuit@bipole at current@beforetrue}}
+\newif\ifpgf at circuit@bipole at current@below
+\ctikzset{bipole/current/y position/.is choice}
+\ctikzset{bipole/current/y position/above/.code={\pgf at circuit@bipole at current@belowfalse}}
+\ctikzset{bipole/current/y position/below/.code={\pgf at circuit@bipole at current@belowtrue}}
+\ctikzset{bipole/current/label/unit/.initial=}
+\ctikzset{bipole/current/label/name/.initial=}
+
+\ctikzset{bipole/flow/.is family}
+\newif\ifpgf at circuit@bipole at flow@backward
+\ctikzset{bipole/flow/direction/.is choice}
+\ctikzset{bipole/flow/direction/forward/.code={\pgf at circuit@bipole at flow@backwardfalse}}
+\ctikzset{bipole/flow/direction/backward/.code={\pgf at circuit@bipole at flow@backwardtrue}}
+\newif\ifpgf at circuit@bipole at flow@before
+\ctikzset{bipole/flow/x position/.is choice}
+\ctikzset{bipole/flow/x position/after/.code={\pgf at circuit@bipole at flow@beforefalse}}
+\ctikzset{bipole/flow/x position/before/.code={\pgf at circuit@bipole at flow@beforetrue}}
+\newif\ifpgf at circuit@bipole at flow@below
+\ctikzset{bipole/flow/y position/.is choice}
+\ctikzset{bipole/flow/y position/above/.code={\pgf at circuit@bipole at flow@belowfalse}}
+\ctikzset{bipole/flow/y position/below/.code={\pgf at circuit@bipole at flow@belowtrue}}
+\ctikzset{bipole/flow/label/unit/.initial=}
+\ctikzset{bipole/flow/label/name/.initial=}
+\ctikzset{flow/distance/.initial = .5}
+\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
+
+\ctikzset{bipole/label/.is family}
+\ctikzset{bipole/label/position/.initial=90}
+\ctikzset{bipole/label/unit/.initial=}
+\ctikzset{bipole/label/name/.initial=}
+\ctikzset{bipole/annotation/.is family}
+\ctikzset{bipole/annotation/position/.initial=-90}
+\ctikzset{bipole/annotation/unit/.initial=}
+\ctikzset{bipole/annotation/name/.initial=}
+
+\newif\ifpgf at circuit@europeanresistor
+\ctikzset{resistor/.is choice}
+\ctikzset{resistor/american/.code = \pgf at circuit@europeanresistorfalse }
+\ctikzset{resistor/european/.code = \pgf at circuit@europeanresistortrue }
+
+\ctikzset{inductor/.is choice}
+\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
+\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
+\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
+
+%
+% Flipping arrows in LED and photodiodes
+%
+\newif\ifpgf at led@fliparrows
+\newif\ifpgf at pd@fliparrows
+\pgf at led@fliparrowsfalse
+\pgf at pd@fliparrowsfalse
+%
+% by default the arrows start (LED) and go (PD) to the anode.
+%
+\ctikzset{led arrows from anode/.code=\pgf at led@fliparrowsfalse}
+\ctikzset{pd arrows to anode/.code=\pgf at pd@fliparrowsfalse}
+%
+% but they can start form the cathode (LED) or go to it (PD)
+%
+\ctikzset{led arrows from cathode/.code=\pgf at led@fliparrowstrue}
+\ctikzset{pd arrows to cathode/.code=\pgf at pd@fliparrowstrue}
+
+\newif\ifpgf at circuit@strokediode
+\newif\ifpgf at circuit@fulldiode
+\pgf at circuit@strokediodefalse
+\pgf at circuit@fulldiodefalse
+
+\ctikzset{diode/.is choice}
+\ctikzset{diode/empty/.code = \pgf at circuit@fulldiodefalse\pgf at circuit@strokediodefalse}%default
+\ctikzset{diode/full/.code = \pgf at circuit@fulldiodetrue }
+\ctikzset{diode/stroke/.code = \pgf at circuit@strokediodetrue}
+
+\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
+\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
+\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
+
+\ctikzset{thickness/.initial=2}
+\ctikzset{color/.initial=black}
+\pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
+
+\newif\ifpgf at circ@siunitx
+\newif\ifpgf at circ@siunitx at res
+
+%
+% voltage and current options
+%
+
+\newif\ifpgf at circuit@europeancurrent
+\newif\ifpgf at circuit@europeanvoltage
+\newif\ifpgf at circuit@bipole at voltage@straight
+
+\ctikzset{voltage/.is choice}
+%
+% straight is expected to be a subset of european, so disable it in american style
+%
+\ctikzset{voltage/american/.code = {\pgf at circuit@europeanvoltagefalse\pgf at circuit@bipole at voltage@straightfalse}}
+\ctikzset{voltage/european/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straightfalse}}
+\ctikzset{voltage/straight/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straighttrue}}
+\ctikzset{voltage/curved/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straighttrue}}
+
+\ctikzset{current/.is choice}
+\ctikzset{current/american/.code = \pgf at circuit@europeancurrentfalse}
+\ctikzset{current/european/.code = \pgf at circuit@europeancurrenttrue}
+
+% this is left for backward compatibility...
+\ctikzset{straight/.is choice}
+\ctikzset{straight/true/.code = {\pgf at circuit@bipole at voltage@straighttrue}}
+\ctikzset{straight/false/.code = {\pgf at circuit@bipole at voltage@straightfalse}}
+\ctikzset{bipole/straight/.is if=pgf at circuit@bipole at voltage@straight}
+% never used, removed (RG 2020-05-17)
+% \ctikzset{straightvoltage value/.initial=true}
+% \ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}}
+
+%
+% voltage is used also to set parameters, apart for the /.is choice
+% above. I hope it is ok --- would be a mess otherwise
+%
+
+\ctikzset{voltage/distance from node/.initial=.5} %\pgf at circ@Rlen units
+\ctikzset{voltage/distance from line/.initial=.08} % pos, tra 0 e 1
+\ctikzset{voltage/bump a/.initial=1.2}
+\ctikzset{voltage/bump b/.initial=1.5}
+\ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
+\ctikzset{voltage shift/.style={voltage/shift=#1}}
+\tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
+\ctikzset{voltage/european label distance/.initial=1.4}
+\ctikzset{voltage/american label distance/.initial=1.1}
+% shaping the +/- sign, see pgfcircvoltage.tex
+\ctikzset{voltage/american font/.initial={}}
+\ctikzset{voltage/american plus/.initial={$+$}}
+\ctikzset{voltage/american minus/.initial={$-$}}
+
+% special cases for voltage positions
+\ctikzset{bipoles/generic/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/generic/voltage/bump b/.initial=2}
+\ctikzset{bipoles/generic/voltage/european label distance/.initial=1.8}
+%\ctikzset{bipoles/thermocouple/voltage/distance from node/.initial=.3}
+\ctikzset{bipoles/thermocouple/voltage/bump b/.initial=2.2}
+\ctikzset{bipoles/thermocouple/voltage/european label distance/.initial=1.5}
+\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
+\ctikzset{bipoles/ageneric/voltage/european label distance/.initial=1.8}
+\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
+\ctikzset{bipoles/fullgeneric/voltage/european label distance/.initial=1.8}
+\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
+\ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
+\ctikzset{bipoles/memristor/voltage/european label distance/.initial=1.8}
+%\ctikzset{bipoles/tline/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
+\ctikzset{bipoles/tline/voltage/european label distance/.initial=2.1}
+%\ctikzset{bipoles/varistor/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
+\ctikzset{bipoles/varistor/voltage/european label distance/.initial=2}
+%\ctikzset{bipoles/photoresistor/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=2}
+\ctikzset{bipoles/photoresistor/voltage/european label distance/.initial=1.8}
+%\ctikzset{bipoles/thermistor/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
+\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=2}
+%\ctikzset{bipoles/thermistorntc/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
+%\ctikzset{bipoles/thermistorptc/voltage/distance from node/.initial=.2}
+\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
+%
+% american open voltage adjusting
+%
+\newif\ifpgf at adjust@open at voltage\pgf at adjust@open at voltagetrue
+\ctikzset{american open voltage/.is choice}
+\ctikzset{american open voltage/center/.code={\pgf at adjust@open at voltagetrue}}
+\ctikzset{american open voltage/legacy/.code={\pgf at adjust@open at voltagefalse}}
+
+%
+% currents
+%
+\ctikzset{current/distance/.initial = .5}
+
+%
+% voltage and current styles
+%
+
+\tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
+\tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
+\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
+\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
+\tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
+\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
+\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
+
+\newif\ifpgf at circuit@europeangfsurgearrester
+\ctikzset{gas filled surge arrester choice/.is choice}
+\ctikzset{gas filled surge arrester choice/european/.code= {\pgf at circuit@europeangfsurgearrestertrue}}
+\ctikzset{gas filled surge arrester choice/american/.code= {\pgf at circuit@europeangfsurgearresterfalse}}
+
+\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
+\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
+\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
+\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
+\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
+\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
+\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
+
+%
+% general styles
+%
+
+\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
+\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
+\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
+
+
+% noise sources
+\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
+
+\ctikzset{label/align/.is choice}
+\ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
+\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
+\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
+
+% seven segment displays by RGtti
+
+\newif\ifpgf at circ@sevenseg at dot
+\newif\ifpgf at circ@sevenseg at box
+\def\pgf at circ@sevenseg at dotstate{empty}
+\ctikzset{seven seg/.is family}
+\ctikzset{seven seg/dot/.is choice}
+% none means no dot, not space for it. Empty means no dot, but space
+\ctikzset{seven seg/dot/none/.code={\pgf at circ@sevenseg at dotfalse}}
+\ctikzset{seven seg/dot/empty/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{empty}}}
+\ctikzset{seven seg/dot/off/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{off}}}
+\ctikzset{seven seg/dot/on/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{on}}}
+%
+\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf at circ@Rlen
+\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
+\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
+\ctikzset{seven seg/box sep/.initial=1pt}% external box gap
+\ctikzset{seven seg/color on/.initial=red}% color for segment "on"
+\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
+\ctikzset{seven seg/box/.is choice}
+\ctikzset{seven seg/box/off/.code={\pgf at circ@sevenseg at boxfalse}}
+\ctikzset{seven seg/box/on/.code={\pgf at circ@sevenseg at boxtrue}}
+
+\ctikzset{seven seg/bits/.initial=0000000}
+
+\ctikzset{seven seg/value/.code={%
+ \edef\@@tmp{#1}%
+ \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
+ \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
+ \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
+ \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
+ \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
+ \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
+ \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
+ \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
+ \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
+ \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
+ \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
+}}
+
+\tikzset{%
+ seven segment val/.style args={#1dot#2box#3}{%
+ shape=bare7seg,
+ /tikz/circuitikz/seven seg/value=#1,
+ /tikz/circuitikz/seven seg/dot=#2,
+ /tikz/circuitikz/seven seg/box=#3,
+ },
+ seven segment bits/.style args={#1dot#2box#3}{%
+ shape=bare7seg,
+ /tikz/circuitikz/seven seg/bits=#1,
+ /tikz/circuitikz/seven seg/dot=#2,
+ /tikz/circuitikz/seven seg/box=#3,
+ },
+}
+
+
+%%%%%%%%%% new
+\pgfkeys{\circuitikzbasekey/.search also={/tikz}}
+
+% Electronic tubes: diodetube, triode, tetrode and pentode
+\ctikzset{tubes/width/.initial=1} % relative width
+\ctikzset{tubes/height/.initial=1.4} % relative height
+\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
+\ctikzset{tubes/anode distance/.initial=0.40} % distance from center
+\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
+\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
+\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
+\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
+\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
+\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
+\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
+\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
+\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
+\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
+\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
+
+\newif\ifpgf at circuit@tubes at filament\pgf at circuit@tubes at filamentfalse
+\pgfkeys{/tikz/filament/.add code={}{\pgf at circuit@tubes at filamenttrue}}
+\ctikzset{tubes/filament/.add code={}{\pgf at circuit@tubes at filamenttrue}}
+\newif\ifpgf at circuit@tubes at nocathode\pgf at circuit@tubes at nocathodefalse
+\pgfkeys{/tikz/nocathode/.add code={}{\pgf at circuit@tubes at nocathodetrue}}
+\ctikzset{tubes/nocathode/.add code={}{\pgf at circuit@tubes at nocathodetrue}}
+\newif\ifpgf at circuit@tubes at fullcathode\pgf at circuit@tubes at fullcathodefalse
+\pgfkeys{/tikz/fullcathode/.add code={}{\pgf at circuit@tubes at fullcathodetrue}}
+\ctikzset{tubes/fullcathode/.add code={}{\pgf at circuit@tubes at fullcathodetrue}}
+
+% powerelectronic blocks
+\ctikzset{bipoles/sacdc/width/.initial=.7}
+\ctikzset{bipoles/sdcac/width/.initial=.7}
+\ctikzset{bipoles/tacdc/width/.initial=.7}
+\ctikzset{bipoles/tdcac/width/.initial=.7}
+\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
+
+%%%---------- close: tex/pgfcirc.defines
+%%%%%%%%%%% Springe nach tex/pgfcircutils
+%%%---------- open: tex/pgfcircutils.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+\def\pgf at circ@handleSI#1{
+ \noexpandarg
+ \def\pgf at temp{}
+ \StrBetween{#1}{<}{>}[\pgf at circ@handleSI at unit]
+ \StrLen{\pgf at circ@handleSI at unit}[\pgf at circ@handleSI at unit@len]
+
+ \ifnum\pgf at circ@handleSI at unit@len=0
+ \pgf at circ@siunitx at resfalse
+ \else
+ \IfEndWith{#1}{>}{
+ \pgf at circ@siunitx at restrue
+ \noexpandarg
+ \StrBefore{#1}{<}[\pgf at circ@handleSI at val]
+ %\typeout{si |#1|}
+ }{
+ \pgf at circ@siunitx at resfalse
+ %\typeout{no si |#1|}
+ }
+\fi
+}
+
+\def\pgf at circ@ifkeyempty#1{
+ \pgfextra{
+ \ctikzset{#1/.get=\pgf at circ@temp}
+ \edef\pgf at temp{}
+ }
+ \ifx\pgf at circ@temp\pgf at temp
+ }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Math routines
+
+\def\pgf at circ@stripdecimals#1.#2\pgf at nil{#1}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% useful commands
+
+\ifpgfutil at format@is at latex
+ %% flipping text
+ \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
+ \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
+ \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
+ % text mode overbar
+ % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
+ \def\ctikztextnot#1{$\overline{\hbox{#1}}\m at th$}
+\else\ifpgfutil at format@is at plain
+ % text mode overbar
+ % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
+ \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
+\else\ifpgfutil at format@is at context
+ % text mode overbar
+ % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
+ \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
+\fi\fi\fi
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% switch to use fpu in reciprocal scale transformations
+%%
+%% this code has been contributed by Schrödinger's cat
+%% https://tex.stackexchange.com/a/529159/38080
+%%
+\tikzset{use fpu reciprocal/.code={%
+\def\pgfmathreciprocal@##1{%
+ \begingroup
+ \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
+ \pgfmathparse{1/##1}%
+ \pgfmath at smuggleone\pgfmathresult
+ \endgroup
+}}}%
+
+%%%---------- close: tex/pgfcircutils
+
+%%%%%%%%%%% Springe nach tex/pgfcircshapes
+%%%---------- open: tex/pgfcircshapes.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Other shapes
+
+%% Nothing
+
+\pgfdeclareshape{emptyshape}{
+ \savedanchor{\northeast}{%
+ \pgf at x=.5\wd\pgfnodeparttextbox%
+ \pgf at y=.5\ht\pgfnodeparttextbox%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+}
+%
+% Provision for changing opacity. Only expert use, see the manual.
+%
+\ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
+\tikzset{open poles opacity/.code={%
+ \ctikzset{poles/open fill opacity=#1}%
+}}
+\ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
+\tikzset{full poles opacity/.code={%
+ \ctikzset{poles/full fill opacity=#1}%
+}}
+
+%% Full terminal
+
+\pgfdeclareshape{circ}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \pgfpointborderellipse{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}
+ }{\pgfpoint{\ctikzvalof{nodes width}*\pgf at circ@Rlen}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}}
+ }
+ \behindforegroundpath{
+
+ \pgfscope
+ \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+
+ }
+}
+
+%% Empty round terminal
+
+\pgfdeclareshape{ocirc}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \pgfpointborderellipse{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}
+ }{\pgfpoint{\ctikzvalof{nodes width}*\pgf at circ@Rlen}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}}
+ }
+
+ \behindforegroundpath{
+
+ \pgfscope
+ \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifx\tikz at fillcolor\pgfutil at empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ % note that this element has no class, but will inherit it when used
+ % into another component
+ \pgf at circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \fi
+ \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+
+ }
+}
+
+%% Diamond terminal
+
+\pgfdeclareshape{diamondpole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ % \typeout{IN\space X:\the\pgf at x\space Y:\the\pgf at y}
+ \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf at x>0,1,-1)}
+ \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf at y>0,1,-1)}
+ \pgfmathsetlength{\pgf at xa}{abs(\pgf at x)}
+ \pgfmathsetlength{\pgf at ya}{abs(\pgf at y)}
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ % \typeout{MID\space X:\the\pgf at xa\space Y:\the\pgf at ya\space L:\the\pgf at circ@res at up}
+ % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
+ \pgfpointintersectionoflines
+ {\pgfpointorigin}{\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfqpoint{0pt}{\pgf at circ@res at up}}{\pgfqpoint{\pgf at circ@res at up}{0pt}}
+ % \typeout{CROSS \space X:\the\pgf at x\space Y:\the\pgf at y}
+ \pgf at x=\@@switchx\pgf at x
+ \pgf at y=\@@switchy\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgftransformrotate{45}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf at circ@res at temp}{-\pgf at circ@res at temp}}
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+%% Diamond terminal, unfilled
+
+\pgfdeclareshape{odiamondpole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ % \typeout{IN\space X:\the\pgf at x\space Y:\the\pgf at y}
+ \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf at x>0,1,-1)}
+ \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf at y>0,1,-1)}
+ \pgfmathsetlength{\pgf at xa}{abs(\pgf at x)}
+ \pgfmathsetlength{\pgf at ya}{abs(\pgf at y)}
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ % \typeout{MID\space X:\the\pgf at xa\space Y:\the\pgf at ya\space L:\the\pgf at circ@res at up}
+ % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
+ \pgfpointintersectionoflines
+ {\pgfpointorigin}{\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfqpoint{0pt}{\pgf at circ@res at up}}{\pgfqpoint{\pgf at circ@res at up}{0pt}}
+ % \typeout{CROSS \space X:\the\pgf at x\space Y:\the\pgf at y}
+ \pgf at x=\@@switchx\pgf at x
+ \pgf at y=\@@switchy\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgftransformrotate{45}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf at circ@res at temp}{-\pgf at circ@res at temp}}
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifx\tikz at fillcolor\pgfutil at empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ % note that this element has no class, but will inherit it when used
+ % into another component
+ \pgf at circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \fi
+ \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+%% square terminal, filled
+
+\pgfdeclareshape{squarepole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at y}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpointborderrectangle
+ {\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfqpoint{\pgf at circ@res at up}{\pgfqpoint{\pgf at circ@res at up}}}
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf at circ@res at temp}{-\pgf at circ@res at temp}}
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+%% square terminal, unfilled
+
+\pgfdeclareshape{osquarepole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf at y}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \anchorborder{
+ \pgf at xa=\pgf at x
+ \pgf at ya=\pgf at y
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpointborderrectangle
+ {\pgfqpoint{\pgf at xa}{\pgf at ya}}
+ {\pgfqpoint{\pgf at circ@res at up}{\pgfqpoint{\pgf at circ@res at up}}}
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf at circ@res at temp}{\ctikzvalof{nodes width}*\pgf at circ@Rlen}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf at circ@res at temp}{-\pgf at circ@res at temp}}
+ {\pgfpoint{\pgf at circ@res at temp}{\pgf at circ@res at temp}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \ifx\tikz at fillcolor\pgfutil at empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ % note that this element has no class, but will inherit it when used
+ % into another component
+ \pgf at circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz at fillcolor}
+ \fi
+ \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+% BNC connector
+
+\pgfdeclareshape{bnc}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ % BNC size is 2.5 times the size of the internal "ocirc"
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgf at y=2.5\pgf at y
+ \pgf at x=-\pgf at y
+ }
+ % center is on the opening
+ \anchor{center}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{zero}{ \pgfpointorigin }
+ \anchor{hot}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{shield}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ % geo-anchors
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{right}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{left}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ \pgfpointborderellipse{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}
+ }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf at circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf at circ@Rlen}}
+ }
+ \behindforegroundpath{
+ \pgfextracty{\pgf at circ@res at other}{\northwest}
+ \pgf at circ@res at step=\ctikzvalof{nodes width}\pgf at circ@Rlen
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgflinewidth}
+ \pgfsetcolor{\ctikzvalof{color}}
+ % external circle
+ \pgfscope
+ % clipping path: first a rectangle bigger then the shape
+ % to avoid problems with the line thickness
+ \pgfpathrectanglecorners{\pgfpoint{-2\pgf at circ@res at other}{-2\pgf at circ@res at other}}
+ {\pgfpoint{2\pgf at circ@res at other}{2\pgf at circ@res at other}}
+ % next the opening to the right
+ \pgfpathrectanglecorners{\pgfpoint{-\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ {\pgfpoint{2\pgf at circ@res at other}{\pgf at circ@res at step}}
+ % do the difference and clip before drawing
+ \pgfseteorule
+ \pgfusepath{clip}
+ \pgfpathcircle{\pgfpointorigin}{\pgf at circ@res at other}
+ \pgfusepath{draw}
+ \endpgfscope
+ % internal circle
+ \pgfpathcircle{\pgfpointorigin}{\pgf at circ@res at step}
+ \pgf at circ@draworfill
+ % and the contact line to the right
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at other}{0pt}}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+%% Fill for correct rectangular joins
+
+\pgfdeclareshape{rectjoinfill}{
+ \savedanchor{\northeast}{%
+ \pgf at x=.5\pgflinewidth%
+ \pgf at y=.5\pgflinewidth%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchorborder{
+ \pgf at circ@res at left=\pgf at x
+ \pgf at circ@res at up=\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfpathrectanglecorners
+ {\pgfpoint{0}{.5\pgflinewidth}}
+ {\pgfpoint{0}{-.5\pgflinewidth}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+%% transistor arrow
+
+\def\pgf at circ@find at linescale{
+ % find the scale inverse of the scale factor: line width do not scale
+ % with scale=..., transform shape so we have to counteract it.
+ \iftikz at fullytransformed % this is true if `transform shape` is active
+ % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
+ % Note that this trick is not working inside a `spy` environment...
+ \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
+ \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
+ \else
+ \pgfmathsetmacro{\@@factor}{1.0}
+ \fi
+}
+
+\pgfdeclareshape{trarrow}{%
+ % this arrow is only filled but grows with the linewidth, more or less
+ % like currarrow do
+ \savedanchor{\northeast}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \pgf at circ@find at linescale
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgfpoint{0.7*\pgf at circ@res at step +0.5*\@@factor*\pgflinewidth}
+ {0.8*\pgf at circ@res at step+0.7593*\@@factor*\pgflinewidth}
+ }
+ % The arrow size should be more or less the same of a currarrow, which is
+ % both filled and stroke, for backward output compatibility (more or less)
+ %
+ % angle \beta W is \pgf at circ@Rlen/\ctikzvalof{current arrow scale}
+ % |-\__ currarrow as the tip at (W,0)
+ % | | and the upper tail at (-0.7*W, 0.8*W)
+ % | \__ it then "overshoot" do to the linew width L
+ % | \__ xangle \alpha
+ % ---0------->
+ %
+ % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
+ % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
+ % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
+ %
+ \savedanchor{\northwest}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at circ@find at linescale
+ \pgfpoint{-0.7*\pgf at circ@res at step -0.5*\@@factor*\pgflinewidth}
+ {0.8*\pgf at circ@res at step+0.7593*\@@factor*\pgflinewidth}
+ }
+ \savedanchor{\tip}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at circ@find at linescale
+ \pgfpoint{\pgf at circ@res at step + 1.743*\@@factor*\pgflinewidth}{0pt}
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{tip}{
+ \tip
+ }
+ \anchor{btip}{% this anchor is behind the tip of half a linewidth
+ \tip
+ \pgf at circ@find at linescale
+ \pgf at circ@res at temp=\@@factor\pgflinewidth
+ \advance\pgf at x by -.5\pgf at circ@res at temp
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \northwest
+ \pgf at circ@res at up=\pgf at y
+ \pgf at circ@res at left=\pgf at x
+ \tip
+ \pgf at circ@res at step = \pgf at x
+ %
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{-\pgf at circ@res at up}}
+ \pgfpathclose
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{fill} % just fill
+ \endpgfscope
+ }
+}
+
+%% Current arrow
+
+\pgfdeclareshape{currarrow}{
+ \savedanchor{\northeast}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at x=.5\pgf at circ@res at step
+ \pgf at y=\pgf at x%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{tip}{
+ \pgfpointorigin
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at x =\pgf at circ@res at step
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+
+ \pgfpathmoveto{\pgfpoint{-.7\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{-.7\pgf at circ@res at step}{-.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{-.7\pgf at circ@res at step}{.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-.7\pgf at circ@res at step}{0pt}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{draw,fill}
+
+ \endpgfscope
+ }
+}
+
+%% Flow arrow
+
+\pgfdeclareshape{flowarrow}{
+ \savedanchor{\northeast}{%
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at y=.5\pgf at circ@res at step
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by 4
+ \pgf at x=\pgf at circ@res at step%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{text}{% text centered above
+ \pgfpointorigin
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
+ }
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \anchor{tip}{
+ \pgfpointorigin
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at x =\pgf at circ@res at step
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by 4
+ \pgfpathmoveto{\pgfpoint{-\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{draw}
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at step}{0pt}}
+ \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
+ \endpgfscope
+ }
+}
+
+%% Input arrow
+
+\pgfdeclareshape{inputarrow}{
+ \savedanchor{\northeast}{% this is really not northeast, really -northwest
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by \ctikzvalof{current arrow scale}
+ \pgf at y=.5\pgf at circ@res at step
+ \pgf at x=1.7\pgf at circ@res at step
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax\pgf at x=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0cm\relax}
+ \anchor{west}{\northeast\pgf at y=0cm\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast\pgf at x=0cm\relax}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y\pgf at x=0cm\relax}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \savedanchor{\tip}{
+ \pgfpointorigin
+ }
+ \anchor{center}{
+ \tip
+ }
+ \anchor{tip}{
+ \tip
+ }
+ \behindforegroundpath{
+
+ \pgfscope
+ \pgf at circ@res at step = \pgf at circ@Rlen
+ \divide \pgf at circ@res at step by 16
+
+ \pgfpathmoveto{\pgfpoint{-1.7\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{-1.7\pgf at circ@res at step}{-.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0pt}{0pt}}
+ \pgfpathlineto{\pgfpoint{-1.7\pgf at circ@res at step}{.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-1.7\pgf at circ@res at step}{0pt}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfusepath{fill}
+
+ \endpgfscope
+ }
+}
+
+
+%% box
+
+\pgfdeclareshape{box}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \behindforegroundpath{
+
+ \pgfscope
+ \pgf at circ@res at step = \ctikzvalof{bipoles/twoport/width}\pgf at circ@Rlen
+ \pgf at circ@res at step = 0.5\pgf at circ@res at step
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{-\pgf at circ@res at step}{\pgf at circ@res at step}}{\pgfpoint{\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+%% box scaled with blocks
+
+\pgfdeclareshape{blockbox}{
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{blocks/scale}\pgf at circ@Rlen}}
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \behindforegroundpath{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{blocks/scale}\pgf at circ@Rlen}
+ \pgfscope
+ \pgf at circ@res at step = \ctikzvalof{bipoles/twoport/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at step = 0.5\pgf at circ@res at step
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{-\pgf at circ@res at step}{\pgf at circ@res at step}}{\pgfpoint{\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+% full nodes for wire crossing
+
+\pgfdeclareshape{jump crossing}
+{
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{bipoles/crossing/size}\pgf at circ@Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \behindbackgroundpath{
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ % horizontal jumper
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{0.4\pgf at circ@res at left}{0pt}}
+ \pgfpatharc{0}{-180}{0.4*\pgf at circ@res at left}
+ \pgfsetbeveljoin
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ % vertical, broken path
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ }
+}
+\pgfdeclareshape{plain crossing}
+{
+ \savedanchor\northwest{%
+ \pgf at y=\ctikzvalof{bipoles/crossing/size}\pgf at circ@Rlen
+ \pgf at y=.5\pgf at y
+ \pgf at x=-\pgf at y
+ }
+ \anchor{center}{ \pgf at y=0pt \pgf at x=0pt }
+ \anchor{east}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{e}{ \northwest \pgf at y=0pt \pgf at x=-\pgf at x }
+ \anchor{west}{ \northwest \pgf at y=0pt }
+ \anchor{w}{ \northwest \pgf at y=0pt }
+ \anchor{south}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{s}{ \northwest \pgf at x=0pt \pgf at y=-\pgf at y }
+ \anchor{north}{ \northwest \pgf at x=0pt }
+ \anchor{n}{ \northwest \pgf at x=0pt }
+ \anchor{south west}{ \northwest \pgf at y=-\pgf at y }
+ \anchor{north east}{ \northwest \pgf at x=-\pgf at x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf at x=-\pgf at x \pgf at y=-\pgf at y }
+ \behindbackgroundpath{
+ \northwest
+ \pgf at circ@res at up = \pgf at y
+ \pgf at circ@res at down = -\pgf at y
+ \pgf at circ@res at right = -\pgf at x
+ \pgf at circ@res at left = \pgf at x
+ % horizontal jumper
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ % vertical, broken path
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf at circ@res at up}}
+ \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at down}}
+ \pgfusepath{draw}
+
+ }
+}
+
+%%%---------- close: tex/pgfcircshapes
+%%%%%%%%%%% Springe nach tex/pgfcircmonopoles
+%%%---------- open: tex/pgfcircmonopoles.tex
+% Copyright 2018-2020 by Romano Giannetti
+% Copyright 2015-2020 by Stefan Lindner
+% Copyright 2013-2020 by Stefan Erhardt
+% Copyright 2007-2020 by Massimo Redaelli
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Monopoles
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%
+%% Grounds
+%%%%%%%%%%%%%
+
+
+%% Ground symbol
+% #1 -> name
+% #2 -> width
+% #3 -> depth
+% #4 -> code
+\long\def\pgf at circ@declareground#1#2#3#4{
+ \pgfdeclareshape{#1}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\southeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/ground/width}\pgf at circ@scaled at Rlen
+ \pgf at x=#2\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/ground/width}\pgf at circ@scaled at Rlen
+ \pgf at y=-#3\pgf at y
+ }
+ \anchor{north}{\pgfpointorigin}
+ \anchor{north east}{\southeast\pgf at y=0pt\relax}
+ \anchor{east}{\southeast\pgf at y=.5\pgf at y}
+ \anchor{south east}{\southeast}
+ \anchor{south}{\southeast\pgf at x=0pt\relax}
+ \anchor{south west}{\southeast\pgf at x=-\pgf at x}
+ \anchor{west}{\southeast\pgf at y=.5\pgf at y\pgf at x=-\pgf at x}
+ \anchor{north west}{\southeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{left}{\pgfpointorigin}
+ \anchor{right}{\pgfpointorigin}
+ \anchor{center}{\pgfpointorigin}
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/ground/width}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \pgfstartlinewidth=\pgflinewidth
+ #4
+ \endpgfscope
+ }
+ }
+}
+
+
+\pgf at circ@declareground{ground}{0.6}{1.6}{
+ \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.4\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.25\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+\pgf at circ@declareground{tlground}{0.6}{0.4}{
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{0pt}}
+ \pgfpathmoveto{\pgfpoint{-.4\pgf at circ@res at step}{-0.2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-0.2\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.25\pgf at circ@res at step}{-0.4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-0.4\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+
+\pgf at circ@declareground{rground}{0.6}{1}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfsetroundcap\pgfusepath{draw}
+}
+
+\pgf at circ@declareground{tground}{0.6}{0}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{0pt}}
+ \pgfusepath{draw}
+}
+
+\pgf at circ@declareground{sground}{0.6}{1.8}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0}{-1.8\pgf at circ@res at step}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+}
+
+% noiseless ground
+\pgf at circ@declareground{nground}{0.9}{1.6}{
+ \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.4\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.25\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.9\pgf at circ@res at step}{-1.6\pgf at circ@res at step}}
+ \pgfpatharc{0}{180}{0.9\pgf at circ@res at step}
+ \pgfusepath{draw}
+}
+
+% protective ground
+\pgf at circ@declareground{pground}{0.9}{1.8}{
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf at circ@res at step}}{0.9\pgf at circ@res at step}
+ \pgf at circ@draworfill
+ \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.6\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.4\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-1.2\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.25\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-1.4\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+% chassis ground
+\pgf at circ@declareground{cground}{1}{2}{
+ \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-1.00\pgf at circ@res at step}{-2.10\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-0.75\pgf at circ@res at step}{-1.50\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{ 0.75\pgf at circ@res at step}{-1.50\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{ 0.50\pgf at circ@res at step}{-2.10\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{ 0.00\pgf at circ@res at step}{-1.50\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-0.25\pgf at circ@res at step}{-2.10\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+% Contributed by @fotesan https://github.com/fotesan
+% european ground
+\pgf at circ@declareground{eground}{1.1}{1.7}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-1\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-1.1\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-.6\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.6\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-.1\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.1\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.4\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{.4\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.9\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+\pgf at circ@declareground{eground2}{1.1}{1.7}{
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-1\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{1\pgf at circ@res at step}{-\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-1.1\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{-.4\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{-.45\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.25\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathmoveto{\pgfpoint{.2\pgf at circ@res at step}{-1.7\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{.9\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+%%%%%%%%%%%%%%%%%%
+%% Power supplies
+%%%%%%%%%%%%%%%%%%
+
+% Vcc
+\pgfdeclareshape{vcc}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
+ \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
+ \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
+ \pgfmathsetlength{\pgf at x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf at circ@Rlen}%
+ }
+ \savedanchor{\northeast}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at circ@res at step
+ \pgf at y=3\pgf at x%
+ }
+ \anchor{north}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y\relax}
+ \anchor{south}{\pgfpointorigin}
+ \anchor{west}{\northeast\pgf at y=0.5\pgf at y\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{center}{\pgfpointorigin}
+ \anchor{left}{\pgfpointorigin}
+ \anchor{right}{\pgfpointorigin}
+ \anchor{text}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf at circ@res at step+2\ht\pgfnodeparttextbox}}
+ \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf at circ@res at step+2\ht\pgfnodeparttextbox}}
+ \pgf at x=0pt
+ \pgf at y=2\pgf at circ@res at step
+ \advance \pgf at y by 0.5\ht\pgfnodeparttextbox
+ \pgf at x=-.5\wd\pgfnodeparttextbox
+ }
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \edef\pgf at circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf at temp{legacy}
+ \ifx\pgf at temp\pgf at circ@temp
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0}{1.5\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{.8\pgf at circ@res at step}}
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \else
+ \pgfsetarrowsend{\pgf at circ@temp}
+ \fi
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+% Vee
+\pgfdeclareshape{vee}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
+ \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
+ \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
+ \pgfmathsetlength{\pgf at x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf at circ@Rlen}%
+ }
+ \savedanchor{\northeast}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at circ@res at step
+ \pgf at y=-3\pgf at x%
+ }
+ \anchor{south}{\northeast\pgf at x=0cm\relax}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y\relax}
+ \anchor{north}{\pgfpointorigin}
+ \anchor{west}{\northeast\pgf at y=0.5\pgf at y\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast}
+ \anchor{south west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{north east}{\northeast\pgf at y=0pt\relax}
+ \anchor{north west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \anchor{center}{\pgfpointorigin}
+ \anchor{left}{\pgfpointorigin}
+ \anchor{right}{\pgfpointorigin}
+ \anchor{text}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf at circ@res at step-2\ht\pgfnodeparttextbox}}
+ \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf at circ@res at step-2\ht\pgfnodeparttextbox}}
+ \pgf at x=0pt
+ \pgf at y=-2\pgf at circ@res at step
+ \advance \pgf at y by -1.5\ht\pgfnodeparttextbox
+ \pgf at x=-.5\wd\pgfnodeparttextbox
+ }
+
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/vcc/width}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \edef\pgf at circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf at temp{legacy}
+ \ifx\pgf at temp\pgf at circ@temp
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf at circ@res at step}{-.8\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0}{-1.5\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{-.8\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \else
+ \pgfsetarrowsend{\pgf at circ@temp}
+ \fi
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+%%%%%%%%%%%%%%%%
+%% RF elements
+%%%%%%%%%%%%%%%%
+
+% Legacy tlinestub
+% Contributed by Leonardo Azzinnari
+\pgfdeclareshape{tlinestub}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\northeast}{%
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step = \ctikzvalof{bipoles/tline/width} \pgf at circ@scaled at Rlen
+ \pgf at x=1.2\pgf at circ@res at step
+ \pgf at circ@res at step = \ctikzvalof{bipoles/tline/width} \pgf at circ@scaled at Rlen
+ \pgf at y=.2\pgf at circ@res at step%
+ }
+ % the center is on the left side of the shape for facility of usage
+ \anchor{north}{\northeast\pgf at x=0.5\pgf at x\relax}
+ \anchor{east}{\northeast\pgf at y=0cm\relax}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y \pgf at x=0.5\pgf at x\relax}
+ \anchor{west}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=0cm\relax}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south west}{\northeast\pgf at x=0cm\pgf at y=-\pgf at y}
+ \anchor{center}{\pgfpointorigin}
+ \behindforegroundpath{
+ \pgfstartlinewidth=\pgflinewidth
+
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{bipoles/tline/width} \pgf at circ@scaled at Rlen
+ \pgf at circ@res at step=0.6\pgf at circ@scaled at Rlen
+
+ \pgfscope\begin{pgftransparencygroup}
+ \pgfpathellipse{\pgfpoint{0.5\pgf at circ@res at step}{0\pgf at circ@res at step}}{\pgfpoint{0.125\pgf at circ@res at step}{0\pgf at circ@res at step}}{\pgfpoint{0\pgf at circ@res at step}{0.25\pgf at circ@res at step}}
+ \pgf at circ@maybefill
+ \pgfpathmoveto{\pgfpoint{0.5\pgf at circ@res at step}{0.25\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{1.5\pgf at circ@res at step}{0.25\pgf at circ@res at step}}
+ \pgfpatharc{90}{-90}{0.125\pgf at circ@res at step and 0.25\pgf at circ@res at step}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{-0.25\pgf at circ@res at step}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf at circ@draworfill
+ \pgfpathellipse{\pgfpoint{0.5\pgf at circ@res at step}{0\pgf at circ@res at step}}{\pgfpoint{0.125\pgf at circ@res at step}{0\pgf at circ@res at step}}{\pgfpoint{0\pgf at circ@res at step}{0.25\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \end{pgftransparencygroup} \endpgfscope
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0.5\pgf at circ@res at step}{0pt}}
+ \pgfusepath{draw}
+ }
+}
+
+%% New antennas without tails
+
+% main body of antennas
+\def\pgf at circ@antennabody{%
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{-\pgf at circ@res at step}{2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at step}{2\pgf at circ@res at step}}
+ \pgfsetbeveljoin
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{2\pgf at circ@res at step}}
+ \pgfusepath{draw}
+}
+
+% Waves for the antennas.
+\def\pgf at circ@antennawaves{%
+ \pgfscope
+ % define a triangle for clipping the waves
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4.2\pgf at circ@res at step}{3\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4.2\pgf at circ@res at step}{-1\pgf at circ@res at step}}
+ \pgfpathclose
+ \pgfusepath{clip}
+ % ...and build the waves as clipped circles
+ \pgf at circ@count at a=8\pgf at circ@res at other=0.5\pgf at circ@res at step
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>2
+ \pgfpathcircle{\pgfpoint{0pt}{\pgf at circ@res at step}}{\the\pgf at circ@count at a*\pgf at circ@res at other}
+ \advance\pgf at circ@count at a-1\relax%
+ \repeatpgfmathloop
+ \pgfusepath{draw}
+ \endpgfscope
+}
+
+% additional shape with the waves
+\pgfdeclareshape{waves}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/waves/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step
+ \pgf at y=\pgf at circ@res at step
+ }
+ \anchor{text}{
+ \northeast
+ \pgf at y=\dimexpr\pgf at y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \anchor{top}{\northeast\pgf at x=0pt}
+ \anchor{right}{\northeast\pgf at y=0pt}
+ \anchor{left}{\northeast\pgf at x=-\pgf at x\pgf at y=0pt}
+ \anchor{bottom}{\northeast\pgf at y=-\pgf at y\pgf at x=0pt}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{north east}{\northeast}
+ \anchor{east}{\northeast\pgf at y=0pt}
+ \anchor{south east}{\northeast\pgf at y=-\pgf at y}
+ \anchor{south}{\northeast\pgf at y=-\pgf at y\pgf at x=0pt}
+ \anchor{south west}{\northeast\pgf at y=-\pgf at y\pgf at x=-\pgf at x}
+ \anchor{west}{\northeast\pgf at x=-\pgf at x\pgf at y=0pt}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \behindforegroundpath{
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/waves/width}\pgf at circ@scaled at Rlen
+ \pgf at circ@res at step=0.5\pgf at circ@res at step
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfscope
+ % define a triangle for clipping the waves
+ \pgfpathmoveto{\pgfpoint{-2\pgf at circ@res at step}{0pt}}
+ \pgfpathlineto{\pgfpoint{2.1\pgf at circ@res at step}{2\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{2.1\pgf at circ@res at step}{-2\pgf at circ@res at step}}
+ \pgfpathclose
+ \pgfusepath{clip}
+ % ...and build the waves as clipped circles
+ \c at pgf@counta=8\pgf at circ@res at other=0.5\pgf at circ@res at step
+ \pgfmathloop%
+ \ifnum\c at pgf@counta>1
+ \pgfpathcircle{\pgfpoint{-2\pgf at circ@res at step}{0pt}}{\the\c at pgf@counta*\pgf at circ@res at other}
+ \advance\c at pgf@counta-1\relax%
+ \repeatpgfmathloop
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+% the three types of antennas: simple, TX, RX. Notice that you can flip them...
+
+\pgfdeclareshape{bareantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step
+ \pgf at y=2\pgf at circ@res at step
+ }
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf at y
+ \pgf at y=\dimexpr\pgf at y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \anchor{top}{\northeast\pgf at x=0pt}
+ \anchor{right}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{left}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{bottom}{\pgfpointorigin}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{west}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{south}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \behindforegroundpath{
+ \pgf at circ@antennabody
+ }
+}
+
+\pgfdeclareshape{bareTXantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step
+ \pgf at y=2\pgf at circ@res at step
+ }
+ \savedanchor{\savedwaves}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=4.2\pgf at circ@res at step
+ \pgf at y=\pgf at circ@res at step
+ }
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf at y
+ \pgf at x=\dimexpr-\pgf at x-\wd\pgfnodeparttextbox\relax
+ \pgf at y=\dimexpr\pgf at y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \anchor{waves}{\savedwaves}
+ \anchor{top}{\northeast\pgf at x=0pt}
+ \anchor{right}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{left}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{bottom}{\pgfpointorigin}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{west}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{south}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \behindforegroundpath{
+ \pgf at circ@antennabody
+ \pgf at circ@antennawaves
+ }
+}
+
+\pgfdeclareshape{bareRXantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step
+ \pgf at y=2\pgf at circ@res at step
+ }
+ \savedanchor{\savedwaves}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/bareantenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-4.2\pgf at circ@res at step
+ \pgf at y=\pgf at circ@res at step
+ }
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf at y
+ \pgf at y=\dimexpr\pgf at y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ \anchor{waves}{\savedwaves}
+ \anchor{top}{\northeast\pgf at x=0pt}
+ \anchor{right}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{left}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{bottom}{\pgfpointorigin}
+ \anchor{north}{\northeast\pgf at x=0pt}
+ \anchor{east}{\northeast\pgf at y=0.5\pgf at y}
+ \anchor{west}{\northeast\pgf at x=-\pgf at x\pgf at y=0.5\pgf at y}
+ \anchor{south}{\pgfpointorigin}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf at x=-\pgf at x}
+ \anchor{south east}{\northeast\pgf at y=0pt\relax}
+ \anchor{south west}{\northeast\pgf at y=0pt\pgf at x=-\pgf at x}
+ \behindforegroundpath{
+ \pgf at circ@antennabody
+ \pgftransformxshift{-5.2\pgf at circ@res at step}
+ \pgf at circ@antennawaves
+ }
+}
+
+% Microstrip monopoles
+
+\pgfdeclareshape{mslstub}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\southeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{bipoles/mstline/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=\ctikzvalof{bipoles/mstline/height}\pgf at circ@scaled at Rlen
+ \pgf at y=-.5\pgf at y
+ }
+ \savedanchor{\northwest}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{bipoles/mstline/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-.5\pgf at x
+ \pgf at y=\ctikzvalof{bipoles/mstline/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ }
+ \anchor{north}{\northwest\pgf at x=0pt\relax}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{east}{\southeast\pgf at y=0pt\relax}
+ \anchor{south east}{\southeast}
+ \anchor{south}{\southeast\pgf at x=0pt\relax}
+ \anchor{south west}{\southeast\pgf at x=-\pgf at x}
+ \anchor{west}{\northwest\pgf at y=0pt\relax}
+ \anchor{north west}{\northwest}
+ %
+ \anchor{center}{\northwest\pgf at y=0pt\relax}
+ \anchor{left}{\northwest\pgf at y=0pt\relax}
+ \anchor{right}{\southeast\pgf at y=0pt\relax}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+ \behindbackgroundpath{
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at right}{\southeast}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfextracty{\pgf at circ@res at down}{\southeast}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.25*\pgf at circ@res at up}
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up}}{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{msrstub}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\southeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/msrstub/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=0pt\relax
+ }
+ \savedanchor{\northwest}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/msrstub/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-.5\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/msrstub/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ }
+ \anchor{north}{\northwest\pgf at x=0pt\relax}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{east}{\southeast\pgf at y=0pt\relax}
+ \anchor{south east}{\southeast}
+ \anchor{south}{\southeast\pgf at x=0pt\relax}
+ \anchor{south west}{\southeast\pgf at x=-\pgf at x}
+ \anchor{west}{\northwest\pgf at y=0pt\relax}
+ \anchor{north west}{\northwest}
+ %
+ \anchor{center}{\pgfpointorigin}
+ \anchor{left}{\pgfpointorigin}
+ \anchor{right}{\pgfpointorigin}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf at circ@res at up\relax
+ }
+ }
+ \behindbackgroundpath{
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at right}{\southeast}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfextracty{\pgf at circ@res at down}{\southeast}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.25*\pgf at circ@res at up}
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfscope
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{\pgf at circ@res at step}}
+ \pgfusepath{draw}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpointpolar{135}{\pgf at circ@res at step}}
+ \pgfpatharc{135}{45}{\pgf at circ@res at step}
+ \pgfpathlineto{\pgfpointpolar{45}{\pgf at circ@res at up}}
+ \pgfpatharc{45}{135}{\pgf at circ@res at up}
+ \pgfclosepath
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{msport}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \savedanchor{\southeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/msport/width}\pgf at circ@scaled at Rlen
+ \pgf at x=.5\pgf at x
+ \pgf at y=\ctikzvalof{bipoles/mstline/height}\pgf at circ@scaled at Rlen
+ \pgf at y=-.5\pgf at y
+ }
+ \savedanchor{\northwest}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at x=\ctikzvalof{monopoles/msport/width}\pgf at circ@scaled at Rlen
+ \pgf at x=-.5\pgf at x
+ \pgf at y=\ctikzvalof{bipoles/mstline/height}\pgf at circ@scaled at Rlen
+ \pgf at y=.5\pgf at y
+ }
+ \anchor{north}{\northwest\pgf at x=0pt\relax}
+ \anchor{north east}{\northwest\pgf at x=-\pgf at x}
+ \anchor{east}{\southeast\pgf at y=0pt\relax}
+ \anchor{south east}{\southeast}
+ \anchor{south}{\southeast\pgf at x=0pt\relax}
+ \anchor{south west}{\southeast\pgf at x=-\pgf at x}
+ \anchor{west}{\northwest\pgf at y=0pt\relax}
+ \anchor{north west}{\northwest}
+ %
+ \anchor{center}{\northwest\pgf at y=0pt\relax}
+ \anchor{left}{\northwest\pgf at y=0pt\relax}
+ \anchor{right}{\southeast\pgf at y=0pt\relax}
+ % put the node text above and centered
+ \anchor{text}{\pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{
+ \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
+ }
+ \behindbackgroundpath{
+ \pgfextracty{\pgf at circ@res at up}{\northwest}
+ \pgfextractx{\pgf at circ@res at right}{\southeast}
+ \pgfextractx{\pgf at circ@res at left}{\northwest}
+ \pgfextracty{\pgf at circ@res at down}{\southeast}
+ \pgfmathsetlength{\pgf at circ@res at step}{0.5*\pgf at circ@res at up}
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfscope
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at step}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at down}}
+ \pgfpathlineto{\pgfpoint{\pgf at circ@res at left+\pgf at circ@res at step}{\pgf at circ@res at down}}
+ \pgfpathclose
+ \pgf at circ@draworfill
+ \endpgfscope
+ }
+}
+
+% Legacy antennas (with tails)
+\def\pgf at circ@shift at antenna@xy#1#2{%
+ \pgf at y=\dimexpr\pgf at y+#2\pgf at circ@res at step
+ \pgf at x=\dimexpr\pgf at x+#1\pgf at circ@res at step
+\relax}
+
+% Legacy antenna
+\pgfdeclareshape{antenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/antenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step%-0.5\pgflinewidth
+ \pgf at y=4\pgf at circ@res at step
+ }
+ \anchor{north}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=0cm\pgf at circ@shift at antenna@xy{0}{2}}
+ \anchor{east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at circ@shift at antenna@xy{0}{3}\relax}
+ \anchor{south}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y \pgf at x=0cm\pgf at circ@shift at antenna@xy{0}{4}\relax}
+ \anchor{west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{0}{3}}
+ \anchor{north east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at circ@shift at antenna@xy{0}{2}}
+ \anchor{north west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{0}{2}}
+ \anchor{south east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at circ@shift at antenna@xy{0}{4}}
+ \anchor{south west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{0}{4}}
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/antenna/width}\pgf at circ@scaled at Rlen
+
+ \pgftransformxshift{ -4\pgf at circ@res at step }
+
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{5\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{3\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ }
+}
+
+% Legacy TX antenna
+\pgfdeclareshape{txantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/antenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step%-0.5\pgflinewidth
+ \pgf at y=4\pgf at circ@res at step
+ }
+ \anchor{north}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=0cm\pgf at circ@shift at antenna@xy{2}{2}}
+ \anchor{east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at circ@shift at antenna@xy{4}{3}\relax}
+ \anchor{south}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y \pgf at x=0cm\pgf at circ@shift at antenna@xy{2}{4}\relax}
+ \anchor{west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{3}}
+ \anchor{north east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at circ@shift at antenna@xy{4}{2}}
+ \anchor{north west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{2}}
+ \anchor{south east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at circ@shift at antenna@xy{4}{4}}
+ \anchor{south west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{4}}
+ \anchor{text}{
+ \northeast
+ \pgf at x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf at x
+ \pgf at y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf at y
+ }
+ \behindforegroundpath{
+ \pgfstartlinewidth=\pgflinewidth
+ \pgf at circ@scaled at Rlen=\scaledRlen
+ \pgf at circ@res at step=\ctikzvalof{monopoles/txantenna/width}\pgf at circ@scaled at Rlen
+
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step}{0pt}}
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{0pt}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+
+ \pgfusepath{draw}
+
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{5\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{4\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{3\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfpathlineto{\pgfpoint{4\pgf at circ@res at step-0.5\pgflinewidth}{6\pgf at circ@res at step}}
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgf at circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgfpathmoveto{\pgfpoint{5.5\pgf at circ@res at step}{6\pgf at circ@res at step}}
+ % \pgfpatharc{60}{-60}{\pgf at circ@res at step and \pgf at circ@res at step}
+ \pgfpatharc{30}{-30}{2\pgf at circ@res at step} \pgfpathmoveto{\pgfpoint{6\pgf at circ@res at step}{6.25\pgf at circ@res at step}}
+ \pgfpatharc{30}{-30}{2.5\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{6.5\pgf at circ@res at step}{6.5\pgf at circ@res at step}}
+ \pgfpatharc{30}{-30}{3\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{7\pgf at circ@res at step}{6.75\pgf at circ@res at step}}
+ \pgfpatharc{30}{-30}{3.5\pgf at circ@res at step}
+ \pgfpathmoveto{\pgfpoint{7.5\pgf at circ@res at step}{7\pgf at circ@res at step}}
+ \pgfpatharc{30}{-30}{4\pgf at circ@res at step}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+
+ }
+}
+
+% Legacy RX antenna
+\pgfdeclareshape{rxantenna}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor{\northeast}{
+ \pgfmathsetlength{\pgf at circ@scaled at Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}
+ \pgf at circ@res at step=\ctikzvalof{monopoles/antenna/width}\pgf at circ@scaled at Rlen
+ \pgf at x=\pgf at circ@res at step%-0.5\pgflinewidth
+ \pgf at y=4\pgf at circ@res at step
+ }
+ \anchor{north}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=0cm\pgf at circ@shift at antenna@xy{2}{2}}
+ \anchor{east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at circ@shift at antenna@xy{4}{3}\relax}
+ \anchor{south}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y \pgf at x=0cm\pgf at circ@shift at antenna@xy{2}{4}\relax}
+ \anchor{west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=0cm\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{3}}
+ \anchor{north east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at circ@shift at antenna@xy{4}{2}}
+ \anchor{north west}{\northeast\pgf at circ@res at step=\pgf at x\pgf at x=-\pgf at x\pgf at circ@shift at antenna@xy{1}{2}}
+ \anchor{south east}{\northeast\pgf at circ@res at step=\pgf at x\pgf at y=-\pgf at y\pgf at circ@shift at antenna@xy{4}{4}}
@@ Diff output truncated at 1234567 characters. @@
More information about the tex-live-commits
mailing list.