diff options
author | Karl Berry <karl@freefriends.org> | 2019-08-31 21:18:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-08-31 21:18:52 +0000 |
commit | ce57a48ad32828c6b55ab174a7ae857475dbdd22 (patch) | |
tree | 201dd15a66a2f8a0323070835f4ab46739decb2b /Master | |
parent | 4071c391a929d5e37fc50476a19c15f32eaaeb93 (diff) |
circuitikz (31aug19)
git-svn-id: svn://tug.org/texlive/trunk@52002 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
24 files changed, 39688 insertions, 4833 deletions
diff --git a/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf b/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf Binary files differindex 8e89da7cb24..5c5c1080a1c 100644 --- a/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf +++ b/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf diff --git a/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md b/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md index a9c30cfded5..c3a3d700c5c 100644 --- a/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md +++ b/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md @@ -1,6 +1,24 @@ <!--- 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 0.9.4 (2019-08-30) + + This release introduces two changes: a big one, which is the styling of the components (please look at the manual for details) and a change to how voltage labels and arrows are positioned. This one should be backward compatible *unless* you used `voltage shift` introduced in 0.9.0, which was broken when using the global `scale` parameter. + + The styling additions are quite big, and, although in principle they are backward compatible, you can find corner cases where they are not, especially if you used to change parameters for `pgfcirc.defines.tex`; so a snapshot for the 0.9.3 version is available. + + - Fixed a bug with "inline" gyrators, now the circle will not overlap + - Fixed a bug in input anchors of european not ports + - Fixed "tlinestub" so that it has the same default size than "tline" (TL) + - Fixed the "transistor arrows at end" feature, added to styling + - Changed the behavior of "voltage shift" and voltage label positioning to be more robust + - Added several new anchors for "elmech" element + - Several minor fixes in some component drawings to allow fill and thickness styles + - Add 0.9.3 version snapshots. + - Added styling of relative size of components (at a global or local level) + - Added styling for fill color and thickeness + - Added style files + * Version 0.9.3 (2019-07-13) - Added the option to have "dotless" P-MOS (to use with arrowmos option) - Fixed a (puzzling) problem with coupler2 @@ -17,7 +35,7 @@ The major changes among the different circuitikz versions are listed here. See < - Added rotary switches - Added more configurable bipole nodes (connectors) and more shapes - Added 7-segment displays - - Added vacuum tubes by J. op den Brouw + - Added vacuum tubes by J. op den Brouw - Made the open shape of dcisources configurable - Made the arrows on vcc and vee configurable - Fixed anchors of diamondpole nodes diff --git a/Master/texmf-dist/doc/generic/circuitikz/README.md b/Master/texmf-dist/doc/generic/circuitikz/README.md index 7f9009e98d1..574ed248597 100644 --- a/Master/texmf-dist/doc/generic/circuitikz/README.md +++ b/Master/texmf-dist/doc/generic/circuitikz/README.md @@ -20,9 +20,9 @@ The stable version is available on ctan and is included within the major latex d ### Stable version Just place ```latex - \usepackage{circuitikz} + \usepackage[siunitx, RPvoltages]{circuitikz} ``` -or, for ConTeXt, +or other opions, for ConTeXt, ```latex \usemodule[circuitikz] ``` @@ -32,7 +32,7 @@ in the preamble and compile away, both with PS and PDF target output. If you want to use the git version, just append a git to the package name: ```latex - \usepackage{circuitikzgit} + \usepackage[siunitx, RPvoltages]{circuitikzgit} ``` or, for ConTeXt, ```latex @@ -52,6 +52,7 @@ In ConTeXt, only the 0.8.3 version is available for the time being; you can use \usemodule[circuitikz-0.8.3] ``` +Be aware that options can (and do) change between versions, so you have to check them manually. ## More Information More Information can be found in the manual and (maybe) at the wiki of the project located at https://github.com/circuitikz/circuitikz/wiki. diff --git a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex index d4359dbb54e..ab413a5a923 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex @@ -4,7 +4,52 @@ here. See \url{https://github.com/circuitikz/circuitikz/commits} for a full list of changes. \begin{itemize} -\tightlist +\item + Version 0.9.4 (2019-08-30) + + This release introduces two changes: a big one, which is the styling + of the components (please look at the manual for details) and a change + to how voltage labels and arrows are positioned. This one should be + backward compatible \emph{unless} you used \texttt{voltage\ shift} + introduced in 0.9.0, which was broken when using the global + \texttt{scale} parameter. + + The styling additions are quite big, and, although in principle they + are backward compatible, you can find corner cases where they are not, + especially if you used to change parameters for + \texttt{pgfcirc.defines.tex}; so a snapshot for the 0.9.3 version is + available. + + \begin{itemize} + \tightlist + \item + Fixed a bug with ``inline'' gyrators, now the circle will not + overlap + \item + Fixed a bug in input anchors of european not ports + \item + Fixed ``tlinestub'' so that it has the same default size than + ``tline'' (TL) + \item + Fixed the ``transistor arrows at end'' feature, added to styling + \item + Changed the behavior of ``voltage shift'' and voltage label + positioning to be more robust + \item + Added several new anchors for ``elmech'' element + \item + Several minor fixes in some component drawings to allow fill and + thickness styles + \item + Add 0.9.3 version snapshots. + \item + Added styling of relative size of components (at a global or local + level) + \item + Added styling for fill color and thickeness + \item + Added style files + \end{itemize} \item Version 0.9.3 (2019-07-13) diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf Binary files differindex 9c4d66502a7..710c67cb8a6 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex index 7c13501b12f..06a6f5ab5ca 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex @@ -8,6 +8,8 @@ \documentclass[a4paper, titlepage]{article} \usepackage{a4wide} % smaller borders \usepackage{titling} +\usepackage{titlesec} +\newcommand{\sectionbreak}{\clearpage} \def\modern{ \usepackage{fontspec} @@ -221,6 +223,7 @@ This same issue create a lot of problem of compatibility between \Circuitikz{} a 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 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). \item After v0.9.0: the parameters \texttt{tripoles/american or port/aaa}, \texttt{...bbb}, \texttt{...ccc} and \texttt{...ddd} are no longer used and are silently ignored; the same stands for \texttt{nor}, \texttt{xor}, and \texttt{xnor} ports. \item After v0.9.0: voltage and current directions/sign (plus and minus signs in case of \texttt{american voltages} and arrows in case of \texttt{european voltages} have been rationalized with a couple of new options (see details in section~\ref{curr-and-volt}. The default case is still the same as v0.8.3. \item Since v0.8.2: voltage and current label directions(v<= / i<=) do NOT change the orientation of the drawn source shape anymore. Use the "invert" option to rotate the shape of the source. Furthermore, from this version on, the current label(i=) at current sources can be used independent of the regular label(l=). @@ -232,12 +235,12 @@ You can check the used version at your local installation using the macro \verb! 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} and \texttt{0.8.3}. To switch to use them, you simply change your \verb|\usepackage| invocation like + \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} and \texttt{0.9.3}. To switch to use them, you simply change your \verb|\usepackage| invocation like \begin{lstlisting} \usepackage[]{circuitik-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 version \texttt{0.8.3} is packaged for now; if can use it with + \item if you are using \ConTeXt, only versions \texttt{0.8.3} and \texttt{0.9.3} are packaged for now; if can use it with \begin{lstlisting} \usemodule[circuitik-0.8.3] \end{lstlisting} @@ -245,7 +248,7 @@ If you have older projects that show compatibility problems, you have two option \subsection{Feedback} -The easiest way to contact the authors is via the official Github repository: \url{https://github.com/circuitikz/circuitikz/issues} +The easiest way to contact the authors is via the official Github repository: \url{https://github.com/circuitikz/circuitikz/issues}. For general help question, a lot of nice people is quite active on \url{https://tex.stackexchange.com/questions/tagged/circuitikz} --- be sure to read the help pages for the site and ask! \subsection{Package options} \label{sec:package-options} @@ -488,19 +491,11 @@ So let's start with the first stage transistor; given that my preferred way of d \end{circuitikz} \end{LTXexample} -Another thing I like to modify with respect to the standard is the position of the arrows in transistors, which are normally in the middle the symbol. Using the following settings will move the arrows to the start or end of the corresponding pin. +Another thing I like to modify with respect to the standard is the position of the arrows in transistors, which are normally in the middle the symbol. Using the following setting (see section~\ref{sec:styling-transistors}) will move the arrows to the start or end of the corresponding pin. -\ctikzset{tripoles/mos style/arrows, -tripoles/npn/arrow pos=0.8, -tripoles/pnp/arrow pos=0.8, -tripoles/nmos/arrow pos=0.8, -tripoles/pmos/arrow pos=0.6, } +\ctikzset{transistors/arrow pos=end} \begin{lstlisting} -\ctikzset{tripoles/mos style/arrows, -tripoles/npn/arrow pos=0.8, -tripoles/pnp/arrow pos=0.8, -tripoles/nmos/arrow pos=0.8, -tripoles/pmos/arrow pos=0.6, } +\ctikzset{transistors/arrow pos=end} \end{lstlisting} The tricky thing about \verb|\killdepth{}| macro is finnicky details; I do not like the standard position of labels on transistors (which is near the collector/drain) so I plot the label at the right of the \texttt{center} anchor. Without the \verb|\killdepth| macro, the labels of different transistor will be adjusted so that the center of the box is at the \texttt{center} anchor, and as an effect, labels with descenders (like Q) will have a different baseline than labels without. You can see this here (it's really subtle): @@ -637,6 +632,50 @@ This is the final circuit, with the nodes still marked: \end{circuitikz} +Finally, if you like a more compact drawing, you can add the options (for example): +\begin{lstlisting} +\begin{circuitikz}[american, scale=0.8] % this will scale only the coordinates + \ctikzset{resistors/scale=0.7, capacitors/scale=0.6} + ... +\end{circuitikz} +\end{lstlisting} + +and you will obtain the following diagram with the exact same code (I just removed the second \verb|\coord| definition to hide the coordinates markings). + +\ctikzset{resistors/scale=0.7, capacitors/scale=0.6} +\def\coord(#1){coordinate(#1)} +\begin{circuitikz}[american, scale=0.8] + \draw (0,0) node[nmos,](Q1){}; + \draw (Q1.center) node[right]{\killdepth{Q1}}; + \draw (Q1.S) to[R, l2^=$R_S$ and \SI{5}{k\ohm}] ++(0,-3) node[vee](VEE){$V_{EE}=\SI{-10}{V}$}; %define VEE level + \draw (Q1.S) to[short] ++(2,0) to[C=$C_1$] ++(0,-1.5) node[ground](GND){}; + \draw (Q1.G) to[short] ++(-1,0) \coord (in) to[R, l2^=$R_G$ and \SI{1}{M\ohm}] (in |- GND) node[ground]{}; + \draw (in) to[C, l_=$C_2$,*-o] ++(-1.5,0) node[left](vi1){$v_i=v_{i1}$}; + \draw (Q1.D) to[R, l2_=$R_D$ and \SI{10}{k\ohm}] ++(0,3) node[vcc](VCC){$V_{CC}=\SI{10}{V}$}; + \draw (Q1.D) to[short, -o] ++(1,0) node[right](vo1){$v_{o1}$}; + % + \path (vo1) -- ++(3,0) \coord(bjt); + % + \draw (bjt) node[npn, ](Q2){}; + \draw (Q2.center) node[right]{\killdepth{Q2}}; + \draw (Q2.B) to[short, -o] ++(-0.5,0) node[left](vi2){$v_{12}$}; + \draw (Q2.E) to[R,l2^=$R_E$ and \SI{9.3}{k\ohm}] (Q2.E |- VEE) node[vee]{}; + \draw (Q2.E) to[short, -o] ++(1,0) node[right](vo2){$v_{o2}$}; + \draw (Q2.C) to[short] (Q2.C |- VCC) node[vcc]{}; + % + \path (vo2) ++(1.5,0) \coord(load); + \draw (load) to[C=$C_3$] ++(1,0) \coord(tmp) to[R=$R_L$] (tmp |- GND) node[ground]{}; + \draw [densely dashed] (vo2) -- (load); + % + \draw [densely dashed] (vo1) -- (vi2); + % + \draw [blockdef](vi1|-VEE) ++(0,-2) \coord(tmp) + -- node[midway, fill=white]{bloque 1} (vo1|- tmp); + \draw [blockdef] (vi2|-VEE) ++(0,-2) \coord(tmp) + -- node[midway, fill=white]{bloque 2} (vo2|- tmp); + +\end{circuitikz} + \endgroup @@ -708,7 +747,9 @@ Pretty much all Circui\TikZ\ relies heavily on \texttt{pgfkeys} for value handli All can be varied using the \verb!\ctikzset! command, anywhere in the code. -\paragraph{Components size} +Note that the details of the parameters that are not described in the manual can change in the future, so be ready to use a fixed version of the package (the ones with the specific number, like \verb|circuitikz-0.9.3|) if you dig into them. + +\paragraph{Components size}\label{sec:pgfcircRlen} Perhaps the most important parameter is \texttt{bipoles/length} (default \SI{1.4}{cm}), which can be interpreted as the length of a resistor (including reasonable connections): all other lengths are relative to this value. For instance: @@ -740,9 +781,36 @@ can be interpreted as the length of a resistor (including reasonable connections ;\end{circuitikz} \end{LTXexample} -\paragraph{Thickness of the lines} (globally) +The changes on \texttt{bipoles/length} should, however, be globally applied to every path, because they affect every element --- including the poles. So you can have artifacts like these: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[ + bigR/.style={R, bipoles/length=3cm} + ] + \draw (0,3) to [bigR, o-o] ++(4,0); + \draw (0,1.5) to [bigR, o-o] ++(4,0) + to[R, o-o] ++(2,0); % will fail here + \draw (0,0) to [R, o-o] ++(4,0); +\end{circuitikz} +\end{LTXexample} + +Several groups of components, on the other hand, have a special \texttt{scale} parameter that can be used safely in this case (starting with 0.9.4 --- more groups of components will be added going forward); the key to use will be explained in the specific description of the components. For example, in the case of resistors you have \texttt{resistors/scale} available: -You can change the thickness of the components lines with the parameter \texttt{bipoles/thickness} (default 2). The number is relative to the thickness of the normal lines leading to the component. +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[ + bigR/.style={R, resistors/scale=1.8} + ] + \draw (0,3) to [bigR, o-o] ++(4,0); + \draw (0,1.5) to [bigR, o-o] ++(4,0) + to[R, o-o] ++(2,0); % ok now + \draw (0,0) to [R, o-o] ++(4,0); +\end{circuitikz} +\end{LTXexample} + +\paragraph{Thickness of the lines}\label{sec:legacy-thickness} (globally) + +The best way to alter the thickness of components is using styling, see section~\ref{sec:styling-thickness}. Alternatively, you can use ``legacy'' classes like \texttt{bipole}, \texttt{tripoles} and so on --- +for example changing the parameter \texttt{bipoles/thickness} (default 2). The number is relative to the thickness of the normal lines leading to the component. \begin{LTXexample}[varwidth=true] \ctikzset{bipoles/thickness=1} @@ -760,6 +828,7 @@ The shape of the components are adjustable with a lot of parameters; in this man \tikz \draw (0,0) to[R=1<\ohm>] (2,0); \end{LTXexample} +It is recommended to use the styling parameters to change the shapes; they are not so fine grained (for example, you can change the width of resistor, not the height at the moment), but they are more stable and coherent across your circuit. \subsubsection{Descriptions} @@ -776,6 +845,8 @@ where you have all the needed information about the bipole, with also no-standar \circuitdescbip*{ammeter}{Ammeter}{} \end{groupdesc} +The \emph{Class} of the component (see section~\ref{sec:styling}) is printed at the end of the description. + \subsection{Node-style components} Node-style components (monopoles, multipoles) can be drawn at a specified point with this syntax, where \verb!#1! is the name of the component: \begin{lstlisting} @@ -808,11 +879,11 @@ Mirroring and flipping of node components is obtained by using the \TikZ\ keys \ \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,2) - node[rground, yscale=-1] {% - \scalebox{1}[-1]{ GND}} - to[R=$R_1$] (0,0) - node[sground] {}; + \draw (0,3) node[op amp]{OA1}; + \draw (3,3) node[op amp, xscale=-1]{OA2}; + \draw (0,0) node[op amp]{OA3}; + \draw (3,0) node[op amp, xscale=-1]{% + \scalebox{-1}[1]{OA4}}; \end{circuitikz} \end{LTXexample} @@ -842,234 +913,294 @@ Sometime, components will expose internal (sub-)shapes that can be accessed with cout 1/180/0.2)[out 1.n/90/0.2, out 4.w/0/0.3] \end{groupdesc} +The \emph{Class} of the component (see section~\ref{sec:styling}) is printed at the end of the description. -\subsection{Grounds and supply voltages} - -For the grounds, the \texttt{center} anchor is put on the connecting point of the symbol, so that you can use them directly in a \texttt{path} specification. +\subsection{Styling circuits and components}\label{sec:relative-size}\label{sec:styling} -\begin{groupdesc} - \circuitdesc{ground}{Ground}{}( center/0/0.3 ) - \circuitdesc{tlground}{Tailless ground}{}( center/0/0.3 ) - \circuitdesc{rground}{Reference ground}{} - \circuitdesc*{sground}{Signal ground}{} - \circuitdesc{tground}{Thicker tailless reference ground}{} - \circuitdesc{nground}{Noiseless ground}{} - \circuitdesc{pground}{Protective ground}{} - \circuitdesc{cground}{Chassis ground\footnotemark}{} - \footnotetext{These last three were contributed by Luigi «Liverpool»} - \circuitdesc{eground}{European style ground}{} - \circuitdesc{eground2}{European style ground, version 2\footnotemark}{} - \footnotetext{These last two were contributed by \texttt{@fotesan}} - \circuitdesc{vcc}{VCC/VDD}{} - \circuitdesc{vee}{VEE/VSS}{} -\end{groupdesc} +You can change the visual appearance of a circuit by using a circuit style different from the default. For styling the circuit, the concept of \emph{class} of a component is key: almost every component has a class, and a style change will affect all the components of that class. -\subsubsection{Power supplies} +\begingroup % protect from style change the rest of the manual -The power supplies are normally drawn with the arrows shown in the list above. -You can change them using all the options of the \texttt{arrows.meta} package (see the Ti\emph{k}Z manual for details) by changing the key \texttt{monopoles/vcc/arrow} and \texttt{monopoles/vee/arrow} (the default for both is \texttt{legacy}, which will use the old code for drawing them). Notes that the anchors are at the start of the connecting lines! +Let's see the effect over a simple circuit\footnote{This is a just an example, the circuit is not intended to be functional.}. -\begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \def\coord(#1){\showcoord(#1)<0:0.3>} - \draw (0,0) - node[vcc](vcc){VCC} \coord(vcc) ++(2,0) - node[vee](vee){VEE} \coord(vee); - \ctikzset{monopoles/vcc/arrow={Stealth[red, width=6pt, length=9pt]}} - \ctikzset{monopoles/vee/arrow={Latex[blue]}} - \draw (0,-2) - node[vcc](vcc){VCC} \coord(vcc) ++(2,0) - node[vee](vee){VEE} \coord(vee); +\def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}} +\newcommand\bjtname[1]{($(#1.C)!0.5!(#1.E)$) node[anchor=west]{\killdepth{#1}} } +\begin{lstlisting}[basicstyle=\scriptsize\ttfamily] +\def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}} +\newcommand\bjtname[1]{($(#1.C)!0.5!(#1.E)$) node[anchor=west]{\killdepth{#1}} } +\begin{circuitikz}[american, cute inductors] + \node [op amp](A1){\texttt{OA1}}; + \draw (A1.-) to[short] ++(0,1) coordinate(tmp) to[R, l_=$R$] (tmp -| A1.out) to[short] (A1.out); + \draw (tmp) to[short] ++(0,1) coordinate(tmp) to[C=$C$] (tmp -| A1.out) to[short] (A1.out); + \draw (A1.+) to [battery2, invert] ++(0,-2.5) node[ground](GND){}; + \draw (A1.-) to [L=$L$] ++(-2,0) coordinate(tmp) to[sV, l=$v_s$, fill=yellow] (tmp |-GND) node[ground]{}; + \draw (A1.out) to[R=$R_s$] ++(2,0) coordinate(bb) to[I, l_=$I_B$, invert] ++(0,2) node[vcc](VCC){}; + \draw (bb) to[D, l=$D$, *-] ++(0,-2) coordinate(bb1) to[R=$R_m$] ++(0,-2) node[vee](VEE){}; + \draw (bb) --++(1,0) node[npn, anchor=B](Q1){} \bjtname{Q1}; + \draw (bb1) --++(1,0) node[pnp, anchor=B](Q2){} \bjtname{Q2}; + \draw (Q1.E) -- (Q2.E) ($(Q1.E)!0.5!(Q2.E)$) to [short, *-o, name=S] ++(2.5,0) + node[right]{$v_{o_Q}$}; + \draw (S.s) to[european resistor, l=$Z_L$, *-] (S.s|-GND) node[ground]{}; + \draw (Q1.C) -- (Q1.C|-VCC) node[vcc]{\SI{5}{V}}; + \draw (Q2.C) -- (Q2.C|-VEE) node[vee]{\SI{-5}{V}}; \end{circuitikz} -\end{LTXexample} +\end{lstlisting} -\subsubsection{Grounds anchors} +This code, with the default parameters, will render like the following image. + +\long\def\tmpcirc#1#2{% Define the circuit to reuse it +% \begin{center} +\begin{circuitikz}[american, cute inductors, #1] + #2 + \node [op amp](A1){\texttt{OA1}}; + \draw (A1.-) to[short] ++(0,1) coordinate(tmp) to[R, l_=$R$] (tmp -| A1.out) to[short] (A1.out); + \draw (tmp) to[short] ++(0,1) coordinate(tmp) to[C=$C$] (tmp -| A1.out) to[short] (A1.out); + \draw (A1.+) to [battery2, invert, l=$v_{io}$] ++(0,-2.5) node[ground](GND){}; + \draw (A1.-) to [L=$L$] ++(-2,0) coordinate(tmp) to[sV, l=$v_s$, fill=yellow] (tmp |-GND) node[ground]{}; + \draw (A1.out) to[R=$R_s$] ++(2,0) coordinate(bb) to[I, l_=$I_B$, invert] ++(0,2) node[vcc](VCC){}; + \draw (bb) to[D, l=$D$, *-] ++(0,-2) coordinate(bb1) to[R=$R_m$] ++(0,-2) node[vee](VEE){}; + \draw (bb) --++(1,0) node[npn, anchor=B](Q1){} \bjtname{Q1}; + \draw (bb1) --++(1,0) node[pnp, anchor=B](Q2){} \bjtname{Q2}; + \draw (Q1.E) -- (Q2.E) ($(Q1.E)!0.5!(Q2.E)$) to [short, *-o, name=S] ++(2.5,0) + node[right]{$v_{o_Q}$}; + \draw (S.s) to[european resistor, l=$Z_L$, *-] (S.s|-GND) node[ground]{}; + \draw (Q1.C) -- (Q1.C|-VCC) node[vcc]{\SI{5}{V}}; + \draw (Q2.C) -- (Q2.C|-VEE) node[vee]{\SI{-5}{V}}; +\end{circuitikz}% +% \end{center} +} -Anchors for grounds are a bit strange, given that they have the \texttt{center} spot at the same location than \texttt{north} and all the ground will develop ``going down'': +\tmpcirc{}{} -\showanchors[baseline]{ground, scale=2}{}(north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, - south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4) -\showanchors[baseline]{ground, scale=2}{}(left/135/0.2, right/45/0.2, center/-180/0.2) +\subsubsection{Relative size}\label{sec:styling-scale} +Component size can be changed globally (see section~\ref{sec:pgfcircRlen}), or you can change their relative size by scaling a family of components by setting the key \texttt{\emph{class}/scale}; for example, you can change the size of all the diodes in your circuit by setting \texttt{diodes/scale} to something different from the default \texttt{1.0}. +Remember that if you use a global scale (be sure to read section~\ref{sec:bugs}!) you change the coordinate only, so using \texttt{scale=0.8} in the environment options you have: -\subsection{Instruments} -\begin{groupdesc} - \circuitdescbip*{ammeter}{Ammeter}{} - \circuitdescbip*{voltmeter}{Voltmeter}{} - \circuitdescbip*{ohmmeter}{Ohmmeter}{} - \circuitdescbip*{rmeter}{Round meter (use \texttt{t=...} for the symbol)}{}(left/135/0.2, right/45/0.2, center/-90/0.3) - \circuitdescbip*{rmeterwa}{Round meter with arrow (use \texttt{t=...} for the symbol)}{}(left/135/0.2, right/45/0.2, center/-90/0.3) - \circuitdescbip*{smeter}{Square meter (use \texttt{t=...} for the symbol)}{}(left/135/0.2, right/45/0.2, center/-90/0.3, in 1/-135/.5, in 2/-45/.5) - \circuitdescbip*{qiprobe}{QUCS-style current probe}{}(left/135/0.2, right/45/0.2, center/-90/0.3) - \circuitdescbip*{qvprobe}{QUCS-style voltage probe}{}(left/135/0.2, right/45/0.2, center/-90/0.3) - \circuitdescbip*{qpprobe}{QUCS-style power probe}{}(left/135/0.2, right/45/0.2, center/-90/0.3, v+/-135/.5, v-/-45/.5) - \circuitdescbip*[oscope]{oscope}{Oscilloscope\footnotemark}{}(left/135/0.2, right/45/0.2, - in 1/-135/0.4, in 2/-45/0.4) - \footnotetext{Suggested by \texttt{@nobrl} on GitHub} - \circuitdescbip{iloop}{Current loop (symbolic)}{}(left/135/0.2, right/45/0.2, center/-90/0.3, i/30/0.4) - \circuitdescbip{iloop2}{Current loop (real)}{}(left/135/0.2, right/-45/0.2, center/-90/0.3, i+/135/0.4, i-/45/0.4) -\end{groupdesc} +\tmpcirc{scale=0.8}{} -\subsubsection{Rotation-invariant elements} +If you want to scale all the circuit, you have to use also \texttt{transform shape}: -The \texttt{oscope} element will not rotate the ``graph'' shown with the component: +\tmpcirc{scale=0.8, transform shape}{} -\begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \foreach \a in {0,45,...,350} { - \draw (0,0) to[oscope] (\a:3); - } -\end{circuitikz} -\end{LTXexample} +Using relative sizes as described in section~\ref{sec:pgfcircRlen} enables your style for the circuit. For example, setting: -The \texttt{rmeter}, \texttt{rmaterwa}, and \texttt{smeter} have the same behavior. +\begin{lstlisting} + \ctikzset{resistors/scale=0.8, % smaller R + capacitors/scale=0.7, % even smaller C + diodes/scale=0.6, % small diodes + transistors/scale=1.3} % bigger BJTs +\end{lstlisting} -\subsubsection{Instruments as node elements} +Will result in a (much more readable in Romano's opinion) circuit: -The node-style usage of the \texttt{oscope} is also interesting, using the additional \texttt{in 1} and \texttt{in 2} anchors; notice that in this case you can use the text content of the node to put labels above it. -Moreover, you can change the size of the oscilloscope by changing \texttt{bipoles/oscope/width} and \texttt{bipoles/oscope/height} keys (which both default at 0.6). +\tmpcirc{scale=0.8, transform shape}{\ctikzset{resistors/scale=0.8, capacitors/scale=0.7, diodes/scale=0.6, transistors/scale=1.3}} -\begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,1) - to[oscope=$C_1$, fill=green!20!gray, name=O1] ++(2,0); - \path (O1.right) - node[ground, scale=0.5, below right=4pt]{}; - \ctikzset{bipoles/oscope/width=1.0} - \draw (1,-1) - node[oscopeshape, fill=yellow!20!orange](O2){$C_2$}; - \draw (O2.in 2) to[short, *-] ++(0,-0.5) node[ground]{}; - \draw (O2.in 1) to[short, *-] ++(0,-0.5) - -- ++(-1,0) node[currarrow, xscale=-1]{}; -\end{circuitikz} -\end{LTXexample} +\textbf{Warning:} relative scaling is meant to work for a reasonable range of stretching and shortening, so try to keep your scale parameter in the \texttt{0.5} to~\texttt{2.0} range (more or less). Bigger or smaller value can result in awkward shapes. -\subsubsection{Measuring voltage and currents, multiple ways} +\subsubsection{Fill color}\label{sec:styling-fillcolor} -This is the classical (legacy) option, with the \texttt{voltmeter} and \texttt{ammeter}. The problem is that elements are intrinsically horizontal and so they looks funny if put in vertical way. +You can also set a default fill color for the components. You can use the keys \texttt{\emph{class}/fill} (which defaults to \texttt{none}, no fill, i.e. transparent component) for all fillable components in the library. -\begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) -- ++(1,0) to[R] ++(2,0) - to [ammeter] ++(0,-2) node[ground]{}; - \draw (1,0) to[voltmeter] ++(0,-2) - node[ground]{}; -\end{circuitikz} -\end{LTXexample} +If you add to the previous styles the following commands: -So the solution is often changing the structure to keep the meters in horizontal position. +\begin{lstlisting} +\ctikzset{ + amplifiers/fill=cyan, + sources/fill=green, + diodes/fill=red, + resistors/fill=violet, +} +\end{lstlisting} + +you will have the following circuit (note that the first generator is \emph{explicitly} set to be yellow, +so if will not be colored green!): + +\tmpcirc{scale=0.8, transform shape}{\ctikzset{resistors/scale=0.8, capacitors/scale=0.7, diodes/scale=0.6, transistors/scale=1.3,% + amplifiers/fill=cyan, sources/fill=green, diodes/fill=red, resistors/fill=violet,}} + +Please use this option with caution. Although two-color circuits can be nice, using more than that can become rapidly unbearable. +Old textbooks used the two-color style quite extensively, filling with a kind of light blue like \texttt{blue!30!white} ``closed'' components, but that was largely to hinder black-and-white photocopying\dots + +\subsubsection{Line thickness}\label{sec:styling-thickness} + +You can change the line thickness for any class of component in an independent way. The default standard thickness of components is defined on a loose ``legacy'' category (like \texttt{bipoles}, \texttt{tripoles} and so on, see section~\ref{sec:legacy-thickness}); to override that you set the key \texttt{\emph{class}/thickness} to any number. The default is \texttt{none}, which means that the old way of selecting thickness is used. + +For example, \emph{amplifiers} have the legacy class of \texttt{tripoles}, as well as transistors and tubes.By default they are drawn with thickness 2 (relative to the base linewidth). To change them to be thicker, you can for example add to the previous style + +\begin{lstlisting} + \ctikzset{amplifier/thickness=4} +\end{lstlisting} + +\tmpcirc{scale=0.8, transform shape}{\ctikzset{resistors/scale=0.8, capacitors/scale=0.7, diodes/scale=0.6, transistors/scale=1.3,% + amplifiers/fill=cyan, sources/fill=green, diodes/fill=red, resistors/fill=violet, + amplifiers/thickness=4}} + +\textbf{Caveat:} not every component has a ``class'', so you have to play with the available ones (it's specified in the component description) and with the absolute values to have the circuit following your taste. A bit of experimentation will create a kind of \emph{style options} that you could use in all your documents. + +\subsubsection{Style files} + +When using styles, it is possible to use \emph{style files} (see section~\ref{sec:writingstylefiles}), that then you can load with the command \verb|\ctikzloadstyle|. For example, in the distribution you have a number of style files: \texttt{legacy}, \texttt{romano}, \texttt{example}.When you load a style name \texttt{\emph{name}}, you will have available a style called \texttt{\emph{name} circuit style} that you can apply to your circuits. +The last style loaded is not enacted --- you have to explicitly do it if you want the style used by default, by putting for example in the preamble: + +\begin{lstlisting} + \ctikzloadstyle{romano} + \tikzset{romano circuit style} +\end{lstlisting} + +Please notice that the style is at \TikZ{} level, not \Circuitikz --- that let's you use it in the top option of the circuit, like: + +\begin{lstlisting} + \begin{circuitikz}[legacy circuit style, + ..., ] + ... + \end{circuitikz} +\end{lstlisting} + + +The \texttt{example} style file will simply make the amplifiers filled with light blue: \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) -- ++(1,0) to[R] ++(2,0) - to [ammeter] ++(2,0) -- - ++(0,-1) node[ground]{}; - \draw (1,0) -- (1,1) to[voltmeter] - ++(2,0) node[ground]{}; + \draw (0,0) node[op amp]{OA1}; +\end{circuitikz} +\ctikzloadstyle{example} +\begin{circuitikz}[example circuit style] + \draw (0,0) node[op amp]{OA1}; \end{circuitikz} \end{LTXexample} +\ctikzloadstyle{legacy} +\ctikzloadstyle{romano} -Since version 0.9.0 you have more options for the measuring instruments. You can use the generic \texttt{rmeterwa} (round meter with arrow), to which you can specify the internal symbol with the option \texttt{t=...} (and is fillable). +The styles \texttt{legacy} is a style that set (most) of the style parameters to the default, and \texttt{romano} is a style used by one of the authors; you can use these styles as is or you can use them to learn to how to write new file style following the instructions in section~\ref{sec:writingstylefiles}. In the next diagrams, the left hand one is using the \texttt{romano circuit style} and the rigth hand one the legacy style. -\begin{LTXexample}[varwidth=true] - \begin{circuitikz}[american] - \draw (0,0) -- ++(1,0) to[R] ++(2,0) - to [rmeterwa, t=A, i=$i$] ++(0,-2) node[ground]{}; - \draw (1,0) to[rmeterwa, t=V, v=$v$] ++(0,-2) - node[ground]{}; -\end{circuitikz} -\end{LTXexample} +\fbox{\tmpcirc{scale=0.6, transform shape, romano circuit style}{}} +\fbox{\tmpcirc{scale=0.6, transform shape, legacy circuit style}{}} -This kind of component will keep the symbol horizontal, whatever the orientation: +\endgroup % restore state before example of sizing -\begin{LTXexample}[varwidth=true] - \begin{circuitikz}[american] - \draw (0,0) -- ++(1,0) to[R] ++(2,0) - to [rmeterwa, t=A, i=$i$] ++(2,0) -- - ++(0,-1) node[ground]{}; - \draw (1,0) -- (1,1) to[rmeterwa, t=V, v^=$v$] - ++(2,0) node[ground]{}; -\end{circuitikz} -\end{LTXexample} +\subsubsection{Style files: how to write them}\label{sec:writingstylefiles} -The plain \texttt{rmeter} is the same, without the measuring arrow: +The best option is to start from \texttt{ctikzstyle-legacy.tex} and edit your style file from it. Then you just put it in your input path and that's all. If you want, you can contribute your style file to the project. -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american] - \draw (0,0) -- ++(1,0) to[R] ++(2,0) - to [rmeter, t=A, i=$i$] ++(0,-2) node[ground]{}; - \draw (1,0) to[rmeter, t=V, v=$v$] ++(0,-2) - node[ground]{}; -\end{circuitikz} -\end{LTXexample} +Basically, to write the style \texttt{example}, you edit a file named \texttt{ctikzstyle-romano.tex} with will define and enact Ti\emph{k}Z style with name \texttt{example circuit style}; basically it has to be something along this: +\lstinputlisting[frame=single, framesep=10pt, basicstyle=\small\ttfamily]{ctikzstyle-example.tex} -If you prefer it, you have the option to use square meters, in order to have more visual difference from generators: +This kind of style will \emph{add} to the existing style. If you want to have a style that \emph{substitute} the current style, you should do like this: -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american] - \draw (0,0) -- ++(1,0) to[R] ++(2,0) - to [smeter, t=A, i=$i$] ++(0,-2) node[ground]{}; - \draw (1,0) to[smeter, t=V, v=$v$] ++(0,-2) - node[ground]{}; -\end{circuitikz} -\end{LTXexample} +\begin{lstlisting}[frame=single, framesep=10pt, basicstyle=\small\ttfamily] +\ctikzloadstyle{legacy}% start from a know state +\tikzset{romano circuit style/.style={% +legacy circuit style, % load the legacy style +\circuitikzbasekey/.cd,% +% Resistors +resistors/scale=0.8, +[...] +\end{lstlisting} -Another possibility is to use QUCS\footnote{QUCS is an open source circuit simulator: \url{http://qucs.sourceforge.net/}}-style probes, which have the nice property of explictly showing the type of connection (in series or parallel) of the meter: -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american] - \draw (0,0) -- ++(1,0) to[R] ++(2,0) - to [qiprobe, l=$i$] ++(0,-2) node[ground]{}; - \draw (1,0) to[qvprobe, l=$v$] ++(0,-2) - node[ground]{}; -\end{circuitikz} -\end{LTXexample} +\subsection{Grounds and supply voltages} -If you want to explicitly show a power measurement, you can use the power probe \texttt{qpprobe} and using the additional anchors \texttt{v+} and \texttt{v-} : +\subsubsection{Grounds} -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american] - \draw (0,0) to[short,-*] ++(1,0) coordinate(b) - to[R] ++(2,0) to [qpprobe, l=$i$, a=$v$, name=P] - ++(0,-2.5) node[ground](GND){}; - \draw (P.v-) -| ++(-0.5,-1) coordinate(a) - to [short, -*] (a-|GND); - \draw (P.v+) -| (b); -\end{circuitikz} -\end{LTXexample} +For the grounds, the \texttt{center} anchor is put on the connecting point of the symbol, so that you can use them directly in a \texttt{path} specification. -The final possibility is to use oscilloscopes. For example: +\begin{groupdesc} + \circuitdesc{ground}{Ground}{}( center/0/0.3 ) + \circuitdesc{tlground}{Tailless ground}{}( center/0/0.3 ) + \circuitdesc{rground}{Reference ground}{} + \circuitdesc*{sground}{Signal ground}{} + \circuitdesc{tground}{Thicker tailless reference ground}{} + \circuitdesc{nground}{Noiseless ground}{} + \circuitdesc*{pground}{Protective ground}{} + \circuitdesc{cground}{Chassis ground\footnotemark}{} + \footnotetext{These last three were contributed by Luigi «Liverpool»} + \circuitdesc{eground}{European style ground}{} + \circuitdesc{eground2}{European style ground, version 2\footnotemark}{} + \footnotetext{These last two were contributed by \texttt{@fotesan}} +\end{groupdesc} + +\paragraph{Grounds anchors} + +Anchors for grounds are a bit strange, given that they have the \texttt{center} spot at the same location than \texttt{north} and all the ground will develop ``going down'': + +\showanchors[baseline]{ground, scale=1.5}{}(north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, + south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4) +\showanchors[baseline]{ground, scale=1.5}{}(left/135/0.2, right/45/0.2, center/-180/0.2) + +\paragraph{Grounds customization} + +You can change the scale of these components (all the ground symbols together) by setting the key \texttt{grounds/scale} (default \texttt{1.0}). + +\subsubsection{Power supplies} + +\begin{groupdesc} + \circuitdesc{vcc}{VCC/VDD}{} + \circuitdesc{vee}{VEE/VSS}{} +\end{groupdesc} + +The power supplies are normally drawn with the arrows shown in the list above. + +\paragraph{Power supply anchors} + +They are similar to grounds anchors, and the geographical anchors are correct only for the default arrow. + +\showanchors[baseline]{vcc, scale=1.5}{}(north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, + south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4) +\showanchors[baseline]{vcc, scale=1.5}{}(left/135/0.2, right/45/0.2, center/-180/0.2) + + +\paragraph{Power supplies customization} + +You can change the scale of the power supplies by setting the key \texttt{power supplies/scale} (default \texttt{1.0}). + +Given that the power supply symbols are basically arrows, you can change them using all the options of the \texttt{arrows.meta} package (see the Ti\emph{k}Z manual for details) by changing the keys \texttt{monopoles/vcc/arrow} and \texttt{monopoles/vee/arrow} (the default for both is \texttt{legacy}, which will use the old code for drawing them). +Note that the anchors are at the start of the connecting lines, and that geographical anchors are just approximation if you change the arrow symbol! \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american] - \draw (0,0) -- ++(1,0) to[R] ++(3,0) - to [iloop, mirror, name=I] ++(0,-2) - node[ground] (GND){}; - \draw (1,0) to[oscope, v=$v$] ++(0,-2) - node[ground]{}; - \draw (I.i) -- ++(-0.5,0) node[oscopeshape, anchor=right, name=O]{}; - \draw (O.south) -- (O.south |- GND) node[ground]{}; +\begin{circuitikz} + \def\coord(#1){\showcoord(#1)<0:0.3>} + \draw (0,0) + node[vcc](vcc){VCC} \coord(vcc) ++(2,0) + node[vee](vee){VEE} \coord(vee); + \ctikzset{monopoles/vcc/arrow={Stealth[red, width=6pt, length=9pt]}} + \ctikzset{monopoles/vee/arrow={Latex[blue]}} + \draw (0,-2) + node[vcc](vcc){VCC} \coord(vcc) ++(2,0) + node[vee](vee){VEE} \coord(vee); \end{circuitikz} \end{LTXexample} -Or, if you want a more physical structure for the measurement setup: +However, arrows in \TikZ{} are in the same class with the line thickness, so they do not scale with neither the class \texttt{power supplies} scale nor the global scale parameter (you should use \texttt{transform canvas={scale\dots}} for this). -\begin{LTXexample}[varwidth=true, pos=b] -\begin{circuitikz}[american] - \draw (0,0) -- ++(1,0) to[R] ++(3,0) to [iloop2, name=I] ++(0,-2) - node[ground] (GND){}; - \ctikzset{bipoles/oscope/width=1.6}\ctikzset{bipoles/oscope/height=1.2} - \node [oscopeshape, fill=green!10](O) at (6,2){}; - \node [bnc, xscale=-1, anchor=zero](bnc1) at (O.in 1){}; - \node [bnc, , anchor=zero, rotate=-90](bnc2) at (O.in 2){}; - \draw [-latexslim] (bnc1.hot) -| (1,0); - \draw (bnc2.hot) |- (I.i+); - \draw (I.i-) node[ground, scale=0.5]{}; +If you want that the arrows behave like the legacy symbols (which are shapes), \emph{only in the arrow definitions}, you can use the special length parameter \verb|\scaledwidth|\footnote{Thanks to @Schrödinger's cat on \href{https://tex.stackexchange.com/a/506249/38080}{\TeX{} stackexchange site}} in the arrow definition, which correspond to the width of the legacy \texttt{vcc} or \texttt{vee}. Compare the effects on the following circuit. + +\begin{LTXexample}[pos=t, basicstyle=\small\ttfamily] +\ctikzset{% + monopoles/vcc/arrow={Triangle[width=0.8*\scaledwidth, length=\scaledwidth]}, + monopoles/vee/arrow={Triangle[width=6pt, length=8pt]}, +} +\begin{circuitikz}[baseline=(vo.center)] + \node [ocirc](TW) at (0,0) {}; + \draw (TW.east) -- ++(1,0) node[midway, above]{$v_i$} node[op amp, anchor=-](A1){}; + \draw (A1.up) -- ++(0, 0.3) node[vcc]{\SI{+10}{V}}; + \draw (A1.down) -- ++(0,-0.3) node[vee]{\SI{-10}{V}}; + \draw (A1.+) -- ++(-0.5,0) to[battery2, invert, l_=\SI{2}{V}] ++(0,-1) node[ground]{}; + \draw (A1.out) to[short, -o] ++(0.5,0) node[above](vo){$v_o$}; +\end{circuitikz} \qquad +\begin{circuitikz}[baseline=(vo.center), scale=0.6, transform shape] + \node [ocirc](TW) at (0,0) {}; + \draw (TW.east) -- ++(1,0) node[midway, above]{$v_i$} node[op amp, anchor=-](A1){}; + \draw (A1.up) -- ++(0, 0.3) node[vcc]{\SI{+10}{V}}; + \draw (A1.down) -- ++(0,-0.3) node[vee]{\SI{-10}{V}}; + \draw (A1.+) -- ++(-0.5,0) to[battery2, invert, l_=\SI{2}{V}] ++(0,-1) node[ground]{}; + \draw (A1.out) to[short, -o] ++(0.5,0) node[above](vo){$v_o$}; \end{circuitikz} \end{LTXexample} + \subsection{Resistive bipoles} \begin{groupdesc} @@ -1078,8 +1209,6 @@ Or, if you want a more physical structure for the measurement setup: \circuitdescbip*{generic}{Generic (symmetric) bipole}{} \circuitdescbip*{tgeneric}{Tunable generic bipole}{} \circuitdescbip*{ageneric}{Generic asymmetric bipole}{} - \circuitdescbip{fullgeneric}{Generic asymmetric bipole (full)}{} - \circuitdescbip{tfullgeneric}{Tunable generic bipole (full)}{} \circuitdescbip*{memristor}{Memristor}{Mr} \end{groupdesc} @@ -1106,16 +1235,13 @@ Other miscellaneous resistor-like devices: \begin{groupdesc} \circuitdescbip*{varistor}{Varistor}{} \circuitdescbip*[photoresistor]{phR}{Photoresistor}{photoresistor} - \circuitdescbip{thermocouple}{Thermocouple}{} \circuitdescbip*[thermistor]{thR}{Thermistor}{thermistor} \circuitdescbip*[thermistorptc]{thRp}{PTC thermistor}{thermistor ptc} \circuitdescbip*[thermistorntc]{thRn}{NTC thermistor}{thermistor ntc} - \circuitdescbip*{fuse}{Fuse}{} - \circuitdescbip*{afuse}{Asymmetric fuse}{asymmetric fuse} \end{groupdesc} -\subsubsection{Generic sensors anchors} -Generic sensors have an extra label to help positioning the type of dependence, if needed: +\subsubsection{Generic sensors anchors}\label{sec:sensors-anchors} +Generic sensors have an extra anchor named \texttt{label} to help position the type of dependence, if needed: \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -1123,12 +1249,133 @@ Generic sensors have an extra label to help positioning the type of dependence, \node [font=\tiny, right] at(mySR.label) {-t\si{\degree}}; \draw (0,0) to[sL, l=$L$, name=mySL] ++(3,0); \node [draw, circle, inner sep=2pt] at(mySL.label) {}; + \draw (0,-2) to[sC, l=$C$, name=mySC] ++(3,0); + \node [font=\tiny, below right, inner sep=0pt] at(mySC.label) {+H\si{\%}}; \end{circuitikz} \end{LTXexample} The anchor is positioned just on the corner of the segmented line crossing the component. +\subsubsection{Resistive components customization} + +You can change the scale of these components (all the resistive bipoles together) by setting the key \texttt{resistors/scale} (default \texttt{1.0}). Similarly, you can change the widths by setting \texttt{resistors/width} (default \texttt{0.8}). + +You can change the width of these components (all the resistive bipoles together) by setting the key \texttt{resistors/width} to something different from the default \texttt{0.8}. + +For the american style resistors, you can change the number of ``zig-zags'' by setting the key +\texttt{resistors/zigs} (default value \texttt{3}). + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[ + longpot/.style = {pR, resistors/scale=0.75, + resistors/width=1.6, resistors/zigs=6}] + \draw (0,1.5) to[R, l=$R$] ++(4,0); + \draw (0,0) to[longpot, l=$P$] ++(4,0); + \ctikzset{resistors/scale=1.5} + \draw (0,-1.5) to[R, l=$R$] ++(4,0); +\end{circuitikz} +\end{LTXexample} + +\subsection{Capacitors and inductors: dynamical bipoles} + +\subsubsection{Capacitors} + +\begin{groupdesc} + \circuitdescbip{capacitor}{Capacitor}{C} + \circuitdescbip[pcapacitor]{polar capacitor}{Polar capacitor}{pC} + \circuitdescbip*{ecapacitor}{Electrolytic capacitor}{eC,elko} + \circuitdescbip[vcapacitor]{variable capacitor}{Variable capacitor}{vC} + \circuitdescbip[capacitivesens]{capacitive sensor}{Capacitive sensor}{sC}(label/0/0.3) + \circuitdescbip*{piezoelectric}{Piezoelectric Element}{PZ} +\end{groupdesc} + +\subsubsection{Capacitive sensors anchors} + +For capacitive sensors, see section~\ref{sec:sensors-anchors}. + +\subsubsection{Capacitors customizations} + +You can change the scale of the capacitors by setting the key \texttt{capacitors/scale} to something different from the default \texttt{1.0}. + +\subsubsection{Inductors} + +If the \texttt{cuteinductors} option is active (default behaviour), or the style \texttt{[cute inductors]} is used, the inductors are displayed as follows: +\begin{groupdesc} + \ctikzset{inductor=cute} + \circuitdescbip[cuteinductor]{L}{Inductor}{cute inductor} + \circuitdescbip[cutechoke]{cute choke}{Choke}{} + \circuitdescbip[vcuteinductor]{vL}{Variable inductor}{variable cute inductor} + \circuitdescbip[scuteinductor]{sL}{Inductive sensor}{cute inductive sensor}( label/0/0.3 ) +\end{groupdesc} + +If the \texttt{americaninductors} option is active (or the style \texttt{[american inductors]} is used), the inductors are displayed as follows: +\begin{groupdesc} + \ctikzset{inductor=american} + \circuitdescbip[americaninductor]{L}{Inductor}{american inductor} + \circuitdescbip[vamericaninductor]{vL}{Variable inductor}{variable american inductor} + \circuitdescbip[samericaninductor]{sL}{Inductive sensor}{american inductive sensor}( label/0/0.3 ) +\end{groupdesc} + +Finally, if the \texttt{europeaninductors} option is active (or the style \texttt{[european inductors]} is used), the inductors are displayed as follows: +\begin{groupdesc} + \ctikzset{inductor=european} + \circuitdescbip[fullgeneric]{L}{Inductor}{european inductor} + \circuitdescbip[tfullgeneric]{vL}{Variable inductor}{variable european inductor} + \circuitdescbip[sfullgeneric]{sL}{Inductive sensor}{european inductive sensor}( label/0/0.3 ) + \ctikzset{inductor=cute} % back to default +\end{groupdesc} + +\subsubsection{Inductive sensors anchors} + +For inductive sensors, see section~\ref{sec:sensors-anchors}. + +\subsubsection{Inductors customizations}\label{sec:tweak-l} + +You can change the scale of the inductors by setting the key \texttt{inductors/scale} to something different from the default \texttt{1.0}. + +You can change the width of these components (all the inductors together, unless you use style or scoping) by setting the key \texttt{inductors/width} to something different from the default, which is \texttt{0.8} for american and european inductors, and \texttt{0.6} for cute inductors. + +Moreover, you can change the number of ``coils'' drawn by setting the key +\texttt{inductors/coils} (default value \texttt{5} for cute inductors and \texttt{4} for american ones). + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[ + longL/.style = {cute choke, inductors/scale=0.75, + inductors/width=1.6, inductors/coils=9}] + \draw (0,1.5) to[L, l=$L$] ++(4,0); + \draw (0,0) to[longL, l=$L$] ++(4,0); + \ctikzset{inductors/scale=1.5, inductor=american} + \draw (0,-1.5) to[L, l=$L$] ++(4,0); +\end{circuitikz} +\end{LTXexample} + +Chokes (which comes only in the \texttt{cute} style) can have single and double lines, and can have the line thickness adjust (the value is relative to the thickness of the inductor). + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american] + \draw (0,0) to[cute choke] ++(3,0); + \draw (0,-1) to[cute choke, twolineschoke] ++(3,0); + + \ctikzset{bipoles/cutechoke/cthick=2, twolineschoke} + + \draw (0,-2) to[cute choke] ++(3,0); + \draw (0,-3) to[cute choke, onelinechoke] ++(3,0); +\end{circuitikz} +\end{LTXexample} + \subsection{Diodes and such} + +There are three basic styles for diodes: \texttt{empty} (fillable in color), \texttt{full} (completely filled with the draw color) and \texttt{stroke} (empty, but with a line across them). + +You can switch between the styles setting the key \texttt{diode} (for example \verb|\ctikzset{diode=full}| or \texttt{empty} or \texttt{stroke}, or with the styles \texttt{full diodes}, \texttt{empty diodes} and \texttt{stroke diodes}. + + +To use the default element, simply use the name shown for the empty diodes without the final ``o'' --- that is \texttt{D}, \texttt{sD}, and so on. The names shown in the following tables will draw the specified diode independently on the style chosen (that is, \texttt{leD*} is always a full LED diode). + +\begin{framed} +The package options \texttt{fulldiode}, \texttt{strokediode}, and \texttt{emptydiode} (and the styles \texttt{[full diodes]}, \texttt{[stroke diodes]}, and \texttt{[empty diodes]}) define which shape will be used by abbreviated commands such that \texttt{D}, \texttt{sD}, \texttt{zD}, \texttt{zzD}, \texttt{tD}, \texttt{pD}, \texttt{leD}, \texttt{VC}, \texttt{Ty},\texttt{Tr} (no stroke symbol available!). +\end{framed} + \begin{groupdesc} \circuitdescbip*[emptydiode] {empty diode}{Empty diode}{Do} \circuitdescbip*[emptysdiode]{empty Schottky diode}{Empty Schottky diode}{sDo} @@ -1163,12 +1410,14 @@ These shapes have no exact node-style counterpart, because the stroke line is bu \circuitdescbip*[emptyvarcap]{stroke varcap}{Stroke varcap}{VC-} \end{groupdesc} -\subsection{Tripole-like diodes}\label{sec:othertrip} The following tripoles are entered with the usual command, of the form +\subsubsection{Tripole-like diodes}\label{sec:othertrip} The following tripoles are entered with the usual command, of the form \texttt{to[Tr, \dots]}. + + \begin{groupdesc} - \circuitdescbip*[emptytriac]{triac}{Standard triac (shape depends on package option)}{Tr}( G/0/0.3 ) + \circuitdescbip*[emptytriac]{triac}{Standard triac (shape depends on package option)}{Tr}( G/0/0.3, anode/-90/0.2, cathode/-90/0.2) \circuitdescbip*[emptytriac]{empty triac}{Empty triac}{Tro}( gate/0/0.3 ) \circuitdescbip[fulltriac]{full triac}{Full triac}{Tr*} - \circuitdescbip*[emptythyristor]{thyristor}{Standard thyristor (shape depends on package option)}{Ty} + \circuitdescbip*[emptythyristor]{thyristor}{Standard thyristor (shape depends on package option)}{Ty}( G/0/0.3, anode/-90/0.2, cathode/-90/0.2) \circuitdescbip*[emptythyristor]{empty thyristor}{Empty thyristor}{Tyo} \circuitdescbip[fullthyristor]{full thyristor}{Full thyristor}{Ty*} \circuitdescbip*[emptythyristor]{stroke thyristor}{Stroke thyristor}{Ty-} @@ -1186,54 +1435,33 @@ When inserting a thrystor, a triac or a potentiometer, one needs to refer to the ;\end{circuitikz} \end{LTXexample} +\subsubsection{Diode customizations}\label{sec:tweak-d} -\begin{framed} -The package options \texttt{fulldiode}, \texttt{strokediode}, and \texttt{emptydiode} (and the styles \texttt{[full diodes]}, \texttt{[stroke diodes]}, and \texttt{[empty diodes]}) define which shape will be used by abbreviated commands such that \texttt{D}, \texttt{sD}, \texttt{zD}, \texttt{zzD}, \texttt{tD}, \texttt{pD}, \texttt{leD}, \texttt{VC}, \texttt{Ty},\texttt{Tr} (no stroke symbol available!). -\end{framed} - +You can change the scale of the diodes by setting the key \texttt{diodes/scale} to something different from the default \texttt{1.0}. In Romano's opinion, diodes are somewhat big with the default style of the package, so a setting like \verb|\ctikzset{diode/scale=0.6}| is recommended. -\subsection{Capacitors and inductors: dynamical bipoles} -\begin{groupdesc} - \circuitdescbip{capacitor}{Capacitor}{C} - \circuitdescbip[polarcapacitor]{polar capacitor}{Polar capacitor}{pC} - \circuitdescbip*{ecapacitor}{Electrolytic capacitor}{eC,elko} - \circuitdescbip[vcapacitor]{variable capacitor}{Variable capacitor}{vC} - \circuitdescbip[capacitivesens]{capacitive sensor}{Capacitive sensor}{sC}( label/0/0.3 ) - \circuitdescbip*{piezoelectric}{Piezoelectric Element}{PZ} -\end{groupdesc} +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,1) to[D, l=$D$] ++(2,0) + node[npn, anchor=B]{}; + \ctikzset{diodes/scale=0.6} + \draw (0,-1) to[D, l=$D$] ++(2,0) + node[npn, anchor=B]{}; +\end{circuitikz} +\end{LTXexample} -If (default behaviour) \texttt{cuteinductors} option is active (or the style \texttt{[cute inductors]} is used), the inductors are displayed as follows: -\begin{groupdesc} - \ctikzset{inductor=cute} - \circuitdescbip[cuteinductor]{L}{Inductor}{cute inductor} - \circuitdescbip[cutechoke]{cute choke}{Choke}{} - \circuitdescbip[vcuteinductor]{vL}{Variable inductor}{variable cute inductor} - \circuitdescbip[scuteinductor]{sL}{Inductive sensor}{cute inductive sensor}( label/0/0.3 ) -\end{groupdesc} +\subsection{Sources and generators} -If \texttt{americaninductors} option is active (or the style \texttt{[american inductors]} is used), the inductors are displayed as follows: -\begin{groupdesc} - \ctikzset{inductor=american} - \circuitdescbip[americaninductor]{L}{Inductor}{american inductor} - \circuitdescbip[vamericaninductor]{vL}{Variable inductor}{variable american inductor} - \circuitdescbip[samericaninductor]{sL}{Inductive sensor}{american inductive sensor}( label/0/0.3 ) -\end{groupdesc} +Notice that source and generators are divided in three classes that can be styled independently: traditional battery symbols (class \texttt{batteries}), independent generators (class \texttt{sources}) and dependent generators (class \texttt{csources}). This is because they are often treated differently, and so you can choose to, for example, fill the dependent sources but not the independent ones. -Finally, if \texttt{europeaninductors} option is active (or the style \texttt{[european inductors]} is used), the inductors are displayed as follows: -\begin{groupdesc} - \ctikzset{inductor=european} - \circuitdescbip[fullgeneric]{L}{Inductor}{european inductor} - \circuitdescbip[tfullgeneric]{vL}{Variable inductor}{variable european inductor} - \circuitdescbip[sfullgeneric]{sL}{Inductive sensor}{european inductive sensor}( label/0/0.3 ) - \ctikzset{inductor=cute} % back to default -\end{groupdesc} - - -\subsection{Stationary sources} +\subsubsection{Batteries} \begin{groupdesc} \circuitdescbip{battery}{Battery}{} \circuitdescbip{battery1}{Single battery cell}{} \circuitdescbip{battery2}{Single battery cell}{} +\end{groupdesc} + +\subsubsection{Stationary sources} +\begin{groupdesc} \circuitdescbip*[vsource]{european voltage source}{Voltage source (european style)}{} \circuitdescbip*[vsourceC]{cute european voltage source}{Voltage source (cute european style)}{vsourceC, ceV} \circuitdescbip*[vsourceAM]{american voltage source}{Voltage source (american style)}{} @@ -1249,13 +1477,21 @@ Similarly, if (default behaviour) \texttt{europeanvoltages} option is active (or \end{framed} -\subsection{Sinusoidal sources} Here because I was asked for them. But how do you distinguish one from the other?! +\subsubsection{Sinusoidal sources}\label{sec:sinusoidal-vi} These two are basically the same symbol; to distinguish among them, you have to add a label, which will be a voltage or a current. + \begin{groupdesc} \circuitdescbip*[vsourcesin]{sinusoidal voltage source}{Sinusoidal voltage source}{vsourcesin, sV} \circuitdescbip*[isourcesin]{sinusoidal current source}{Sinusoidal current source}{isourcesin, sI} \end{groupdesc} -\subsection{Controlled sources} +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american] + \draw (0,1) to[sV=$V$] ++(3,0); + \draw (0,0) to[sI=$I$] ++(3,0); +\end{circuitikz} +\end{LTXexample} + +\subsubsection{Controlled sources} \begin{groupdesc} \circuitdescbip*[cvsource]{european controlled voltage source}{Controlled voltage source (european style)}{} \circuitdescbip*[cvsourceC]{cute european controlled voltage source}{Voltage source (cute european style)}{cvsourceC, cceV} @@ -1263,6 +1499,7 @@ Similarly, if (default behaviour) \texttt{europeanvoltages} option is active (or \circuitdescbip*[cisource]{european controlled current source}{Controlled current source (european style)}{} \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*[ecsource]{empty controlled source}{Empty controlled source}{ecsource} \end{groupdesc} \begin{framed} @@ -1271,6 +1508,8 @@ If (default behaviour) \texttt{europeancurrents} option is active (or the style Similarly, if (default behaviour) \texttt{europeanvoltages} option is active (or the style \texttt{[european voltages]} is used), the shorthands \texttt{controlled voltage source}, \texttt{cvsource}, and \texttt{cV} are equivalent to \texttt{european controlled voltage source}. Otherwise, if \texttt{americanvoltages} option is active (or the style \texttt{[american voltages]} is used) they are equivalent to \texttt{american controlled voltage source}. \end{framed} +The following two behave like the corresponding independent sources, see section~\ref{sec:sinusoidal-vi}. + \begin{groupdesc} \circuitdescbip*[cvsourcesin]{controlled sinusoidal voltage source}{Controlled sinusoidal voltage source}{controlled vsourcesin, cvsourcesin, csV} \circuitdescbip*[cisourcesin]{controlled sinusoidal current source}{Controlled sinusoidal current source}{controlled isourcesin, cisourcesin, csI} @@ -1278,7 +1517,7 @@ Similarly, if (default behaviour) \texttt{europeanvoltages} option is active (or -\subsection{Noise sources} +\subsubsection{Noise sources} In this case, the ``direction'' of the source is undefined. Noise sources are filled in gray by default, but if you choose the dashed style, they become fillable. @@ -1324,7 +1563,7 @@ Notice that if you choose the dashed style, the noise sources are fillable: \end{circuitikz} \end{LTXexample} -\subsection{Special sources} +\subsubsection{Special sources} \begin{groupdesc} \circuitdescbip*[vsourcesquare]{square voltage source}{Square voltage source}{vsourcesquare, sqV} \circuitdescbip*{vsourcetri}{Triangle voltage source}{tV} @@ -1334,7 +1573,7 @@ Notice that if you choose the dashed style, the noise sources are fillable: \circuitdescbip*[oosource]{voosource}{Double Zero style voltage source}{} \end{groupdesc} -\subsection{DC sources} +\subsubsection{DC sources} \begin{groupdesc} \circuitdescbip*{dcvsource}{DC voltage source}{} \circuitdescbip*{dcisource}{DC current source}{} @@ -1351,6 +1590,191 @@ The size of the broken part of the DC current source is configurable by changing \end{circuitikz} \end{LTXexample} +\subsubsection{Sources customizations}\label{sec:tweak-sources} + +You can change the scale of the batteries by setting the key \texttt{batteries/scale}, for the controlled (dependent) sources with \texttt{csources/scale}, and for all the other independent sources and generators with \texttt{sources/scale}, to something different from the default \texttt{1.0}. + +\subsection{Instruments} +\begin{groupdesc} + \circuitdescbip*{ammeter}{Ammeter}{} + \circuitdescbip*{voltmeter}{Voltmeter}{} + \circuitdescbip*{ohmmeter}{Ohmmeter}{} + \circuitdescbip*{rmeter}{Round meter (use \texttt{t=...} for the symbol)}{}(left/135/0.2, right/45/0.2, center/-90/0.3) + \circuitdescbip*{rmeterwa}{Round meter with arrow (use \texttt{t=...} for the symbol)}{}(left/135/0.2, right/45/0.2, center/-90/0.3) + \circuitdescbip*{smeter}{Square meter (use \texttt{t=...} for the symbol)}{}(left/135/0.2, right/45/0.2, center/-90/0.3, in 1/-135/.5, in 2/-45/.5) + \circuitdescbip*{qiprobe}{QUCS-style current probe}{}(left/135/0.2, right/45/0.2, center/-90/0.3) + \circuitdescbip*{qvprobe}{QUCS-style voltage probe}{}(left/135/0.2, right/45/0.2, center/-90/0.3) + \circuitdescbip*{qpprobe}{QUCS-style power probe}{}(left/135/0.2, right/45/0.2, center/-90/0.3, v+/-135/.5, v-/-45/.5) + \circuitdescbip*[oscope]{oscope}{Oscilloscope\footnotemark}{}(left/135/0.2, right/45/0.2, + in 1/-135/0.4, in 2/-45/0.4) + \footnotetext{Suggested by \texttt{@nobrl} on GitHub} + \circuitdescbip{iloop}{Current loop (symbolic)}{}(left/135/0.2, right/45/0.2, center/-90/0.3, i/30/0.4) + \circuitdescbip{iloop2}{Current loop (real)}{}(left/135/0.2, right/-45/0.2, center/-90/0.3, i+/135/0.4, i-/45/0.4) +\end{groupdesc} + +\subsubsection{Instruments customizations}\label{sec:tweak-instruments} + +You can change the scale of all the instruments (including the current loops) by setting the key \texttt{instruments/scale} to something different from the default \texttt{1.0}. + +\subsubsection{Rotation-invariant elements} + +The \texttt{oscope} element will not rotate the ``graph'' shown with the component: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \foreach \a in {0,45,...,350} { + \draw (0,0) to[oscope] (\a:3); + } +\end{circuitikz} +\end{LTXexample} + +The \texttt{rmeter}, \texttt{rmaterwa}, and \texttt{smeter} have the same behavior. + +\subsubsection{Instruments as node elements} + +The node-style usage of the \texttt{oscope} is also interesting, using the additional \texttt{in 1} and \texttt{in 2} anchors; notice that in this case you can use the text content of the node to put labels above it. +Moreover, you can change the size of the oscilloscope by changing \texttt{bipoles/oscope/width} and \texttt{bipoles/oscope/height} keys (which both default to 0.6). + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,1) + to[oscope=$C_1$, fill=green!20!gray, name=O1] ++(2,0); + \path (O1.right) + node[ground, scale=0.5, below right=4pt]{}; + \ctikzset{bipoles/oscope/width=1.0} + \draw (1,-1) + node[oscopeshape, fill=yellow!20!orange](O2){$C_2$}; + \draw (O2.in 2) to[short, *-] ++(0,-0.5) node[ground]{}; + \draw (O2.in 1) to[short, *-] ++(0,-0.5) + -- ++(-1,0) node[currarrow, xscale=-1]{}; +\end{circuitikz} +\end{LTXexample} + +\subsubsection{Measuring voltage and currents, multiple ways} + +This is the classical (legacy) option, with the \texttt{voltmeter} and \texttt{ammeter}. The problem is that elements are intrinsically horizontal, so they look funny if put in vertically. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) -- ++(1,0) to[R] ++(2,0) + to [ammeter] ++(0,-2) node[ground]{}; + \draw (1,0) to[voltmeter] ++(0,-2) + node[ground]{}; +\end{circuitikz} +\end{LTXexample} + +So the solution is often changing the structure to keep the meters in horizontal position. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) -- ++(1,0) to[R] ++(2,0) + to [ammeter] ++(2,0) -- + ++(0,-1) node[ground]{}; + \draw (1,0) -- (1,1) to[voltmeter] + ++(2,0) node[ground]{}; +\end{circuitikz} +\end{LTXexample} + +Since version 0.9.0 you have more options for the measuring instruments. You can use the generic \texttt{rmeterwa} (round meter with arrow), to which you can specify the internal symbol with the option \texttt{t=...} (and is fillable). + +\begin{LTXexample}[varwidth=true] + \begin{circuitikz}[american] + \draw (0,0) -- ++(1,0) to[R] ++(2,0) + to [rmeterwa, t=A, i=$i$] ++(0,-2) node[ground]{}; + \draw (1,0) to[rmeterwa, t=V, v=$v$] ++(0,-2) + node[ground]{}; +\end{circuitikz} +\end{LTXexample} + +This kind of component will keep the symbol horizontal, whatever the orientation: + +\begin{LTXexample}[varwidth=true] + \begin{circuitikz}[american] + \draw (0,0) -- ++(1,0) to[R] ++(2,0) + to [rmeterwa, t=A, i=$i$] ++(2,0) -- + ++(0,-1) node[ground]{}; + \draw (1,0) -- (1,1) to[rmeterwa, t=V, v^=$v$] + ++(2,0) node[ground]{}; +\end{circuitikz} +\end{LTXexample} + +The plain \texttt{rmeter} is the same, without the measuring arrow: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american] + \draw (0,0) -- ++(1,0) to[R] ++(2,0) + to [rmeter, t=A, i=$i$] ++(0,-2) node[ground]{}; + \draw (1,0) to[rmeter, t=V, v=$v$] ++(0,-2) + node[ground]{}; +\end{circuitikz} +\end{LTXexample} + + +If you prefer it, you have the option to use square meters, in order to have more visual difference from generators: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american] + \draw (0,0) -- ++(1,0) to[R] ++(2,0) + to [smeter, t=A, i=$i$] ++(0,-2) node[ground]{}; + \draw (1,0) to[smeter, t=V, v=$v$] ++(0,-2) + node[ground]{}; +\end{circuitikz} +\end{LTXexample} + +Another possibility is to use QUCS\footnote{QUCS is an open source circuit simulator: \url{http://qucs.sourceforge.net/}}-style probes, which have the nice property of explictly showing the type of connection (in series or parallel) of the meter: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american] + \draw (0,0) -- ++(1,0) to[R] ++(2,0) + to [qiprobe, l=$i$] ++(0,-2) node[ground]{}; + \draw (1,0) to[qvprobe, l=$v$] ++(0,-2) + node[ground]{}; +\end{circuitikz} +\end{LTXexample} + +If you want to explicitly show a power measurement, you can use the power probe \texttt{qpprobe} and using the additional anchors \texttt{v+} and \texttt{v-} : + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american] + \draw (0,0) to[short,-*] ++(1,0) coordinate(b) + to[R] ++(2,0) to [qpprobe, l=$i$, a=$v$, name=P] + ++(0,-2.5) node[ground](GND){}; + \draw (P.v-) -| ++(-0.5,-1) coordinate(a) + to [short, -*] (a-|GND); + \draw (P.v+) -| (b); +\end{circuitikz} +\end{LTXexample} + +The final possibility is to use oscilloscopes. For example: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american] + \draw (0,0) -- ++(1,0) to[R] ++(3,0) + to [iloop, mirror, name=I] ++(0,-2) + node[ground] (GND){}; + \draw (1,0) to[oscope, v=$v$] ++(0,-2) + node[ground]{}; + \draw (I.i) -- ++(-0.5,0) node[oscopeshape, anchor=right, name=O]{}; + \draw (O.south) -- (O.south |- GND) node[ground]{}; +\end{circuitikz} +\end{LTXexample} + +Or, if you want a more physical structure for the measurement setup: + +\begin{LTXexample}[varwidth=true, pos=b] +\begin{circuitikz}[american] + \draw (0,0) -- ++(1,0) to[R] ++(3,0) to [iloop2, name=I] ++(0,-2) + node[ground] (GND){}; + \ctikzset{bipoles/oscope/width=1.6}\ctikzset{bipoles/oscope/height=1.2} + \node [oscopeshape, fill=green!10](O) at (6,2){}; + \node [bnc, xscale=-1, anchor=zero](bnc1) at (O.in 1){}; + \node [bnc, , anchor=zero, rotate=-90](bnc2) at (O.in 2){}; + \draw [-latexslim] (bnc1.hot) -| (1,0); + \draw (bnc2.hot) |- (I.i+); + \draw (I.i-) node[ground, scale=0.5]{}; +\end{circuitikz} +\end{LTXexample} + \subsection{Mechanical Analogy} \begin{groupdesc} @@ -1361,11 +1785,19 @@ The size of the broken part of the DC current source is configurable by changing \circuitdescbip*{mass}{Mechanical Mass}{} \end{groupdesc} -\subsection{Other bipoles} +\subsubsection{Mechanical elements customizations}\label{sec:tweak-mechanicals} + +You can change the scale of all the mechanical elements by setting the key \texttt{mechanicals/scale} to something different from the default \texttt{1.0}. + + +\subsection{Miscellaneous bipoles} Here you'll find bipoles that are not easily grouped in the categories above. \begin{groupdesc} + \circuitdescbip{thermocouple}{Thermocouple}{} + \circuitdescbip*{fuse}{Fuse}{} + \circuitdescbip*{afuse}{Asymmetric fuse}{asymmetric fuse} \circuitdescbip{squid}{Squid}{} \circuitdescbip{barrier}{Barrier}{} \end{groupdesc} @@ -1386,17 +1818,11 @@ If otherwise \texttt{americangfsurgearrester} option is active (or the style \te \begin{groupdesc} \circuitdescbip*{lamp}{Lamp}{} \circuitdescbip*{bulb}{Bulb}{} - \circuitdescbip*{loudspeaker}{loudspeaker}{}( north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, - south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, - left/135/0.2, right/45/0.2, center/-135/0.2 - ) - \circuitdescbip*{mic}{mic}{}( north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, - south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, - left/135/0.2, right/45/0.2, center/-135/0.2 - ) + \circuitdescbip*{loudspeaker}{loudspeaker}{}( north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, left/135/0.2, right/45/0.2, center/-135/0.2) + \circuitdescbip*{mic}{mic}{}( north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, left/135/0.2, right/45/0.2, center/-135/0.2) \end{groupdesc} -You can use microphones and loudspeakers with \texttt{waves} (see section~\ref{sec:support}) too: +You can use microphones and loudspeakers with \texttt{waves} (see section~\ref{sec:RF}) too: \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -1411,6 +1837,147 @@ You can use microphones and loudspeakers with \texttt{waves} (see section~\ref{s \end{circuitikz} \end{LTXexample} +\subsubsection{Miscellanous element customization}\label{sec:tweak-misc} + +You can change the scale of all the miscellaneous elements by setting the key \texttt{misc/scale} to something different from the default \texttt{1.0}. + +\subsection{Crossings} + +Path style: +\begin{groupdesc} +\circuitdescbip{crossing}{Jumper style non-contact crossing}{xing} +\end{groupdesc} + +Node style: +\begin{groupdesc} + \circuitdesc{jump crossing}{Jumper-style crossing node}{} + \circuitdesc{plain crossing}{Plain style crossing node}{} +\end{groupdesc} + +All circuit-drawing standards agree that to show a crossing without electric contact, a simple crossing of the wires suffices; the electrical contact must be explicitly marked with a filled dot. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[] +\draw(1,-1) to[short] (1,1) + (0,0) to[short] (2,0); +\draw(4,-1) to[short] (4,1) + (3,0) to[short] (5,0) + (4,0) node[circ]{}; +\end{circuitikz} +\end{LTXexample} + +However, sometime it is advisable to mark the non-contact situation more explicitly. To this end, you can use a path-style component called \texttt{crossing}: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[] +\draw(1,-1) to[short] (1,1) (0,0) to[crossing] (2,0); +\draw(4,-1) to[short] (4,1) (3,0) to[short] (5,0) + (4,0) node[circ]{}; +\end{circuitikz} +\end{LTXexample} + +That should suffice most of the time; the only problem is that the crossing jumper will be put in the center of the subpath where the \texttt{to[crossing]} is issued, so sometime a bit of trial and error is needed to position it. + +For a more powerful (and elegant) way you can use the crossing nodes: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[] + \node at (1,1)[jump crossing](X){}; + \draw (X.west) -- ++(-1,0); + \draw (X.east) to[R] ++(2,0); + \draw (X.north) node[vcc]{}; + \draw (X.south) to[C] ++(0,-1.5); +\end{circuitikz} +\end{LTXexample} + +Notice that the \texttt{plain crossing} and the \texttt{jump crossing} have a small gap in the straight wire, to enhance the effect of crossing (as a kind of shadow). + +The size of the crossing elements can be changed with the key \texttt{bipoles/crossing/size} (default 0.2). + +\subsection{Arrows}\label{sec:arrows} + +These are pseudo-arrows used in lot of places in the packages (for transistors, flows, currents, and so on). + +\begin{groupdesc} + \circuitdesc{currarrow}{Arrows (current and voltage)}{}(center/0/0.2) + \circuitdesc{inputarrow}{Arrow to draw at its tip, useful for block diagrams.}{}(center/0/0.2) + \circuitdesc*{bnc}{BNC connector}{}(left/135/0.6, right/45/0.6, center/-90/0.6, hot/0/0.6, zero/-135/0.6) +\end{groupdesc} + +\subsubsection{Arrows size}\label{sec:currarrow-size} + +You can use the parameter \texttt{current arrow scale} to change the size of the arrows in various components and indicators; the normal value is 16, higher numbers give smaller arrows and so on. You need to use \texttt{circuitikz/current arrow scale} if you use it into a node. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i=f] ++(2,0) node[npn, anchor=B]{}; + \draw (0,-2) to[R, f=f, current arrow scale=8] ++(2,0) + node[pnp, anchor=B, circuitikz/current arrow scale=8]{}; + \draw (0,-4) to[R, f=f, current arrow scale=24] ++(2,0) + node[nigbt, anchor=B]{}; +\end{circuitikz} +\end{LTXexample} + +Moreover, you have the arrow tip \texttt{latexslim} which is an arrow similar to the old (in deprecated \texttt{arrows} library) \texttt{latex'} element: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american,] + \draw [latexslim-latexslim] (0,0) -- (1,0); +\end{circuitikz} +\end{LTXexample} + +\subsection{Terminal shapes}\label{sec:terminals} + +These are the so-called ``bipole nodes'' shapes, or poles (see section~\ref{sec:bipole-nodes}). These nodes are always filled; the ``open'' versions (starting with an \texttt{o}) are by default filled white, but you can override it with the \texttt{fill} parameter. + +\begin{groupdesc} + \circuitdesc{circ}{Connected terminal}{} + \circuitdesc{ocirc}{Unconnected terminal}{} + \circuitdesc{diamondpole}{Diamond-square terminal}{} + \circuitdesc{odiamondpole}{Open diamond-square terminal}{} + \circuitdesc{squarepole}{Square-shape terminal}{} + \circuitdesc{osquarepole}{Open square-shape terminal}{} +\end{groupdesc} + +Since version 0.9.0, ``bipole nodes'' shapes have all the standard geographical anchors, so you can do things like these: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american,] + \draw (0,-1) node[draw](R){R}; + \draw (R.east) node[ocirc, right]{}; +\end{circuitikz} +\end{LTXexample} + +The size of the poles is controlled by the key \texttt{nodes width} (default \texttt{0.04}, relative to the basic length). +Be sure to see section~\ref{sec:bipole-nodes} for more usage and configurability. + +\subsubsection{BNC connector/terminal} + +\begin{groupdesc} + \circuitdesc*{bnc}{BNC connector}{}(left/135/0.6, right/45/0.6, center/-90/0.6, hot/0/0.6, zero/-135/0.6) +\end{groupdesc} +The BNC connector is defined so that you can easily connect it as input or output (but remember that you need to flip the text if you flip the component): + +\begin{LTXexample}[varwidth, ] +\begin{circuitikz} + \draw (0,0) + node[bnc](B1){$v_i$} to[R=\SI{50}{\ohm}] ++(3,0) + node[bnc, xscale=-1](B2){\scalebox{-1}[1]{$v_o$}}; + \node [ground] at (B1.shield) {}; + \node [eground] at (B2.shield){}; +\end{circuitikz} +\end{LTXexample} + +It also has a \texttt{zero} anchor if you need to rotate it about its real center. + +\begin{LTXexample}[varwidth, ] +\begin{circuitikz} + \draw[thin, red] (0,0) -- ++(1,0) (0,-1) -- ++(1,0); + \path (0,0) node[bnc]{} ++(1,0) node[bnc, rotate=-90]{}; + \path (0,-1) node[bnc, anchor=zero]{} ++(1,0) node[bnc, anchor=zero, rotate=-90]{}; +\end{circuitikz} +\end{LTXexample} + \subsection{Block diagram components} \noindent Contributed by Stefan Erhardt. @@ -1447,8 +2014,9 @@ You can use microphones and loudspeakers with \texttt{waves} (see section~\ref{s \end{groupdesc} \begin{groupdesc} - \circuitdesc{coupler}{Coupler}{} - \circuitdesc{coupler2}{Coupler, 2}{} + \circuitdesc*{fourport}{Generic fourport}{} + \circuitdesc*{coupler}{Coupler}{} + \circuitdesc*{coupler2}{Coupler with rounded arrows}{} \end{groupdesc} \subsubsection{Blocks anchors} @@ -1516,6 +2084,8 @@ The couplers have: \subsubsection{Blocks customization} +You can change the scale of all the block elements by setting the key \texttt{blocks/scale} to something different from the default \texttt{1.0}. + With the option \texttt{>} you can draw an arrow to the input of the block diagram symbols. \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw @@ -1624,7 +2194,7 @@ You can go back to the no-arrows mos with \texttt{noarrowmos} locally or with \texttt{\textbackslash ctikzset\{tripoles/mos style/no arrows\}}. To draw the PMOS circle non-solid, use the option \texttt{emptycircle} or the command -\\\verb!\ctikzset{tripoles/pmos style/emptycircle}!. To remove the dot completely (only useful if you have \texttt{arrowmos} enabled, otherwise ther ewill be no difference between P-MOS and N-MOS), you can use the option \texttt{nocircle} or \verb|\ctikzset{tripoles/pmos style/nocircle}|. +\\\verb!\ctikzset{tripoles/pmos style/emptycircle}!. To remove the dot completely (only useful if you have \texttt{arrowmos} enabled, otherwise there will be no difference between P-MOS and N-MOS), you can use the option \texttt{nocircle} or \verb|\ctikzset{tripoles/pmos style/nocircle}|. \begin{groupdesc} \circuitdesc{pmos,emptycircle}{pmos}{} @@ -1647,24 +2217,7 @@ To draw the PMOS circle non-solid, use the option \texttt{emptycircle} or the co node[pmos]{} (2,-8) node[nmos]{}; \end{circuitikz}\end{LTXexample} -If you prefer a different position of the arrows in transistors and FETs, you can adjust them like this (it works for the other BJT-based transistors, too): -\begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \ctikzset{tripoles/mos style/arrows, - tripoles/npn/arrow pos=0.8, - tripoles/pnp/arrow pos=0.8, - tripoles/nmos/arrow pos=0.8, - tripoles/pmos/arrow pos=0.6, } - \draw (0,0) node[npn, ](npn){}; - \draw (2,0) node[pnp, ](npn){}; - \draw (0,-2) node[nmos, ](npn){}; - \draw (2,-2) node[pmos, ](npn){}; -\end{circuitikz} -\end{LTXexample} - -\textsc{nfet}s and \textsc{pfet}s have been incorporated based on code provided by Clemens Helfmeier and Theodor -Borsche. Use the package options \texttt{fetsolderdot}/\texttt{nofetsolderdot} to enable/disable solderdot at some fet-transistors. Additionally, the solderdot option can be enabled/disabled for single transistors with the option "solderdot" and "nosolderdot", respectively. - +\textsc{nfet}s and \textsc{pfet}s have been incorporated based on code provided by Clemens Helfmeier and Theodor Borsche. Use the package options \texttt{fetsolderdot}/\texttt{nofetsolderdot} to enable/disable solderdot at some fet-transistors. Additionally, the solderdot option can be enabled/disabled for single transistors with the option "solderdot" and "nosolderdot", respectm ively. \begin{groupdesc} \circuitdesc{nfet}{nfet}{} @@ -1795,8 +2348,26 @@ Access to the gate and/or base nodes can be gained by naming the transistors wit ;\end{circuitikz} \end{LTXexample} -The \texttt{name} property is available also for bipoles, although this is useful mostly for triac, potentiometer and thyristor (see~\ref{sec:othertrip}). +Transistor paths have the possibility to use the poles syntax (see section~\ref{sec:bipole-nodes}) but they have \textbf{no} voltage, current, flow, annotation options. +The \texttt{name} property is available also for bipoles; this is useful mostly for triac, potentiometer and thyristor (see~\ref{sec:othertrip}). + +\subsubsection{Transistors customization}\label{sec:styling-transistors} + +The default position of the arrows in transistors is somewhat in the middle of the terminal; if you prefer you can move them to the end with the style key \texttt{transistors/arrow pos=end} (the default value is \texttt{legacy}). + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \ctikzset{transistors/arrow pos=end} + \draw (0,0) node[npn, ](npn){}; + \draw (2,0) node[pnp, ](npn){}; + \draw (0,-2) node[nmos, ](npn){}; + \draw (2,-2) node[pmos, ](npn){}; +\end{circuitikz} +\end{LTXexample} + +You can change the scale of all the transistors by setting the key \texttt{transistors/scale} (default \texttt{1.0}). +The size of the arrows (if any) is controlled by the same parameters as \texttt{currarrow} (see section~\ref{sec:currarrow-size}) and the dots on P-type transistors (if any) are the same as the nodes/poles (see section~\ref{sec:bipole-nodes}). \subsection{Electronic Tubes} @@ -1835,12 +2406,16 @@ If you want a full cathode to be drawn, use the \verb|fullcathode| option in the \circuitdesc*{diodetube,fullcathode}{Tube Diode}{}(anode/90/0.2, cathode 1/-135/0.2, cathode 2/-45/0.2 ) \end{groupdesc} -These circuit elements are fully configurable, and the attributes are described below: +\subsubsection{Tubes customization} + +The tubes can be scaled using the key \texttt{tubes/scale}, default \texttt{1.0}. In addition, they are +fully configurable, and the attributes are described below: \begin{tabular}{l | l | l} Key & Default value & Description\\ \hline + \verb|tubes/scale| & \verb|1| & scale factor \\ \verb|tubes/width| & \verb|1| & relative width \\ \verb|tubes/height| & \verb|1.4| & relative height \\ \verb|tubes/tube radius| & \verb|0.40| & radius of tube circle \\ @@ -1914,6 +2489,8 @@ Example triode amplifier: \draw (Tri.east) node[right] {12AX7}; \end{circuitikz} +The \texttt{magnetron} shape will also scale with \texttt{tubes/scale}. + \begin{groupdesc} \circuitdesc*{magnetron}{Magnetron}{}( anode/-90/0.2, cathode1/135/0.2, cathode2/45/0.2, left/180/0.2, right/0/0.2, top/90/0.4 ) @@ -1932,7 +2509,7 @@ Example triode amplifier: \end{circuitikz} \end{LTXexample} -\subsection{RF components} +\subsection{RF components}\label{sec:RF} For the RF components, similarly to the grounds and supply rails, the \texttt{center} anchor is put on the connecting point of the symbol, so that you can use them directly in a \texttt{path} specification. @@ -1942,23 +2519,29 @@ Notes that in the transmission and receiving antennas, the ``waves'' are outside \circuitdesc*{bareantenna}{Bare Antenna}{A}( top/90/0.1, bottom/180/0.3, left/180/0.3, right/45/0.3, center/0/0.3 ) \circuitdesc*{bareTXantenna}{Bare TX Antenna}{Tx}( top/90/0.1, center/180/0.3, waves/90/0.3 ) \circuitdesc*{bareRXantenna}{Bare RX Antenna}{Rx}( top/90/0.1, center/0/0.3, waves/90/0.3 ) + \circuitdesc{waves}{Waves}{}( north/90/0.4, north east/45/0.4, east/-45/0.4, south east/-45/0.4, + south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, + left/135/0.2, top/45/0.2, right/45/0.2, bottom/-45/0.2 ) \circuitdescbip*{mstline}{Microstrip transmission line\footnotemark}{}(left/135/0.2, right/45/0.2, center/-90/0.3) - \circuitdesc*{mslstub}{Microstrip stub}{text}(left/135/0.2, right/45/0.2, center/-45/0.3) + \circuitdesc*{mslstub}{Microstrip linear stub}{text}(left/135/0.2, right/45/0.2, center/-45/0.3) \circuitdesc*{msport}{Microstrip port}{T}(left/135/0.2, right/45/0.2, center/-45/0.3) \circuitdesc*{msrstub}{Microstrip radial stub}{}(left/135/0.2, right/45/0.2, center/-45/0.3) \footnotetext{This four components were suggested by \texttt{@tcpluess} on GitHub} - \circuitdesc{antenna}{Antenna}{}( center/0/0.3 ) - \circuitdesc{rxantenna}{Receiving antenna}{} - \circuitdesc{txantenna}{Transmitting antenna}{} + \circuitdesc{antenna}{Legacy antenna (with tails)}{}( center/0/0.3 ) + \circuitdesc{rxantenna}{Legacy receiving antenna (with tails)}{} + \circuitdesc{txantenna}{Legacy transmitting antenna (with tails)}{} \circuitdesc*{tlinestub}{Transmission line stub}{} \circuitdescbip*[tline]{TL}{Transmission line}{transmission line, tline} \circuitdesc{match}{match}{} \end{groupdesc} +\subsubsection{RF elements customization} + +The RF elements can be scaled using the key \texttt{RF/scale}, default \texttt{1.0}. \subsubsection{Microstrip customization} -The microstrip linear components' (\texttt{mstline}, \texttt{mslstub}, \texttt{msport}) heights depend on the parameters \texttt{bipoles/mstline/height} (for the three of them, default 0.3). The widths are specified in \texttt{bipoles/mstline/width} for the first two and by \texttt{monopoles/msport/width} for the port (defaults: 1.2, 0.5). +The microstrip linear components' (\texttt{mstline}, \texttt{mslstub}, \texttt{msport}) heights can be changed by setting the parameter \texttt{bipoles/mstline/height} (for the three of them, default 0.3). The widths are specified in \texttt{bipoles/mstline/width} for the first two and by \texttt{monopoles/msport/width} for the port (defaults: 1.2, 0.5). For the length parameter of the transmission line there is a shortcut in the form of the direct parameter \texttt{mstlinelen}. @@ -1980,10 +2563,31 @@ For the length parameter of the transmission line there is a shortcut in the for The internal part of the motor and generator are, by default, filled white (to avoid compatibility problems with older versions of the package). \begin{groupdesc} - \circuitdesc*{elmech}{Motor}{M}( bottom/-90/0.2, - left/180/0.2, right/0/0.2, top/90/0.4 ) - \circuitdesc*{elmech}{Generator}{G} + \circuitdesc*{elmech}{Motor}{M}(bottom/-90/0.2, left/180/0.2, right/0/0.2, top/90/0.4, 45/45/0.2) + \circuitdesc*{elmech}{Generator}{G}(block down right/0/0.2, block north east/0/0.2) \end{groupdesc} + +\subsubsection{Electro-Mechanical Devices anchors} + +Apart from the standard geographical anchors, \texttt{elmech} has the border anchors (situated on the inner circle) and the following anchors on the ``block'': + +\begin{quote} +\begin{circuitikz} + \def\coordx(#1)[#2:#3]#4{node[circle, #4, draw, inner sep=1pt,pin={[#4, inner sep=0.5pt, font=\scriptsize, pin distance=#2cm, pin edge={#4, }]#3:#1}](#1){}} + \node [elmech](T) at(0,0) {A}; + \foreach \a/\d/\t in {block north east/0.2/45, block south east/0.2/-45, + block south west/0.2/-135, block north west/0.1/135, 150/0.1/150, + 180/0.1/180, 210/0.1/210, 60/0.4/-15, -60/0.4/15} + \path (T.\a) \coordx(\a)[\d:\t]{red}; + \node [elmech](T) at(6,0) {B}; + \foreach \a/\d/\t in {block up right/0.2/45, block down right/0.2/-45, + block down left/0.2/-135, block up left/0.1/135, north/0.3/90, + south/0.3/-90, east/0.3/0, west/0.3/180} + \path (T.\a) \coordx(\a)[\d:\t]{red}; +\end{circuitikz} +\end{quote} + + \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw (2,0) node[elmech](motor){M}; @@ -1998,7 +2602,9 @@ The internal part of the motor and generator are, by default, filled white (to a \draw[thick,->>](motor.center)--++(1.5,0)node[midway,above]{$\omega$}; \end{circuitikz} \end{LTXexample} -The symbols can also be used along a path, using the transistor-path-syntax(T in front of the shape name, see section \ref{sec:transasbip}). Don´t forget to use parameter $n$ to name the node and get access to the anchors: + +The symbols can also be used along a path, using the transistor-path-syntax(\texttt{T} in front of the shape name, see section \ref{sec:transasbip}). Don't forget to use parameter $n$ to name the node and get access to the anchors: + \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw (0,0) to [Telmech=M,n=motor] ++(0,-3) to [Telmech=M] ++(3,0) to [Telmech=G,n=generator] ++(0,3) to [R] (0,0); @@ -2023,7 +2629,7 @@ Transformers automatically use the inductor shape currently selected. These are outer dot B1/0/0.2, outer dot B2/0/0.2 ) \ctikzset{inductor=european} \circuitdesc{transformer}{Transformer (european inductor)}{} - \circuitdesc{gyrator}{Gyrator}{} + \circuitdesc*{gyrator}{Gyrator}{} \end{groupdesc} @@ -2099,6 +2705,8 @@ A couple of examples follow: \subsubsection{Double dipoles customization} +Transformers are in the \texttt{inductors} class (also the gyrator\dots), so they scale with the key \texttt{inductors/scale}. + You can change the aspect of a quadpole using the corresponding parameters \texttt{quadpoles/*/width} and \texttt{quadpoles/*/heigth} (substitute the star for \texttt{transformer}, \texttt{transformer core} or \texttt{gyrator}; default value is \texttt{1.5} for all). You have to be careful to not choose value that overlaps the components! \begin{LTXexample}[varwidth=true] @@ -2112,6 +2720,8 @@ You can change the aspect of a quadpole using the corresponding parameters \text \end{circuitikz} \end{LTXexample} +Transformers also inherits the \texttt{inductors/scale} (see~\ref{sec:tweak-l}) and similar parameters. It's your responsibility to set the aforementioned parameters if you change the scale or width of inductors. + Another very useful parameter is \texttt{quadpoles/*/inner} (default \texttt{0.4}) that determine which part of the component is the ``vertical'' one. So, setting that parameter to 1 will eliminate the horizontal part of the component (obviously, to maintain the general aspect ratio you need to change the width also): @@ -2159,8 +2769,8 @@ This can be useful if you want to put seamlessly something in series with either \circuitdesc*{inst amp}{plain instrumentation amplifier}{}( up/90/0.2, down/-90/0.2, refv up/45/0.2, refv down/-45/0.2 ) \circuitdesc*{fd inst amp}{Fully differential instrumentation amplifier}{} \circuitdesc*{inst amp ra}{instrumentation amplifier with amplification resistance terminals}{}( ra+/180/0.1, ra-/180/0.1 ) - \circuitdesc*{plain amp}{Plain amplifier}{} - \circuitdesc*{buffer}{Buffer}{} + \circuitdesc*{plain amp}{Plain amplifier}{}(+/180/0.2, -/180/0.2, out/0/0.2, up/90/0.2) + \circuitdesc*{buffer}{Buffer}{}(in/180/0.2, out/0/0.2) \end{groupdesc} \subsubsection{Amplifiers anchors} @@ -2249,6 +2859,8 @@ The instrumentation amplifier with resistance terminals (\texttt{inst amp ra}) d \subsubsection{Amplifiers customization} +You can scale the amplifiers using the key \texttt{amplifiers/scale} and setting it to something different from \texttt{1.0}. The font used for symbols will not scale, so it's your responsibility to change it if the need arises. + All these amplifier have the possibility to flip input and output (if needed) polarity. You can change polarity of the input with the \texttt{noinv input down} (default) or \texttt{noinv input up} key; and the output with \texttt{noinv output up} (default) or \texttt{noinv output down} key: \begin{LTXexample}[varwidth=true] @@ -2367,139 +2979,12 @@ But notice that the ``A'' is also flipped by the \texttt{xscale} parameter. So t \end{LTXexample} -\subsection{Support shapes and bipoles}\label{sec:support} - -Path style: -\begin{groupdesc} -\circuitdescbip{crossing}{Jumper style non-contact crossing}{xing} -\end{groupdesc} - -\noindent Node style: - -\begin{groupdesc} - \circuitdesc{currarrow}{Arrows (current and voltage)}{} - \circuitdesc{inputarrow}{Arrow to draw at its tip, useful for block diagrams.}{} - \circuitdesc{jump crossing}{Jumper-style crossing node}{} - \circuitdesc{plain crossing}{Plain style crossing node}{} - \circuitdesc{waves}{Waves}{}( north/90/0.4, north east/45/0.4, east/-45/0.4, south east/-45/0.4, - south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, - left/135/0.2, top/45/0.2, right/45/0.2, bottom/-45/0.2 ) - \circuitdesc*{bnc}{BNC connector}{}(left/135/0.6, right/45/0.6, center/-90/0.6, hot/0/0.6, zero/-135/0.6) -\end{groupdesc} - -These are the so-called ``bipole nodes'' shapes, or poles (see section~\ref{sec:bipole-nodes}). These nodes are always filled; the ``open'' versions (starting with an \texttt{o}) are by default filled white, but you can override it with the \texttt{fill} parameter. - -\begin{groupdesc} - \circuitdesc{circ}{Connected terminal}{} - \circuitdesc{ocirc}{Unconnected terminal}{} - \circuitdesc{diamondpole}{Diamond-square terminal}{} - \circuitdesc{odiamondpole}{Open diamond-square terminal}{} - \circuitdesc{squarepole}{Square-shape terminal}{} - \circuitdesc{osquarepole}{Open square-shape terminal}{} -\end{groupdesc} - - -Moreover, you have the arrow tip \texttt{latexslim} which is an arrow similar to the old (in deprecated \texttt{arrows} library) \texttt{latex'} element: - -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american,] - \draw [latexslim-latexslim] (0,0) -- (1,0); -\end{circuitikz} -\end{LTXexample} - -\subsubsection{Terminal shapes} -Since version 0.9.0, ``bipole nodes'' shapes have all the standard geographical anchors, so you can do things like these: - -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american,] - \draw (0,-1) node[draw](R){R}; - \draw (R.east) node[ocirc, right]{}; -\end{circuitikz} -\end{LTXexample} - -The BNC connector is defined so that you can easily connect it as input or output (but remember that you need to flip the text if you flip the component): - -\begin{LTXexample}[varwidth, ] -\begin{circuitikz} - \draw (0,0) - node[bnc](B1){$v_i$} to[R=\SI{50}{\ohm}] ++(3,0) - node[bnc, xscale=-1](B2){\scalebox{-1}[1]{$v_o$}}; - \node [ground] at (B1.shield) {}; - \node [eground] at (B2.shield){}; -\end{circuitikz} -\end{LTXexample} - -It also has a \texttt{zero} anchor if you need to rotate it about its real center. - -\begin{LTXexample}[varwidth, ] -\begin{circuitikz} - \draw[thin, red] (0,0) -- ++(1,0) (0,-1) -- ++(1,0); - \path (0,0) node[bnc]{} ++(1,0) node[bnc, rotate=-90]{}; - \path (0,-1) node[bnc, anchor=zero]{} ++(1,0) node[bnc, anchor=zero, rotate=-90]{}; -\end{circuitikz} -\end{LTXexample} - -\subsubsection{Crossings} - -All circuit-drawing standards agree that to show a crossing without electric contact, a simple crossing of the wires suffices; the electrical contact must be explicitly marked with a filled dot. - -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[] -\draw(1,-1) to[short] (1,1) - (0,0) to[short] (2,0); -\draw(4,-1) to[short] (4,1) - (3,0) to[short] (5,0) - (4,0) node[circ]{}; -\end{circuitikz} -\end{LTXexample} - -However, sometime it is advisable to mark the non-contact situation more explicitly. To this end, you can use a path-style component called \texttt{crossing}: - -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[] -\draw(1,-1) to[short] (1,1) (0,0) to[crossing] (2,0); -\draw(4,-1) to[short] (4,1) (3,0) to[short] (5,0) - (4,0) node[circ]{}; -\end{circuitikz} -\end{LTXexample} - -That should suffice most of the time; the only problem is that the crossing jumper will be put in the center of the subpath where the \texttt{to[crossing]} is issued, so sometime a bit of trial and error is needed to position it. - -For a more powerful (and elegant) way you can use the crossing nodes: - -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[] - \node at (1,1)[jump crossing](X){}; - \draw (X.west) -- ++(-1,0); - \draw (X.east) to[R] ++(2,0); - \draw (X.north) node[vcc]{}; - \draw (X.south) to[C] ++(0,-1.5); -\end{circuitikz} -\end{LTXexample} - -Notice that the \texttt{plain crossing} and the \texttt{jump crossing} have a small gap in the straight wire, to enhance the effect of crossing (as a kind of shadow). - -The size of the crossing elements can be changed with the key \texttt{bipoles/crossing/size} (default 0.2). - - -\subsubsection{Arrows size} - -You can use the parameter \texttt{current arrow scale} to change the size of the arrows in various components and indicators; the normal value is 16, higher numbers give smaller arrows and so on. You need to use \texttt{circuitikz/current arrow scale} if you use it into a node. - -\begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, i=f] ++(2,0) node[npn, anchor=B]{}; - \draw (0,-2) to[R, f=f, current arrow scale=8] ++(2,0) - node[pnp, anchor=B, circuitikz/current arrow scale=8]{}; - \draw (0,-4) to[R, f=f, current arrow scale=24] ++(2,0) - node[nigbt, anchor=B]{}; -\end{circuitikz} -\end{LTXexample} - \subsection{Switches and buttons} Switches and button come in to-style (the simple ones and the pushbuttons), and as nodes. +The switches can be scaled with the key \texttt{switches/scale} (default \texttt{1.0}). Notice that scaling the switches will not scale the poles, which are controlled with their own parameters (see section~\ref{sec:terminals}). + \subsubsection{Traditional switches} These are all of the to-style type: @@ -2595,8 +3080,6 @@ For more complex situations, the contact nodes are available\footnote{Thanks to \end{circuitikz} \end{LTXexample} - - The \texttt{mid} anchor in the cute switches (both path- and node-style) can be used to combine switches to get more complex configurations: \begin{LTXexample}[varwidth=true] @@ -2656,7 +3139,7 @@ cout 1/180/0.2)[out 1.n/90/0.2, out 4.w/0/0.3] Notice that the name of the shape is \texttt{rotaryswitch}, no spaces. The default rotary switch component has 5 channels (this is set in the parameter \texttt{multipoles/rotary/channels}), spanning form \SI{-60}{\degree} to \SI{60}{\degree} (parameter \texttt{multipoles/rotary/angle}) and with the wiper at \SI{20}{\degree} (parameter \texttt{multipoles/rotary/wiper}). -Moreover, there are by default no arrows on the wiper; you can set this with the parameter \texttt{multipoles/rotary/arrow} which can assume the values \texttt{none}, \texttt{cw} (clockwise), \texttt{ccw} (counterclockwise) or \texttt{both}. +Moreover, there are by default no arrows on the wiper; if needed, you can change this default setting the parameter \texttt{multipoles/rotary/arrow} which can assume the values \texttt{none}, \texttt{cw} (clockwise), \texttt{ccw} (counterclockwise) or \texttt{both}. To simplify the usage of the component, a series of styles are defined: \texttt{rotary switch=\textsl{<channels>} in \textsl{<angle>} wiper \textsl{<wiper angle>}} (notice the space in the name of the style!). Using \texttt{rotary switch} without parameters will generate a default switch. @@ -2781,21 +3264,23 @@ Logic gates, with two or more input, are supported. Albeit in principle these co \begin{groupdesc} \circuitdesc*{american and port}{American \textsc{and} port}{}( in 1/180/0.2, in 2/180/0.2, out/0/0.2 ) \circuitdesc*{american or port}{American \textsc{or} port}{}( bin 1/135/0.2, bin 2/-135/0.2, bout/-45/0.2 ) - \circuitdesc*{american not port}{American \textsc{not} port}{} \circuitdesc*{american nand port}{American \textsc{nand} port}{} \circuitdesc*{american nor port}{American \textsc{nor} port}{} \circuitdesc*{american xor port}{American \textsc{xor} port}{} \circuitdesc*{american xnor port}{American \textsc{xnor} port}{} + \circuitdesc*{american buffer port}{American \textsc{buffer} port}{} + \circuitdesc*{american not port}{American \textsc{not} port}{} \end{groupdesc} \subsubsection{European Logic gates} \begin{groupdesc} \circuitdesc*{european and port}{European \textsc{and} port}{}( in 1/180/0.2, in 2/180/0.2, out/0/0.2 ) - \circuitdesc*{european or port}{European \textsc{or} port}{} - \circuitdesc*{european not port}{European \textsc{not} port}{} + \circuitdesc*{european or port}{European \textsc{or} port}{}( bin 1/135/0.2, bin 2/-135/0.2, bout/-45/0.2 ) \circuitdesc*{european nand port}{European \textsc{nand} port}{} \circuitdesc*{european nor port}{European \textsc{nor} port}{} \circuitdesc*{european xor port}{European \textsc{xor} port}{} \circuitdesc*{european xnor port}{European \textsc{xnor} port}{} + \circuitdesc*{european buffer port}{European \textsc{buffer} port}{} + \circuitdesc*{european not port}{European \textsc{not} port}{} \end{groupdesc} \begin{framed} @@ -2815,6 +3300,8 @@ There is no ``european'' version of these symbols. \subsubsection{Logic port customization} +Logic port class is called \texttt{logic ports}, so you can scale them all with \texttt{logic ports/scale} (default \texttt{1.0}). + As for most components, you can change the width and height of the ports; the thickness is given by the parameter \texttt{tripoles/thickness} (default 2): \begin{LTXexample}[varwidth=true] @@ -2963,12 +3450,15 @@ In the case of \textsc{not}, there are only \texttt{in} and \texttt{out} (althou \subsubsection{DIP and QFP chips customization} -You can customize the DIP chip with the keys \texttt{multipoles/dipchip/width} (default 1.2) and \texttt{multipoles/dipchip/pin spacing} (default 0.4) that are expressed in fraction of basic lengths (see section~\ref{sec:components-size}). +You can scale chips with the key \texttt{chips/scale}. As ever, that will \textbf{not} scale text size of the labels, when they are printed. + +You can customize the DIP chip with the key \texttt{multipoles/dipchip/width} (with a default of \texttt{1.2}) and the key \texttt{multipoles/dipchip/pin spacing} (default \texttt{0.4}) that are expressed in fraction of basic lengths (see section~\ref{sec:components-size}). The height of the chip will be equal to half the numbers of pins multiplied by the spacing, plus one spacing for the borders. + For the QFP chips, you can only chose the pin spacing with \texttt{multipoles/qfpchip/pin spacing} key. -The pins of the chip can be ``hidden'' (that is, just a spot in the border, optionally marked with a number) or ``stick out'' with a thin lead by setting \texttt{multipoles/external pins width} greater than 0 (default value is 0.2, so you'll have leads as shown above). -Moreover, you can transform the thin lead into a pad by setting the key \texttt{multipoles/external pad fraction} to something different form 0 (default is 0); the value expresses the fraction of the pin spacing space that the pad will use on both sides of the pin. +The pins of the chip can be ``hidden'' (that is, just a spot in the border, optionally marked with a number) or ``stick out'' with a thin lead by setting \texttt{multipoles/external pins width} greater than 0 (default value is \texttt{0.2}, so you'll have leads as shown above). +Moreover, you can transform the thin lead into a pad by setting the key \texttt{multipoles/external pad fraction} to something different form 0 (default is \texttt{0}); the value expresses the fraction of the pin spacing space that the pad will use on both sides of the pin. The number of pins is settable with the key \texttt{num pins}. \textbf{Please notice} that the number of pins \textbf{must} be \emph{even} for \texttt{dipchip}s and \emph{multiple of 4} for \texttt{qfpchip}s, otherwise havoc will ensue. @@ -3143,17 +3633,19 @@ e/-129/0.4, f/145/0.4, g/190/0.4, dot/-45/0.2) \subsubsection{Seven segments customization} +You can scale the seven segment display with the key \texttt{displays/scale}. This will scale the size of the digit, but not the absolute sizes shown below --- if you want them to scale, yo have to do it manually. + You can change several parameters to adjust the displays: \begin{lstlisting}[basicstyle=\small\ttfamily] -\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@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/width/.initial=0.4}% relative to \pgf@circ@Rlen (scalable) +\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness (not scaled) +\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments (not scaled) +\ctikzset{seven seg/box sep/.initial=1pt}% external box gap (not scaled) \ctikzset{seven seg/color on/.initial=red}% color for segment "on" \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" \end{lstlisting} -A couple of examples following: +A couple of examples are shown below. \begin{LTXexample}[varwidth=true, pos=b, basicstyle=\small\ttfamily] \begin{circuitikz}[scale=0.5] @@ -3744,21 +4236,23 @@ This could be especially useful if you define a style, to use like this: \tikz \draw (0,0) to[C, i=$\imath$] (2,0); \end{LTXexample} -\noindent However, you can override the properties \texttt{voltage/distance from node}\footnote{That is, how distant from the initial and final points of the path the arrow starts and ends.}, \texttt{voltage/bump b}\footnote{Controlling how high the bump of the arrow is --- how curved it is.} and \texttt{voltage/european label distance}\footnote{Controlling how distant from the bipole the voltage label will be.} 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) 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: + \begin{LTXexample}[varwidth=true] \tikz \draw (0,0) to[R, v=1<\volt>] (1.5,0) to[C, v=2<\volt>] (3,0); \par -\ctikzset{bipoles/capacitor/voltage/% - distance from node/.initial=.7} +\ctikzset{bipoles/capacitor/voltage/distance from node/.initial=.7} \tikz \draw (0,0) to[R, v=1<\volt>] (1.5,0) to[C, v=2<\volt>] (3,0); \par \end{LTXexample} +Note the \texttt{.initial}; you have to create such key the first time you use it. + \subsection{Nodes (also called poles)}\label{sec:bipole-nodes} -You can add nodes to the bipoles, positioned at the coordinates surrounding the component. The general style to use is \texttt{bipole nodes=\{start\}\{stop\}}, where \texttt{start} and \texttt{stop} are the nodes --- to be chosen between \texttt{none}, \texttt{circ}, \texttt{ocirc}, \texttt{squarepole}, \texttt{osquarepole}, \texttt{diamondpole}, \texttt{odiamondpole} and \texttt{rectfill}\footnote{You can use other shapes too, but at your own risk\dots Moreover, notice that \texttt{none} is not really a node, just a special word used to say ``do not put any node here''.} (see section~\ref{sec:support}). +You can add nodes to the bipoles, positioned at the coordinates surrounding the component. The general style to use is \texttt{bipole nodes=\{start\}\{stop\}}, where \texttt{start} and \texttt{stop} are the nodes --- to be chosen between \texttt{none}, \texttt{circ}, \texttt{ocirc}, \texttt{squarepole}, \texttt{osquarepole}, \texttt{diamondpole}, \texttt{odiamondpole} and \texttt{rectfill}\footnote{You can use other shapes too, but at your own risk\dots Moreover, notice that \texttt{none} is not really a node, just a special word used to say ``do not put any node here''.} (see section~\ref{sec:terminals}). \begin{LTXexample}[varwidth=true, @@ -3772,8 +4266,6 @@ You can add nodes to the bipoles, positioned at the coordinates surrounding the \end{circuitikz} \end{LTXexample} - - These bipole nodes are added after the path is drawn, as every node in Ti\emph{k}Z --- this is the reason why they are always filled (with the main color the normal nodes, with white the open ones), in order to ``hide'' the wire below. You can override the fill color if you want; but notice that if you draw things in two different paths, you will have ``strange'' results; notice that in the second line of resistors the second wire is starting from the center of the white \texttt{ocirc} of the previous path. \begin{LTXexample}[varwidth=true, @@ -4236,6 +4728,22 @@ Since version 0.9.0, you can also fill most shapes with a color (the manual spec ;\end{circuitikz} \end{LTXexample} + +This fill color will override any color defined by the style (see section~\ref{sec:styling-fillcolor}). If you want to override a style fill color with no-fill for a specific component, you need to override the style --- it's a bit unfortunate but it should be an exceptional thing anyway: + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz} + \ctikzset{logic ports/fill=cyan!30!white} + \draw[red] (-0.5,3) -- (-0.5, -1); + \draw[red] (1.5,3) -- (1.5, -1); + \draw + (0,2) node[and port, ] (myand1) {} + (0,0) node[and port, fill=cyan] (myand2) {} + (2,1) node[xnor port, circuitikz/logic ports/fill=none] (myxnor) {} + (myand1.out) -| (myxnor.in 1) + (myand2.out) -| (myxnor.in 2) +;\end{circuitikz} +\end{LTXexample} You can combine shape colors with fill colors, too, but you should use the \texttt{draw} color option style for this: \begin{LTXexample}[varwidth=true] @@ -4248,8 +4756,8 @@ You can combine shape colors with fill colors, too, but you should use the \text ;\end{circuitikz} \end{LTXexample} -This is because, as you can see from the following example in port \texttt{2}, you can't specify both a fill and a color in the node (yes, it's a bug too, but it's quite complex to solve given the current circuit\TikZ{} architecture). a workaround is shown in port \texttt{3}: - +This is because, as you can see from the following example in port \texttt{2}, you can't specify both a fill and a color in the node (yes, it's a bug too, but it's quite complex to solve given the current circuit\TikZ{} architecture). +A workaround is shown in port \texttt{3}: \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw @@ -4395,7 +4903,7 @@ From now on, you can add the new commands for the component between the \verb|\m \subsection{Path-style component} -Let's define for example a path style component, like the one suggested by the user \texttt{@alex} on \href{https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz}{tex.stackexchange.com}. The component will be a mix of the \texttt{damper} and the \texttt{spring} components already present. +Let's define for example a path style component, like the one suggested by the user \texttt{@alex} on \href{https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz}{\TeX{} stackexchange site}. The component will be a mix of the \texttt{damper} and the \texttt{spring} components already present. The first step is to check if we can use the definition already existing for similar elements (for coherence of size) or if we need to define new ones; for this you have to check the file \texttt{pgfcirc.defines.tex}: we find @@ -4409,18 +4917,17 @@ The first step is to check if we can use the definition already existing for sim We will use them; at this stage you can decide to add other parameters if you need them. (Notice, however, than although flexibility is good, these parameters should be described in the manual, otherwise they're as good as a fixed number in the code). - To define the new component we will look into \texttt{pgfcircbipoles.tex} and we will copy, for example, the definition of the damper into our code, just changing the name: \begin{lstlisting} %% mechanical resistor - damper -\pgfcircdeclarebipole +\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@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgf@circ@maybefill @@ -4431,7 +4938,7 @@ To define the new component we will look into \texttt{pgfcircbipoles.tex} and we \pgfusepath{stroke} % damper box - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} @@ -4448,10 +4955,17 @@ To define the new component we will look into \texttt{pgfcircbipoles.tex} and we {.8\pgf@circ@res@up}} \pgfsetbuttcap \pgfusepath{stroke} + } \end{lstlisting} -This command will define a shape that is named \texttt{viscoeshape}, with all the correct geographical anchors based on the depth, height and width defined in the parameters of \verb|\pgfcircdeclarebipole|. This is not sufficient for using the element in a \texttt{to[]} path command; you need to ``activate'' it with (this commands are normally in \texttt{pgfcircpath.tex}): +This command will define a shape that is named \texttt{viscoeshape}, with all the correct geographical anchors based on the depth, height and width defined in the parameters of \verb|\pgfcircdeclarebipolescaled|. Moreover, the element is assigned to the class \texttt{mechanicals} for styling. + +To be coherent with the styling, you should use (when needed) the length \verb|\pgf@circ@scaled@Rlen| as the ``basic'' length for drawing, using the fill functions defined at the start of \texttt{pgfcirc.defines.tex} to fill and stroke --- so that the operation will follow the style parameters and, finally, use the macro \verb|\pgf@circ@setlinewidth| to set the line thickness /the first argument is the ``legacy'' class, if you do not want to assign one you can use the pseudo-legacy class \texttt{none}. + +The anchors for the bipole (which then set the lengths \verb|\pgf@circ@res@left|) are already scaled for your use. You can use these lenghts (which defines, normally, the geographical anchors of the element) to draw your shapes. + +This is not sufficient for using the element in a \texttt{to[]} path command; you need to ``activate'' it with (this commands are normally in \texttt{pgfcircpath.tex}): \begin{lstlisting} \def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}} @@ -4462,7 +4976,7 @@ This command will define a shape that is named \texttt{viscoeshape}, with all th And now you can show it with: \begin{lstlisting} -\circuitdescbip*{viscoe}{Mechanical viscoelastic element\footnotemark}{}(left/135/0.2, right/45/0.2, center/-90/0.3) +\circuitdescbip*{viscoe}{Mechanical viscoelastic element}{}(left/135/0.2, right/45/0.2, center/-90/0.3) \geolrcoord{viscoeshape, fill=yellow} @@ -4486,7 +5000,7 @@ Looking at the implementation of the \texttt{spring} element, a possible impleme % spring into the damper \pgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} @@ -4510,13 +5024,34 @@ which leads to: \end{circuitikz} \end{LTXexample} - As a final note, notice that the \texttt{viscoe} element is already added to the standard package. \subsection{Node-style component} Adding a node-style component is much more straightforward. Just define it by following examples in, for example, \texttt{pgfcirctripoles.tex} or the other files; be careful that you should define all the geographical anchors of the shape if you want that the \TikZ{} positioning options (like \texttt{left}, \texttt{above}, etc.) behave correctly with your component. +To have a scalable component, for example in the \texttt{transistors} class, you should use something like +\begin{lstlisting} + \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} +\end{lstlisting} +at the start of anchors and macros definition, and use (for example, the exact code will change greatly depending on your component): +\begin{lstlisting} + \savedanchor\northeast{% upper right + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\pgf@circ@scaled@Rlen + \pgf@y=0.5\pgf@y + \pgf@x=0.3\pgf@y + } +\end{lstlisting} +in all the \texttt{savedanchors}. + +Then, in the drawing part, you should start with: +\begin{lstlisting} + \pgf@circ@scaled@Rlen=\scaledRlen +\end{lstlisting} +and then use \verb|\pgf@circ@scaled@Rlen| (or the anchors) as default lengths while you draw it. + \subsubsection{Finishing your work} Once you have a satisfactory element, you should @@ -4539,7 +5074,7 @@ The best way of contributing is forking the project, adding your component in th to[L, l=12<\milli\henry>, i=$i_1$,v=b] (4,0) -- (0,0) (4,2) { to[D*, *-*, color=red] (2,0) } (0,2) to[R, l=1<\kilo\ohm>, *-] (2,2) - to[cV, i=1,v=$\SI{.3}{\kilo\ohm} i_1$] (4,2) + to[cV, i=1,v=$\SI{.3}{\kilo\ohm}\, i_1$] (4,2) (2,0) to[I, i=1<\milli\ampere>, -*] (2,2) ;\end{circuitikz} \end{LTXexample} @@ -4675,7 +5210,7 @@ The best way of contributing is forking the project, adding your component in th \end{tabular} % % changelog.tex will be updated by makefile from CHANGELOG.md -\section{Changelog} +\section{Changelog and Release Notes} \IfFileExists{changelog.tex} {\sloppy\input{changelog.tex}} {The file changelog.tex was not found, run 'make changelog' at toplevel to generate it with pandoc from CHANGELOG.md} diff --git a/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty b/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty index d158bb21a52..5e11576ca24 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty +++ b/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ctikzmanutils}[2019/04/14 utilities for formatting circuitikz manual] +\ProvidesPackage{ctikzmanutils}[2019/07/26 utilities for formatting circuitikz manual] \RequirePackage{ifthen} \RequirePackage{xparse} \RequirePackage{showexpl} @@ -27,6 +27,16 @@ } % filling color for filled-enabled component \colorlet{fillcol}{cyan!30!white} +% find the class for the element. Thanks to Symbol 1 +% https://tex.stackexchange.com/a/501389/38080 +\def\checkclass#1{% + \csname pgf@sh@ma@#1\endcsname + \ifdefined\ctikzclass + Class: \texttt{\ctikzclass}.% + \else + No class.% + \fi +} % description of a node component: % optional star for fillable % optional: scale of the component in the entry @@ -51,7 +61,9 @@ \end{circuitikz}% }{\sloppy% {#4, type: node\IfBooleanT{#1}{, fillable}% - } (\texttt{node[#3]\IfValueT{#7}{(N)}\{#5\}}) \index{#3} } + } (\texttt{node[#3]\IfValueT{#7}{(N)}\{#5\}}). \index{#3}% + \checkclass{N}% + }% } % description of a path-style component: % optional: main name, if different from above @@ -80,14 +92,13 @@ \IfValueT{#7}{, \texttt{name=B}}% \IfValueTF{#2}{, nodename: #2shape.%\drawphantomshape{#2shape}% }{, nodename: #3shape.%\drawphantomshape{#3shape}% - } + }% }% - \ifthenelse{\equal{#5}{}}{}{% - Aliases: \texttt{#5}.}% - } + \ifthenelse{\equal{#5}{}}{ }{% + Aliases: \texttt{#5}. }\checkclass{B}% + }% } - %new environment for grouping descriptions \newenvironment{groupdesc}{\medskip\begingroup}{\endgroup\par\medskip\par\noindent} diff --git a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz-0.9.3.tex b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz-0.9.3.tex new file mode 100644 index 00000000000..c3e1205ab04 --- /dev/null +++ b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz-0.9.3.tex @@ -0,0 +1,16507 @@ +\def\pgfcircversion{0.9.3} +\def\pgfcircversiondate{2019/07/13} +\writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} + +\usemodule[tikz] + +\startmodule[circuitikzgit] +\usetikzlibrary[calc] +\usetikzlibrary[arrows.meta, bending] + +\unprotect + +\edef\tikzatcode{\the\catcode`\@} +\edef\tikzbarcode{\the\catcode`\|} +\edef\tikzexclaimcode{\the\catcode`\!} +\catcode`\@=11 +\catcode`\|=12 +\catcode`\!=12 + +\let\tiny=\tfxx +\let\small=\tfx + +%%%%%%%%%%% Springe nach tex/pgfcirc.defines +%%%---------- open: tex/pgfcirc.defines.tex +%% Counters + +\newcount\pgf@circ@count@a +\newcount\pgf@circ@count@b +\newcount\pgf@circ@count@c +%%%%%%%%%%%% +%% Dimensions + +% coordinates +\newdimen\pgf@circ@res@up +\newdimen\pgf@circ@res@down +\newdimen\pgf@circ@res@zero +\newdimen\pgf@circ@res@left +\newdimen\pgf@circ@res@right +\newdimen\pgf@circ@res@other +\newdimen\pgf@circ@res@step +\newdimen\pgf@circ@res@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@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{+-4\pgfutil@tempdima} + \pgfarrowsrightextend{+6\pgfutil@tempdima} +} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}} + {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}} + {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}} + {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}} + {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}} + {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}} + {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathclose + \pgfusepathqfill +} + +\pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} + +%% Macro to fill or draw + +\def\pgf@circ@draworfill{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgfusepath{draw} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} + \fi +} + +\def\pgf@circ@draworfillandclip{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgfusepath{draw, clip} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, clip, fill} + \fi +} + +\def\pgf@circ@maybefill{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgfusepath{discard} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{fill} + \fi +} +%% Keys + +\long\def\pgf@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}} + +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circuit@compat +\newif\ifpgf@circ@oldvoltagedirection % default false +\newif\ifpgf@circ@explicitvdir +\newif\ifpgf@circ@fixbatteries + +\ctikzset{voltage dir/.is choice} +\ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}} +\ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}} +\ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}} +\ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}} +\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}} + + +% Option ">" for twoports +\newif\ifpgf@circuit@inputarrow +\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/.is choice} +\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} + +% Option "boxed" for nodes and twoports +\newif\ifpgf@circuit@boxed +\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} +\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} + +% Option "dashed" for nodes and twoports +\newif\ifpgf@circuit@dashed +\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} +\ctikzset{dashed/.add code={}{\pgf@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@circ@Rlen +\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1}} +\pgf@circ@Rlen = 1.4cm + +\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/tlinestub/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} + +\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/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/vresistor/height/.initial=.6} +\ctikzset{bipoles/vresistor/width/.initial=.8} +\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@circuit@bipole@twolines +\pgf@circuit@bipole@twolinesfalse +% +\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/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/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/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= \fontsize{6}{0}\selectfont\boldmath} +\ctikzset{bipoles/pcapacitor/height/.initial=.6} +\ctikzset{bipoles/pcapacitor/width/.initial=.2} +\ctikzset{bipoles/pcapacitor/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} +\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} +\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} +\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} +\ctikzset{bipoles/generic/height/.initial=.30} +\ctikzset{bipoles/generic/width/.initial=.80} +\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/generic potentiometer/height/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} +\ctikzset{bipoles/generic potentiometer/width/.initial=.80} +\ctikzset{bipoles/ageneric/height/.initial=.30} +\ctikzset{bipoles/ageneric/width/.initial=.80} +\ctikzset{bipoles/memristor/height/.initial=.30} +\ctikzset{bipoles/memristor/wave height/.initial=.5} +\ctikzset{bipoles/memristor/width/.initial=.80} +\ctikzset{bipoles/tgeneric/height/.initial=.70} +\ctikzset{bipoles/tgeneric/width/.initial=.80} +\ctikzset{bipoles/tfullgeneric/height/.initial=.70} +\ctikzset{bipoles/tfullgeneric/width/.initial=.80} +\ctikzset{bipoles/fullgeneric/height/.initial=.30} +\ctikzset{bipoles/fullgeneric/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} +\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/qmeter/depth/.initial=.40} +\ctikzset{bipoles/qmeter/height/.initial=.80} +\ctikzset{bipoles/qmeter/width/.initial=.60} +\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/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/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} +% resistive sensor american style +\ctikzset{bipoles/resistivesens/height/.initial=.6} +\ctikzset{bipoles/resistivesens/width/.initial=.8} + +% crossing wires +\ctikzset{bipoles/crossing/size/.initial=.2} + +\newif\ifpgf@circuit@trans@depletiontype +\pgf@circuit@trans@depletiontypefalse + +\newif\ifpgf@circuit@mos@arrows +\ctikzset{tripoles/mos style/.is choice} +\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} +\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} + +% Option solderdot for fet +\newif\ifpgf@circuit@fet@solderdot +\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} +\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} + +% Option bodydiode for fet +\newif\ifpgf@circuit@fet@bodydiode +\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} +\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} + +% Option draw fet without gate connection +\newif\ifpgf@circuit@bpt@drawgate +\pgf@circuit@bpt@drawgatetrue +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} + +% Option draw bpt without base connection +\newif\ifpgf@circuit@bpt@drawbase +\pgf@circuit@bpt@drawbasetrue +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} + +% Option draw bpt with optical input +\newif\ifpgf@circuit@bpt@drawphoto +\pgf@circuit@bpt@drawphotofalse +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} + +% Option draw pmos with empty circle +\newif\ifpgf@circuit@pmos@emptycircle +\pgf@circuit@pmos@emptycirclefalse +\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +% Option draw pmos with no circle +\newif\ifpgf@circuit@pmos@nocircle +\pgf@circuit@pmos@nocirclefalse +\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +% back to normal +\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} + + +\newif\ifpgf@circuit@trans@ntype +\pgf@circuit@trans@ntypetrue %default true +%\newif\ifpgf@circuit@trans@ptype +%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@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/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/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/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/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/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} + +\newif\ifpgf@circuit@europeanlogicport +\ctikzset{logic ports/.is choice} +\ctikzset{logic ports/european/.code= {\pgf@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{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@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{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 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 not port/origin/.initial=0} + } +} + + +\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 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 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} +% +% switches for op amps +% changing input polarity +% +\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse +\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\pgfkeys{/tikz/input noinv down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +\ctikzset{input noinv down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +% +% changing output polarity (for fully diff objects) +% +\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue +\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} +\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} +% +\ctikzset{tripoles/op amp/width/.initial=1.7} +\ctikzset{tripoles/op amp/port width/.initial=.7} +\ctikzset{tripoles/op amp/height/.initial=1.4} +\ctikzset{tripoles/op amp/input height/.initial=.5} +\ctikzset{tripoles/op amp/up pos/.initial=.45} +\ctikzset{tripoles/op amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath}%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= \fontsize{10}{12}\selectfont}%absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial= \fontsize{12}{14}\selectfont}%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}$} + }, +} +\ctikzset{tripoles/gm amp/width/.initial=1.7} +\ctikzset{tripoles/gm amp/port width/.initial=.7} +\ctikzset{tripoles/gm amp/height/.initial=1.4} +\ctikzset{tripoles/gm amp/input height/.initial=.5} +\ctikzset{tripoles/gm amp/up pos/.initial=.45} +\ctikzset{tripoles/inst amp/width/.initial=1.7} % instrumentation amplifier, simple +\ctikzset{tripoles/inst amp/port width/.initial=.7} +\ctikzset{tripoles/inst amp/height/.initial=1.4} +\ctikzset{tripoles/inst amp/input height/.initial=.5} +\ctikzset{tripoles/inst amp/up pos/.initial=.4} +\ctikzset{tripoles/inst amp/refv pos/.initial=.7} +\ctikzset{tripoles/inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! +\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % instrumentation amplifier, diff output +\ctikzset{tripoles/fd inst amp/port width/.initial=.7} +\ctikzset{tripoles/fd inst amp/height/.initial=1.4} +\ctikzset{tripoles/fd inst amp/input height/.initial=.5} +\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} +\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} +\ctikzset{tripoles/fd inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! +\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % instrumentation amplifier with ra gain resistance added +\ctikzset{tripoles/inst amp ra/port width/.initial=.7} +\ctikzset{tripoles/inst amp ra/height/.initial=2.9} +\ctikzset{tripoles/inst amp ra/input height/.initial=.7} +\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} +\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} +\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} +\ctikzset{tripoles/inst amp ra/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! +\ctikzset{tripoles/plain amp/width/.initial=1.7} +\ctikzset{tripoles/plain amp/port width/.initial=.7} +\ctikzset{tripoles/plain amp/height/.initial=1.4} +\ctikzset{tripoles/plain amp/input height/.initial=.5} +\ctikzset{tripoles/plain amp/up pos/.initial=.45} + +\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} + \ctikzset{quadpoles/gyrator/width=0.6} + } +} + + +% +% multipoles +% +\ctikzset{multipoles/thickness/.initial=2} +\ctikzset{multipoles/font/.initial=\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@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue +\pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue +\pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +\ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@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@circuit@chip@topmark\pgf@circuit@chip@topmarktrue +\pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} +\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@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@circ@rotaryarrow\pgf@circ@rotaryarrowfalse +\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse +\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse +\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}} +\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@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/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@circuit@bipole@isvoltage +\ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage} +\newif\ifpgf@circuit@bipole@voltageoutsideofsymbol +\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol} +\newif\ifpgf@circuit@bipole@strokedsymbol +\ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol} +\newif\ifpgf@circuit@bipole@iscurrent +\ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent} + +\ctikzset{bipole/voltage/.is family} +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}} +\newif\ifpgf@circuit@bipole@voltage@below +\ctikzset{bipole/voltage/position/.is choice} +\ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}} +\ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}} + +\ctikzset{bipole/voltage/label/unit/.initial=} +\ctikzset{bipole/voltage/label/name/.initial=} + +\ctikzset{bipole/current/.is family} +\newif\ifpgf@circuit@bipole@current@backward +\ctikzset{bipole/current/direction/.is choice} +\ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}} +\ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}} +\newif\ifpgf@circuit@bipole@current@before +\ctikzset{bipole/current/x position/.is choice} +\ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}} +\ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}} +\newif\ifpgf@circuit@bipole@current@below +\ctikzset{bipole/current/y position/.is choice} +\ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}} +\ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}} +\ctikzset{bipole/current/label/unit/.initial=} +\ctikzset{bipole/current/label/name/.initial=} + +\ctikzset{bipole/flow/.is family} +\newif\ifpgf@circuit@bipole@flow@backward +\ctikzset{bipole/flow/direction/.is choice} +\ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}} +\ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}} +\newif\ifpgf@circuit@bipole@flow@before +\ctikzset{bipole/flow/x position/.is choice} +\ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}} +\ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}} +\newif\ifpgf@circuit@bipole@flow@below +\ctikzset{bipole/flow/y position/.is choice} +\ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}} +\ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@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@circuit@europeanresistor +\ctikzset{resistor/.is choice} +\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } +\ctikzset{resistor/european/.code = \pgf@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}}} + +\newif\ifpgf@circuit@strokediode +\newif\ifpgf@circuit@fulldiode +\pgf@circuit@strokediodefalse +\pgf@circuit@fulldiodefalse + +\ctikzset{diode/.is choice} +\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default +\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } +\ctikzset{diode/stroke/.code = \pgf@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@circ@siunitx +\newif\ifpgf@circ@siunitx@res + +\ctikzset{straight/.is choice} +\ctikzset{straightvoltage value/.initial=true} +\ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}} +\ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}} +\ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}} +\newif\ifpgf@circuit@bipole@voltage@straight +\ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight} + + +\ctikzset{voltage/.is family} +\ctikzset{voltage/distance from node/.initial=.5} %\pgf@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 +\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} + +\ctikzset{current/.is family} +\ctikzset{current/distance/.initial = .5} + + +\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{american resistors/.style = { \circuitikzbasekey/resistor = american } } +\tikzset{european resistors/.style = { \circuitikzbasekey/resistor = european } } + +\newif\ifpgf@circuit@europeangfsurgearrester +\ctikzset{gas filled surge arrester choice/.is choice} +\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue } } +\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@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 } } +\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 } } + +% I should try to make the tree clearer (this voltage conflicts with the options above) + +\newif\ifpgf@circuit@europeanvoltage +\ctikzset{voltage/.is choice} +\ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse } } +\ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue } } + +\newif\ifpgf@circuit@europeancurrent +\ctikzset{current/.is choice} +\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse } +\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue } + +% 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@circ@sevenseg@dot +\newif\ifpgf@circ@sevenseg@box +\def\pgf@circ@sevenseg@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@circ@sevenseg@dotfalse}} +\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} +\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} +\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} +% +\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@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@circ@sevenseg@boxfalse}} +\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@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@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse +\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse +\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse +\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} +\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} + +%%%---------- close: tex/pgfcirc.defines +%%%%%%%%%%% Springe nach tex/pgfcircutils +%%%---------- open: tex/pgfcircutils.tex +% Copyright 2007-2009 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@circ@handleSI#1{% + % \pgf@circ@siunitx@resfalse +% + % \edef\len{\stringlength[e]{#1}} + %\testmatchingchar[e]{#1}{\len}{>}% + %\ifmatchingchar% + % \ifnum\findchars{#1}{<}=0 + % \def\pgf@circ@handleSI@val{\substring{#1}{1}{\findchars{#1}{<}-1}} + %\def\pgf@circ@handleSI@unit{\substring{#1}{\findchars{#1}{<}-1}+1}{\stringlength{#1}} + %\pgf@circ@siunitx@restrue +% \else +% \fi + %\else + %\fi +%} + +\def\pgf@circ@handleSI#1{ + \noexpandarg + \def\pgf@temp{} + \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit] + \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len] + + \ifnum\pgf@circ@handleSI@unit@len=0 + \pgf@circ@siunitx@resfalse + \else + \IfEndWith{#1}{>}{ + \pgf@circ@siunitx@restrue + \noexpandarg + \StrBefore{#1}{<}[\pgf@circ@handleSI@val] + %\typeout{si |#1|} + }{ + \pgf@circ@siunitx@resfalse + %\typeout{no si |#1|} + } +\fi +} + +\def\pgf@circ@ifkeyempty#1{ + \pgfextra{ + \ctikzset{#1/.get=\pgf@circ@temp} + \edef\pgf@temp{} + } + \ifx\pgf@circ@temp\pgf@temp + } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Math routines + +\def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1} + +%%%---------- close: tex/pgfcircutils + +%%%%%%%%%%% Springe nach tex/pgfcircshapes +%%%---------- open: tex/pgfcircshapes.tex +% Copyright 2007-2009 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@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{center}{ + \pgfpointorigin + } +} + +%% Full terminal + +\pgfdeclareshape{circ}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + } + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Empty terminal + +\pgfdeclareshape{ocirc}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + } + + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifx\tikz@fillcolor\pgfutil@empty + \pgfsetfillcolor{white} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Diamond terminal + +\pgfdeclareshape{diamondpole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northwest} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgftransformrotate{45} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% Diamond terminal, unfilled + +\pgfdeclareshape{odiamondpole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northwest} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgftransformrotate{45} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifx\tikz@fillcolor\pgfutil@empty + \pgfsetfillcolor{white} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% square terminal, filled + +\pgfdeclareshape{squarepole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpointborderrectangle + {\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}} + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + } +} +%% square terminal, unfilled + +\pgfdeclareshape{osquarepole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpointborderrectangle + {\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}} + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifx\tikz@fillcolor\pgfutil@empty + \pgfsetfillcolor{white} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{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@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@y=2.5\pgf@y + \pgf@x=-\pgf@y + } + % center is on the opening + \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{zero}{ \pgfpointorigin } + \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + % geo-anchors + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{left}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{2.5*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{2.5*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + } + \behindforegroundpath{ + \pgfextracty{\pgf@circ@res@other}{\northwest} + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % external circle + \pgfscope + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}} + {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}} + % next the opening to the right + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}} + {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal circle + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step} + \pgf@circ@draworfill + % and the contact line to the right + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \endpgfscope + } +} + +%% Fill for correct rectangular joins + +\pgfdeclareshape{rectjoinfill}{ + \savedanchor{\northeast}{% + \pgf@x=.5\pgflinewidth% + \pgf@y=.5\pgflinewidth% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint{0}{.5\pgflinewidth}} + {\pgfpoint{0}{-.5\pgflinewidth}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw,fill} + \endpgfscope + } +} + + +%% Current arrow + +\pgfdeclareshape{currarrow}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@x=.5\pgf@circ@res@step + \pgf@y=\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@x =\pgf@circ@res@step + } + \behindforegroundpath{ + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + + \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw,fill} + + \endpgfscope + } +} + +%% Flow arrow + +\pgfdeclareshape{flowarrow}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@y=.5\pgf@circ@res@step + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + \pgf@x=\pgf@circ@res@step% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@x =\pgf@circ@res@step + } + \behindforegroundpath{ + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw} + \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}} + \endpgfscope + } +} + +%% Input arrow + +\pgfdeclareshape{inputarrow}{ + \savedanchor{\northeast}{% this is really not northeast, really -northwest + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@y=.5\pgf@circ@res@step + \pgf@x=1.7\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@x=0cm\relax} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \savedanchor{\tip}{ + \pgfpointorigin + } + \anchor{center}{ + \tip + } + \anchor{tip}{ + \tip + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 16 + + \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{fill} + + \endpgfscope + } +} + + +%% box + +\pgfdeclareshape{box}{ + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen + \pgf@circ@res@step = 0.5\pgf@circ@res@step + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope + } + +} + + +% full nodes for wire crossing + +\pgfdeclareshape{jump crossing} +{ + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \behindbackgroundpath{ + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % horizontal jumper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % vertical, broken path + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} +\pgfdeclareshape{plain crossing} +{ + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \behindbackgroundpath{ + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % horizontal jumper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % vertical, broken path + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +%%%---------- close: tex/pgfcircshapes +%%%%%%%%%%% Springe nach tex/pgfcircmonopoles +%%%---------- open: tex/pgfcircmonopoles.tex +% Copyright 2007-2009 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 + +%% Ground symbol +% #1 -> name +% #2 -> width +% #3 -> depth +% #4 -> code +\long\def\pgf@circ@declareground#1#2#3#4{ + \pgfdeclareshape{#1}{ + \savedanchor{\southeast}{ + \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgf@x=#2\pgf@x + \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgf@y=-#3\pgf@y + } + \anchor{north}{\pgfpointorigin} + \anchor{north east}{\southeast\pgf@y=0pt\relax} + \anchor{east}{\southeast\pgf@y=.5\pgf@y} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{center}{\pgfpointorigin} + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + #4 + \endpgfscope + } + } +} + + +\pgf@circ@declareground{ground}{0.6}{1.6}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{tlground}{0.6}{0.4}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +\pgf@circ@declareground{rground}{0.6}{1}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\ctikzvalof{monopoles/rground/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfsetroundcap\pgfusepath{draw} +} + +\pgf@circ@declareground{tground}{0.6}{0}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{sground}{0.6}{1.8}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}} + \pgfpathclose + \pgf@circ@draworfill +} + +% noiseless ground +\pgf@circ@declareground{nground}{0.9}{1.6}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpatharc{0}{180}{0.9\pgf@circ@res@step} + \pgfusepath{draw} +} + +% protective ground +\pgf@circ@declareground{pground}{0.9}{1.8}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step} + \pgfusepath{draw} +} + +% chassis ground +\pgf@circ@declareground{cground}{1}{2}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Contributed by @fotesan https://github.com/fotesan + +\pgf@circ@declareground{eground}{1.1}{1.7}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{eground2}{1.1}{1.7}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Contributed by Leonardo Azzinnari +\pgfdeclareshape{tlinestub}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen + \pgf@x=1.625\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen + \pgf@y=.25\pgf@circ@res@step% + } + % the center is on the left side of the shape for facility of usage + \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax} + \anchor{west}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=0cm\relax} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y} + \anchor{center}{\pgfpointorigin} + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + + \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen + + \pgfscope\begin{pgftransparencygroup} + \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgf@circ@maybefill + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfusepath{draw} + \end{pgftransparencygroup} \endpgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} + } +} + +%% New antennas without tails + +% main body +\def\pgf@circ@antennabody{% + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfsetbeveljoin + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Waves for the antennas. +\def\pgf@circ@antennawaves{% + \pgfscope + % define a triangle for clipping the waves + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathclose + \pgfusepath{clip} + % ...and build the waves as clipped circles + \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step + \pgfmathloop% + \ifnum\pgf@circ@count@a>2 + \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other} + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \pgfusepath{draw} + \endpgfscope +} + + +% additional shape with the waves +\pgfdeclareshape{waves}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0pt} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} + \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{north east}{\northeast} + \anchor{east}{\northeast\pgf@y=0pt} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@Rlen + \pgf@circ@res@step=0.5\pgf@circ@res@step + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfscope + % define a triangle for clipping the waves + \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}} + \pgfpathclose + \pgfusepath{clip} + % ...and build the waves as clipped circles + \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step + \pgfmathloop% + \ifnum\c@pgf@counta>1 + \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other} + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop + \pgfusepath{draw} + \endpgfscope + } +} + +% the three types of antennas: simple, TX, RX. Notice that you can flip them... + +\pgfdeclareshape{bareantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + } +} + +\pgfdeclareshape{bareTXantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{waves}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + \pgf@circ@antennawaves + } +} + +\pgfdeclareshape{bareRXantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{waves}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=-4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + \pgftransformxshift{-5.2\pgf@circ@res@step} + \pgf@circ@antennawaves + } +} + +% Microstrip monopoles + +\pgfdeclareshape{mslstub}{ + \savedanchor{\southeast}{ + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=-.5\pgf@y + } + \savedanchor{\northwest}{ + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\northwest\pgf@y=0pt\relax} + \anchor{left}{\northwest\pgf@y=0pt\relax} + \anchor{right}{\southeast\pgf@y=0pt\relax} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + } +} + +\pgfdeclareshape{msrstub}{ + \savedanchor{\southeast}{ + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt\relax + } + \savedanchor{\northwest}{ + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@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@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}} + \pgfpatharc{135}{45}{\pgf@circ@res@step} + \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}} + \pgfpatharc{45}{135}{\pgf@circ@res@up} + \pgfclosepath + % \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + } +} + +\pgfdeclareshape{msport}{ + \savedanchor{\southeast}{ + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=-.5\pgf@y + } + \savedanchor{\northwest}{ + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\northwest\pgf@y=0pt\relax} + \anchor{left}{\northwest\pgf@y=0pt\relax} + \anchor{right}{\southeast\pgf@y=0pt\relax} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + } +} +% Legacy antennas (with tails) + +\def\pgf@circ@shift@antenna@xy#1#2{% + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step + \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step +\relax} + +\pgfdeclareshape{antenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}} + \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + + \pgftransformxshift{ -4\pgf@circ@res@step } + + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + + +\pgfdeclareshape{txantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}} + % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step} + \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{3\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{4\pgf@circ@res@step} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + + +\pgfdeclareshape{rxantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}} + % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step} + \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}} + \pgfpatharc{150}{210}{3.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}} + \pgfpatharc{150}{210}{3\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}} + \pgfpatharc{150}{210}{2.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}} + \pgfpatharc{150}{210}{2\pgf@circ@res@step} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + +% Vcc +\pgfdeclareshape{vcc}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=3\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{south}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=2\pgf@circ@res@step + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +% Vee +\pgfdeclareshape{vee}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=-3\pgf@x% + } + \anchor{south}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{north}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{south east}{\northeast} + \anchor{south west}{\northeast\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@y=0pt\relax} + \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=-2\pgf@circ@res@step + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +% match +\pgfdeclareshape{match}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@Rlen + \pgf@x=2\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@Rlen + \pgf@y=.5\pgf@circ@res@step% + } + % the center is on the left side of the shape for facility of usage + \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax} + \anchor{west}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=0cm\relax} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\pgfpointorigin} + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@Rlen + \pgf@x=1.5\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \pgf@y=-1.5\ht\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@Rlen + + \pgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}} + \pgfusepath{fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \endpgfscope + } +} + +%%%---------- close: tex/pgfcircmonopoles +%%%%%%%%%%% Springe nach tex/pgfcircbipoles +%%%---------- open: tex/pgfcircbipoles.tex +% Copyright 2007-2009 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#1#2#3#4#5#6{ + \pgfdeclareshape{#3shape}{ + + \savedanchor{\northeast}{ + \pgf@y=#4\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=#5\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\northeastborder}{ + \pgf@y=#4\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=#5\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwestborder}{ + \pgf@y=-#2\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=-#5\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwest}{ + \pgf@y=-#2\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-#5\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\centerpoint}{ + \pgf@circ@res@down=-#2\pgf@circ@Rlen + \pgf@circ@res@up=#4\pgf@circ@Rlen + \pgfpointorigin + \pgf@y=\pgf@circ@res@up + \advance\pgf@y by\pgf@circ@res@down + \pgf@y=.5\pgf@y + } + \anchor{center}{\pgfpointorigin} + \anchor{n}{ + \northeast + \pgf@x=0cm + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{ne}{ + \northeast + } + \anchor{nw}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{e}{ + \northeast + \pgf@y=0cm + } + \anchor{s}{ + \southwest + \pgf@x=0cm + } + \anchor{south east}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \southwest + } + \anchor{se}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{sw}{ + \southwest + } + \anchor{w}{ + \southwest + \pgf@y=0cm + } + \anchor{north}{ + \northeast + \pgf@x=0cm + } + \anchor{east}{ + \northeast + \pgf@y=0cm + } + \anchor{south}{ + \southwest + \pgf@x=0cm + } + \anchor{west}{ + \southwest + \pgf@y=0cm + } + \anchor{right}{ + \northeast + \pgf@y=0cm + } + \anchor{above}{ + \northeast + \pgf@x=0cm + } + \anchor{left}{ + \southwest + \pgf@y=0cm + } + \anchor{below}{ + \southwest + \pgf@x=0cm + } + \anchor{a}{ + \northeast + \pgf@y=0cm + } + \anchor{b}{ + \southwest + \pgf@y=0cm + } + \savedanchor{\textanchor}{% + \pgf@y=\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \anchor{text}{ + \textanchor + } + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@right=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@right=\pgf@y + \fi + \ifdim\pgf@circ@res@right>0cm + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\northeastborder} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } + + #1 + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@zero = 0cm + \pgf@circ@res@left = -\pgf@x + \pgf@circ@res@right = \pgf@x + \southwest + \pgf@circ@res@down = \pgf@y + + \pgfstartlinewidth=\pgflinewidth + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + #6 + + \pgfsetlinewidth{\pgfstartlinewidth} + } + } +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Standard bipole shapes declarations + +%% Resistor +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/resistor/height}} +{resistor} +{\ctikzvalof{bipoles/resistor/height}} +{\ctikzvalof{bipoles/resistor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} +} + + + +%% Variable resistor +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vresistor/height}} +{vresistor} +{\ctikzvalof{bipoles/vresistor/height}} +{\ctikzvalof{bipoles/vresistor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + +%% Capacitor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitor} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + +} + +%% Capacitive sensor +\pgfcircdeclarebipole +{\anchor{label}{% + \southwest + \pgf@x=2.6\pgf@x + \pgf@y=1.4\pgf@y + }% +} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitivesens} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.4\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Polar Capacitor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/pcapacitor/height}} +{polarcapacitor} +{\ctikzvalof{bipoles/pcapacitor/height}} +{\ctikzvalof{bipoles/pcapacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/pcapacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgftransformrotate{-90} + \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + +} + +%% Electrolytic Capacitor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ecapacitor/height}} +{ecapacitor} +{\ctikzvalof{bipoles/ecapacitor/height}} +{\ctikzvalof{bipoles/ecapacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/ecapacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + \pgfsetrectcap + % % % Draw plus pole + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgf@circ@draworfill + % % Draw minus pole + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfsetfillcolor{black} + \pgfusepath{draw,fill} + \pgfsetfillcolor{black} + % % plus pole annotation + \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}] + {\pgfkeysvalueof{/tikz/circuitikz/bipoles/ecapacitor/font} $+$} +} + +%% Battery + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/battery/height}} +{battery} +{\ctikzvalof{bipoles/battery/height}} +{\ctikzvalof{bipoles/battery/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 6 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + + +%% Battery 1 % poles with equl thickness + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/battery1/height}} +{battery1} +{\ctikzvalof{bipoles/battery1/height}} +{\ctikzvalof{bipoles/battery1/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%% Battery 2 % negative pole thicker + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/battery2/height}} +{battery2} +{\ctikzvalof{bipoles/battery2/height}} +{\ctikzvalof{bipoles/battery2/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + + +%% cute inductor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{cuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% cute inductive sensor + +\pgfcircdeclarebipole +{% +{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.8\pgf@x + \pgf@y=2.6\pgf@y + }% +}} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{scuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + \pgfscope + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% cute choke + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cutechoke/lower coil height}} +{cutechoke} +{\ctikzvalof{bipoles/cutechoke/height}} +{\ctikzvalof{bipoles/cutechoke/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cutechoke/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}*\ctikzvalof{bipoles/cutechoke/cthick}\pgfstartlinewidth} + \pgfusepath{stroke} + + \ifpgf@circuit@bipole@twolines + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}*\ctikzvalof{bipoles/cutechoke/cthick}\pgfstartlinewidth} + \pgfusepath{stroke} + \fi +} + +%% variable cute inductor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vcuteinductor/lower coil height}} +{vcuteinductor} +{\ctikzvalof{bipoles/vcuteinductor/height}} +{\ctikzvalof{bipoles/vcuteinductor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} +%% american inductor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/americaninductor/height 2}} +{americaninductor} +{\ctikzvalof{bipoles/americaninductor/height}} +{\ctikzvalof{bipoles/americaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + + +%% american inductive sensor + +\pgfcircdeclarebipole +{% +{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.8\pgf@x + \pgf@y=2.6\pgf@y + }% +}} +{\ctikzvalof{bipoles/americaninductor/height 2}} +{samericaninductor} +{\ctikzvalof{bipoles/americaninductor/height}} +{\ctikzvalof{bipoles/americaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + \pgfscope + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% variable american inductor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vamericaninductor/height 2}} +{vamericaninductor} +{\ctikzvalof{bipoles/vamericaninductor/height}} +{\ctikzvalof{bipoles/vamericaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@Rlen + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% Independent voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsource} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + +%% Independent voltage source - American style + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsourceam/height}} +{vsourceAM} +{\ctikzvalof{bipoles/vsourceam/height}} +{\ctikzvalof{bipoles/vsourceam/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifpgf@circ@oldvoltagedirection + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$} + \else + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$-$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$+$} + \fi +} + + + +%% Independent sinusoidal voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsourcesin/height}} +{vsourcesin} +{\ctikzvalof{bipoles/vsourcesin/height}} +{\ctikzvalof{bipoles/vsourcesin/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% Square Voltage source - contributed by Alistair Kwan +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsourcesquare/height}} +{vsourcesquare} +{\ctikzvalof{bipoles/vsourcesquare/height}} +{\ctikzvalof{bipoles/vsourcesquare/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}} + \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% Triangle Voltage source - contributed by Ralf Farkas +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsourcetri/height}} +{vsourcetri} +{\ctikzvalof{bipoles/vsourcetri/height}} +{\ctikzvalof{bipoles/vsourcetri/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% PV Source +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/pvsource/height}} +{pvsource} +{\ctikzvalof{bipoles/pvsource/height}} +{\ctikzvalof{bipoles/pvsource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}} + \pgfusepath{draw} + + %Arrow Part + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty Source +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/esource/height}} +{esource} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill +} + +%% DC Current Source with open shape +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/dcisource/height}} +{dcisource} +{\ctikzvalof{bipoles/dcisource/height}} +{\ctikzvalof{bipoles/dcisource/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@maybefill + \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}} + \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}} + \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up} + \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}} + \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} +%% DC-Voltage source +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/dcvsource/height}} +{dcvsource} +{\ctikzvalof{bipoles/dcvsource/height}} +{\ctikzvalof{bipoles/dcvsource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}} + \pgfusepath{draw} +} + + +%% Independent current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isource/height}} +{isource} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill +} + +%% Independent double oo source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/oosource/height}} +{oosource} +{\ctikzvalof{bipoles/oosource/height}} +{\ctikzvalof{bipoles/oosource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} + \pgf@circ@maybefill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right} + \pgf@circ@draworfill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} + \pgfusepath{draw} +} + + +%% Independent current source - American + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isourceam/height}} +{isourceAM} +{\ctikzvalof{bipoles/isourceam/height}} +{\ctikzvalof{bipoles/isourceam/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + + +%% Independent sinusoidal current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isource/height}} +{isourcesin} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + + +%% Controlled voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsource/height}} +{cvsource} +{\ctikzvalof{bipoles/cvsource/height}} +{\ctikzvalof{bipoles/cvsource/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + + + +%% Controlled voltage source - American +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsourceam/height}} +{cvsourceAM} +{\ctikzvalof{bipoles/cvsourceam/height}} +{\ctikzvalof{bipoles/cvsourceam/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifpgf@circ@oldvoltagedirection + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$} + \else + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$-$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$+$} + \fi +} + + +%% Controlled sinusoidal voltage source +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{cvsourcesin} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{\ctikzvalof{bipoles/cvsourcesin/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + + +%% Controlled sinusoidal current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{cisourcesin} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{\ctikzvalof{bipoles/cvsourcesin/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Controlled current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cisource/height}} +{cisource} +{\ctikzvalof{bipoles/cisource/height}} +{\ctikzvalof{bipoles/cisource/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + + +%% Controlled current source - American + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cisourceam/height}} +{cisourceAM} +{\ctikzvalof{bipoles/cisourceam/height}} +{\ctikzvalof{bipoles/cisourceam/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + +%% Cute Independent voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsourceC} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Cute Independent current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isource/height}} +{isourceC} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Cute Controlled voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsource/height}} +{cvsourceC} +{\ctikzvalof{bipoles/cvsource/height}} +{\ctikzvalof{bipoles/cvsource/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Cute Controlled current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cisource/height}} +{cisourceC} +{\ctikzvalof{bipoles/cisource/height}} +{\ctikzvalof{bipoles/cisource/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Noise voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsourceN} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + % + \pgf@circ@res@step=0.125\pgf@circ@Rlen\relax + \edef\pgf@noise@temp{dashed} + \edef\pgf@noise@fill{\pgfkeysvalueof{/tikz/circuitikz/bipoles/noise sources/fillcolor}} + \ifx\pgf@noise@temp\pgf@noise@fill + % fillable in this case + \pgf@circ@draworfillandclip + \pgfmathsetmacro{\thinner}{.5*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\thinner\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % + \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \else + \pgfsetfillcolor{\pgf@noise@fill} + \pgfusepath{draw,fill} + \fi + \endpgfscope + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Noise current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isource/height}} +{isourceN} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + % + \pgf@circ@res@step=0.125\pgf@circ@Rlen\relax + \edef\pgf@noise@temp{dashed} + \edef\pgf@noise@fill{\pgfkeysvalueof{/tikz/circuitikz/bipoles/noise sources/fillcolor}} + \ifx\pgf@noise@temp\pgf@noise@fill + % fillable in this case + \pgf@circ@draworfillandclip + \pgfmathsetmacro{\thinner}{.5*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\thinner\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % + \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \else + \pgfsetfillcolor{\pgf@noise@fill} + \pgfusepath{draw,fill} + \fi + \endpgfscope + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Black generic diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fulldiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Black Zener diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fullzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black alternative zigzag Zener diode +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fullzzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black Schottky diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fullsdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Black tunnel diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fulltdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black light emitting diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fulllediode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + +} + +%% Black photodiode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fullpdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Black varcap + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/varcap/height}} +{fullvarcap} +{\ctikzvalof{bipoles/varcap/height}} +{\ctikzvalof{bipoles/varcap/width}} +{ + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgfsetlinewidth{\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfusepath{draw,fill} + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Code for the diode triangle +\def\pgf@circ@basicdiodeshape{ + % \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + % \endpgfscope +} + + +%% Empty generic diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptydiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty Zener diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptyzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty alternative zigzag Zener diode +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptyzzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} +%% Empty Schottky diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptysdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty tunnel diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptytdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty light emitting diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptylediode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty photodiode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptypdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty varcap + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/varcap/height}} +{emptyvarcap} +{\ctikzvalof{bipoles/varcap/height}} +{\ctikzvalof{bipoles/varcap/width}} +{ + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgfsetlinewidth{\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty bidirectionaldiode + +\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/bidirectionaldiode/height}}{emptybidirectionaldiode}{\ctikzvalof{bipoles/bidirectionaldiode/height}}{\ctikzvalof{bipoles/bidirectionaldiode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + % \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + + +%% Full bidirectionaldiode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{fullbidirectionaldiode} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{\ctikzvalof{bipoles/bidirectionaldiode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw, fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% (Closing) SPST +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/spst/depth}} +{cspst} +{\ctikzvalof{bipoles/spst/height}} +{\ctikzvalof{bipoles/spst/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}} + \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfsetbeveljoin + \pgfusepath{draw} + \endpgfscope +} + +%% Opening SPST +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/spst/depth}} +{ospst} +{\ctikzvalof{bipoles/spst/height}} +{\ctikzvalof{bipoles/spst/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} + \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfsetbeveljoin + \pgfusepath{draw} + \endpgfscope +} + +%% Normal open Switch +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/nos/depth}} +{nos} +{\ctikzvalof{bipoles/nos/height}} +{\ctikzvalof{bipoles/nos/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{draw} +} + +%% Normal closed Switch +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ncs/depth}} +{ncs} +{\ctikzvalof{bipoles/ncs/height}} +{\ctikzvalof{bipoles/ncs/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Push Button +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{pushbutton} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} + +%% Normally closed Push Button +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{ncpushbutton} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}} + \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfusepath{draw} + % + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} +% cute switch "to" shapes help function +% #1 -> name +% #2 -> barposition +% #3 -> arrowcode +\long\def\pgfcircdeclarecutesw#1#2#3{ + \pgfcircdeclarebipole + { + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@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@y=0cm} + \anchor{cin}{\southwest\pgf@y=0cm} + \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius} + \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@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) + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}} + } +} + +%% closed cute switch +\pgfcircdeclarecutesw{cuteclosedswitch} + {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} + {} + +%% open cute switch +\pgfcircdeclarecutesw{cuteopenswitch} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + {} + +%% closing cute switch +\pgfcircdeclarecutesw{cuteclosingswitch} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + { + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}} + \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} + } + +%% opening cute switch +\pgfcircdeclarecutesw{cuteopeningswitch} + {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} + { + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} + \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} + } + + +% % METERINGSHAPE + \long\def\drawmeteringcircle{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \pgf@circ@res@step=1.2\pgf@circ@res@up + \fi + \fi + %draw connections to circle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + %draw circle + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + %draw arrow + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + } +%AMPEREMETER +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ammeter/height}} +{ammeter} +{\ctikzvalof{bipoles/ammeter/height}} +{\ctikzvalof{bipoles/ammeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\textbf{A}}{}{} +} +%OHMMETER +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ohmmeter/height}} +{ohmmeter} +{\ctikzvalof{bipoles/ohmmeter/height}} +{\ctikzvalof{bipoles/ohmmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\boldmath$\Omega$}{}{} +} +%VOLTMETER +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/voltmeter/height}} +{voltmeter} +{\ctikzvalof{bipoles/voltmeter/height}} +{\ctikzvalof{bipoles/voltmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\textbf{V}}{}{} + +} + +% oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 +\pgfcircdeclarebipole +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/oscope/height}} +{oscope} +{\ctikzvalof{bipoles/oscope/height}} +{\ctikzvalof{bipoles/oscope/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + % this would create a round (analog?) scope... + % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \endpgfscope + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + % grid + \pgfscope + \pgfsetlinewidth{0.5\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]% + {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfsetstrokeopacity{0.5} + \pgfusepath{draw} + \endpgfscope + % function displayed, thanks to + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} +%% 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}} +{ } + +%% Generic bipole - used as resistor by some (bleah) + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/generic/height}} +{generic} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill +} + + +%% fuse + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/fuse/height}} +{fuse} +{\ctikzvalof{bipoles/fuse/height}} +{\ctikzvalof{bipoles/fuse/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@draworfill +} + + + +%% Generic bipole, filled - used as inductor by some + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/fullgeneric/height}} +{fullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfusepath{draw,fill} +} + +%% Generic sensor, filled - used as inductive sensor by some + +\pgfcircdeclarebipole +{{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + \pgf@y=2\pgf@y + }% +}} +{\ctikzvalof{bipoles/fullgeneric/height}} +{sfullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw,fill} + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + + +%% Generic asymmetric bipole + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ageneric/height}} +{ageneric} +{\ctikzvalof{bipoles/ageneric/height}} +{\ctikzvalof{bipoles/ageneric/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + + +%% asymmetric fuse + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/afuse/height}} +{afuse} +{\ctikzvalof{bipoles/afuse/height}} +{\ctikzvalof{bipoles/afuse/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + + + + +%% Memristor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/memristor/height}} +{memristor} +{\ctikzvalof{bipoles/memristor/height}} +{\ctikzvalof{bipoles/memristor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + + + + +%% Generic empty tunable + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/tgeneric/height}} +{tgeneric} +{\ctikzvalof{bipoles/tgeneric/height}} +{\ctikzvalof{bipoles/tgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Photoresistor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/photoresistor/height 2}} +{photoresistor} +{\ctikzvalof{bipoles/photoresistor/height}} +{\ctikzvalof{bipoles/photoresistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + + +%% Thermistor +\pgfcircdeclarebipole +{{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + \pgf@y=1.2\pgf@y + }% +}} +{\ctikzvalof{bipoles/thermistor/height}} +{thermistor} +{\ctikzvalof{bipoles/thermistor/height}} +{\ctikzvalof{bipoles/thermistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + + +%% Thermistor PTC +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/thermistorptc/height 2}} +{thermistorptc} +{\ctikzvalof{bipoles/thermistorptc/height}} +{\ctikzvalof{bipoles/thermistorptc/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Thermistor NTC +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/thermistorntc/height 2}} +{thermistorntc} +{\ctikzvalof{bipoles/thermistorntc/height}} +{\ctikzvalof{bipoles/thermistorntc/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% thermocouple +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/thermocouple/height 2}} +{thermocouple} +{\ctikzvalof{bipoles/thermocouple/height}} +{\ctikzvalof{bipoles/thermocouple/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} +} + +%% Varistor +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/varistor/height}} +{varistor} +{\ctikzvalof{bipoles/varistor/height}} +{\ctikzvalof{bipoles/varistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\tiny\textsf{U}}} +} + + + +%% Generic full tunable + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{tfullgeneric} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{\ctikzvalof{bipoles/tfullgeneric/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw,fill} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + + + + + +%% Variable Capacitor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vcapacitor/height}} +{vcapacitor} +{\ctikzvalof{bipoles/vcapacitor/height}} +{\ctikzvalof{bipoles/vcapacitor/width}} +{ + %\pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfusepath{draw} +} + + +%% Piezoelectric Element + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/piezoelectric/height}} +{piezoelectric} +{\ctikzvalof{bipoles/piezoelectric/height}} +{\ctikzvalof{bipoles/piezoelectric/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + %% Outer markings + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + %% Inner Box + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left+4}{\pgf@circ@res@up-1}}{\pgfpoint{\pgf@circ@res@right-4}{\pgf@circ@res@down+1}} + \pgf@circ@draworfill + \endpgfscope +} + + + + + + +%% Lamp + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/lamp/height}} +{lamp} +{\ctikzvalof{bipoles/lamp/height}} +{\ctikzvalof{bipoles/lamp/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% bulb +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/bulb/height}} +{bulb} +{\ctikzvalof{bipoles/bulb/height}} +{\ctikzvalof{bipoles/bulb/width}} +{% + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + +% transmission line + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/tline/height}} +{tline} +{\ctikzvalof{bipoles/tline/height}} +{\ctikzvalof{bipoles/tline/width}} +{ + \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis + \begin{pgftransparencygroup} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} + \pgf@circ@draworfill + \end{pgftransparencygroup} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{stroke} +} + +% microstrip transmission line + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/mstline/height}} +{mstline} +{\ctikzvalof{bipoles/mstline/height}} +{\ctikzvalof{bipoles/mstline/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill +} +%% SQUID added by Cor Molenaar 5 March 2010 + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/squid/height}} +{squid} +{\ctikzvalof{bipoles/squid/height}} +{\ctikzvalof{bipoles/squid/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}} + + \pgfusepath{draw} +} + + + +% Generic barrier added by Cor Molenaar 5 March 2010 + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/barrier/height}} +{barrier} +{\ctikzvalof{bipoles/barrier/height}} +{\ctikzvalof{bipoles/barrier/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + + \pgfusepath{draw} +} + + +% Contributed by Danilo Piazzalunga + +\pgfdeclareshape{buffer} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfscope + \pgfsetlinewidth{2\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + } +} + + + + + +\pgfdeclareshape{plain amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgfsetlinewidth{2\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + + + + + } +} + + +%% Draw the two-port fillable box +\def\pgf@circ@twoportbox{ + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope +} + +%% Generic two port box +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/twoport/height}} +{twoport} +{\ctikzvalof{bipoles/twoport/height}} +{\ctikzvalof{bipoles/twoport/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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 +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vco/width}} +{vco} +{\ctikzvalof{bipoles/twoport/width}} +{\ctikzvalof{bipoles/vco/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw circle + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} + \pgf@circ@draworfill + \endpgfscope + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + +} + +%% bandpass filter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/bandpass/width}} +{bandpass} +{\ctikzvalof{bipoles/bandpass/width}} +{\ctikzvalof{bipoles/bandpass/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandstop filter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/bandstop/width}} +{bandstop} +{\ctikzvalof{bipoles/bandstop/width}} +{\ctikzvalof{bipoles/bandstop/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% highpass filter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/highpass/width}} +{highpass} +{\ctikzvalof{bipoles/highpass/width}} +{\ctikzvalof{bipoles/highpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% lowpass filter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/lowpass/width}} +{lowpass} +{\ctikzvalof{bipoles/lowpass/width}} +{\ctikzvalof{bipoles/lowpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% ADC +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/adc/width}} +{adc} +{\ctikzvalof{bipoles/adc/width}} +{\ctikzvalof{bipoles/adc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{A} + \def\textii{D} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DAC +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/dac/width}} +{dac} +{\ctikzvalof{bipoles/dac/width}} +{\ctikzvalof{bipoles/dac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{D} + \def\textii{A} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DSP +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/dsp/width}} +{dsp} +{\ctikzvalof{bipoles/dsp/width}} +{\ctikzvalof{bipoles/dsp/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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 +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/fft/width}} +{fft} +{\ctikzvalof{bipoles/fft/width}} +{\ctikzvalof{bipoles/fft/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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 +\pgfcircdeclarebipole +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{amp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgf@circ@draworfill + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} +} + + +%% variable amplifier +\pgfcircdeclarebipole +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{vamp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + + % draw arrow + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% pi attenuator +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/piattenuator/width}} +{piattenuator} +{\ctikzvalof{bipoles/piattenuator/width}} +{\ctikzvalof{bipoles/piattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable pi attenuator +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{vpiattenuator} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% T attenuator +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/tattenuator/width}} +{tattenuator} +{\ctikzvalof{bipoles/tattenuator/width}} +{\ctikzvalof{bipoles/tattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable T attenuator +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vtattenuator/width}} +{vtattenuator} +{\ctikzvalof{bipoles/vtattenuator/width}} +{\ctikzvalof{bipoles/vtattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% phase shifter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{phaseshifter} +{\ctikzvalof{bipoles/phaseshifter/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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 +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{vphaseshifter} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{0.65\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% detector +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/detector/width}} +{detector} +{\ctikzvalof{bipoles/detector/width}} +{\ctikzvalof{bipoles/detector/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@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@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \ifpgf@circuit@fulldiode + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} + \else + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} + \fi + +} + + + + +%% european gas filled surge arrester + +\pgfcircdeclarebipole +{} +{\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}} +{ + + %\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + %\divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@draworfill + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw} + + \endpgfscope +} + + + + +%% american gas filled surge arrester + +\pgfcircdeclarebipole +{} +{\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@circ@res@left}{\pgf@circ@res@zero}} + \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latex} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope{} + + \pgfcircle{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/size}\pgf@circ@res@down} + \pgfusepath{fill} +} + +% % MECHANICAL SYMBOLS + +%% mechanical capacitance - stiffness/spring + +\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/spring/height}}{spring}{\ctikzvalof{bipoles/spring/height}}{\ctikzvalof{bipoles/spring/width}}{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% mechanical inductance - mass +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/mass/box height}} +{mass} +{\ctikzvalof{bipoles/mass/height}} +{\ctikzvalof{bipoles/mass/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} +} + +%% mechanical resistor - damper +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/damper/height}} +{damper} +{\ctikzvalof{bipoles/damper/height}} +{\ctikzvalof{bipoles/damper/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill + + % line into the damper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {\pgf@circ@res@zero}} + \pgfusepath{stroke} + + % damper box + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} + +} +%% mechanical viscoelastic element, suggested by @alex +%% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz +\pgfcircdeclarebipole +{} % 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@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill + + % spring into the damper + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}} + \pgfusepath{stroke} + \endpgfscope + % damper box + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} + +} + + +\pgfcircdeclarebipole +{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + }% +} +{\ctikzvalof{bipoles/resistivesens/height}} +{resistivesens} +{\ctikzvalof{bipoles/resistivesens/height}} +{\ctikzvalof{bipoles/resistivesens/width}} +{% + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% crossing bipole (but see also nodes) +\pgfcircdeclarebipole + {} + {\ctikzvalof{bipoles/crossing/size}} + {crossing} + {\ctikzvalof{bipoles/crossing/size}} + {\ctikzvalof{bipoles/crossing/size}}{ + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope + } + +%% loudspeaker and microphone + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/loudspeaker/depth}} +{loudspeaker} +{\ctikzvalof{bipoles/loudspeaker/height}} +{\ctikzvalof{bipoles/loudspeaker/width}}{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}} + \pgfpathclose + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill +} + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/mic/depth}} +{mic} +{\ctikzvalof{bipoles/mic/height}} +{\ctikzvalof{bipoles/mic/width}}{ + + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}} + % 0.25358 is 0.6-0.4*cos(30) + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + + \pgfusepath{draw} + \endpgfscope +} + +% generic round meter with always horizontal text, no arrow +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/esource/height}} +{rmeter} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + % draw the text label + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgftransformrotate{\rot} + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% generic round meter with always horizontal text, with arrow +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/esource/height}} +{rmeterwa} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + % draw the text label + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/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@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next open a circle into it + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@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@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% generic square meter with always horizontal text +\pgfcircdeclarebipole +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/smeter/height}} +{smeter} +{\ctikzvalof{bipoles/smeter/height}} +{\ctikzvalof{bipoles/smeter/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % 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@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% probles qucs style: +% #1 : name +% #2 : extra code +\long\def\pgfcirc@qucsprobe#1#2{ + \pgfcircdeclarebipole + { + \anchor{v+}{\southwest\pgf@x=0.6\pgf@x} + \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + } + {\ctikzvalof{bipoles/qmeter/depth}} + {#1} + {\ctikzvalof{bipoles/qmeter/height}} + {\ctikzvalof{bipoles/qmeter/width}} + { + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + \def\@starta{103}\def\@stopa{77} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfscope + \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgf@circ@draworfill + \endpgfscope + #2 + \endpgfscope + } +} + +\pgfcirc@qucsprobe{qiprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} +} + +\pgfcirc@qucsprobe{qvprobe}{ + \pgfmathsetlength{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfusepath{draw} + \pgfscope + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope +} + +\pgfcirc@qucsprobe{qpprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} + \pgfmathsetlength{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope +} + + +% current loop for oscope and similar: stylized + +\pgfcircdeclarebipole +{ + \anchor{i}{\northeast\pgf@x=0pt\relax} + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % external ellipse + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathellipse{\pgfpointorigin}{ + \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ + \pgfpoint{0.4\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +% current loop for oscope and similar: real (double connection) + +\pgfcircdeclarebipole +{ + \anchor{i+}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{i-}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop2} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + % must be the same than internal i+ and i- anchors definition + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} + \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % external ellipse + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathmoveto{\@plus} + \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + % I use ...left and ---right as temporal lengths here to avoid defining more + \pgfextractx{\pgf@circ@res@left}{\@plus} + \pgfextractx{\pgf@circ@res@right}{\@minus} + \pgfpathmoveto{\@plus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\@minus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +% end of pgfcircbipoles.tex +%%%---------- close: tex/pgfcircbipoles +%%%%%%%%%%% Springe nach tex/pgfcirctripoles +%%%---------- open: tex/pgfcirctripoles.tex +% Copyright 2007-2009 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 + +\pgfdeclareshape{spdt}{ + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out 1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{out 2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/margin}\pgf@circ@res@left + + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} + \endpgfscope + + + \pgfscope + \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} + {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} + } + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\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} + { + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/width}\pgf@circ@Rlen + \pgf@x=.25\pgf@x + } + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@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@y=0pt} + \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x } + \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius} + \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius} + \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y } + + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + % terminals + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + + } + } +} + +\pgfcircdeclarecutespdt{cute spdt up} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt mid} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{} + +\pgfcircdeclarecutespdt{cute spdt down} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt up arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} + \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt mid arrow} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} + \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt down arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} + \pgfpatharc{-50}{70}{1.5\pgf@circ@res@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@users.noreply.github.com> +%% + +\newcount\pgf@circ@res@count% reserve global register + +\def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter +{% + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@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@circ@logicport@baseinput#1#2#3% +{% + % and and nand + \ifnum #2=1\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@left + \fi + % or and nor + \ifnum #2=2\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/angle}}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgf@y + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgf@x=\pgf@circ@res@other + \fi + % xor and xnor + \ifnum #2=3\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@circ@res@temp=\pgf@y + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgf@x=\pgf@circ@res@other + \fi + % european + \ifnum #2=4\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@other}{\left}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgf@circ@res@other + \fi +}% + +%%% american +\long\def\pgfcircdeclarelogicport#1#2#3{% + \pgfdeclareshape{american #1 port}% + {% + \savedmacro\resize{% automatic + \pgf@circ@res@up = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/height}\pgf@circ@Rlen + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgf@circ@res@down = -\pgf@circ@res@up + \pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/width}\pgf@circ@Rlen + \pgf@circ@res@right = .5\pgf@circ@res@right + \pgf@circ@res@left = -\pgf@circ@res@right + }% + \savedmacro\inputs{% get number of inputs + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% + \ifnum\pgf@circ@res@count=0 + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/inputs}\relax% + \fi + \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi + \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi + \def\inputs{\the\pgf@circ@res@count}% + }% + \savedanchor\step{% 1/2 gap at edges + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/height}\pgf@circ@Rlen + \divide\pgf@circ@res@step by \pgf@circ@res@count + \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% + }% + \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \savedanchor\left{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} + \savedanchor\right{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} + \savedanchor\origin{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/origin}\pgf@circ@res@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@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{% + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@circ@res@count% + \else% + %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above + }% + %}{}% + \repeatpgfmathloop% + } + + \anchor{out}{\northeast\pgf@y=0pt} + \anchor{bout}{\right\pgf@y=0pt} + + + \anchor{left}{\left}% edges of component mius leads + \anchor{right}{\right} + + \anchor{north east}{\northeast}% see \Compass macro + \anchor{south west}{\southwest} + \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfpoint{0cm}{\pgf@circ@res@up}} + \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{0cm}} + \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfpoint{0cm}{\pgf@circ@res@down}} + \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{0cm}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + #3 + } +} +} +%%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{and}{1}{ + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@left + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up} + \pgfpathclose + \pgf@circ@draworfill + } +%%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfcircdeclarelogicport{nand}{1}{ + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up} + \pgfpathclose + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgf@circ@draworfill +} +%%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{nor}{2}{ + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/angle}}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/port width}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/angle}}% + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/circle width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + \advance\pgf@circ@res@other by -\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgf@circ@draworfill +} +%%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{or}{2}{ + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/angle}}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/port width}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/angle}}% + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + + \pgf@circ@draworfill +} +%%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{xor}{3}{ + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/port width}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/angle}}% + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + \pgf@circ@draworfill + + \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% + + \pgfusepath{draw} +} +%%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{xnor}{3}{ + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/angle}}% + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/circle width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + \advance\pgf@circ@res@other by -\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + \pgf@circ@draworfill + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@left + \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% + + \pgfusepath{draw} +} + +%%% Original one-input ports + +\pgfdeclareshape{american not port}{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \left + \pgf@x=-.8\pgf@x + } + \anchor{west}{ + \left + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgf@circ@draworfill + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + } +} + +\pgfdeclareshape{invschmitt}{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \left + \pgf@x=-.8\pgf@x + } + \anchor{west}{ + \left + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + %draw inner shape + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} + +\pgfdeclareshape{schmitt}{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \left + \pgf@x=-.8\pgf@x + } + \anchor{west}{ + \left + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + %draw inner shape + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} + + +%%% start european logic ports, from John Kormylo +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% + +% #1 - name +% #2 - text inside +% #3 - number of inputs +% #4 = is it a not? + +\long\def\pgfcircdeclareeurologicport#1#2#3#4{ + \pgfdeclareshape{european #1 port} + { + \savedmacro\resize{% automatic + \pgf@circ@res@up = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/height}\pgf@circ@Rlen + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgf@circ@res@down = -\pgf@circ@res@up + \pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/width}\pgf@circ@Rlen + \pgf@circ@res@right = .5\pgf@circ@res@right + \pgf@circ@res@left = -\pgf@circ@res@right + }% + \savedmacro\inputs{% get number of inputs + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% + \ifnum\pgf@circ@res@count=0 + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/inputs}\relax% + \fi + \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi + \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi + \def\inputs{\the\pgf@circ@res@count}% + }% + \savedanchor\step{% 1/2 gap at edges + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/height}\pgf@circ@Rlen + \divide\pgf@circ@res@step by #3 + \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% + }% + \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}% + \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}% + \savedanchor\left{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \savedanchor\right{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% + \savedanchor\origin{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/origin}\pgf@circ@res@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}{\pgfpoint{\pgf@circ@res@left}{0pt}}% or \step + \else + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{% + \pgfmathloop% + \ifnum\pgfmathcounter>#3% + \else% + %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant + \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above + }% + %}{}% + \repeatpgfmathloop% + } + \fi + \anchor{out}{\northeast\pgf@y=0pt} + \anchor{bout}{\right\pgf@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@circ@res@up}{\northeast}% + \pgfpoint{0cm}{\pgf@circ@res@up}} + \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{0cm}} + \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfpoint{0cm}{\pgf@circ@res@down}} + \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{0cm}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfpathrectanglecorners + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + \ifnum#3=1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \else + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + %\pgf@circ@res@count = #3\relax% redundant + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{% + \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} + % + \edef\pgf@temp{not} + \edef\pgf@circ@temp{#4} + \ifx\pgf@temp\pgf@circ@temp % is a not + \pgfpathmoveto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/not height}\pgf@circ@res@up}} + \fi + % + \pgfusepath{draw} + % + \pgfpathmoveto{\pgfpointorigin} + \pgftext{#2} + % + % + % + } + } +} +\pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{not}{$1$}{1}{not} +\pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} + +%% end european logic ports + +\long\def\pgfcircdeclaretransistor#1#2#3{ + \pgfdeclareshape{#1} + { + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northeast{% upper right + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=0pt + } + \savedanchor\left{%center left + \pgf@y=0pt + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/width}\pgf@circ@Rlen + } + \anchor{text}{ + \northeast + \pgf@y=.7\pgf@y + \pgf@x= \pgf@circ@Rlen + \pgf@x=0.1\pgf@x + } + \anchor{pathstart}{ % south + \northeast + \pgf@y=-\pgf@y + } + \anchor{pathend}{ + \northeast + } + \anchor{north}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=\pgf@circ@res@step + \pgf@x=.5\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \northeast + \pgf@y=0pt + } + \anchor{south}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=-\pgf@circ@res@step + \pgf@x=.5\pgf@x + } + \anchor{south west}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=-\pgf@circ@res@step + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=\pgf@circ@res@step + } + \anchor{south east}{ + \northeast + \pgf@y=-\pgf@y + } + \anchor{B}{ + \northeast + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{base}{ + \northeast + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{G}{ + \northeast + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{gate}{ + \northeast + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{nobase}{ + \left + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@x + } + \anchor{nogate}{ + \left + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@x + } + \anchor{E}{ + \northeast + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{emitter}{ + \northeast + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{C}{ + \northeast + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{collector}{ + \northeast + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{S}{ + \northeast + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{source}{ + \northeast + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{D}{ + \northeast + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{drain}{ + \northeast + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + #2 + \backgroundpath{ + \pgftransformationadjustments + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % + \ifnum \pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction} > 0 + \pgf@circuit@trans@ntypetrue + \else + \pgf@circuit@trans@ntypefalse + \fi + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = \pgf@x + \left + \pgf@circ@res@left = \pgf@x + % + #3 + % BODY DIODE + \ifpgf@circuit@fet@bodydiode + \drawbodydiode{#1} + \fi + % + } +} +} + +\long\def\drawbodydiode#1{ + \pgfscope + \pgftransformshift{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgftransformrotate{90} + \pgftransformscale{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode scale}} + \ifpgf@circuit@fulldiode + \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} + \else + \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} + \fi + \endpgfscope + % Draw stroke line + \ifpgf@circuit@strokediode + \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} + \pgfusepath{stroke} + \fi + %Draw upper connection to body diode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgftransformscale{0.5} + \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} + \endpgfscope{} + %Draw lower connection to body diode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgftransformscale{0.5} + \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} + \endpgfscope +} + +\long\def\declarebpt#1{ + \pgfcircdeclaretransistor{#1}{}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + %draw arrow depending on type of transistor + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@ntype + \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/arrow pos}}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/arrow pos}}{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \fi + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \ifpgf@circuit@bpt@drawphoto + \pgfscope + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointadd{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpointadd{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} + \pgfusepath{draw} + \endpgfscope + \else + \ifpgf@circuit@bpt@drawbase + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + \fi + } +} + +\declarebpt{npn} +\declarebpt{pnp} + +\long\def\declareigbt#1{ + \pgfcircdeclaretransistor{#1}{} + { + %draw upper connection + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + %draw thicker gate lines + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + %draw lower connection + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + %draw arrow depending on type of transiytor + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@ntype + \pgftransformlineattime{.5}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{.5}{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@up}% + } + \fi + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + %draw gate + \ifpgf@circuit@trans@ntype + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@up}} + \fi + \pgfusepath{draw} + } +} + +\declareigbt{pigbt} +\declareigbt{nigbt} +\declareigbt{Lnigbt} +\declareigbt{Lpigbt} + + +\pgfcircdeclaretransistor{nmos}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + \ifpgf@circuit@mos@arrows + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/arrow pos}}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \fi + + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi +} + + +\pgfcircdeclaretransistor{pmos}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + \ifpgf@circuit@mos@arrows + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/arrow pos}}{% + \pgfpoint% + {\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \fi + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + + + \pgfusepath{draw} + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + \ifpgf@circuit@pmos@nocircle\else + \pgfpathcircle{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left - \pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + {\pgf@circ@res@up+\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \ifpgf@circuit@pmos@emptycircle + \pgfsetfillcolor{white} + \fi + \pgfusepath{draw,fill} + \fi +} + +%% HEMT FET Transistor +\pgfcircdeclaretransistor{hemt}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} +} + +\long\def\drawfetcore#1{ + \pgftransformationadjustments + %top connection + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + \ifpgf@circuit@trans@depletiontype + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + \else + + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up*0.45}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up*0.25}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down*0.25}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nfet/base height}\pgf@circ@res@down*0.45}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + \fi + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + %Bulk connection line + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + + %bottom connection + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + %draw thick gate line + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + + \pgftransformlineattime{.6}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + }{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + } + \ifpgf@circuit@trans@ntype + \else + \pgftransformrotate{180} + \fi + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} +\endpgfscope + +% GATE CONNECTION +\ifpgf@circuit@bpt@drawgate + \ifpgf@circuit@trans@ntype + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +\fi + +} + +\long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3 +{\pgfcircdeclaretransistor{#1}{ + \anchor{bulk}{\left\pgf@x=0pt} + \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt + #2 + } + {#3} +} + + +\pgfdeclaretransistorwrapperaddbulk{nfet}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nfet} +} + + +\pgfdeclaretransistorwrapperaddbulk{pfet}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pfet} +} + +% N-CHANNEL IGFET ENHANCEMENT TYPE +\pgfdeclaretransistorwrapperaddbulk{nigfete}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nigfete} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} +\fi +} + + + + +% N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector +\pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nigfetebulk} + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + + + +% N-CHANNEL IGFET DEPLETION TYPE +\pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{nigfetd} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +% P-CHANNEL IGFET ENHANCEMENT TYPE +\pgfdeclaretransistorwrapperaddbulk{pigfete}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pigfete} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/pigfete/gate height}\pgf@circ@res@up}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope + \fi +} + +% P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector +\pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pigfetebulk} +} + + +% P-CHANNEL IGFET DEPLETION TYPE +\pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{pigfetd} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@up}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +\pgfcircdeclaretransistor{njfet}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{.6}{% + \pgfpoint{\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfusepath{draw} +} + + +\pgfcircdeclaretransistor{pjfet}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{.4}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + }{% + \pgfpoint{\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} +} + + +\pgfdeclaretransistorwrapperaddbulk{isfet}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + % DRAIN CONNECTION + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@up}} + % DRAIN + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + % GATE, DEPLETION TYPE + \pgfscope %% added + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} %% added + \pgfusepath{draw} %% added + \endpgfscope %% added + + % BULK + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + + % SOURCE + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@down}} + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi + % ARROW + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{.6}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + }{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfusepath{draw} + + % Wavy lines + \pgfscope + \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + + +%% Black thyristor + +\pgfcircdeclarebipole{ + \anchor{gate}{ + \northeast + } + \anchor{anode}{ + \southwest + \pgf@y=0cm + } + \anchor{G}{ + \northeast + } + \anchor{cathode}{ + \northeast + \pgf@y=0cm + } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{fullthyristor}{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Empty thyristor + +\pgfcircdeclarebipole{ + \anchor{gate}{ + \northeast + } + \anchor{anode}{ + \southwest + \pgf@y=0cm + } + \anchor{G}{ + \northeast + } + \anchor{cathode}{ + \northeast + \pgf@y=0cm + } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{emptythyristor}{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Empty triac + +\pgfcircdeclarebipole{ + \anchor{gate}{ + \northeast + } + \anchor{G}{ + \northeast + } + \anchor{anode}{ + \southwest + \pgf@y=0cm + } + \anchor{cathode}{ + \northeast + \pgf@y=0cm + } +} +{\ctikzvalof{tripoles/triac/height}} +{emptytriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Full triac + +\pgfcircdeclarebipole{ + \anchor{gate}{ + \northeast + } + \anchor{G}{ + \northeast + } + \anchor{anode}{ + \southwest + \pgf@y=0cm + } + \anchor{cathode}{ + \northeast + \pgf@y=0cm + } +} +{\ctikzvalof{tripoles/triac/height}} +{fulltriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +\pgfcircdeclarebipole{ + \anchor{out 1}{ + \northeast + \pgf@y=0cm + } + \anchor{out 2}{ + \northeast + \pgf@y=.8\pgf@y + } +} +{\ctikzvalof{tripoles/toggleswitch/height 2}} +{toggleswitch} +{\ctikzvalof{tripoles/toggleswitch/height}} +{\ctikzvalof{tripoles/toggleswitch/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} + \pgfusepath{draw} + + + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetdash{}{0cm} +} + +%% operational and instrumentation amplifiers + +\pgfdeclareshape{op amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfsetrectcap + \pgfusepath{draw} + + + } +} + +%op amp shape as in european standard en 60617 +\pgfdeclareshape{en amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + { + \left + \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgfsetlinewidth{\ctikzvalof{tripoles/thickness}\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfsetrectcap + \pgfusepath{draw} + + + \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}} + % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$} + } +} + +%%Transkonduktanzverstärker +\pgfdeclareshape{gm amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{\northwest + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + \pgfpoint{-.5\wd\pgfnodeparttextbox+.25\pgf@x}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + %Umrandung: + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0}} %geändert startpunkt neu am ausgangsstrich + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}%vom Ausgang nach oben + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}%ecke links unten nach rechts unten + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{0pt}} % + \pgfsetrectcap + \pgfusepath{draw} + + } +} + +%% instrumentation amplifier + +\pgfdeclareshape{inst amp} +{ + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@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{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/refv pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@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@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % main component, normally in thicker lines + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % input terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % input terminal + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + % output lead + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% instrumentation amplifier, with terminals for gain resistance between inputs +\pgfdeclareshape{inst amp ra} +{ + \anchor{center}{\pgfpointorigin} + % bounding-box top left + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + % inputs (+-) + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@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{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{ra up}{ + \inOneFixed + } + \anchor{ra down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\raOne{% + \pgf@y=\pgf@circ@Rlen + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{ra-}{ + \raOne + } + \anchor{ra+}{ + \raOne + \pgf@y=-\pgf@y + } + % power supplies + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.4\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgf@y=0.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=0.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/refv pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.4\pgf@circ@res@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@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % drawing of the component + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + % main component, normally in thicker lines + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + %primer punto: la linea de salida (lado componente) + \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} + %from the exit to the top (short side)... (note that the .4 must be copied in \up anchor + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.4\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.4\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % ra terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % ra terminal + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % input terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % input terminal + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + % output lead + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} + } +} +%% Potentiometer +\pgfcircdeclarebipole{ + \anchor{wiper}{ + \northeast + \pgfpoint{0pt}{\pgf@y} + } + \anchor{W}{ + \northeast + \pgfpoint{0pt}{\pgf@y} + } +} +{\ctikzvalof{bipoles/potentiometer/height 2}} +{potentiometer}{\ctikzvalof{bipoles/potentiometer/height}} +{\ctikzvalof{bipoles/potentiometer/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} + + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + + + +%% Generic tunable + +\pgfcircdeclarebipole{ + \anchor{wiper}{ + \northeast + \pgfpoint{0pt}{\pgf@y} + } +} +{\ctikzvalof{bipoles/generic potentiometer/height 2}} +{genericpotentiometer} +{\ctikzvalof{bipoles/generic potentiometer/height}} +{\ctikzvalof{bipoles/generic potentiometer/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + +\pgfdeclareshape{mixer} +{ + \savedanchor\northwest{ + \ifpgf@circuit@boxed + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/mixer/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/mixer/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{adder} +{ + \savedanchor\northwest{ + \ifpgf@circuit@boxed + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/adder/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/adder/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{oscillator} +{ + \savedanchor\northwest{ + \ifpgf@circuit@boxed + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \else + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/oscillator/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/oscillator/width}\pgf@circ@Rlen + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{north}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y} + \anchor{north east}{ \northwest \pgf@x=0pt\relax} + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{text}{ + \pgf@x=-2\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@Rlen{} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east" + + % draw outer box + \ifpgf@circuit@boxed{} + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@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@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{circulator} +{ + \savedanchor\northwest{ + \ifpgf@circuit@boxed + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/circulator/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/circulator/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{3}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed{} + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % inner arrow + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}} + \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + + +% Wilkinson divider +\pgfdeclareshape{wilkinson}{ + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/wilkinson/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/wilkinson/width}\pgf@x + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{out2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@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@circ@res@right}{0pt}} + \pgftransformrotate{90} + + % calculate size of resistor + \ifpgf@circuit@europeanresistor + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{genericshape}{center}{}{pgf@generic}{\pgfusepath{fill}} + \else + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{resistorshape}{center}{}{pgf@resistor}{\pgfusepath{fill}} + \fi + } + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +% electromechanical device (motor/generator) +\pgfdeclareshape{elmech} +{ + \savedanchor\northwest{ + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/elmech/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/elmech/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@Rlen + \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope % clip the bar: whole size minus the circle + \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgfseteorule + \pgfusepath{clip} + \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfsetfillcolor{black} + \pgfusepath{fill, draw} + \endpgfscope + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \ifx\tikz@fillcolor\pgfutil@empty + \pgfsetfillcolor{white} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfusepath{draw, fill} + \endpgfscope + } +} + +\pgfdeclareshape{magnetron} +{ + \savedanchor\northwest{ + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/magnetron/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/magnetron/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{anode}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{cathode1}{ + \northwest + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(105)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(105)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture + } + \anchor{cathode2}{ + \northwest + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(75)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(75)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@Rlen + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + %create outer circle + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right} + \pgf@circ@draworfill + %create chambers + \foreach \angle in {45,135,225,315}{ + \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}} + \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}} + } + \pgfsetroundcap + \pgfusepath{draw} + \pgfscope + %draw connection from outside + %anode + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}} + %cathodes + \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + %create cathode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + %create anode + \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + } +} + +% Electronic tubes, submitted by J. op den Brouw + +% Draw tube outline +\def\pgf@circ@tubes@drawtube{% + \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfutil@tempdima=\pgf@circ@res@right + \advance\pgfutil@tempdima by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} + \pgfpatharc{90}{-90}{\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} + \pgfpatharc{270}{90}{\pgf@circ@res@up} + \else + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} + \pgfutil@tempdima=\pgf@circ@res@up + \advance\pgfutil@tempdima by -\pgf@circ@res@right + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpatharc{180}{0}{\pgf@circ@res@right} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} + \pgfpatharc{180}{0}{-\pgf@circ@res@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}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen + % x and y should be half the Rlen + \pgf@y=\pgf@circ@res@up + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@circ@res@right + \pgf@x=.5\pgf@x + } + \anchor{north} {% + \northwest + \pgf@x=0pt + } + \anchor{east}{% + \northwest + \pgf@x=-\pgf@x + \pgf@y=0pt + } + \anchor{south}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{west}{% + \northwest + \pgf@y=0pt + } + \anchor{north west}{% + \northwest + } + \anchor{north east}{% + \northwest + \pgf@x=-\pgf@x + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{anode} {% + \northwest + \pgf@x=0pt + } + \anchor{cathode}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 1}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 2}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{filament 1}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + \anchor{filament 2}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=-\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + + % Extra anchors + #2 + + \backgroundpath{ + \pgfscope + % Line width for tripoles + \pgfsetlinewidth{\ctikzvalof{tripoles/thickness}\pgflinewidth} + + % Setup to draw tube + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen + \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up + \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + + % Tube fill color (if any) + \ifx\tikz@fillcolor\pgfutil@empty + \else + \pgfscope + \pgfsetfillcolor{\tikz@fillcolor} + \pgf@circ@tubes@drawtube + \pgfusepath{fill} + \endpgfscope + \fi + + % Tube outline + \pgf@circ@tubes@drawtube + + % Setup to draw grid, filament, anode and cathode + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen + \pgf@circ@res@up=0.5\pgf@circ@res@up + \pgf@circ@res@right=0.5\pgf@circ@res@right + + % Grid drawing + #3 + + % Filament (is not drawn by default) + \ifpgf@circuit@tubes@filament + \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up + \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@xa=\pgfmathresult\pgf@circ@res@right + \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} + \pgf@ya=\pgfmathresult\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@filamentfalse + \fi + + % Anode (or plate) + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north + \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + + % Cathode + \ifpgf@circuit@tubes@nocathode + \pgf@circuit@tubes@nocathodefalse + \else + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \ifpgf@circuit@tubes@fullcathode + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@fullcathodefalse + \else + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@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@y=\ctikzvalof{tubes/grid shift}\pgf@y + } + \anchor{control} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } +} +{ + % Grid protrusion + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{tetrode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \pgfutil@tempdima=0.5\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgfutil@tempdimb=0.5\pgfutil@tempdimb + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{pentode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } + \anchor{suppressor} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{pentode suppressor to cathode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \ifnum\pgf@circ@count@a>1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} + \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat + % Grid: connection from suppressor to cathode + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + +} + +%%%---------- close: tex/pgfcirctripoles +%%%%%%%%%%% Springe nach tex/pgfcircquadpoles +%%%---------- open: tex/pgfcircquadpoles.tex +% Copyright 2007-2009 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} + { + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=.5\pgf@circ@Rlen + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + } + \anchor{A2}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{B1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{A1}{ + \northwest + } + \anchor{B2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + %% notice for the dot anchors: I use the cute inductors as reference + %% size; if you change one you have to change all of them. + \anchor{inner dot A1}{ + \northwest + \pgfmathsetlength\pgf@x{\stretto*\pgf@x + + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} + } + \anchor{outer dot A1}{ + \northwest + \pgfmathsetlength\pgf@x{\stretto*\pgf@x - + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} + } + \anchor{inner dot A2}{ + \northwest + \pgfmathsetlength\pgf@x{\stretto*\pgf@x + + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} + } + \anchor{outer dot A2}{ + \northwest + \pgfmathsetlength\pgf@x{\stretto*\pgf@x - + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} + } + \anchor{inner dot B1}{ + \northwest + \pgfmathsetlength\pgf@x{-\stretto*\pgf@x - + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} + } + \anchor{outer dot B1}{ + \northwest + \pgfmathsetlength\pgf@x{-\stretto*\pgf@x + + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} + } + \anchor{inner dot B2}{ + \northwest + \pgfmathsetlength\pgf@x{-\stretto*\pgf@x - + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} + } + \anchor{outer dot B2}{ + \northwest + \pgfmathsetlength\pgf@x{-\stretto*\pgf@x + + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{base}{ + \northwest + \pgf@x=0pt + } + #3 + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + #2 + } + } +} + + +\def\pgf@circ@drawtransformerbasicanchor{ + \pgfkeysvalueof{/tikz/circuitikz/quadpoles/trans/height} + \anchor{AA2}{ + \northwest + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + } + \anchor{BB1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + } + \anchor{AA1}{ + \northwest + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + } + \anchor{BB2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + } +} + +\def\pgf@circ@drawtransformerbasicbody{ + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@up}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@down}% + } + + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \fi% + \fi% + + + \endpgfscope + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@down}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@up}% + } + + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \fi% + \fi% + + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@inductor1}{b}} + + \pgfpathmoveto{\pgfpointanchor{pgf@inductor1}{a}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@inductor2}{a}} + + \pgfpathmoveto{\pgfpointanchor{pgf@inductor2}{b}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + +} + + +\pgfcircdeclarequadpole{transformer}{ + \pgf@circ@drawtransformerbasicbody +}{\pgf@circ@drawtransformerbasicanchor} + +\pgfcircdeclarequadpole{transformer core}{ + + \pgf@circ@drawtransformerbasicbody + + \pgfmoveto{\pgfpoint% + {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@right}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint + {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@right}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + \pgfmoveto{\pgfpoint% + {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@left}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint + {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@left}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgfusepath{draw} +}{\pgf@circ@drawtransformerbasicanchor} + + +\pgfcircdeclarequadpole{gyrator}{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{.7*\stretto\pgf@circ@res@down}} + \pgfpatharc{90}{270}{.7*\stretto\pgf@circ@res@down} + + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{.7*\stretto\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{.7*\stretto\pgf@circ@res@down} + \pgfusepath{draw} + +}{} + +%% four-port +% defines a general outer box for four-ports +% TikZ usage: +% \draw (0,0) node[coupler](coup){\SI{-3}{dB}} +% (coup.port1) to[short,-o] ++(-1,0) +% + +\long\def\pgfcircdeclarefourport#1#2{ + \pgfdeclareshape{#1}{ + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=.5\pgf@circ@Rlen + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{port1}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{port2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{port3}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{port4}{ + \northwest + \pgf@y=0.5\pgf@y + } + \anchor{1}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{3}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{4}{ + \northwest + \pgf@y=0.5\pgf@y + } + + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % draw inner stuff + #2 + + % draw inner text + \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + } + } +} + +% four-port +\pgfcircdeclarefourport{fourport}{} + + +% straight coupler +\pgfcircdeclarefourport{coupler}{ + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfsetarrows{latex-latex} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfsetarrows{latex-latex} + \pgfusepath{draw} +} + +% "bended" coupler +\pgfcircdeclarefourport{coupler2}{ + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}} + \pgfpatharc{180}{90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}} + \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope +} + +% contrib Kristofer M. Monisit + +\pgfdeclareshape{fd op amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\outline{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out up}{ + \northwest + \pgf@y=.5\pgf@y + \pgf@x=-.7\pgf@x + } + \anchor{out down}{ + \northwest + \pgf@y=-.5\pgf@y + \pgf@x=-.7\pgf@x + } + \anchor{out +}{ + \outline + \pgf@y=.5\pgf@y + \pgf@x=-.7\pgf@x + } + \anchor{out -}{ + \outline + \pgf@y=-.5\pgf@y + \pgf@x=-.7\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-.7\pgf@x + } + + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-.7\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-.7\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + % Triangle + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + % Negative output terminal + \pgfpathmoveto{\pgfpoint + {0.7\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{0.3\pgf@circ@res@left}{.3\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@oplusup$-$\else$+$\fi} + + % Positive output terminal + \pgfpathmoveto{\pgfpoint + {0.7\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{0.3\pgf@circ@res@left}{.3\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@oplusup$+$\else$-$\fi} + + \pgfsetrectcap + % Draw them all! + \pgfusepath{draw} + + } +} + + +%% instrumentation amplifier diff output + +\pgfdeclareshape{fd inst amp} +{ + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@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{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/refv pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@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@y=-\pgf@y + } + \savedanchor\outport{ + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{out}{ + \outport + \pgf@y=0pt + } + \anchor{out +}{ + \outport + } + \anchor{out -}{ + \outport + \pgf@y=-\pgf@y + } + \savedanchor\outportfixed{ + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + } + \anchor{out up}{ + \outportfixed + } + \anchor{out down}{ + \outportfixed + \pgf@y=-\pgf@y + } + % + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % main component, normally in thicker lines + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % input terminal up + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % input terminal down + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + % output leads down and up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} % + \pgftext[right, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} % + \pgftext[right, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi} + % + \pgfsetrectcap + \pgfusepath{draw} + } +} +%%%---------- close: tex/pgfcircquadpoles +%%%%%%%%%%% Springe nach tex/pgfcircmultipoles +%%%---------- open: tex/pgfcircmultipoles.tex +% Copyright 2007-2009 by Massimo Redaelli +% Copyright 2019 by Romano Giannetti +% +% 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 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% counters for pin accounting... +\def\pgf@circ@dip@pin@shift{0.5} +\def\pgf@circ@qfp@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\numpins{% + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins}% + \def\numpins{\the\pgf@circ@count@a} + } + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength\pgf@x{((\numpins) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}% + }% + \saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}}} + \saveddimen{\width}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}}} + \saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength\pgf@y{0.5*((\numpins) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}} + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}\pgf@circ@Rlen + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}\pgf@circ@Rlen + \pgfscope% (for the line width) + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/thickness}\pgflinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% + \pgf@circ@draworfill + %% upside mark + \ifpgf@circuit@chip@topmark + \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left} + \fi + \pgfusepath{stroke}% + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % Adding the pin number + \ifpgf@circuit@chip@shownumbers + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@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@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + \def\mytext{\pgfkeysvalueof{/tikz/circuitikz/multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \fi + \endpgfscope + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \edef\padfrac{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pad fraction}} + \ifnum\padfrac>0 + \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac + % left side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % right side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \else + % left side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % right side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + \pgfusepath{stroke} + \endpgfscope + \fi + }% + % \pgf@sh@s@<name of the shape here> contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@dipchip{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins\relax + \pgfmathloop% + \ifnum\pgf@circ@count@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@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% + } + +% QFP (quad flat package) chips + +\pgfdeclareshape{qfpchip}{ + \savedmacro\numpins{% + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}% + \def\numpins{\the\pgf@circ@count@a} + } + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength\pgf@x{((\numpins+2) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + }% + \saveddimen\width{% + \pgfmathsetlength\pgf@x{((\numpins+2) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + }% + \saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}}} + \saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength\pgf@y{0.5*((\numpins+2) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + \pgf@x=-\pgf@y + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}\pgf@circ@Rlen + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}\pgf@circ@Rlen + \pgfscope% (for the line width) + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/thickness}\pgflinewidth} + %% upside mark + \ifpgf@circuit@chip@topmark + \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}} + \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@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@circ@draworfill + % Adding the pin number + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifpgf@circuit@chip@shownumbers + \pgf@circ@count@a=\numpins% + \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@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@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + \def\mytext{\pgfkeysvalueof{/tikz/circuitikz/multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \fi + \endpgfscope + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins% + \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \edef\padfrac{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pad fraction}} + \ifnum\padfrac>0 + \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac + % left side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % bottom side pads + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + % right side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % top side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \else + % left side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % bottom side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + % right side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % top side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \pgfusepath{stroke} + \endpgfscope + \fi + }% + % \pgf@sh@s@<name of the shape here> contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins% + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop% + }% + } + +%% anchors for DIP +\def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \c@pgf@countc=\numpins\relax + \divide\c@pgf@countc by 2 + \ifnum #1 > \the\c@pgf@countc + % right side + \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing} + \else + \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing} +\fi +} + +%% anchors for QFP +\def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \c@pgf@countc=\numpins\relax + \divide\c@pgf@countc by 4 + \ifnum #1 > \the\c@pgf@countc + \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2 + \ifnum #1 > \the\c@pgf@countb + \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3 + \ifnum #1 > \the\c@pgf@countb + % 3*npins/4 < pin, top side + \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@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@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}% + \fi + \else + % npins/4 < pin <= 2*npins/4, bottom side + \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}% + \fi + \else + % <= npins/4, left side + \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}% + \fi +} + + +%% Rotary Switch + +\pgfdeclareshape{rotaryswitch} +{ + \savedanchor\northeast{% + % 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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@Rlen + \pgf@circ@res@temp} + } + \savedanchor\northwest{% + % 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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp} + } + \savedanchor\central{% + % 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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp} + } + % external square limits + \savedanchor\extnorthwest{% + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35) + \pgf@x=2.5\pgf@x % external square size + \pgf@y=-\pgf@x %square thing when angle=180? + } + \saveddimen{\width}{\pgfmathsetlength\pgf@x{0.3052*\pgf@circ@Rlen*\ctikzvalof{tripoles/spdt/width}}} + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@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@circ@res@temp=-\pgf@x + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)} + } + % center anchors + \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius} + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt} + \anchor{ain}{ \northwest \pgf@y=0pt} + + \anchor{center}{ \central \pgf@y=0pt } + \anchor{east}{ \northeast \pgf@y=0pt } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \central \pgf@y=-\pgf@y } + \anchor{north}{ \central } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northeast } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northeast \pgf@y=-\pgf@y } + + \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width} + \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width} + \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width} + \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width} + \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width} + \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width} + \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width} + \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width} + \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@res@right = \width + \pgf@circ@res@left = -\width + + \pgfscope %wiper + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + + \ifpgf@circ@rotaryarrow + \pgfscope % arrow + \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node + \pgftransformrotate{\wiper} + \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}} + \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right} + \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi + \pgfusepath{draw} + \endpgfscope + \fi + + % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa} + \pgf@circ@count@a=\channels\relax + \pgfmathsetmacro{\currenta}{-\angle} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right} + \pgfscope + \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}} + \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}} + \endpgfscope + \pgfmathsetmacro{\currenta}{\currenta+\stepa} + % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right} + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + + \pgfscope % input + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + } + % \pgf@sh@s@<name of the shape here> contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\channels\relax + \pgfmathloop% + \ifnum\pgf@circ@count@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@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +\def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer + \pgf@circ@res@temp=\width + \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} + \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius} + \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)} + \advance\pgf@x by -\pgf@circ@res@temp +} + +\def\pgf@circ@rotarysqanchor#1{% external square anchors + \pgf@circ@res@temp=\width + \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} + \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}} + \advance\pgf@x by -\pgf@circ@res@temp +} + +% Seven segments displays + +\pgfdeclareshape{bare7seg}{ + \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}} + \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness + \ifpgf@circ@sevenseg@dot + \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}} + \else + \pgf@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@x}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen}} + \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}} + \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}} + \savedanchor{\southwest}{% both negative + \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} + \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} + } + \savedanchor{\northeast}{% both positive + \ifpgf@circ@sevenseg@dot + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}} + \else + \pgf@circ@res@other=0pt + \fi + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}} + } + \savedanchor{\topright}{% anchor without the box sep and the thickness + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen} + } + \anchor{center}{\pgfpointorigin} + \anchor{north west}{\southwest\pgf@y=-\pgf@y} + \anchor{north east}{\northeast} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\southwest} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0pt} + \anchor{south}{\southwest\pgf@x=0pt} + \anchor{west}{\southwest\pgf@y=0pt} + \anchor{a}{\topright\pgf@x=0pt} + \anchor{b}{\topright\pgf@y=0.5\pgf@y} + \anchor{c}{\topright\pgf@y=-0.5\pgf@y} + \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y} + \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{g}{\pgfpointorigin} + \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace} + \behindbackgroundpath{% + \southwest % I do not want the dot here, it will stick out + \pgf@circ@res@up = -\pgf@y + \pgf@circ@res@down = \pgf@y + \pgf@circ@res@right = \pgf@x + \pgf@circ@res@left = -\pgf@x + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/thickness}\pgflinewidth} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfpathrectanglecorners% + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}} + \ifpgf@circ@sevenseg@box + \pgf@circ@draworfill + \else + \pgf@circ@maybefill + \fi + \endpgfscope + \edef\bits{\ctikzvalof{seven seg/bits}} + \pgfscope + \pfg@circ@sseg@drawbits{\bits} + \endpgfscope + \pgfscope + \ifpgf@circ@sevenseg@dot + \pgf@circ@sseg@drawdots + \fi + \endpgfscope + } +} + +\def\pgf@circ@sseg@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@circ@sseg@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@circ@sseg@drawbits#1{% #1 must be 7 bits + \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic... + \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}} + \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}} + % \pgfsetroundcap + \pgfsetarrowsstart{Triangle Cap[]} + \pgfsetarrowsend{Triangle Cap[]} + % segments + \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width} + \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap} + \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap} + \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width} + \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap} + \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap} + \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt} +} +\def\pgf@circ@sseg@drawdots{% dots + \edef\what{empty} + \ifx\what\pgf@circ@sevenseg@dotstate + % do nothing + \else + \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}} + \edef\what{off} + \ifx\what\pgf@circ@sevenseg@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@circ@res@other}{-\width}}{\pgf@circ@res@other} + \pgfusepath{draw,fill} + \fi +} +%%%---------- close: tex/pgfcircmultipoles + +%%%%%%%%%%% Springe nach tex/pgfcirclabel +%%%---------- open: tex/pgfcirclabel.tex +% Copyright 2007-2009 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 + +%% Options +\ctikzset{label/.style = { l=#1 } } +\ctikzset{l/.code = { + \pgfkeys{/tikz/circuitikz/bipole/label/name=#1} + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@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@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@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@circ@ls{.75ex} % labelspace to have just one point to change + +\def\pgf@circ@drawlabels#1{ + \pgfextra{ + % This function will be called with argument #1 equal + % to "label" or "annotation" form pgfcircpath.tex. + % pgf@circ@direction is the direction of the path, + % its value is set in pgfcircpath.tex + \pgfmathsubtract{\pgf@circ@direction}{90} + \pgfmathround{\pgfmathresult} % avoid precision loss errors + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}} + \ifnum \pgf@circ@temp < 0 + \pgfmathadd{\pgf@circ@labanc}{180} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc} + % + % normalize the angle values + % + \pgfmathmod{\pgf@circ@labanc}{360} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + % + \ifpgf@circuit@bipole@inverted + \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % + \ifnum \ctikzvalof{mirror value} = -1 + \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc} + } + %Firstly, place a coordinate directly at the edge of the shape + (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (labelcoor) + %now decide, which labels should be drawn + \pgfextra{ + \edef\pgf@temp{\ctikzvalof{label/align}} + \def\pgf@circ@temp{straight} + } + \ifx\pgf@temp\pgf@circ@temp %straight + \pgf@circ@drawreglabels{#1} + \else + \pgfextra{\def\pgf@circ@temp{rotate}} + \ifx\pgf@temp\pgf@circ@temp %rotate + \pgf@circ@drawrotlabels{#1} + \else% smart + \pgf@circ@drawsmartlabels{#1} + \fi + \fi +} + + +\def\pgf@circ@drawsmartlabels#1{ + \pgfextra{ + \pgfmathmod{\pgf@circ@direction}{90} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \ifnum \pgfcircmathresult > 20 + \ifnum \pgfcircmathresult < 70 + \pgf@circ@drawrotlabels{#1} + \else + \pgf@circ@drawreglabels{#1} + \fi + \else + \pgf@circ@drawreglabels{#1} + \fi + } + + +\def\pgf@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{\tmp}{\tmp}{\tmp}{\myscale}{\tmp}{\tmp} + \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@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@circ@res@temp=1.5\pgf@circ@res@temp + \fi + %Calculate rotation of the label from direction and strip decimals + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + % rotate the label at second or third quadrant: + \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270 + \pgfmathsubtract{\pgf@circ@direction}{180} + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + %invert the space relationships due to rotated strings + \ifnum \ctikzvalof{bipole/#1/position}>0 + \pgf@circ@res@temp=1.5\pgf@circ@res@temp + \fi + \fi\fi + \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90} + \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + % reset cm is not working correctly here + (labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(labelcoor) + node[anchor=mid, rotate=\pgfcirclabrot](\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}} +} + +\def\pgf@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{\tmp}{\tmp}{\tmp}{\myscale}{\tmp}{\tmp} + \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale} + \pgfmathadd{\pgf@circ@labanc}{90} + \pgfmathround{\pgfmathresult} + \def\pgf@circ@labanctext{\pgf@circ@labanc} + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + %Values around 90 are at both y-axis + \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96 + \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}} + \ifnum \pgf@circ@labpos > 180 + \ifnum \ctikzvalof{bipole/#1/position} > 0 + \pgfextra{\def\pgf@circ@labanctext{mid west}} + \else + \pgfextra{\def\pgf@circ@labanctext{mid east}} + \fi + \else + \ifnum \ctikzvalof{bipole/#1/position} > 0 + \pgfextra{\def\pgf@circ@labanctext{mid east}} + \else + \pgfextra{\def\pgf@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@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@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \pgfextra{\def\pgf@circ@labanctext{north}}%north + \fi + \else + \ifnum \pgf@circ@labanc < 90 + % shift, as above + (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \ifnum \pgf@circ@labanc > 180 + % this shouldn't happen, but somehow it does (270 degree anchors) + % shift, as above + (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \pgfextra{\def\pgf@circ@labanctext{north}}%north + \fi + \fi + \fi + \fi\fi + (labelcoor) node[anchor=\pgf@circ@labanctext, + inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, + ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}% + } +} + +\def\pgf@circ@finallabels#1{% + \edef\pgf@temp{}% + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}% + \ifx\pgf@temp\pgf@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@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@valign, l2 valign=c, + l2 halign/.store in=\ltwo@halign, l2 halign=l, +} +\ctikzset{l2base/.code n args={2}{ + \pgfkeys{/tikz/circuitikz/bipole/label/name=% + \bgroup + \setlength{\tabcolsep}{2pt}% + \def\ltwo@tabu{\tabular[\ltwo@valign]}% + \expandafter\ltwo@tabu\expandafter{\ltwo@halign}% + #1\\ #2% + \endtabular + \egroup + }% + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#2} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@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 2007-2009 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 + + +\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@circuit@bipole@isvoltage + \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above, + \circuitikzbasekey/bipole/voltage/direction=forward} + \else + \ifpgf@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@circ@oldvoltagedirection + \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries + \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below, + \circuitikzbasekey/bipole/voltage/direction=forward} + \fi\fi + \else + \ifpgf@circuit@bipole@iscurrent + \ifpgf@circuit@bipole@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@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp} + \else + \fi + \else + \fi + } +} + +% american voltage font selection and symbol definition +% the default font command is {} --- nothing +\def\pgf@circ@avfont{\ctikzvalof{voltage/american font}} +% +% plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex) +% notice that the double braces are needed to be able +% to use \boldmath in the font (although it is semi-deprecated...) +% +\def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}} +\def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}} + +%% Output routine for generic bipoles + +\def\pgf@circ@drawvoltagegeneric{ + \pgfextra{ + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance} + \pgfkeysifdefined{\pgf@temp} + { + \edef\partheight{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance}} + \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen)} + } + { + \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance} + { + \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}} + \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen)} + } + {%calculate default value from part height + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height} + \pgfkeysifdefined{\pgf@temp} + { + \edef\partheight{0.5*\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height}} + \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen+0.2\pgf@circ@Rlen)} + } + { + \edef\tmpdistfromline{(.5\pgf@circ@Rlen)} %fallback to fixed value + } + } + } + \ifnum \ctikzvalof{mirror value}=-1 + \ifpgf@circuit@bipole@inverted + \ifpgf@circuit@bipole@voltage@straight + \def\distfromline{\tmpdistfromline} + \else + \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \fi + \else + \ifpgf@circuit@bipole@voltage@straight + \def\distfromline{-\tmpdistfromline} + \else + \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \fi + \fi + \else + \ifpgf@circuit@bipole@inverted + \ifpgf@circuit@bipole@voltage@straight + \def\distfromline{-\tmpdistfromline} + \else + \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \fi + \else + \ifpgf@circuit@bipole@voltage@straight + \def\distfromline{\tmpdistfromline} + \else + \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \fi + \fi + \fi + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@voltage@angle{90} + \else + \def\pgf@circ@voltage@angle{-90} + \fi + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node} + \pgfkeysifdefined{\pgf@temp} + { \edef\distacefromnode{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node}} } + { \edef\distacefromnode{\ctikzvalof{voltage/distance from node}} } + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b} + \pgfkeysifdefined{\pgf@temp} + { \edef\bumpb{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b}} } + { \edef\bumpb{\ctikzvalof{voltage/bump b}} } + \edef\shiftv{\ctikzvalof{voltage/shift}} + \pgfmathsetmacro{\bumpb}{\bumpb + \shiftv} %% adjust the bump is shift + \ifpgf@circuit@bipole@inverted + \pgfmathsetmacro{\shiftv}{-\shiftv} + \fi + \ifnum \ctikzvalof{mirror value} = -1 + \pgfmathsetmacro{\shiftv}{-\shiftv} + \fi + } + % %\pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} is equal to the length of the currarrow + coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorstartnode)$) + + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$) + coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorendnode)$) + + coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$) + + \ifpgf@circuit@bipole@voltage@below + coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto) ! \shiftv!90 : (anchorendnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom) ! \shiftv!-90 : (anchorstartnode)$) + coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$) + coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$) + \else + coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto) ! -\shiftv!90 : (anchorendnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom) ! -\shiftv!-90 : (anchorstartnode)$) + coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$) + coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$) + \fi + + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@straight + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} + \else + (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} + \fi + \else + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vto) .. controls (pgfcirc@Vcont2) and (pgfcirc@Vcont1) .. + node[currarrow, sloped, allow upside down, pos=1] {} + (pgfcirc@Vfrom) + \else + (pgfcirc@Vfrom) .. controls (pgfcirc@Vcont1) and (pgfcirc@Vcont2) .. + node[currarrow, sloped, allow upside down, pos=1] {} + (pgfcirc@Vto) + \fi + \fi + \else + \ifpgf@circuit@bipole@voltage@backward + \ifpgf@circ@oldvoltagedirection + (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} + (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} + \else + (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} + (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} + \fi + \else + \ifpgf@circ@oldvoltagedirection + (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} + (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} + \else + (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} + (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} + \fi + \fi + \fi +} + +%% Output routine for voltage sources +\def\pgf@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 + \shiftv} + } + \ifpgf@circuit@bipole@voltage@below + coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$) + coordinate (pgfcirc@Vto) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$) + \else + coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$) + coordinate (pgfcirc@Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$) + \fi + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vfrom) + \else + (pgfcirc@Vfrom) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vto) + \fi + \else% american voltage + \ifpgf@circuit@bipole@voltageoutsideofsymbol + % if it is a battery, must put + and - + + \ifpgf@circ@fixbatteries + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + \else + (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + \fi + \else + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + \else + (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + \fi + \fi + \fi + \fi +} + +%% Output routine +\def\pgf@circ@drawvoltage{% node name + \pgfextra{ %WARNING: indentation is probably wrong + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north west} + \else + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{west} + \else + \def\pgf@circ@bipole@voltage@label@anchor{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south west} + \else \def\pgf@circ@bipole@voltage@label@anchor{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south} + \else\def\pgf@circ@bipole@voltage@label@anchor{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \else\def\pgf@circ@bipole@voltage@label@anchor{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{east} + \else \def\pgf@circ@bipole@voltage@label@anchor{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north east} + \else\def\pgf@circ@bipole@voltage@label@anchor{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi\fi + \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi\fi + + \ifnum \ctikzvalof{mirror value}=-1 + \ifpgf@circuit@bipole@voltage@below + \pgf@circuit@bipole@voltage@belowfalse + \else + \pgf@circuit@bipole@voltage@belowtrue + \fi + \fi + + \ifpgf@circuit@bipole@inverted + \ifpgf@circuit@bipole@voltage@below + \pgf@circuit@bipole@voltage@belowfalse + \else + + \pgf@circuit@bipole@voltage@belowtrue + \fi + \fi + + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@where{-90} + \else + \def\pgf@circ@bipole@voltage@label@where{90} + \fi + + + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance} + \pgfkeysifdefined{\pgf@temp} + { \edef\eudist{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance}} } + { \edef\eudist{\ctikzvalof{voltage/european label distance}} } + \edef\shiftv{\ctikzvalof{voltage/shift}} + % adjust the label distance to the shift. + \pgfmathsetmacro{\eudistplus}{\eudist+\shiftv} + + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + }%end pgfextra + + \ifpgf@circuit@bipole@isvoltage + \pgf@circ@drawvoltagegenerator + \else + \pgf@circ@drawvoltagegeneric + \fi + + % (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where) %Zeile sinnlos!? + \ifpgf@circuit@bipole@voltage@straight + coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] + at (Vlab) { \pgf@circ@finallabels{voltage/label} } + \else + coordinate (Vlab) at ($(\ctikzvalof{bipole/name}.center) ! + \ifpgf@circuit@europeanvoltage + \eudistplus + \else + \ctikzvalof{voltage/american label distance} + \fi ! + (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where)$) + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] at (Vlab) { \pgf@circ@finallabels{voltage/label} } + \fi +}%end drawvoltages +%%%---------- close: tex/pgfcircvoltage +%%%%%%%%%%% Springe nach tex/pgfcirccurrent +%%%---------- open: tex/pgfcirccurrent.tex +% Copyright 2007-2009 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 + +%% 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@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp} + \else + \fi + \else + \fi + %reverse current direction for voltage sources + \ifpgf@circ@oldvoltagedirection\else + \ifpgf@circuit@bipole@isvoltage + \ifpgf@circuit@bipole@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@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@circ@drawcurrent{ + \pgfextra{ + \edef\pgf@circ@ffffff{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@bipole@current@label@where{-90} + \else + \def\pgf@circ@bipole@current@label@where{+90} + \fi + } + + \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} + \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line + (\tikztostart)--(\tikztotarget) + \else% normal bipole or source + \ifpgf@circuit@bipole@current@before + (\tikztostart)--(anchorstartnode) + \else + (anchorendnode)--(\tikztotarget) + \fi + \fi + \ifpgf@circuit@bipole@current@backward + \pgfextra{ + \pgfmathsubtract{\pgf@circ@ffffff}{180} + \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \fi + coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf@circ@ffffff](Iarrow) + (Iarrow.\pgf@circ@bipole@current@label@where) node[anchor=\pgf@circ@dir]{\pgf@circ@finallabels{current/label}} +} + +%%%---------- close: tex/pgfcirccurrent +%%%%%%%%%%% Springe nach tex/pgfcircflow +%%%---------- open: tex/pgfcircflow.tex +% Copyright 2007-2009 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 + +%% 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@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +} +} + +%% Output routine +\def\pgf@circ@drawflow{ + \pgfextra{ + \edef\pgf@circ@ffffff{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@bipole@flow@label@where{-90} + \else + \def\pgf@circ@bipole@flow@label@where{+90} + \fi + } + + \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} + \ifx\pgf@circ@temp\pgf@temp%draw flow at a short at middle of the line + (\tikztostart)--(\tikztotarget) + \else% normal bipole or source + \ifpgf@circuit@bipole@flow@before + (\tikztostart)--(anchorstartnode) + \else + (anchorendnode)--(\tikztotarget) + \fi + \fi + \pgfextra{ + \ifpgf@circuit@bipole@flow@backward + \ifpgf@circuit@bipole@flow@below + \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \else + \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \fi + \pgfmathsubtract{\pgf@circ@ffffff}{180} + \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \else + \ifpgf@circuit@bipole@flow@below + \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \else + \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \fi + \fi + } + coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf@circ@ffffff,yshift=\flow@offset](Farrowpos) + (Farrowpos.\pgf@circ@bipole@flow@label@where) node[anchor=\pgf@circ@dir]{ \pgf@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@circ@siunitxtrue, + +\processaction + [\currentmoduleparameter{arrowmos}] + [true=>\pgf@circuit@mos@arrowstrue, + false=>\pgf@circuit@mos@arrowsfalse] +% \s!default=>\pgf@circuit@mos@arrowstrue, + + +\ifpgf@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 + +\def\pgf@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@circuit@bipole@invertedtrue}} +\ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}} +\ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}} +\newif\ifpgf@circuit@bipole@inverted +\ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted} + +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@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@explicit@center@anchor#1{ + \pgfutil@ifundefined{pgf@sh@ns@#1} + { + %This coordinate is no node(but a relative position or a coordinate), no further handling needed + }{ + \pgfutil@in@.{#1} + \ifpgfutil@in@ + % Anchor is used, do nothing! + \else% + \let\tikz@moveto@waiting=\relax + \pgfpathmoveto{\tikz@last@position}%force movement, because tikz@moveto@waiting + \edef#1{#1.center}%ensure using center anchor + \fi +} +} + + +%% Generic bipole path +\def\pgf@circ@bipole@path#1#2{ + + \pgfextra{ + \set@explicit@center@anchor{\tikztostart} + \set@explicit@center@anchor{\tikztotarget} + \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates + \ctikzset{bipole/kind = #1} + \edef\pgf@temp{\ctikzvalof{bipole/name}} + \def\pgf@circ@temp{} + \ifx\pgf@temp\pgf@circ@temp % if it has not a name + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = #2\pgf@circ@rand} % create it + \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}} + \pgfmathround{\pgfmathresult} + \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path + \pgfsyssoftpath@setcurrentpath{\myp@th} + } + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \ifx\pgf@temp\pgf@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@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}] + (\ctikzvalof{bipole/name}) {} + \ifpgf@circuit@bipole@inverted + \ifcsname pgf@anchor@#1shape@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@anchor@#1shape@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@temp{open}\def\pgf@circ@temp{#1}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open + \else + (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode) + (anchorendnode) -- (\ctikzvalof{bipole/name}end.center) + \fi + + \drawpoles + \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi + \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi + \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi + \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi + \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \ifx\pgf@temp\pgf@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@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}} + \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi + \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} } + \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi +} + +%% Path definitions +\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi} +\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi} +\def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi} +\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi} +\def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}} +\def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}} +\def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}} +\def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}} +\def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} +\def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}} +\def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}} +\def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}} +\def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}} +\def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}} +\def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} +\def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}} +\def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}} +\def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} +\def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}} +\def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}} +\def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}} +\def\pgf@circ@inductor@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductor@path{#1}% + \else% + \pgf@circ@americaninductor@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@vinductor@path#1{ + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@veuropeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@vcuteinductor@path{#1}% + \else% + \pgf@circ@vamericaninductor@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@inductivesens@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductivesens@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductivesens@path{#1}% + \else% + \pgf@circ@americaninductivesens@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} +\def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}} +\def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}} +\def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}} +\def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}} +\def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}} +\def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}} +\def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}} +\def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}} +\def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}} +\def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}} +\def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}} +\def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}} +\def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}} +\def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}} +\def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}} +\def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}} +\def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}} +\def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}} +\def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}} +\def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} +\def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} +\def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} +\def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} +\def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}} +\def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}} +\def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}} +\def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}} +\def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}} +\def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}} +\def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}} +\def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}} +\def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}} +\def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}} +\def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}} +\def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}} +\def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}} +\def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}} +\def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} +\def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} +\def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}} +\def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}} +\def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}} +\def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}} +\def\pgf@circ@empty@path#1{} +\def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}} +\def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}} +\def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}} +\def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}} +\def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}} +\def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}} +\def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}} +\def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}} +\def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}} +\def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}} +\def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}} +\def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}} +\def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}} +\def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}} + +\def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} +\def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}} +\def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}} + +\def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}} +\def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}} +\def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}} +\def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}} +\def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}} +\def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}} +\def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}} +\def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}} +\def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}} +\def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}} +\def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}} +\def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}} +\def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}} +\def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}} +\def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}} +\def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}} +\def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}} +\def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}} +\def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}} + +%%Mechanical +\def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}} +\def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}} +\def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}} +\def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}} + +%% Styles + +\def\comnpatname{\ifpgf@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@circ@spring@path, l=#1}} +\compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}} +\compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}} +\compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}} +\compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}} +\compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}} +\compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}} +\compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}} +\compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}} +\compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}} +\compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}} +\compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}} +\compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} +\compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}} +\compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}} +\compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}} +\compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}} +\compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}} +\compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}} +\compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +\compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +\compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}} +\compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}} +\compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}} +\compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}} +\compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} +\compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}} +\compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}} +\compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} +\compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}} +\compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}} +\compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}} +\compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}} +\compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}} +\compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}} +\compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}} +\compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}} +\compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}} +\compattikzset{transmission line/.style = {tline = #1}} +\compattikzset{TL/.style = {tline = #1}} +\compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}} +\compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesquare@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcetri@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} + +\compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}} +\compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}} + + +\compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}} +\compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}} +\compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}} +\compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}} +\compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}} +\compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}} +\compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}} + +\compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}} +\compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}} + +\compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}} +\compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}} +\compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}} +\compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}} +\compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}} + +\compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}} +\compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}} +\compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}} +\compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}} +\compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}} +\compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}} +\compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}} +\compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}} +\compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}} +\compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}} +\compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}} +\compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}} +\compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}} +\compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}} +\compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}} +\compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}} +\compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}} +\compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}} +\compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}} + +% % % % % % +% % Begin of Diodes +% % % % % % + +\def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}} +\def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}} +\def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}} +\def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}} +\def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}} +\def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}} +\def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}} +\def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}} +\def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}} +\def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}} +\def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}} +\def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}} +\def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}} +\def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}} +\def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}} +\def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}} +\def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}} +\def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}} + +\compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}} +\compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}} +\compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}} +\compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}} +\compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}} +\compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}} +\compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}} +\compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}} +\compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}} +\compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}} +\compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}} + +\compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}} +\compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}} +\compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}} +\compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}} +\compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}} +\compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}} +\compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}} +\compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}} +\compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}} +\compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}} +\compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}} + +\compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}} +\compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}} +\compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}} +\compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}} +\compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}} +\compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}} +\compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}} +\compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}} +\compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}} +%\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}} + +\def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@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@circuit@fulldiode full \else empty \fi triac}}%no stroke triac! +\compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@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@circ@memristor@path}} +\compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} +\compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}} +\compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} +\compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} +\compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} +\compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} +\compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} +\compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} +\compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} +\compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}} + +\compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}} +\compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}} +\compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}} +\tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}} + +% cute switches +%% closed cute switch +\def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}} +\compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}} +\compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}} + +%% open cute switch +\def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}} +\compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}} +\compattikzset{cosw/.style= {\comnpatname cute open switch= #1}} + +%% closing cute switch +\def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}} +\compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}} +\compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}} + +%% opening cute switch +\def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}} +\compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}} +\compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}} + + +% short forms +\compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}} + +\compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}} +\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosource@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{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}} +\compattikzset{pC/.style = {\comnpatname polar 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@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@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@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@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@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} + +% cute sources +\def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}} +\compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceC@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@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}} +\compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@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@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}} +\compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceC@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@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}} +\compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@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@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}} +\compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceN@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@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}} +\compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@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@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}} +\compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}} +\compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} +\compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}} +\compattikzset{sR/.style= {\comnpatname resistive sensor= #1}} + +\compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}} +\compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}} + +\compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}} +\compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}} +\compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}} +\compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@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@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}} +\compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}} +\compattikzset{xing/.style= {\comnpatname crossing= #1}} + +%% loudspeaker and microphone + +\def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}} +\compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}} + +\def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}} +\compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}} + +% more instrument +\def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}} +\compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}} +\def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}} +\compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}} +\def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}} +\compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}} +% current loop probes +\def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}} +\compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}} +\def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}} +\compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}} +% qucs-style probes +\def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}} +\compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}} +\def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}} +\compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}} +\def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}} +\compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}} + + +% Transistor like bipoles + +\def\pgf@circ@trans@path#1#2{ + \pgfextra{ + \edef\pgf@temp{\pgfkeysvalueof{/tikz/circuitikz/bipole/name}} + \def\pgf@circ@temp{#2} + \ifx\pgf@temp\pgf@circ@temp % if it has not a name + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = trans\pgf@circ@rand} % create it + \fi + } + \ifpgf@circuit@bipole@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@circ@direction{\pgfmathresult} + } + ($(\tikztostart) ! .5 ! (\tikztotarget)$) + node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}] + (\ctikzvalof{bipole/name}) {} node {\ctikzvalof{bipole/label/name}} + \ifcsname pgf@anchor@#1@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 + \pgfextra{ + \pgfcircresetpath + } + (\tikztotarget) \tikztonodes % e si continua +} + + +\def\pgf@circ@definetranspath#1{ + \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}} +} + +\pgf@circ@definetranspath{elmech} +\pgf@circ@definetranspath{nmos} +\pgf@circ@definetranspath{pmos} +\pgf@circ@definetranspath{hemt} +\pgf@circ@definetranspath{npn} +\pgf@circ@definetranspath{pnp} +\pgf@circ@definetranspath{nfet} +\pgf@circ@definetranspath{nigfete} +\pgf@circ@definetranspath{nigfetd} +\pgf@circ@definetranspath{nigfetebulk} +\pgf@circ@definetranspath{pfet} +\pgf@circ@definetranspath{pigfete} +\pgf@circ@definetranspath{pigfetd} +\pgf@circ@definetranspath{pigfetebulk} +\pgf@circ@definetranspath{njfet} +\pgf@circ@definetranspath{pjfet} +\pgf@circ@definetranspath{pigbt} +\pgf@circ@definetranspath{nigbt} +\pgf@circ@definetranspath{Lpigbt} +\pgf@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 diff --git a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex index 8432d8c672d..a5117dfe78e 100644 --- a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex +++ b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex @@ -1,5 +1,5 @@ -\def\pgfcircversion{0.9.3} -\def\pgfcircversiondate{2019/07/13} +\def\pgfcircversion{0.9.4} +\def\pgfcircversiondate{2019/08/30} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-example.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-example.tex new file mode 100644 index 00000000000..c9719314c68 --- /dev/null +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-example.tex @@ -0,0 +1,11 @@ +% example style for circuits +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +\tikzset{example circuit style/.style={% + \circuitikzbasekey/.cd,% + amplifiers/fill=blue!20!white, +},% end .style +}% end \tikzset +% +\endinput + diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex new file mode 100644 index 00000000000..2e33283dc4b --- /dev/null +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex @@ -0,0 +1,136 @@ +% legacy style for circuits --- useful as a base for designing your style +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +% +\tikzset{legacy circuit style/.style={\circuitikzbasekey/.cd,% +% Resistors +resistors/scale=1.0, +resistors/width=0.8, +resistors/zigs=3, +resistors/fill=none, +resistors/thickness=none, +% +% Capacitors +capacitors/scale=1.0, +capacitors/fill=none, +capacitors/thickness=none, +% +% Inductors (and transformers) +inductors/scale=1.0, +inductors/fill=none, +inductors/thickness=none, +% these two are not set because the default is different in american and cute coils +% inductors/width=0.6, % it's 0.8 for american coils +% inductors/coils=5, % it's 4 for american coils +% +% Diodes +diodes/scale=1.0, +diodes/fill=none, +diodes/thickness=none, +% +% Batteries +batteries/scale=1.0, +batteries/fill=none, +batteries/thickness=none, +% +% Independent sources (the round ones) +sources/scale=1.0, +sources/fill=none, +sources/thickness=none, +% Dependent sources (the diamond-shaped ones) +csources/scale=1.0, +csources/fill=none, +csources/thickness=none, +% +% Instruments +instruments/scale=1.0, +instruments/fill=none, +instruments/thickness=none, +% +% Mechanical analogy +mechanicals/scale=1.0, +mechanicals/fill=none, +mechanicals/thickness=none, +% +% Misc component (look at the manual) +misc/scale=1.0, +misc/fill=none, +misc/thickness=none, +% +% Block diagrams +blocks/scale=1.0, +blocks/fill=none, +blocks/thickness=none, +% +% Ground symbols +grounds/scale=1.0, +grounds/fill=none, +grounds/thickness=none, +% +% Power supplies (but look at the manual, you can do more) +power supplies/scale=1.0, +power supplies/fill=none, +power supplies/thickness=none, +% +% Transistors +transistors/scale=1.0, +transistors/fill=none, +transistors/thickness=none, +tripoles/mos style=no arrows, % it can be "arrows" +tripoles/pmos style=fullcircle, % it can be "fullcircle", "nocircle" +transistors/arrow pos=legacy, % it can be "end" +% +% Vacuum tubes +tubes/scale=1.0, +tubes/fill=none, +tubes/thickness=none, +% +% RF components +RF/scale=1.0, +RF/fill=none, +RF/thickness=none, +% +% Electromechanical +electromechanicals/scale=1.0, +electromechanicals/fill=none, +electromechanicals/thickness=none, +% +% Amplifiers +amplifiers/scale=1.0, +amplifiers/fill=none, +amplifiers/thickness=none, +% +% Switches (they're a bit special, look the manual) +switches/scale=1.0, +switches/fill=none, +switches/thickness=none, +% +% Logic ports +logic ports/scale=1.0, +logic ports/fill=none, +logic ports/thickness=none, +logic ports origin=legacy, % it can be "center" (better) +% +% Integrated circuits +chips/scale=1.0, +chips/fill=none, +chips/thickness=none, +% +% Displays +displays/scale=1.0, +displays/fill=none, +displays/thickness=none, +% +% Nodes width (connectors, etc +nodes width=.04, +% +% Arrows size +current arrow scale=16, +},% end .style +}% end \tikzset +% You can add more commands here +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +% +\endinput + diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex new file mode 100644 index 00000000000..fabba4abf29 --- /dev/null +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex @@ -0,0 +1,74 @@ +% romano style for circuitikz +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +\tikzset{romano circuit style/.style={% +\circuitikzbasekey/.cd,% +% Resistors +resistors/scale=0.8, +resistors/thickness=1.0, +% +% Capacitors +capacitors/scale=0.7, +capacitors/thickness=1.0, +% +% Inductors (and transformers) +inductors/scale=0.8, +inductors/thickness=1.0, +% +% Diodes +diodes/scale=0.6, +diodes/thickness=1.0, +% +% Batteries +batteries/scale=1.0, +batteries/thickness=2.0, +% +% Sources (the round and diamond-shaped ones!) +sources/scale=0.9, +sources/thickness=1.0, +csources/scale=0.9, +csources/thickness=1.0, +bipoles/noise sources/fillcolor=dashed, +% +% Instruments +instruments/scale=1.0, +% +% Ground symbols +grounds/scale=1.0, +grounds/thickness=1.0, +% +% Transistors +transistors/scale=1.3, +transistors/thickness=3.0, +tripoles/mos style=arrows, % it can be "arrows" +tripoles/pmos style=emptycircle, % it can be "fullcircle", "nocircle" +transistors/arrow pos=end, % it can be "end" +% +% Amplifiers +amplifiers/scale=1.0, +amplifiers/thickness=3.0, +% +% Logic ports +logic ports/scale=1.0, +logic ports/thickness=2.0, +logic ports origin=center, % it can be "center" (better) +% +% Switches +bipoles/cuteswitch/thickness=0.5, +% +% Integrated circuits +chips/scale=1.0, +chips/thickness=3.0, +% +% other options for romano style +bipoles/crossing/size=0.4, +% I am not sure I like them... +% monopoles/vcc/arrow={Triangle[width=0.8*\scaledwidth, length=\scaledwidth]}, +% monopoles/vee/arrow={Triangle[width=0.8*\scaledwidth, length=\scaledwidth]}, +},% end .style +}% end \tikzset +% You can add more commands here +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +\endinput + diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index 22bcf58f930..200230b50a5 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex @@ -1,4 +1,17 @@ -%% Counters +%% Key managements + +\long\def\pgf@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@circ@count@a \newcount\pgf@circ@count@b @@ -51,11 +64,32 @@ \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} +\def\pgf@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@circ@draworfill{% \ifx\tikz@fillcolor\pgfutil@empty - \pgfusepath{draw} + \pgf@circ@setifdefinedfill{draw,fill}{draw} \else \pgfsetfillcolor{\tikz@fillcolor} \pgfusepath{draw, fill} @@ -64,6 +98,7 @@ \def\pgf@circ@draworfillandclip{% \ifx\tikz@fillcolor\pgfutil@empty + \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip} \pgfusepath{draw, clip} \else \pgfsetfillcolor{\tikz@fillcolor} @@ -73,24 +108,37 @@ \def\pgf@circ@maybefill{% \ifx\tikz@fillcolor\pgfutil@empty - \pgfusepath{discard} + \pgf@circ@setifdefinedfill{fill}{discard} \else \pgfsetfillcolor{\tikz@fillcolor} \pgfusepath{fill} \fi } -%% Keys - -\long\def\pgf@circ@comment#1{} -\def\circuitikzbasekey{/tikz/circuitikz} - -\pgfkeys{\circuitikzbasekey/.is family} +%% Macros for setting linewidth +% #1 is the legacy class (bipoles, tripoles) etc +% #2 is the reference linewidth +\def\pgf@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@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case +\ctikzset{none/thickness/.initial=1.0} % do not touch -\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}} -\let\ctikzset\circuitikzset -\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}} -\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}} +% voltage options \newif\ifpgf@circ@siunitx \newif\ifpgf@circuit@compat @@ -105,7 +153,6 @@ \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}} \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}} - % Option ">" for twoports \newif\ifpgf@circuit@inputarrow \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} @@ -139,8 +186,130 @@ % Base len for all circuitikz \newdimen\pgf@circ@Rlen -\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1}} +% scaled length for internal use in scalable shapes +\newdimen\pgf@circ@scaled@Rlen +\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}} \pgf@circ@Rlen = 1.4cm +% by default scale is 1.0 +\pgf@circ@scaled@Rlen=\pgf@circ@Rlen + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% main style definitions +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +% load a style file: search ctikzstyle-NAME.tex in path +\def\ctikzloadstyle#1{% + \edef\pgf@temp{#1}% + % guard against re-loading + \expandafter\ifx\csname pgf@circ@style@\pgf@temp @loaded\endcsname\relax% + \expandafter\global\expandafter\let\csname pgf@circ@style@\pgf@temp @loaded\endcsname=\pgfutil@empty + \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{% + \tikzerror{I did not find the circuitikz style #1}}% + \fi +} + +% 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{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} @@ -155,7 +324,6 @@ \ctikzset{monopoles/chassis/width/.initial=.25} \ctikzset{monopoles/alternative chassis/width/.initial=.25} \ctikzset{monopoles/equipotentiality/width/.initial=.25} -\ctikzset{monopoles/tlinestub/width/.initial=.25} \ctikzset{monopoles/antenna/width/.initial=.25} \ctikzset{monopoles/antenna/label/xanchor/.initial=.4} \ctikzset{monopoles/antenna/label/yanchor/.initial=.75} @@ -169,6 +337,7 @@ \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} @@ -185,11 +354,34 @@ \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}% +}} +% 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/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} @@ -207,8 +399,48 @@ \ctikzset{bipoles/varistor/main/.initial=.7} \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7 \ctikzset{bipoles/varistor/width/.initial=.8} -\ctikzset{bipoles/vresistor/height/.initial=.6} -\ctikzset{bipoles/vresistor/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/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= \fontsize{6}{0}\selectfont\boldmath} +\ctikzset{bipoles/pcapacitor/height/.initial=.6} +\ctikzset{bipoles/pcapacitor/width/.initial=.2} +\ctikzset{bipoles/pcapacitor/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} @@ -223,8 +455,12 @@ \ctikzset{bipoles/cutechoke/cstep/.initial=.3} \ctikzset{bipoles/cutechoke/cdist/.initial=1.3} \ctikzset{bipoles/cutechoke/cthick/.initial=1} -\newif\ifpgf@circuit@bipole@twolines -\pgf@circuit@bipole@twolinesfalse +\newif\ifpgf@circuit@bipole@twolineschoke +\pgf@circuit@bipole@twolineschokefalse +\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +\ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} % \ctikzset{bipoles/americaninductor/height/.initial=.3} \ctikzset{bipoles/americaninductor/height 2/.initial=.1} @@ -241,6 +477,13 @@ \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} @@ -275,6 +518,8 @@ \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} @@ -284,25 +529,15 @@ \ctikzset{bipoles/cisourcesin/width/.initial=.7} \ctikzset{bipoles/cvsourcesin/height/.initial=.7} \ctikzset{bipoles/cvsourcesin/width/.initial=.7} -\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= \fontsize{6}{0}\selectfont\boldmath} -\ctikzset{bipoles/pcapacitor/height/.initial=.6} -\ctikzset{bipoles/pcapacitor/width/.initial=.2} -\ctikzset{bipoles/pcapacitor/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} \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} + +% diodes + \ctikzset{bipoles/diode/height/.initial=.50} \ctikzset{bipoles/diode/width/.initial=.40} \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} @@ -311,6 +546,9 @@ \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} @@ -320,8 +558,9 @@ \ctikzset{bipoles/ncs/height/.initial=.35} \ctikzset{bipoles/ncs/width/.initial=.35} \ctikzset{bipoles/ncs/depth/.initial=.2} -\ctikzset{bipoles/generic/height/.initial=.30} -\ctikzset{bipoles/generic/width/.initial=.80} + +% 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} @@ -335,20 +574,9 @@ \ctikzset{bipoles/fuse/width/.initial=.50} \ctikzset{bipoles/afuse/height/.initial=.20} \ctikzset{bipoles/afuse/width/.initial=.50} -\ctikzset{bipoles/generic potentiometer/height/.initial=.80} -\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} -\ctikzset{bipoles/generic potentiometer/width/.initial=.80} -\ctikzset{bipoles/ageneric/height/.initial=.30} -\ctikzset{bipoles/ageneric/width/.initial=.80} \ctikzset{bipoles/memristor/height/.initial=.30} \ctikzset{bipoles/memristor/wave height/.initial=.5} \ctikzset{bipoles/memristor/width/.initial=.80} -\ctikzset{bipoles/tgeneric/height/.initial=.70} -\ctikzset{bipoles/tgeneric/width/.initial=.80} -\ctikzset{bipoles/tfullgeneric/height/.initial=.70} -\ctikzset{bipoles/tfullgeneric/width/.initial=.80} -\ctikzset{bipoles/fullgeneric/height/.initial=.30} -\ctikzset{bipoles/fullgeneric/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} @@ -415,13 +643,12 @@ \ctikzset{bipoles/phaseshifter/width/.initial=.7} \ctikzset{bipoles/vphaseshifter/width/.initial=.7} \ctikzset{bipoles/detector/width/.initial=.7} -% resistive sensor american style -\ctikzset{bipoles/resistivesens/height/.initial=.6} -\ctikzset{bipoles/resistivesens/width/.initial=.8} % crossing wires \ctikzset{bipoles/crossing/size/.initial=.2} +% Transistors starts here + \newif\ifpgf@circuit@trans@depletiontype \pgf@circuit@trans@depletiontypefalse @@ -473,6 +700,7 @@ % Option draw pmos with empty circle \newif\ifpgf@circuit@pmos@emptycircle \pgf@circuit@pmos@emptycirclefalse +\ctikzset{tripoles/pmos style/.is choice} \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} % Option draw pmos with no circle @@ -483,7 +711,12 @@ % back to normal \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} - +% arrows at the end, the correct way +\newif\ifpgf@circuit@trans@arrowatend +\pgf@circuit@trans@arrowatendfalse +\ctikzset{transistors/arrow pos/.is choice} +\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} +\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} \newif\ifpgf@circuit@trans@ntype \pgf@circuit@trans@ntypetrue %default true @@ -742,56 +975,60 @@ \newif\ifpgf@circuit@europeanlogicport \ctikzset{logic ports/.is choice} \ctikzset{logic ports/european/.code= {\pgf@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{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}} - } } + \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@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{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}} - } } + \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 not port/origin/.initial=0.8} - } +\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 not port/origin/.initial=0} - } +\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}% + }% } @@ -876,6 +1113,12 @@ \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} @@ -907,6 +1150,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 @@ -940,61 +1185,88 @@ \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} -% -\ctikzset{tripoles/op amp/width/.initial=1.7} -\ctikzset{tripoles/op amp/port width/.initial=.7} -\ctikzset{tripoles/op amp/height/.initial=1.4} -\ctikzset{tripoles/op amp/input height/.initial=.5} -\ctikzset{tripoles/op amp/up pos/.initial=.45} -\ctikzset{tripoles/op amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath}%absolute font size needed! + +% 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= \fontsize{10}{12}\selectfont\boldmath} % 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= \fontsize{10}{12}\selectfont\boldmath} % 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= \fontsize{10}{12}\selectfont}%absolute font size needed! -\ctikzset{tripoles/en amp/font2/.initial= \fontsize{12}{14}\selectfont}%absolute font size needed! +\ctikzset{tripoles/en amp/font/.initial= \fontsize{10}{12}\selectfont} % Absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial= \fontsize{12}{14}\selectfont} % 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/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{#1}% }, - en amp text A/.code = { - \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$} + en amp text A/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% }, } -\ctikzset{tripoles/gm amp/width/.initial=1.7} -\ctikzset{tripoles/gm amp/port width/.initial=.7} -\ctikzset{tripoles/gm amp/height/.initial=1.4} -\ctikzset{tripoles/gm amp/input height/.initial=.5} -\ctikzset{tripoles/gm amp/up pos/.initial=.45} -\ctikzset{tripoles/inst amp/width/.initial=1.7} % instrumentation amplifier, simple -\ctikzset{tripoles/inst amp/port width/.initial=.7} -\ctikzset{tripoles/inst amp/height/.initial=1.4} -\ctikzset{tripoles/inst amp/input height/.initial=.5} -\ctikzset{tripoles/inst amp/up pos/.initial=.4} -\ctikzset{tripoles/inst amp/refv pos/.initial=.7} -\ctikzset{tripoles/inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! -\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % instrumentation amplifier, diff output -\ctikzset{tripoles/fd inst amp/port width/.initial=.7} -\ctikzset{tripoles/fd inst amp/height/.initial=1.4} -\ctikzset{tripoles/fd inst amp/input height/.initial=.5} -\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} -\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} -\ctikzset{tripoles/fd inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! -\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % instrumentation amplifier with ra gain resistance added -\ctikzset{tripoles/inst amp ra/port width/.initial=.7} -\ctikzset{tripoles/inst amp ra/height/.initial=2.9} -\ctikzset{tripoles/inst amp ra/input height/.initial=.7} -\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} -\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} -\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} -\ctikzset{tripoles/inst amp ra/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! -\ctikzset{tripoles/plain amp/width/.initial=1.7} -\ctikzset{tripoles/plain amp/port width/.initial=.7} -\ctikzset{tripoles/plain amp/height/.initial=1.4} -\ctikzset{tripoles/plain amp/input height/.initial=.5} -\ctikzset{tripoles/plain amp/up pos/.initial=.45} + +% 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= \fontsize{10}{12}\selectfont\boldmath} % 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= \fontsize{10}{0}\selectfont\boldmath} % 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= \fontsize{10}{0}\selectfont\boldmath} % 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= \fontsize{10}{0}\selectfont\boldmath} % 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 \ctikzset{tripoles/thyristor/height/.initial=1.10} \ctikzset{tripoles/thyristor/height 2/.initial=.5} @@ -1055,26 +1327,25 @@ \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/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} - \ctikzset{quadpoles/gyrator/width=0.6} - } +\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 % @@ -1129,7 +1400,7 @@ \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}} \tikzset{% - rotary switch/.style args={#1in#2wiper#3}{ + rotary switch/.style args={#1in#2wiper#3}{% shape=rotaryswitch, /tikz/circuitikz/multipoles/rotary/channels=#1, /tikz/circuitikz/multipoles/rotary/angle=#2, @@ -1152,11 +1423,11 @@ /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 }, + 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 @@ -1174,8 +1445,8 @@ \ctikzset{bipole/.is family} -\ctikzset{bipole/kind/.initial = } -\ctikzset{bipole/name/.initial = } +\ctikzset{bipole/kind/.initial=} +\ctikzset{bipole/name/.initial=} \newif\ifpgf@circuit@bipole@isvoltage \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage} \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol @@ -1261,9 +1532,9 @@ \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} -\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full }} -\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty }} -\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke }} +\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} @@ -1333,40 +1604,40 @@ \ctikzset{current/distance/.initial = .5} -\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{american resistors/.style = { \circuitikzbasekey/resistor = american } } -\tikzset{european resistors/.style = { \circuitikzbasekey/resistor = european } } +\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{american resistors/.style = {\circuitikzbasekey/resistor = american}} +\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}} \newif\ifpgf@circuit@europeangfsurgearrester \ctikzset{gas filled surge arrester choice/.is choice} -\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue } } -\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@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 } } -\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 } } +\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}} +\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@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}} +\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}} % I should try to make the tree clearer (this voltage conflicts with the options above) \newif\ifpgf@circuit@europeanvoltage \ctikzset{voltage/.is choice} -\ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse } } -\ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue } } +\ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse}} +\ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue}} \newif\ifpgf@circuit@europeancurrent \ctikzset{current/.is choice} -\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse } -\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue } +\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse} +\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue} % noise sources \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} @@ -1401,8 +1672,8 @@ \ctikzset{seven seg/bits/.initial=0000000} -\ctikzset{seven seg/value/.code={ - \edef\@@tmp{#1} +\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 @@ -1435,13 +1706,13 @@ }} \tikzset{% - seven segment val/.style args={#1dot#2box#3}{ + 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}{ + seven segment bits/.style args={#1dot#2box#3}{% shape=bare7seg, /tikz/circuitikz/seven seg/bits=#1, /tikz/circuitikz/seven seg/dot=#2, diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index bf024ec473f..0048efb8924 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -14,42 +14,59 @@ % #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}} - -\long\def\pgfcircdeclarebipole#1#2#3#4#5#6{ - \pgfdeclareshape{#3shape}{ - +%% 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@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\northeast}{ - \pgf@y=#4\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=#5\pgf@circ@Rlen + \pgf@x=#6\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \savedanchor{\northeastborder}{ - \pgf@y=#4\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y - \pgf@x=#5\pgf@circ@Rlen + \pgf@x=#6\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x } \savedanchor{\southwestborder}{ - \pgf@y=-#2\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y - \pgf@x=-#5\pgf@circ@Rlen + \pgf@x=-#6\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x } \savedanchor{\southwest}{ - \pgf@y=-#2\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-#5\pgf@circ@Rlen + \pgf@x=-#6\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \savedanchor{\centerpoint}{ - \pgf@circ@res@down=-#2\pgf@circ@Rlen - \pgf@circ@res@up=#4\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen + \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen \pgfpointorigin \pgf@y=\pgf@circ@res@up \advance\pgf@y by\pgf@circ@res@down @@ -163,10 +180,10 @@ \fi } - #1 + #2 \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northeast \pgf@circ@res@up = \pgf@y @@ -175,10 +192,10 @@ \pgf@circ@res@right = \pgf@x \southwest \pgf@circ@res@down = \pgf@y - + \pgf@circ@scaled@Rlen=\scaledRlen \pgfstartlinewidth=\pgflinewidth \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! - #6 + #7 \pgfsetlinewidth{\pgfstartlinewidth} } @@ -187,74 +204,316 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Standard bipole shapes declarations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Resistor +%%%%%%%%%%%%%%%%%%%%%%%% +% Resistive components +%%%%%%%%%%%%%%%%%%%%%%%% + +%% Short circuit + +%%% NOTICE that the short is really NOT drawn; we trust the fact that its +%%% natural length is zero. \pgfcircdeclarebipole {} -{\ctikzvalof{bipoles/resistor/height}} -{resistor} -{\ctikzvalof{bipoles/resistor/height}} -{\ctikzvalof{bipoles/resistor/width}} +{0} +{short} +{0} +{0} +{ } + +%% Open circuit +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/open/height}} +{open} +{\ctikzvalof{bipoles/open/height}} +{\ctikzvalof{bipoles/open/width}} +{ } + +%% Generic bipole - used as resistor by some (bleah) +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/generic/height}} +{generic} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} - \divide \pgf@circ@res@step by 12 + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + +%% Generic empty tunable +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/tgeneric/height}} +{tgeneric} +{\ctikzvalof{bipoles/tgeneric/height}} +{\ctikzvalof{bipoles/tgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@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@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + +%% Memristor +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/memristor/height}} +{memristor} +{\ctikzvalof{bipoles/memristor/height}} +{\ctikzvalof{bipoles/memristor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@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@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Thermistor +\pgfcircdeclarebipolescaled{resistors} +{{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + \pgf@y=1.2\pgf@y + }% +}} +{\ctikzvalof{bipoles/thermistor/height}} +{thermistor} +{\ctikzvalof{bipoles/thermistor/height}} +{\ctikzvalof{bipoles/thermistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@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@circ@res@left}{\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@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@circ@res@left}{\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Generic tunable +\pgfcircdeclarebipolescaled{resistors}{ + \anchor{wiper}{ + \northeast + \pgfpoint{0pt}{\pgf@y} + } +} +{\ctikzvalof{bipoles/generic potentiometer/height 2}} +{genericpotentiometer} +{\ctikzvalof{bipoles/generic potentiometer/height}} +{\ctikzvalof{bipoles/generic potentiometer/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Zig zag resistores +\def\pgf@circ@zigzag#1{% + \divide \pgf@circ@res@step by \numexpr4*\zigs\relax \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} \pgf@circ@res@other = \pgf@circ@res@left + \pgf@circ@count@a=\zigs\relax + % first half zig \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}} + \pgfmathloop% + \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times + \ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}} + \repeatpgfmathloop% + % last zig and a half \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} \advance\pgf@circ@res@other by \pgf@circ@res@step \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@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@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{1} +} %% Variable resistor -\pgfcircdeclarebipole -{} +\pgfcircdeclarebipolescaled{resistors} +{ +\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} {\ctikzvalof{bipoles/vresistor/height}} {vresistor} {\ctikzvalof{bipoles/vresistor/height}} {\ctikzvalof{bipoles/vresistor/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} - \divide \pgf@circ@res@step by 12 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} - - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfsetbeveljoin - \pgfusepath{draw} + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{.5} \pgfscope \pgfsetarrowsend{latexslim} @@ -264,21 +523,68 @@ \endpgfscope } +%% Potentiometer +\pgfcircdeclarebipolescaled{resistors} +{ + \anchor{wiper}{\northeast\pgfpoint{0pt}{\pgf@y}} + \anchor{W}{\northeast\pgfpoint{0pt}{\pgf@y}} + \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/potentiometer/height 2}} +{potentiometer}{\ctikzvalof{bipoles/potentiometer/height}} +{\ctikzvalof{bipoles/potentiometer/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{1} + + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Resistive sensor +\pgfcircdeclarebipolescaled{resistors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.4\pgf@x}% + \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/resistivesens/height}} +{resistivesens} +{\ctikzvalof{bipoles/resistivesens/height}} +{\ctikzvalof{bipoles/resistivesens/width}} +{% + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{.5} + \pgfscope + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} -%% Capacitor +%%%%%%%%%%%%%% +%% Capacitors +%%%%%%%%%%%%% -\pgfcircdeclarebipole +%% Plain Capacitor +\pgfcircdeclarebipolescaled{capacitors} {} {\ctikzvalof{bipoles/capacitor/height}} {capacitor} {\ctikzvalof{bipoles/capacitor/height}} {\ctikzvalof{bipoles/capacitor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} @@ -289,22 +595,16 @@ } %% Capacitive sensor -\pgfcircdeclarebipole -{\anchor{label}{% - \southwest - \pgf@x=2.6\pgf@x - \pgf@y=1.4\pgf@y - }% +\pgfcircdeclarebipolescaled{capacitors} +{ + \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}% } {\ctikzvalof{bipoles/capacitor/height}} {capacitivesens} {\ctikzvalof{bipoles/capacitor/height}} {\ctikzvalof{bipoles/capacitor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} @@ -313,25 +613,21 @@ \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}} \pgfusepath{draw} \endpgfscope } %% Polar Capacitor - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{capacitors} {} {\ctikzvalof{bipoles/pcapacitor/height}} {polarcapacitor} {\ctikzvalof{bipoles/pcapacitor/height}} {\ctikzvalof{bipoles/pcapacitor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/pcapacitor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}} @@ -348,19 +644,16 @@ } %% Electrolytic Capacitor - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{capacitors} {} {\ctikzvalof{bipoles/ecapacitor/height}} {ecapacitor} {\ctikzvalof{bipoles/ecapacitor/height}} {\ctikzvalof{bipoles/ecapacitor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/ecapacitor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 \pgfsetrectcap % % % Draw plus pole - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} @@ -378,137 +671,96 @@ \pgfsetfillcolor{black} % % plus pole annotation \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}] - {\pgfkeysvalueof{/tikz/circuitikz/bipoles/ecapacitor/font} $+$} + {\ctikzvalof{bipoles/ecapacitor/font} $+$} } -%% Battery - -\pgfcircdeclarebipole +%% Variable Capacitor +\pgfcircdeclarebipolescaled{capacitors} {} -{\ctikzvalof{bipoles/battery/height}} -{battery} -{\ctikzvalof{bipoles/battery/height}} -{\ctikzvalof{bipoles/battery/width}} +{\ctikzvalof{bipoles/vcapacitor/height}} +{vcapacitor} +{\ctikzvalof{bipoles/vcapacitor/height}} +{\ctikzvalof{bipoles/vcapacitor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 6 - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \ifpgf@circ@fixbatteries - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \else + \pgfscope + \pgfsetarrowsend{latexslim} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} - \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetlinewidth{\pgfstartlinewidth} \pgfusepath{draw} } -%% Battery 1 % poles with equl thickness +%% Piezoelectric Element -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{capacitors} {} -{\ctikzvalof{bipoles/battery1/height}} -{battery1} -{\ctikzvalof{bipoles/battery1/height}} -{\ctikzvalof{bipoles/battery1/width}} +{\ctikzvalof{bipoles/piezoelectric/height}} +{piezoelectric} +{\ctikzvalof{bipoles/piezoelectric/height}} +{\ctikzvalof{bipoles/piezoelectric/width}} { - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfusepath{draw} + % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen + % \divide \pgf@circ@res@step by 5 - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \ifpgf@circ@fixbatteries - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \else - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} - \fi - \pgfusepath{draw} -} - -%% Battery 2 % negative pole thicker + %% Outer markings + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/battery2/height}} -{battery2} -{\ctikzvalof{bipoles/battery2/height}} -{\ctikzvalof{bipoles/battery2/width}} -{ - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \ifpgf@circ@fixbatteries - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfsetlinewidth{3\pgflinewidth} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \else - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfsetlinewidth{3\pgflinewidth} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} - \fi - \pgfusepath{draw} + %% Inner Box + \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10 + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners + {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}} + {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope } +%%%%%%%%%%%%%%% +%% Inductors +%%%%%%%%%%%%%%% %% cute inductor - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/cuteinductor/lower coil height}} {cuteinductor} {\ctikzvalof{bipoles/cuteinductor/height}} {\ctikzvalof{bipoles/cuteinductor/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \pgfmathsetlength{\pgf@circ@res@other}%width of small coil - {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} @@ -523,30 +775,24 @@ } %% cute inductive sensor - -\pgfcircdeclarebipole -{% +\pgfcircdeclarebipolescaled{inductors} {% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.8\pgf@x - \pgf@y=2.6\pgf@y - }% -}} + \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% +} {\ctikzvalof{bipoles/cuteinductor/lower coil height}} {scuteinductor} {\ctikzvalof{bipoles/cuteinductor/height}} {\ctikzvalof{bipoles/cuteinductor/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \pgfmathsetlength{\pgf@circ@res@other}%width of small coil - {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} @@ -567,23 +813,22 @@ } %% cute choke - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/cutechoke/lower coil height}} {cutechoke} {\ctikzvalof{bipoles/cutechoke/height}} {\ctikzvalof{bipoles/cutechoke/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \pgfmathsetlength{\pgf@circ@res@other}%width of small coil - {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)} + {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)} \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/cutechoke/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2} + {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}} @@ -598,35 +843,36 @@ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}*\ctikzvalof{bipoles/cutechoke/cthick}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} \pgfusepath{stroke} - \ifpgf@circuit@bipole@twolines + \ifpgf@circuit@bipole@twolineschoke \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}*\ctikzvalof{bipoles/cutechoke/cthick}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} \pgfusepath{stroke} \fi } %% variable cute inductor - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/vcuteinductor/lower coil height}} {vcuteinductor} {\ctikzvalof{bipoles/vcuteinductor/height}} {\ctikzvalof{bipoles/vcuteinductor/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \pgfmathsetlength{\pgf@circ@res@other}%width of small coil - {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)} + {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)} \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} + {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} \pgfscope \pgfsetarrowsend{latexslim} @@ -646,22 +892,22 @@ \pgfsetbeveljoin \pgfusepath{stroke} } -%% american inductor -\pgfcircdeclarebipole +%% american inductor +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/americaninductor/height 2}} {americaninductor} {\ctikzvalof{bipoles/americaninductor/height}} {\ctikzvalof{bipoles/americaninductor/width}} { - \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} \divide \pgf@circ@res@step by 2 - \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} @@ -675,28 +921,22 @@ %% american inductive sensor - -\pgfcircdeclarebipole -{% +\pgfcircdeclarebipolescaled{inductors} {% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.8\pgf@x - \pgf@y=2.6\pgf@y - }% -}} + \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% +} {\ctikzvalof{bipoles/americaninductor/height 2}} {samericaninductor} {\ctikzvalof{bipoles/americaninductor/height}} {\ctikzvalof{bipoles/americaninductor/width}} { - \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} \divide \pgf@circ@res@step by 2 - \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} @@ -715,21 +955,20 @@ } %% variable american inductor - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/vamericaninductor/height 2}} {vamericaninductor} {\ctikzvalof{bipoles/vamericaninductor/height}} {\ctikzvalof{bipoles/vamericaninductor/width}} { - \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@Rlen - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils} \divide \pgf@circ@res@step by 2 - \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@Rlen + \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}} @@ -748,10 +987,183 @@ \endpgfscope } +%% Generic bipole, filled - used as inductor by some +\pgfcircdeclarebipolescaled{inductors} +{} +{\ctikzvalof{bipoles/fullgeneric/height}} +{fullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} -%% Independent voltage source + \pgfusepath{draw,fill} +} -\pgfcircdeclarebipole +%% Generic sensor, filled - used as inductive sensor by some +\pgfcircdeclarebipolescaled{inductors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}% +} +{\ctikzvalof{bipoles/fullgeneric/height}} +{sfullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw,fill} + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + +%% Generic full tunable +\pgfcircdeclarebipolescaled{inductors} +{} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{tfullgeneric} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{\ctikzvalof{bipoles/tfullgeneric/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw,fill} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%% +%% Battery +%%%%%%%%%%% + +%% Battery +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery/height}} +{battery} +{\ctikzvalof{bipoles/battery/height}} +{\ctikzvalof{bipoles/battery/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 6 + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@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@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@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@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%%%%%%%%%%% +%% Round and diamond sources +%%%%%%%%%%% + +%% Independent voltage source +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsource/height}} {vsource} @@ -759,7 +1171,7 @@ {\ctikzvalof{bipoles/vsource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -768,10 +1180,8 @@ \pgfusepath{draw} } - %% Independent voltage source - American style - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsourceam/height}} {vsourceAM} @@ -779,10 +1189,10 @@ {\ctikzvalof{bipoles/vsourceam/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifpgf@circ@oldvoltagedirection \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$} \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$} @@ -792,11 +1202,8 @@ \fi } - - %% Independent sinusoidal voltage source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsourcesin/height}} {vsourcesin} @@ -804,7 +1211,7 @@ {\ctikzvalof{bipoles/vsourcesin/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -821,14 +1228,14 @@ } % Square Voltage source - contributed by Alistair Kwan -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsourcesquare/height}} {vsourcesquare} {\ctikzvalof{bipoles/vsourcesquare/height}} {\ctikzvalof{bipoles/vsourcesquare/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill \pgf@circ@res@up = .5\pgf@circ@res@up @@ -845,7 +1252,7 @@ } % Triangle Voltage source - contributed by Ralf Farkas -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsourcetri/height}} {vsourcetri} @@ -853,7 +1260,7 @@ {\ctikzvalof{bipoles/vsourcetri/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -870,7 +1277,7 @@ %% PV Source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/pvsource/height}} {pvsource} @@ -878,7 +1285,7 @@ {\ctikzvalof{bipoles/pvsource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} \pgf@circ@draworfill @@ -889,7 +1296,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}} @@ -911,7 +1318,7 @@ } %% Empty Source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/esource/height}} {esource} @@ -919,20 +1326,20 @@ {\ctikzvalof{bipoles/esource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill } %% DC Current Source with open shape -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/dcisource/height}} {dcisource} {\ctikzvalof{bipoles/dcisource/height}} {\ctikzvalof{bipoles/dcisource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpointorigin} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@maybefill @@ -951,8 +1358,9 @@ \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} \endpgfscope } + %% DC-Voltage source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/dcvsource/height}} {dcvsource} @@ -960,7 +1368,7 @@ {\ctikzvalof{bipoles/dcvsource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}} @@ -970,10 +1378,8 @@ \pgfusepath{draw} } - %% Independent current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isource/height}} {isource} @@ -981,7 +1387,7 @@ {\ctikzvalof{bipoles/isource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} @@ -989,8 +1395,7 @@ } %% Independent double oo source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/oosource/height}} {oosource} @@ -998,7 +1403,7 @@ {\ctikzvalof{bipoles/oosource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} \pgf@circ@maybefill @@ -1010,10 +1415,8 @@ \pgfusepath{draw} } - %% Independent current source - American - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isourceam/height}} {isourceAM} @@ -1021,7 +1424,7 @@ {\ctikzvalof{bipoles/isourceam/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -1034,10 +1437,8 @@ \endpgfscope } - %% Independent sinusoidal current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isource/height}} {isourcesin} @@ -1045,7 +1446,7 @@ {\ctikzvalof{bipoles/isource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -1059,13 +1460,29 @@ \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} \pgfusepath{draw} \endpgfscope - } +%% Empty controlled source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/ecsource/height}} +{ecsource} +{\ctikzvalof{bipoles/ecsource/height}} +{\ctikzvalof{bipoles/ecsource/width}} +{ -%% Controlled voltage source + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} -\pgfcircdeclarebipole + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill +} + +%% Controlled voltage source +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsource/height}} {cvsource} @@ -1073,7 +1490,7 @@ {\ctikzvalof{bipoles/cvsource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} @@ -1087,18 +1504,15 @@ \pgfusepath{draw} } - - - %% Controlled voltage source - American -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsourceam/height}} {cvsourceAM} {\ctikzvalof{bipoles/cvsourceam/height}} {\ctikzvalof{bipoles/cvsourceam/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} @@ -1106,7 +1520,7 @@ \pgfpathclose \pgf@circ@draworfill - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifpgf@circ@oldvoltagedirection \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$} \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$} @@ -1116,9 +1530,8 @@ \fi } - %% Controlled sinusoidal voltage source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsourcesin/height}} {cvsourcesin} @@ -1126,7 +1539,7 @@ {\ctikzvalof{bipoles/cvsourcesin/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -1149,11 +1562,8 @@ \endpgfscope } - - %% Controlled sinusoidal current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsourcesin/height}} {cisourcesin} @@ -1161,7 +1571,7 @@ {\ctikzvalof{bipoles/cvsourcesin/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -1185,8 +1595,7 @@ } %% Controlled current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cisource/height}} {cisource} @@ -1194,7 +1603,7 @@ {\ctikzvalof{bipoles/cisource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} @@ -1208,17 +1617,15 @@ \pgfusepath{draw} } - %% Controlled current source - American - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cisourceam/height}} {cisourceAM} {\ctikzvalof{bipoles/cisourceam/height}} {\ctikzvalof{bipoles/cisourceam/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} @@ -1236,26 +1643,25 @@ } %% Cute Independent voltage source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsource/height}} {vsourceC} {\ctikzvalof{bipoles/vsource/height}} {\ctikzvalof{bipoles/vsource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfsetroundcap\pgfusepath{draw} } -%% Cute Independent current source -\pgfcircdeclarebipole +%% Cute Independent current source +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isource/height}} {isourceC} @@ -1263,32 +1669,32 @@ {\ctikzvalof{bipoles/isource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} \pgfsetroundcap\pgfusepath{draw} } -%% Cute Controlled voltage source -\pgfcircdeclarebipole +%% Cute Controlled voltage source +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsource/height}} {cvsourceC} {\ctikzvalof{bipoles/cvsource/height}} {\ctikzvalof{bipoles/cvsource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgf@circ@draworfill - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} @@ -1296,22 +1702,21 @@ } %% Cute Controlled current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cisource/height}} {cisourceC} {\ctikzvalof{bipoles/cisource/height}} {\ctikzvalof{bipoles/cisource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgf@circ@draworfill - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}} @@ -1319,8 +1724,7 @@ } %% Noise voltage source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsource/height}} {vsourceN} @@ -1328,17 +1732,18 @@ {\ctikzvalof{bipoles/vsource/width}} { \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} % - \pgf@circ@res@step=0.125\pgf@circ@Rlen\relax + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax \edef\pgf@noise@temp{dashed} - \edef\pgf@noise@fill{\pgfkeysvalueof{/tikz/circuitikz/bipoles/noise sources/fillcolor}} + \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}} \ifx\pgf@noise@temp\pgf@noise@fill % fillable in this case \pgf@circ@draworfillandclip - \pgfmathsetmacro{\thinner}{.5*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} - \pgfsetlinewidth{\thinner\pgfstartlinewidth} + \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thinner\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step @@ -1366,7 +1771,7 @@ \pgfusepath{draw,fill} \fi \endpgfscope - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} @@ -1374,7 +1779,7 @@ } %% Noise current source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isource/height}} {isourceN} @@ -1383,17 +1788,18 @@ { \pgfpointorigin \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} % - \pgf@circ@res@step=0.125\pgf@circ@Rlen\relax + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax \edef\pgf@noise@temp{dashed} - \edef\pgf@noise@fill{\pgfkeysvalueof{/tikz/circuitikz/bipoles/noise sources/fillcolor}} + \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}} \ifx\pgf@noise@temp\pgf@noise@fill % fillable in this case \pgf@circ@draworfillandclip - \pgfmathsetmacro{\thinner}{.5*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} - \pgfsetlinewidth{\thinner\pgfstartlinewidth} + \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thinner\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step @@ -1421,15 +1827,19 @@ \pgfusepath{draw,fill} \fi \endpgfscope - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} \pgfsetroundcap\pgfusepath{draw} } -%% Black generic diode -\pgfcircdeclarebipole +%%%%%%%%%%%%%% +%% Diodes +%%%%%%%%%%%%%% + +%% Black generic diode +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fulldiode} @@ -1437,7 +1847,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} @@ -1453,8 +1863,7 @@ } %% Black Zener diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fullzdiode} @@ -1462,7 +1871,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} @@ -1479,7 +1888,7 @@ } %% Black alternative zigzag Zener diode -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fullzzdiode} @@ -1487,7 +1896,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} @@ -1505,8 +1914,7 @@ } %% Black Schottky diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fullsdiode} @@ -1514,7 +1922,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1536,8 +1944,7 @@ } %% Black tunnel diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fulltdiode} @@ -1545,7 +1952,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1563,8 +1970,7 @@ } %% Black light emitting diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fulllediode} @@ -1572,7 +1978,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1597,8 +2003,7 @@ } %% Black photodiode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fullpdiode} @@ -1606,7 +2011,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1630,15 +2035,14 @@ } %% Black varcap - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/varcap/height}} {fullvarcap} {\ctikzvalof{bipoles/varcap/height}} {\ctikzvalof{bipoles/varcap/width}} { - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgfsetlinewidth{\pgf@circ@res@temp} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} @@ -1663,7 +2067,7 @@ \pgfpathclose \pgf@circ@draworfill \pgfscope - % to allow filling, we need to draw explicitily the stroke here. + % to allow filling, we need to draw explicitly the stroke here. \pgfsetlinewidth{\pgfstartlinewidth} \ifpgf@circuit@bipole@strokedsymbol \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1674,17 +2078,15 @@ % \endpgfscope } - %% Empty generic diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptydiode} {\ctikzvalof{bipoles/diode/height}} {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \endpgfscope @@ -1694,8 +2096,7 @@ } %% Empty Zener diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptyzdiode} @@ -1703,7 +2104,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape @@ -1715,7 +2116,7 @@ } %% Empty alternative zigzag Zener diode -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptyzzdiode} @@ -1723,7 +2124,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape @@ -1735,8 +2136,7 @@ \endpgfscope } %% Empty Schottky diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptysdiode} @@ -1744,7 +2144,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} @@ -1760,8 +2160,7 @@ } %% Empty tunnel diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptytdiode} @@ -1769,7 +2168,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} @@ -1781,8 +2180,7 @@ } %% Empty light emitting diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptylediode} @@ -1790,7 +2188,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \endpgfscope @@ -1809,8 +2207,7 @@ } %% Empty photodiode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptypdiode} @@ -1818,7 +2215,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \endpgfscope @@ -1837,15 +2234,14 @@ } %% Empty varcap - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/varcap/height}} {emptyvarcap} {\ctikzvalof{bipoles/varcap/height}} {\ctikzvalof{bipoles/varcap/width}} { - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgfsetlinewidth{\pgf@circ@res@temp} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} @@ -1871,44 +2267,44 @@ } %% Empty bidirectionaldiode - -\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/bidirectionaldiode/height}}{emptybidirectionaldiode}{\ctikzvalof{bipoles/bidirectionaldiode/height}}{\ctikzvalof{bipoles/bidirectionaldiode/width}} +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{emptybidirectionaldiode} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{\ctikzvalof{bipoles/bidirectionaldiode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgf@circ@draworfill - % \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfsetlinewidth{\pgfstartlinewidth} + \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} } - %% Full bidirectionaldiode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/bidirectionaldiode/height}} {fullbidirectionaldiode} @@ -1916,7 +2312,7 @@ {\ctikzvalof{bipoles/bidirectionaldiode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right @@ -1942,18 +2338,227 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfusepath{draw} +} +%% Black thyristor +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } } +{\ctikzvalof{tripoles/thyristor/height 2}} +{fullthyristor} +{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Empty thyristor + +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{emptythyristor} +{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Empty triac +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/triac/height}} +{emptytriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Full triac +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/triac/height}} +{fulltriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% %% (Closing) SPST -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/spst/depth}} {cspst} {\ctikzvalof{bipoles/spst/height}} {\ctikzvalof{bipoles/spst/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} @@ -1969,7 +2574,7 @@ } %% Opening SPST -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/spst/depth}} {ospst} @@ -1977,7 +2582,7 @@ {\ctikzvalof{bipoles/spst/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} @@ -1993,7 +2598,7 @@ } %% Normal open Switch -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/nos/depth}} {nos} @@ -2001,7 +2606,7 @@ {\ctikzvalof{bipoles/nos/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfsetbuttcap @@ -2009,14 +2614,14 @@ } %% Normal closed Switch -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/ncs/depth}} {ncs} {\ctikzvalof{bipoles/ncs/height}} {\ctikzvalof{bipoles/ncs/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} @@ -2028,14 +2633,14 @@ } %% Push Button -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/pushbutton/height 2}} {pushbutton} {\ctikzvalof{bipoles/pushbutton/height}} {\ctikzvalof{bipoles/pushbutton/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}} @@ -2049,16 +2654,17 @@ } %% Normally closed Push Button -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/pushbutton/height 2}} {ncpushbutton} {\ctikzvalof{bipoles/pushbutton/height}} {\ctikzvalof{bipoles/pushbutton/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + % Warning, if the nodes will have a class, we have to touch this. + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}} \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}} @@ -2075,12 +2681,13 @@ % #2 -> barposition % #3 -> arrowcode \long\def\pgfcircdeclarecutesw#1#2#3{ - \pgfcircdeclarebipole + \pgfcircdeclarebipolescaled{switches} { \savedanchor\midlever{ % these values are calculated when we create the definition of the shape. - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp \pgf@circ@res@down = -.5\pgf@y \pgf@circ@res@up = .5\pgf@y @@ -2090,6 +2697,7 @@ } % 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@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} % shapename \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} @@ -2108,7 +2716,8 @@ {\ctikzvalof{bipoles/cuteswitch/width}}{ \pgfscope % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + % If cnnecting nodes are scaled, we have to modify this + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp \pgfsetlinewidth{2\pgf@circ@res@temp} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} @@ -2139,7 +2748,7 @@ \pgfcircdeclarecutesw{cuteclosingswitch} {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}} \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right} @@ -2151,7 +2760,7 @@ \pgfcircdeclarecutesw{cuteopeningswitch} {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right} @@ -2159,42 +2768,46 @@ \pgfusepath{draw} } +%%%%%%%%%%%%%%%%% +%% Instruments +%%%%%%%%%%%%%%%%% % % METERINGSHAPE - \long\def\drawmeteringcircle{ - \def\pgf@circ@temp{right} +\long\def\drawmeteringcircle{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} \ifx\tikz@res@label@pos\pgf@circ@temp \pgf@circ@res@step=-1.2\pgf@circ@res@up \else - \def\pgf@circ@temp{below} - \ifx\tikz@res@label@pos\pgf@circ@temp - \pgf@circ@res@step=-1.2\pgf@circ@res@up - \else - \pgf@circ@res@step=1.2\pgf@circ@res@up - \fi + \pgf@circ@res@step=1.2\pgf@circ@res@up \fi - %draw connections to circle - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \fi + %draw connections to circle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + %draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + %draw arrow + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfusepath{draw} - %draw circle - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} - \pgf@circ@draworfill - \endpgfscope - %draw arrow - \pgfscope - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - } + \endpgfscope +} + %AMPEREMETER -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{instruments} {} {\ctikzvalof{bipoles/ammeter/height}} {ammeter} @@ -2205,7 +2818,7 @@ \pgfnode{circle}{center}{\textbf{A}}{}{} } %OHMMETER -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{instruments} {} {\ctikzvalof{bipoles/ohmmeter/height}} {ohmmeter} @@ -2216,7 +2829,7 @@ \pgfnode{circle}{center}{\boldmath$\Omega$}{}{} } %VOLTMETER -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{instruments} {} {\ctikzvalof{bipoles/voltmeter/height}} {voltmeter} @@ -2229,7 +2842,7 @@ } % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{instruments} { \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} @@ -2245,7 +2858,7 @@ {\ctikzvalof{bipoles/oscope/height}} {\ctikzvalof{bipoles/oscope/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfextracty{\pgf@circ@res@up}{\northeast} \pgfextractx{\pgf@circ@res@right}{\northeast} \pgfextractx{\pgf@circ@res@left}{\southwest} @@ -2275,7 +2888,7 @@ \pgfusepath{draw} \endpgfscope % function displayed, thanks to - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}} @@ -2284,353 +2897,368 @@ \pgfusepath{draw} \endpgfscope } -%% 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}} -{ } - -%% Generic bipole - used as resistor by some (bleah) - -\pgfcircdeclarebipole +% generic round meter with always horizontal text, no arrow +\pgfcircdeclarebipolescaled{instruments} {} -{\ctikzvalof{bipoles/generic/height}} -{generic} -{\ctikzvalof{bipoles/generic/height}} -{\ctikzvalof{bipoles/generic/width}} +{\ctikzvalof{bipoles/esource/height}} +{rmeter} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} { - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill + % draw the text label + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgftransformrotate{\rot} + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope } - -%% fuse - -\pgfcircdeclarebipole +% generic round meter with always horizontal text, with arrow +\pgfcircdeclarebipolescaled{instruments} {} -{\ctikzvalof{bipoles/fuse/height}} -{fuse} -{\ctikzvalof{bipoles/fuse/height}} -{\ctikzvalof{bipoles/fuse/width}} +{\ctikzvalof{bipoles/esource/height}} +{rmeterwa} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} { - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfusepath{draw} - - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill + % draw the text label + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % 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@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next open a circle into it + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@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@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope } - - -%% Generic bipole, filled - used as inductor by some - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/fullgeneric/height}} -{fullgeneric} -{\ctikzvalof{bipoles/fullgeneric/height}} -{\ctikzvalof{bipoles/fullgeneric/width}} -{ - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfusepath{draw,fill} -} - -%% Generic sensor, filled - used as inductive sensor by some - -\pgfcircdeclarebipole -{{% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.4\pgf@x - \pgf@y=2\pgf@y - }% -}} -{\ctikzvalof{bipoles/fullgeneric/height}} -{sfullgeneric} -{\ctikzvalof{bipoles/fullgeneric/height}} -{\ctikzvalof{bipoles/fullgeneric/width}} +% generic square meter with always horizontal text +\pgfcircdeclarebipolescaled{instruments} { - - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfusepath{draw,fill} - %\pgfscope - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}} - \pgfusepath{draw} - %\endpgfscope + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } } - - -%% Generic asymmetric bipole - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/ageneric/height}} -{ageneric} -{\ctikzvalof{bipoles/ageneric/height}} -{\ctikzvalof{bipoles/ageneric/width}} +{\ctikzvalof{bipoles/smeter/height}} +{smeter} +{\ctikzvalof{bipoles/smeter/height}} +{\ctikzvalof{bipoles/smeter/width}} { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgf@circ@draworfill \endpgfscope - - \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{stroke,fill} -} - - -%% asymmetric fuse - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/afuse/height}} -{afuse} -{\ctikzvalof{bipoles/afuse/height}} -{\ctikzvalof{bipoles/afuse/width}} -{ - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfusepath{draw} - + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill + \pgftransformrotate{\rot} + % the metering window + \pgfscope + \def\@starta{105}\def\@stopa{75} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}} \endpgfscope - - \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{stroke,fill} } +% probes qucs style: +% #1 : name +% #2 : extra code +\long\def\pgfcirc@qucsprobe#1#2{ + \pgfcircdeclarebipolescaled{instruments} + { + \anchor{v+}{\southwest\pgf@x=0.6\pgf@x} + \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + } + {\ctikzvalof{bipoles/qmeter/depth}} + {#1} + {\ctikzvalof{bipoles/qmeter/height}} + {\ctikzvalof{bipoles/qmeter/width}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + \def\@starta{103}\def\@stopa{77} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfscope + \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgf@circ@draworfill + \endpgfscope + #2 + \endpgfscope + } +} - - -%% Memristor - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/memristor/height}} -{memristor} -{\ctikzvalof{bipoles/memristor/height}} -{\ctikzvalof{bipoles/memristor/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 14 - - \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill - \endpgfscope +\pgfcirc@qucsprobe{qiprobe}{ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}} - + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfusepath{draw} - - \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{stroke,fill} + \pgfnode{currarrow}{center}{}{}{} } - - - -%% Generic empty tunable - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/tgeneric/height}} -{tgeneric} -{\ctikzvalof{bipoles/tgeneric/height}} -{\ctikzvalof{bipoles/tgeneric/width}} -{ - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill +\pgfcirc@qucsprobe{qvprobe}{ + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfusepath{draw} \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} \pgfusepath{draw} \endpgfscope } -%% Photoresistor - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/photoresistor/height 2}} -{photoresistor} -{\ctikzvalof{bipoles/photoresistor/height}} -{\ctikzvalof{bipoles/photoresistor/width}} -{ - \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill - \endpgfscope - +\pgfcirc@qucsprobe{qpprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} \pgfusepath{draw} \endpgfscope } - - - -%% Thermistor -\pgfcircdeclarebipole -{{% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.4\pgf@x - \pgf@y=1.2\pgf@y - }% -}} -{\ctikzvalof{bipoles/thermistor/height}} -{thermistor} -{\ctikzvalof{bipoles/thermistor/height}} -{\ctikzvalof{bipoles/thermistor/width}} +% current loop for oscope and similar: stylized +\pgfcircdeclarebipolescaled{instruments} { - \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill - \endpgfscope - - %\pgfscope - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}} - \pgfusepath{draw} - %\endpgfscope + \anchor{i}{\northeast\pgf@x=0pt\relax} + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } } - - -%% Thermistor PTC -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/thermistorptc/height 2}} -{thermistorptc} -{\ctikzvalof{bipoles/thermistorptc/height}} -{\ctikzvalof{bipoles/thermistorptc/width}} +{\ctikzvalof{bipoles/iloop/height}} +{iloop} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} { + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathellipse{\pgfpointorigin}{ + \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ + \pgfpoint{0.4\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} \endpgfscope - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} - \pgfusepath{draw} } -%% Thermistor NTC -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/thermistorntc/height 2}} -{thermistorntc} -{\ctikzvalof{bipoles/thermistorntc/height}} -{\ctikzvalof{bipoles/thermistorntc/width}} +% current loop for oscope and similar: real (double connection) +\pgfcircdeclarebipolescaled{instruments} { + \anchor{i+}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{i-}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop2} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + % must be the same than internal i+ and i- anchors definition + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} + \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathmoveto{\@plus} + \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + % I use ...left and ---right as temporal lengths here to avoid defining more + \pgfextractx{\pgf@circ@res@left}{\@plus} + \pgfextractx{\pgf@circ@res@right}{\@minus} + \pgfpathmoveto{\@plus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\@minus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} \endpgfscope - - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} } -%% thermocouple -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/thermocouple/height 2}} -{thermocouple} -{\ctikzvalof{bipoles/thermocouple/height}} -{\ctikzvalof{bipoles/thermocouple/width}} -{ - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfusepath{draw} -} %% Varistor -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{resistors} {} {\ctikzvalof{bipoles/varistor/height}} {varistor} @@ -2638,8 +3266,8 @@ {\ctikzvalof{bipoles/varistor/width}} { \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgf@circ@draworfill \endpgfscope @@ -2651,152 +3279,12 @@ \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\tiny\textsf{U}}} } - - -%% Generic full tunable - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/tfullgeneric/height}} -{tfullgeneric} -{\ctikzvalof{bipoles/tfullgeneric/height}} -{\ctikzvalof{bipoles/tfullgeneric/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 14 - - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfusepath{draw,fill} - - \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} - \endpgfscope -} - - - - - - - -%% Variable Capacitor - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/vcapacitor/height}} -{vcapacitor} -{\ctikzvalof{bipoles/vcapacitor/height}} -{\ctikzvalof{bipoles/vcapacitor/width}} -{ - %\pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/width}\pgf@circ@Rlen - \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfusepath{draw} - - \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} - \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfusepath{draw} -} - - -%% Piezoelectric Element - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/piezoelectric/height}} -{piezoelectric} -{\ctikzvalof{bipoles/piezoelectric/height}} -{\ctikzvalof{bipoles/piezoelectric/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 - - %% Outer markings - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} - - %% Inner Box - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left+4}{\pgf@circ@res@up-1}}{\pgfpoint{\pgf@circ@res@right-4}{\pgf@circ@res@down+1}} - \pgf@circ@draworfill - \endpgfscope -} - - - - - - -%% Lamp - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/lamp/height}} -{lamp} -{\ctikzvalof{bipoles/lamp/height}} -{\ctikzvalof{bipoles/lamp/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% bulb -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/bulb/height}} -{bulb} -{\ctikzvalof{bipoles/bulb/height}} -{\ctikzvalof{bipoles/bulb/width}} -{% - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}} - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} - \pgfsetbeveljoin - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfusepath{draw} -} - +%%%%%%%%%%%%%% +%% RF bipoles +%%%%%%%%%%%%%% % transmission line - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{RF} {} {\ctikzvalof{bipoles/tline/height}} {tline} @@ -2805,7 +3293,7 @@ { \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis \begin{pgftransparencygroup} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} @@ -2822,8 +3310,7 @@ } % microstrip transmission line - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{RF} {} {\ctikzvalof{bipoles/mstline/height}} {mstline} @@ -2831,264 +3318,32 @@ {\ctikzvalof{bipoles/mstline/width}} { \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgf@circ@draworfill } -%% SQUID added by Cor Molenaar 5 March 2010 - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/squid/height}} -{squid} -{\ctikzvalof{bipoles/squid/height}} -{\ctikzvalof{bipoles/squid/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}} - - \pgfusepath{draw} -} - - - -% Generic barrier added by Cor Molenaar 5 March 2010 - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/barrier/height}} -{barrier} -{\ctikzvalof{bipoles/barrier/height}} -{\ctikzvalof{bipoles/barrier/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} - - \pgfusepath{draw} -} - - -% Contributed by Danilo Piazzalunga - -\pgfdeclareshape{buffer} -{ - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{west}{ \northwest \pgf@y=0pt } - \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } - \anchor{north}{ \northwest \pgf@x=0pt } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \savedanchor\left{% - \pgf@y=0pt - } - \anchor{in}{ - \northwest - \pgf@y=0pt - } - \anchor{out}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfscope - \pgfsetlinewidth{2\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} - \pgf@circ@res@step=\pgf@circ@res@right - \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - - } -} - - - - - -\pgfdeclareshape{plain amp} -{ - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{west}{ \northwest \pgf@y=0pt } - \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } - \anchor{north}{ \northwest \pgf@x=0pt } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \savedanchor\left{% - \pgf@y=0pt - } - \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{-}{ - \inOne - } - \anchor{+}{ - \inOne - \pgf@y=-\pgf@y - } - \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/up pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{0pt}} - } - \anchor{up}{ - \up - } - \anchor{down}{ - \up - \pgf@y=-\pgf@y - } - \anchor{out}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - - \pgfscope - \pgfsetlinewidth{2\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} - \pgf@circ@res@step=\pgf@circ@res@right - \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}} - - - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - - - - - - } -} +%%%%%%%%%%%%%%%%%%% +%% Block diagrams +%%%%%%%%%%%%%%%%%%% %% Draw the two-port fillable box \def\pgf@circ@twoportbox{ \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope } %% Generic two port box -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/twoport/height}} {twoport} {\ctikzvalof{bipoles/twoport/height}} {\ctikzvalof{bipoles/twoport/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3101,7 +3356,7 @@ \pgf@circ@twoportbox \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3125,14 +3380,14 @@ } %% voltage controled oscillator -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/vco/width}} {vco} {\ctikzvalof{bipoles/twoport/width}} {\ctikzvalof{bipoles/vco/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3144,13 +3399,13 @@ \fi % draw circle \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} \pgf@circ@draworfill \endpgfscope \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3177,11 +3432,10 @@ \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} \pgfusepath{draw} - } %% bandpass filter -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/bandpass/width}} {bandpass} @@ -3189,7 +3443,7 @@ {\ctikzvalof{bipoles/bandpass/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3205,7 +3459,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3256,14 +3510,14 @@ } %% bandstop filter -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/bandstop/width}} {bandstop} {\ctikzvalof{bipoles/bandstop/width}} {\ctikzvalof{bipoles/bandstop/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3279,7 +3533,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3327,14 +3581,14 @@ } %% highpass filter -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/highpass/width}} {highpass} {\ctikzvalof{bipoles/highpass/width}} {\ctikzvalof{bipoles/highpass/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3350,7 +3604,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3401,14 +3655,14 @@ } %% lowpass filter -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/lowpass/width}} {lowpass} {\ctikzvalof{bipoles/lowpass/width}} {\ctikzvalof{bipoles/lowpass/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3424,7 +3678,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3475,14 +3729,14 @@ } %% ADC -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/adc/width}} {adc} {\ctikzvalof{bipoles/adc/width}} {\ctikzvalof{bipoles/adc/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3498,7 +3752,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3537,14 +3791,14 @@ } %% DAC -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/dac/width}} {dac} {\ctikzvalof{bipoles/dac/width}} {\ctikzvalof{bipoles/dac/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3560,7 +3814,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3599,14 +3853,14 @@ } %% DSP -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/dsp/width}} {dsp} {\ctikzvalof{bipoles/dsp/width}} {\ctikzvalof{bipoles/dsp/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3622,7 +3876,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3645,14 +3899,14 @@ } %% FFT -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/fft/width}} {fft} {\ctikzvalof{bipoles/fft/width}} {\ctikzvalof{bipoles/fft/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3668,7 +3922,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3691,7 +3945,7 @@ } %% Amplifier -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} { \ifpgf@circuit@boxed @@ -3716,7 +3970,7 @@ \fi } { - \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen \ifpgf@circuit@dashed \pgfsetdash{{0.1cm}{0.1cm}}{0cm} @@ -3724,15 +3978,15 @@ % draw outer box \ifpgf@circuit@boxed - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \pgf@circ@draworfill + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgf@circ@draworfill \fi % draw input arrow \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3743,11 +3997,10 @@ \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box \else - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \fi \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} @@ -3762,7 +4015,7 @@ %% variable amplifier -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} { \ifpgf@circuit@boxed @@ -3787,7 +4040,7 @@ \fi } { - \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen \ifpgf@circuit@dashed \pgfsetdash{{0.1cm}{0.1cm}}{0cm} @@ -3795,13 +4048,13 @@ % draw outer box \ifpgf@circuit@boxed - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} \fi % draw input arrow \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3812,13 +4065,12 @@ \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box \else - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \fi \pgfsetdash{}{0pt} % always draw solid line for inner symbol \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} @@ -3839,14 +4091,14 @@ } %% pi attenuator -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/piattenuator/width}} {piattenuator} {\ctikzvalof{bipoles/piattenuator/width}} {\ctikzvalof{bipoles/piattenuator/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3862,7 +4114,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3893,14 +4145,14 @@ } %% variable pi attenuator -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/vpiattenuator/width}} {vpiattenuator} {\ctikzvalof{bipoles/vpiattenuator/width}} {\ctikzvalof{bipoles/vpiattenuator/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3916,7 +4168,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3952,14 +4204,14 @@ } %% T attenuator -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/tattenuator/width}} {tattenuator} {\ctikzvalof{bipoles/tattenuator/width}} {\ctikzvalof{bipoles/tattenuator/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3975,7 +4227,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -4003,14 +4255,14 @@ } %% variable T attenuator -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/vtattenuator/width}} {vtattenuator} {\ctikzvalof{bipoles/vtattenuator/width}} {\ctikzvalof{bipoles/vtattenuator/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -4026,7 +4278,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -4059,14 +4311,14 @@ } %% phase shifter -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/phaseshifter/width}} {phaseshifter} {\ctikzvalof{bipoles/phaseshifter/width}} {\ctikzvalof{bipoles/phaseshifter/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -4082,7 +4334,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -4105,14 +4357,14 @@ } %% variable phase shifter -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/phaseshifter/width}} {vphaseshifter} {\ctikzvalof{bipoles/vphaseshifter/width}} {\ctikzvalof{bipoles/vphaseshifter/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -4128,7 +4380,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -4158,14 +4410,14 @@ } %% detector -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{blocks} {} {\ctikzvalof{bipoles/detector/width}} {detector} {\ctikzvalof{bipoles/detector/width}} {\ctikzvalof{bipoles/detector/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -4181,7 +4433,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -4196,137 +4448,70 @@ \pgfusepath{draw} \ifpgf@circuit@fulldiode - \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width}} + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}} \pgftransformscale{\pgfmathresult} \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} \else - \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width}} + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}} \pgftransformscale{\pgfmathresult} \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} \fi } +%%%%%%%%%%%%%%%%%%%%%%% +%% MECHANICAL SYMBOLS +%%%%%%%%%%%%%%%%%%%%%%% +%% mechanical capacitance - stiffness/spring - -%% european gas filled surge arrester - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{mechanicals} {} -{\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}} -{ - - %\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen - %\divide \pgf@circ@res@step by 14 - - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgf@circ@draworfill - - \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfusepath{draw} - - \endpgfscope -} - - - - -%% american gas filled surge arrester +{\ctikzvalof{bipoles/spring/height}} +{spring} +{\ctikzvalof{bipoles/spring/height}} +{\ctikzvalof{bipoles/spring/width}}{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments -\pgfcircdeclarebipole -{} -{\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}}{ + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfusepath{draw} - - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} - \pgf@circ@draworfill - \endpgfscope - - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfusepath{draw} - - \pgfscope - \pgfsetarrowsend{latex} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfusepath{draw} - \endpgfscope{} - - \pgfcircle{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/size}\pgf@circ@res@down} - \pgfusepath{fill} -} - -% % MECHANICAL SYMBOLS - -%% mechanical capacitance - stiffness/spring - -\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/spring/height}}{spring}{\ctikzvalof{bipoles/spring/height}}{\ctikzvalof{bipoles/spring/width}}{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - - \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} - \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfsetbuttcap - \pgfsetbeveljoin - \pgfusepath{stroke} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} } %% mechanical inductance - mass -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{mechanicals} {} {\ctikzvalof{bipoles/mass/box height}} {mass} {\ctikzvalof{bipoles/mass/height}} {\ctikzvalof{bipoles/mass/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}} @@ -4341,7 +4526,7 @@ } %% mechanical resistor - damper -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{mechanicals} {} {\ctikzvalof{bipoles/damper/height}} {damper} @@ -4358,7 +4543,7 @@ \pgfusepath{stroke} % damper box - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} @@ -4379,7 +4564,7 @@ } %% mechanical viscoelastic element, suggested by @alex %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{mechanicals} {} % extra anchors {\ctikzvalof{bipoles/damper/height}} % depth (under the path line) {viscoe} % name @@ -4392,7 +4577,7 @@ % spring into the damper \pgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} @@ -4402,7 +4587,7 @@ \pgfusepath{stroke} \endpgfscope % damper box - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} @@ -4422,72 +4607,34 @@ } - -\pgfcircdeclarebipole -{% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.4\pgf@x - }% -} -{\ctikzvalof{bipoles/resistivesens/height}} -{resistivesens} -{\ctikzvalof{bipoles/resistivesens/height}} -{\ctikzvalof{bipoles/resistivesens/width}} -{% - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} - \divide \pgf@circ@res@step by 12 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} - - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfsetbeveljoin - \pgfusepath{draw} - - \pgfscope - \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} - \pgfusepath{draw} - \endpgfscope -} +%%%%%%%%%%%%%%%% +%% Crossing +%%%%%%%%%%%%%%%% %% crossing bipole (but see also nodes) \pgfcircdeclarebipole - {} - {\ctikzvalof{bipoles/crossing/size}} - {crossing} - {\ctikzvalof{bipoles/crossing/size}} - {\ctikzvalof{bipoles/crossing/size}}{ - \pgfscope +{} +{\ctikzvalof{bipoles/crossing/size}} +{crossing} +{\ctikzvalof{bipoles/crossing/size}} +{\ctikzvalof{bipoles/crossing/size}}{ + \pgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} \pgfsetbeveljoin \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfusepath{draw} - \endpgfscope - } + \endpgfscope +} + +%%%%%%%%%%%%%%%%%%%%%%%%% +%% Miscellaneous bipoles +%%%%%%%%%%%%%%%%%%%%%%%%% %% loudspeaker and microphone -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{misc} {} {\ctikzvalof{bipoles/loudspeaker/depth}} {loudspeaker} @@ -4501,11 +4648,11 @@ \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}} \pgfpathclose - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgf@circ@draworfill } -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{misc} {} {\ctikzvalof{bipoles/mic/depth}} {mic} @@ -4513,7 +4660,7 @@ {\ctikzvalof{bipoles/mic/width}}{ \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up} \pgf@circ@draworfill \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}} @@ -4534,366 +4681,210 @@ \endpgfscope } -% generic round meter with always horizontal text, no arrow -\pgfcircdeclarebipole +%% european gas filled surge arrester +\pgfcircdeclarebipolescaled{misc} {} -{\ctikzvalof{bipoles/esource/height}} -{rmeter} -{\ctikzvalof{bipoles/esource/height}} -{\ctikzvalof{bipoles/esource/width}} +{\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}} { - \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill - % draw the text label - % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} - % and unrotate the scope + \pgfscope - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgftransformrotate{\rot} - \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope } -% generic round meter with always horizontal text, with arrow -\pgfcircdeclarebipole +%% american gas filled surge arrester +\pgfcircdeclarebipolescaled{misc} {} -{\ctikzvalof{bipoles/esource/height}} -{rmeterwa} -{\ctikzvalof{bipoles/esource/height}} -{\ctikzvalof{bipoles/esource/width}} -{ - \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} - \pgf@circ@draworfill - % draw the text label - % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} - % and unrotate the scope - \pgfscope - \pgftransformrotate{\rot} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/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@circ@res@left}{2\pgf@circ@res@down}} - {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} - % next open a circle into it - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@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@circ@res@left}{1.2\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - \pgftext[center]{\ctikzvalof{bipoles/twoport/text}} - \endpgfscope -} +{\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@circ@res@left}{\pgf@circ@res@zero}} + \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfusepath{draw} -% generic square meter with always horizontal text -\pgfcircdeclarebipole -{ - \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} - \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} - % put the node text above and centered - \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } -} -{\ctikzvalof{bipoles/smeter/height}} -{smeter} -{\ctikzvalof{bipoles/smeter/height}} -{\ctikzvalof{bipoles/smeter/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\southwest} - \pgfextracty{\pgf@circ@res@down}{\southwest} - \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} \pgfscope - \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} \pgf@circ@draworfill \endpgfscope - % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} - % 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@circ@res@up}} - \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}} - \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up} - \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} - \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} - \pgfclosepath - \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}} - \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}} - \endpgfscope -} - -% probles qucs style: -% #1 : name -% #2 : extra code -\long\def\pgfcirc@qucsprobe#1#2{ - \pgfcircdeclarebipole - { - \anchor{v+}{\southwest\pgf@x=0.6\pgf@x} - \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x} - % put the node text above and centered - \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } - } - {\ctikzvalof{bipoles/qmeter/depth}} - {#1} - {\ctikzvalof{bipoles/qmeter/height}} - {\ctikzvalof{bipoles/qmeter/width}} - { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\southwest} - \pgfextracty{\pgf@circ@res@down}{\southwest} - \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} - \pgfscope - \pgfscope - \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgf@circ@draworfill - \endpgfscope - \def\@starta{103}\def\@stopa{77} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfscope - \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}} - \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up} - \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} - \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} - \pgfclosepath - \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}} - \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgf@circ@draworfill - \endpgfscope - #2 - \endpgfscope - } -} -\pgfcirc@qucsprobe{qiprobe}{ - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfusepath{draw} - \pgfnode{currarrow}{center}{}{}{} -} -\pgfcirc@qucsprobe{qvprobe}{ - \pgfmathsetlength{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}} - \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} - \pgfusepath{draw} \pgfscope - % "+" and "-", drawn so that they scale correctly - \pgfsetlinewidth{2\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfsetarrowsend{latex} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfusepath{draw} - \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope{} + + \pgfcircle{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\ctikzvalof{bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\ctikzvalof{bipoles/american gas filled surge arrester/size}\pgf@circ@res@down} + \pgfusepath{fill} } -\pgfcirc@qucsprobe{qpprobe}{ - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} +%% thermocouple +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/thermocouple/height 2}} +{thermocouple} +{\ctikzvalof{bipoles/thermocouple/height}} +{\ctikzvalof{bipoles/thermocouple/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} \pgfusepath{draw} - \pgfnode{currarrow}{center}{}{}{} - \pgfmathsetlength{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} \pgfusepath{draw} - \pgfscope - % "+" and "-", drawn so that they scale correctly - \pgfsetlinewidth{2\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfusepath{draw} - \endpgfscope } +%% fuse +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/fuse/height}} +{fuse} +{\ctikzvalof{bipoles/fuse/height}} +{\ctikzvalof{bipoles/fuse/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} -% current loop for oscope and similar: stylized + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} -\pgfcircdeclarebipole -{ - \anchor{i}{\northeast\pgf@x=0pt\relax} - \anchor{text}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } + \pgf@circ@draworfill } -{\ctikzvalof{bipoles/iloop/height}} -{iloop} -{\ctikzvalof{bipoles/iloop/height}} -{\ctikzvalof{bipoles/iloop/width}} + +%% asymmetric fuse +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/afuse/height}} +{afuse} +{\ctikzvalof{bipoles/afuse/height}} +{\ctikzvalof{bipoles/afuse/width}} { - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@down=-\pgf@circ@res@up - \pgf@circ@res@left=-\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + \pgfscope - \pgfstartlinewidth=\pgflinewidth - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - % external ellipse - \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} - % clipping path: first a rectangle bigger then the shape - % to avoid problems with the line thickness - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} - {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} - % next the opening to the left - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} - {\pgfpoint{0pt}{.1\pgf@circ@res@up}} - % do the difference and clip before drawing - \pgfseteorule - \pgfusepath{clip} - \pgfpathellipse{\pgfpointorigin}{ - \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ - \pgfpoint{0.4\pgf@circ@res@right}{0pt}} - \pgfusepath{draw} - \endpgfscope - % internal wire - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - % and the contact line up - \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfusepath{draw} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@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@circ@setlinewidth{bipoles}{\pgfstartlinewidth} -% current loop for oscope and similar: real (double connection) + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}} -\pgfcircdeclarebipole + \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}} { - \anchor{i+}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgf@y=\pgf@circ@res@up - } - \anchor{i-}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgf@y=\pgf@circ@res@up - } - \anchor{text}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + + \pgfusepath{draw} } -{\ctikzvalof{bipoles/iloop/height}} -{iloop2} -{\ctikzvalof{bipoles/iloop/height}} -{\ctikzvalof{bipoles/iloop/width}} + +%% Lamp +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/lamp/height}} +{lamp} +{\ctikzvalof{bipoles/lamp/height}} +{\ctikzvalof{bipoles/lamp/width}} { - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@down=-\pgf@circ@res@up - \pgf@circ@res@left=-\pgf@circ@res@right - % must be the same than internal i+ and i- anchors definition - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} - \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} - \pgfscope - \pgfstartlinewidth=\pgflinewidth - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - % external ellipse - \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} - % clipping path: first a rectangle bigger then the shape - % to avoid problems with the line thickness - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} - {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} - % next the opening to the left - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} - {\pgfpoint{0pt}{.1\pgf@circ@res@up}} - % do the difference and clip before drawing - \pgfseteorule - \pgfusepath{clip} - \pgfpathmoveto{\@plus} - \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfusepath{draw} - \endpgfscope - % internal wire - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - % and the contact line up - % I use ...left and ---right as temporal lengths here to avoid defining more - \pgfextractx{\pgf@circ@res@left}{\@plus} - \pgfextractx{\pgf@circ@res@right}{\@minus} - \pgfpathmoveto{\@plus} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathmoveto{\@minus} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% bulb +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/bulb/height}} +{bulb} +{\ctikzvalof{bipoles/bulb/height}} +{\ctikzvalof{bipoles/bulb/width}} +{% + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex index 4dc91d9eb66..0d14585846c 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex @@ -272,9 +272,9 @@ \fi% } -\ctikzset{text/.style = { t=#1 } } -\ctikzset{t/.code = { - \ctikzsetvalof{bipoles/twoport/text}{#1} +\ctikzset{text/.style={t=#1}} +\ctikzset{t/.code={% + \ctikzsetvalof{bipoles/twoport/text}{#1}% }} %%%% Stacked labels diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex index c6fe8bfdb29..88ca4711daf 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex @@ -9,6 +9,12 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Monopoles +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%% +%% Grounds +%%%%%%%%%%%%% + %% Ground symbol % #1 -> name @@ -17,10 +23,13 @@ % #4 -> code \long\def\pgf@circ@declareground#1#2#3#4{ \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\southeast}{ - \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen \pgf@x=#2\pgf@x - \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen \pgf@y=-#3\pgf@y } \anchor{north}{\pgfpointorigin} @@ -35,7 +44,8 @@ \anchor{right}{\pgfpointorigin} \anchor{center}{\pgfpointorigin} \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen \pgfscope \pgfstartlinewidth=\pgflinewidth #4 @@ -50,7 +60,7 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} @@ -61,7 +71,7 @@ } \pgf@circ@declareground{tlground}{0.6}{0.4}{ - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} @@ -78,7 +88,7 @@ \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\ctikzvalof{monopoles/rground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} @@ -90,7 +100,7 @@ \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} @@ -103,7 +113,7 @@ \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} @@ -118,7 +128,7 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} @@ -133,11 +143,14 @@ % protective ground \pgf@circ@declareground{pground}{0.9}{1.8}{ + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step} + \pgf@circ@draworfill \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} @@ -145,8 +158,6 @@ \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} \pgfusepath{draw} - \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step} - \pgfusepath{draw} } % chassis ground @@ -155,7 +166,7 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} @@ -166,14 +177,14 @@ } % Contributed by @fotesan https://github.com/fotesan - +% european ground \pgf@circ@declareground{eground}{1.1}{1.7}{ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} @@ -197,7 +208,7 @@ \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} @@ -213,13 +224,148 @@ \pgfusepath{draw} } +%%%%%%%%%%%%%%%%%% +%% Power supplies +%%%%%%%%%%%%%%%%%% + +% Vcc +\pgfdeclareshape{vcc}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@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@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}% + } + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=3\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{south}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=2\pgf@circ@res@step + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +% Vee +\pgfdeclareshape{vee}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@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@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}% + } + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=-3\pgf@x% + } + \anchor{south}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{north}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{south east}{\northeast} + \anchor{south west}{\northeast\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@y=0pt\relax} + \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=-2\pgf@circ@res@step + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +%%%%%%%%%%%%%%%% +%% RF elements +%%%%%%%%%%%%%%%% + +% Legacy tlinestub % Contributed by Leonardo Azzinnari \pgfdeclareshape{tlinestub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\northeast}{% - \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen - \pgf@x=1.625\pgf@circ@res@step - \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen - \pgf@y=.25\pgf@circ@res@step% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@x=1.2\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@y=.2\pgf@circ@res@step% } % the center is on the left side of the shape for facility of usage \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} @@ -234,7 +380,9 @@ \behindforegroundpath{ \pgfstartlinewidth=\pgflinewidth - \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@circ@res@step=0.6\pgf@circ@scaled@Rlen \pgfscope\begin{pgftransparencygroup} \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} @@ -243,7 +391,7 @@ \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step} \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgf@circ@draworfill \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} \pgfusepath{draw} @@ -256,13 +404,14 @@ %% New antennas without tails -% main body +% main body of antennas \def\pgf@circ@antennabody{% \pgfstartlinewidth=\pgflinewidth - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}} @@ -296,12 +445,14 @@ \endpgfscope } - % additional shape with the waves \pgfdeclareshape{waves}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step \pgf@y=\pgf@circ@res@step } @@ -322,9 +473,10 @@ \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} \anchor{north west}{\northeast\pgf@x=-\pgf@x} \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen \pgf@circ@res@step=0.5\pgf@circ@res@step - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfscope % define a triangle for clipping the waves \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}} @@ -347,9 +499,12 @@ % 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@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step \pgf@y=2\pgf@circ@res@step } @@ -377,12 +532,21 @@ } \pgfdeclareshape{bareTXantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step \pgf@y=2\pgf@circ@res@step } + \savedanchor{\savedwaves}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x @@ -390,12 +554,7 @@ \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax } - \anchor{waves}{ - \northeast - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen - \pgf@x=4.2\pgf@circ@res@step - \pgf@y=\pgf@circ@res@step - } + \anchor{waves}{\savedwaves} \anchor{top}{\northeast\pgf@x=0pt} \anchor{right}{\northeast\pgf@y=0.5\pgf@y} \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} @@ -415,24 +574,28 @@ } \pgfdeclareshape{bareRXantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step \pgf@y=2\pgf@circ@res@step } + \savedanchor{\savedwaves}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=-4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax } - \anchor{waves}{ - \northeast - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen - \pgf@x=-4.2\pgf@circ@res@step - \pgf@y=\pgf@circ@res@step - } + \anchor{waves}{\savedwaves} \anchor{top}{\northeast\pgf@x=0pt} \anchor{right}{\northeast\pgf@y=0.5\pgf@y} \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} @@ -455,16 +618,20 @@ % Microstrip monopoles \pgfdeclareshape{mslstub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\southeast}{ - \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x - \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen \pgf@y=-.5\pgf@y } \savedanchor{\northwest}{ - \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen \pgf@x=-.5\pgf@x - \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y } \anchor{north}{\northwest\pgf@x=0pt\relax} @@ -493,7 +660,7 @@ \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} \pgfstartlinewidth=\pgflinewidth \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope @@ -501,15 +668,19 @@ } \pgfdeclareshape{msrstub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\southeast}{ - \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@y=0pt\relax } \savedanchor{\northwest}{ - \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen \pgf@x=-.5\pgf@x - \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y } \anchor{north}{\northwest\pgf@x=0pt\relax} @@ -541,29 +712,32 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}} \pgfpatharc{135}{45}{\pgf@circ@res@step} \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}} \pgfpatharc{45}{135}{\pgf@circ@res@up} \pgfclosepath - % \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope } } \pgfdeclareshape{msport}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\southeast}{ - \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x - \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen \pgf@y=-.5\pgf@y } \savedanchor{\northwest}{ - \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen \pgf@x=-.5\pgf@x - \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y } \anchor{north}{\northwest\pgf@x=0pt\relax} @@ -592,7 +766,7 @@ \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up} \pgfstartlinewidth=\pgflinewidth \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} @@ -603,29 +777,32 @@ \endpgfscope } } -% Legacy antennas (with tails) +% Legacy antennas (with tails) \def\pgf@circ@shift@antenna@xy#1#2{% - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step \relax} +% Legacy antenna \pgfdeclareshape{antenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth \pgf@y=4\pgf@circ@res@step } - \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}} - \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax} - \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax} - \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}} - \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{0}{2}} - \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} - \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}} - \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}} \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x @@ -633,7 +810,8 @@ } \behindforegroundpath{ \pgfstartlinewidth=\pgflinewidth - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen \pgftransformxshift{ -4\pgf@circ@res@step } @@ -648,8 +826,8 @@ \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfusepath{draw} \endpgfscope \pgfsetlinewidth{\pgfstartlinewidth} @@ -657,22 +835,25 @@ } } - +% Legacy TX antenna \pgfdeclareshape{txantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth \pgf@y=4\pgf@circ@res@step } - \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} - \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} - \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} - \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} - \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{4}{2}} - \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} - \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} - \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x @@ -680,7 +861,8 @@ } \behindforegroundpath{ \pgfstartlinewidth=\pgflinewidth - \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} @@ -695,8 +877,8 @@ \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfusepath{draw} \endpgfscope \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}} @@ -715,22 +897,25 @@ } } - +% Legacy RX antenna \pgfdeclareshape{rxantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth \pgf@y=4\pgf@circ@res@step } - \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} - \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} - \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} - \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} - \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{4}{2}} - \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} - \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} - \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x @@ -738,7 +923,8 @@ } \behindforegroundpath{ \pgfstartlinewidth=\pgflinewidth - \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} @@ -753,8 +939,8 @@ \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfusepath{draw} \endpgfscope @@ -770,115 +956,18 @@ \pgfpatharc{150}{210}{2\pgf@circ@res@step} \pgfusepath{draw} \pgfsetlinewidth{\pgfstartlinewidth} - } } -% Vcc -\pgfdeclareshape{vcc}{ - \savedanchor{\northeast}{% - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@circ@res@step - \pgf@y=3\pgf@x% - } - \anchor{north}{\northeast\pgf@x=0cm\relax} - \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} - \anchor{south}{\pgfpointorigin} - \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} - \anchor{north east}{\northeast} - \anchor{north west}{\northeast\pgf@x=-\pgf@x} - \anchor{south east}{\northeast\pgf@y=0pt\relax} - \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} - \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} - \pgf@x=0pt - \pgf@y=2\pgf@circ@res@step - \advance \pgf@y by 0.5\ht\pgfnodeparttextbox - \pgf@x=-.5\wd\pgfnodeparttextbox - } - \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgfscope - \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy} - \ifx\pgf@temp\pgf@circ@temp - \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - \else - \pgfsetarrowsend{\pgf@circ@temp} - \fi - \pgfpathmoveto{\pgfpointorigin} - \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}} - \pgfusepath{draw} - \endpgfscope - } -} - -% Vee -\pgfdeclareshape{vee}{ - \savedanchor{\northeast}{% - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@circ@res@step - \pgf@y=-3\pgf@x% - } - \anchor{south}{\northeast\pgf@x=0cm\relax} - \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} - \anchor{north}{\pgfpointorigin} - \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} - \anchor{south east}{\northeast} - \anchor{south west}{\northeast\pgf@x=-\pgf@x} - \anchor{north east}{\northeast\pgf@y=0pt\relax} - \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} - \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} - \pgf@x=0pt - \pgf@y=-2\pgf@circ@res@step - \advance \pgf@y by -1.5\ht\pgfnodeparttextbox - \pgf@x=-.5\wd\pgfnodeparttextbox - } - - \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgfscope - \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy} - \ifx\pgf@temp\pgf@circ@temp - - \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \else - \pgfsetarrowsend{\pgf@circ@temp} - \fi - \pgfpathmoveto{\pgfpointorigin} - \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} - \pgfusepath{draw} - \endpgfscope - } -} - -% match +% Legacy match \pgfdeclareshape{match}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\northeast}{% - \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen \pgf@x=2\pgf@circ@res@step - \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen \pgf@y=.5\pgf@circ@res@step% } % the center is on the left side of the shape for facility of usage @@ -894,13 +983,15 @@ \pgfpointorigin } \anchor{text}{ - \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen \pgf@x=1.5\pgf@x \advance \pgf@x by -.5\wd\pgfnodeparttextbox \pgf@y=-1.5\ht\pgfnodeparttextbox } \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen \pgfscope \pgfpathmoveto{\pgfpointorigin} @@ -913,7 +1004,6 @@ \pgfusepath{fill} \pgfsetlinewidth{\pgfstartlinewidth} - \endpgfscope } } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex index 04734a19543..ab2b0d4e77a 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex @@ -12,7 +12,11 @@ %% Multipoles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% counters for pin accounting... +%%%%%%%%% +%% Chips +%%%%%%%%% + +% let's use the same shifts everywhere, no magic numbers \def\pgf@circ@dip@pin@shift{0.5} \def\pgf@circ@qfp@pin@shift{0.25} @@ -25,8 +29,10 @@ % DIP (dual in line package) chips \pgfdeclareshape{dipchip}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro\numpins{% - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins}% + \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}% \def\numpins{\the\pgf@circ@count@a} } \savedanchor\centerpoint{% @@ -38,17 +44,25 @@ \anchor{center}{\origin} \anchor{text}{\centerpoint}% to adjust text \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@x{((\numpins) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}% + *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}% }% - \saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}}} - \saveddimen{\width}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}}} - \saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}} + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} % standard anchors \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@y{0.5*((\numpins) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}% - \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}} + *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}} } \anchor{dot}{\northwest \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} @@ -77,10 +91,11 @@ \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}\pgf@circ@Rlen - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen \pgfscope% (for the line width) - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% \pgf@circ@draworfill %% upside mark @@ -89,7 +104,7 @@ \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left} \fi \pgfusepath{stroke}% - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} % Adding the pin number \ifpgf@circuit@chip@shownumbers \pgf@circ@count@a=\numpins\relax @@ -104,7 +119,7 @@ \pgfmathsetmacro{\quadrant}{0} \fi \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} - \def\mytext{\pgfkeysvalueof{/tikz/circuitikz/multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} \pgfmathloop% \ifnum\pgf@circ@count@a>0 \ifcase\quadrant % rotation 0 @@ -158,12 +173,12 @@ \endpgfscope \ifdim\pgf@circ@res@other>0pt \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth} + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} \pgf@circ@count@a=\numpins\relax \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a \pgfmathloop% \ifnum\pgf@circ@count@a>0 - \edef\padfrac{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pad fraction}} + \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}} \ifnum\padfrac>0 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac % left side pads @@ -214,8 +229,10 @@ % QFP (quad flat package) chips \pgfdeclareshape{qfpchip}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro\numpins{% - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}% + \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}% \def\numpins{\the\pgf@circ@count@a} } \savedanchor\centerpoint{% @@ -227,19 +244,26 @@ \anchor{center}{\origin} \anchor{text}{\centerpoint}% to adjust text \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@x{((\numpins+2) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% }% \saveddimen\width{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@x{((\numpins+2) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% }% - \saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}}} - \saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}} + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} % standard anchors \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@y{0.5*((\numpins+2) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% \pgf@x=-\pgf@y } \anchor{dot}{\northwest @@ -269,10 +293,11 @@ \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}\pgf@circ@Rlen - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen \pgfscope% (for the line width) - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} %% upside mark \ifpgf@circuit@chip@topmark \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}} @@ -287,7 +312,7 @@ \pgfpathclose \pgf@circ@draworfill % Adding the pin number - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifpgf@circuit@chip@shownumbers \pgf@circ@count@a=\numpins% \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a @@ -301,7 +326,7 @@ \pgfmathsetmacro{\quadrant}{0} \fi \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} - \def\mytext{\pgfkeysvalueof{/tikz/circuitikz/multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} \pgfmathloop% \ifnum\pgf@circ@count@a>0 \ifcase\quadrant % rotation 0 @@ -395,12 +420,12 @@ \endpgfscope \ifdim\pgf@circ@res@other>0pt \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth} + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} \pgf@circ@count@a=\numpins% \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a \pgfmathloop% \ifnum\pgf@circ@count@a>0 - \edef\padfrac{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pad fraction}} + \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}} \ifnum\padfrac>0 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac % left side pads @@ -498,53 +523,62 @@ \fi } - +%%%%%%%%%%%%%%%%% %% Rotary Switch +%%%%%%%%%%%%%%%%% \pgfdeclareshape{rotaryswitch} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northeast{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=.3052\pgf@circ@res@temp \edef\a{\ctikzvalof{multipoles/rotary/angle}} \edef\r{\ctikzvalof{nodes width}} - \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@Rlen + \pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp} } \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=.3052\pgf@circ@res@temp \edef\a{\ctikzvalof{multipoles/rotary/angle}} \edef\r{\ctikzvalof{nodes width}} - \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp} } \savedanchor\central{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=.3052\pgf@circ@res@temp \edef\a{\ctikzvalof{multipoles/rotary/angle}} \edef\r{\ctikzvalof{nodes width}} - \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp} } % external square limits \savedanchor\extnorthwest{% - \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35) \pgf@x=2.5\pgf@x % external square size \pgf@y=-\pgf@x %square thing when angle=180? } - \saveddimen{\width}{\pgfmathsetlength\pgf@x{0.3052*\pgf@circ@Rlen*\ctikzvalof{tripoles/spdt/width}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}} % radius of the connector % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} @@ -590,7 +624,7 @@ \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgf@circ@res@right = \width \pgf@circ@res@left = -\width @@ -607,7 +641,7 @@ \ifpgf@circ@rotaryarrow \pgfscope % arrow \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node \pgftransformrotate{\wiper} \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}} @@ -679,9 +713,13 @@ \advance\pgf@x by -\pgf@circ@res@temp } +%%%%%%%%%%%%%%%%%%%%%%%%%% % Seven segments displays +%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfdeclareshape{bare7seg}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}} \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness \ifpgf@circ@sevenseg@dot @@ -692,29 +730,34 @@ } % 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@x}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}} \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}} \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}} \savedanchor{\southwest}{% both negative - \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} - \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} } \savedanchor{\northeast}{% both positive + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \ifpgf@circ@sevenseg@dot \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}} \else \pgf@circ@res@other=0pt \fi - \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}} - \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}} } \savedanchor{\topright}{% anchor without the box sep and the thickness - \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen} } \anchor{center}{\pgfpointorigin} \anchor{north west}{\southwest\pgf@y=-\pgf@y} @@ -740,8 +783,8 @@ \pgf@circ@res@right = \pgf@x \pgf@circ@res@left = -\pgf@x \pgfscope - \pgfsetlinewidth{\ctikzvalof{multipoles/thickness}\pgflinewidth} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfsetcolor{\ctikzvalof{color}} \pgfpathrectanglecorners% {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex index bc10b95dc44..0c9bfc12093 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex @@ -59,6 +59,7 @@ %% Generic bipole path +%% I am not user what the second argument is needed for \def\pgf@circ@bipole@path#1#2{ \pgfextra{ @@ -70,7 +71,7 @@ \def\pgf@circ@temp{} \ifx\pgf@temp\pgf@circ@temp % if it has not a name \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} - \ctikzset{bipole/name = #2\pgf@circ@rand} % create it + \ctikzset{bipole/name = #1\pgf@circ@rand} % create it (re-usage should not create problem, but...) \fi } @@ -278,6 +279,7 @@ \def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}} \def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}} \def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} +\def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}} \def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} \def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} \def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} @@ -404,6 +406,7 @@ \compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} \compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} \compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} \compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} \compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} \compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} @@ -638,6 +641,7 @@ \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}} @@ -792,7 +796,7 @@ \def\pgf@circ@trans@path#1#2{ \pgfextra{ - \edef\pgf@temp{\pgfkeysvalueof{/tikz/circuitikz/bipole/name}} + \edef\pgf@temp{\ctikzvalof{bipole/name}} \def\pgf@circ@temp{#2} \ifx\pgf@temp\pgf@circ@temp % if it has not a name \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} @@ -823,6 +827,7 @@ (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left) (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center) \fi + \drawpoles \pgfextra{ \pgfcircresetpath } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex index fc9960b4a09..1ab0f935b6d 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex @@ -13,6 +13,8 @@ \long\def\pgfcircdeclarequadpole#1#2#3{ \pgfdeclareshape{#1} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{ \northwest \pgf@x=0pt @@ -20,10 +22,50 @@ } \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=.5\pgf@circ@Rlen - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + \pgf@x=.5\pgf@circ@scaled@Rlen + \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x + } + %% we define the upper right (positive coord) dot (which is B1) + \savedanchor{\innerdot}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=.5\pgf@circ@scaled@Rlen + \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa + % by default use the cute inductor size + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2} + % check if it's american + \edef\pgf@circ@temp{\ctikzvalof{inductor}} + \edef\pgf@temp{american} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2} + \fi + % check if it's european + \edef\pgf@temp{european} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2} + \fi + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen} + } + \savedanchor{\outerdot}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=.5\pgf@circ@scaled@Rlen + \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa + % by default use the cute inductor size + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2} + % check if it's american + \edef\pgf@circ@temp{\ctikzvalof{inductor}} + \edef\pgf@temp{american} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2} + \fi + % check if it's european + \edef\pgf@temp{european} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2} + \fi + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen} } \anchor{A2}{ \northwest @@ -41,56 +83,16 @@ \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - %% notice for the dot anchors: I use the cute inductors as reference - %% size; if you change one you have to change all of them. - \anchor{inner dot A1}{ - \northwest - \pgfmathsetlength\pgf@x{\stretto*\pgf@x + - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} - } - \anchor{outer dot A1}{ - \northwest - \pgfmathsetlength\pgf@x{\stretto*\pgf@x - - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} - } - \anchor{inner dot A2}{ - \northwest - \pgfmathsetlength\pgf@x{\stretto*\pgf@x + - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} - } - \anchor{outer dot A2}{ - \northwest - \pgfmathsetlength\pgf@x{\stretto*\pgf@x - - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} - } - \anchor{inner dot B1}{ - \northwest - \pgfmathsetlength\pgf@x{-\stretto*\pgf@x - - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} - } - \anchor{outer dot B1}{ - \northwest - \pgfmathsetlength\pgf@x{-\stretto*\pgf@x + - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} - } - \anchor{inner dot B2}{ - \northwest - \pgfmathsetlength\pgf@x{-\stretto*\pgf@x - - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} - } - \anchor{outer dot B2}{ - \northwest - \pgfmathsetlength\pgf@x{-\stretto*\pgf@x + - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} - } + %% dot's anchors + \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x} + \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x} + \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{inner dot B1}{\innerdot} + \anchor{outer dot B1}{\outerdot} + \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y} + \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y} + % geographical \anchor{north}{ \northwest \pgf@x=0pt @@ -131,7 +133,7 @@ } #3 \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y @@ -145,34 +147,34 @@ \def\pgf@circ@drawtransformerbasicanchor{ - \pgfkeysvalueof{/tikz/circuitikz/quadpoles/trans/height} + \ctikzvalof{quadpoles/trans/height} \anchor{AA2}{ \northwest - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x \pgf@x=.7\pgf@x \pgf@y=-\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } \anchor{BB1}{ \northwest \pgf@x=-\pgf@x - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x \pgf@x=.7\pgf@x - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } \anchor{AA1}{ \northwest - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x \pgf@x=.7\pgf@x - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } \anchor{BB2}{ \northwest \pgf@x=-\pgf@x - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x \pgf@x=.7\pgf@x \pgf@y=-\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } } @@ -282,7 +284,7 @@ {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% } - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgfusepath{draw} }{\pgf@circ@drawtransformerbasicanchor} @@ -301,35 +303,665 @@ \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{.7*\stretto\pgf@circ@res@down}} - \pgfpatharc{90}{270}{.7*\stretto\pgf@circ@res@down} - - \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{.7*\stretto\pgf@circ@res@up}} - \pgfpatharc{-90}{90}{.7*\stretto\pgf@circ@res@down} - \pgfusepath{draw} + \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}} + \pgfpatharc{-90}{90}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpatharc{90}{270}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill }{} -%% four-port -% defines a general outer box for four-ports -% TikZ usage: -% \draw (0,0) node[coupler](coup){\SI{-3}{dB}} -% (coup.port1) to[short,-o] ++(-1,0) -% +%%%%%%%%%%%%%%%%%%%% +%% Block elements +%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{mixer} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{adder} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + } +} + +\pgfdeclareshape{oscillator} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \else + \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{north}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y} + \anchor{north east}{ \northwest \pgf@x=0pt\relax} + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{text}{ + \pgf@x=-2\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east" + + % draw outer box + \ifpgf@circuit@boxed{} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@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@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{circulator} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{3}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed{} + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % inner arrow + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}} + \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } + } + + +% Wilkinson divider +\pgfdeclareshape{wilkinson}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x + } + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{out2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@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@circ@res@right}{0pt}} + \pgftransformrotate{90} + + % calculate size of resistor + \ifpgf@circuit@europeanresistor + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \else + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \fi + } + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}} + + \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +%% couplers generics \long\def\pgfcircdeclarefourport#1#2{ + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{ \northwest \pgf@x=0pt \pgf@y=0pt } \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=.5\pgf@circ@Rlen - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + \pgf@x=.5\pgf@circ@scaled@Rlen + \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x } \anchor{north}{ \northwest @@ -408,20 +1040,21 @@ \pgf@x=-.5\wd\pgfnodeparttextbox } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen \pgfstartlinewidth=\pgflinewidth % draw outer box - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} + \pgf@circ@draworfill % draw inner stuff #2 @@ -435,7 +1068,6 @@ % four-port \pgfcircdeclarefourport{fourport}{} - % straight coupler \pgfcircdeclarefourport{coupler}{ \pgfsetlinewidth{\pgfstartlinewidth} @@ -490,398 +1122,3 @@ \endpgfscope } -% contrib Kristofer M. Monisit - -\pgfdeclareshape{fd op amp} -{ - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \savedanchor\outline{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi - } - \anchor{south}{ - \northwest - \pgf@y=-\pgf@y\pgf@x=0pt\relax - } - \anchor{north}{ - \northwest\pgf@x=0pt\relax - } - \savedanchor\left{% - \pgf@y=0pt - } - \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{in up}{ - \inOneFixed - } - \anchor{in down}{ - \inOneFixed - \pgf@y=-\pgf@y - } - \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi - } - \anchor{-}{ - \inOne - } - \anchor{+}{ - \inOne - \pgf@y=-\pgf@y - } - \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/up pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{0pt}} - } - \anchor{up}{ - \up - } - \anchor{down}{ - \up - \pgf@y=-\pgf@y - } - \anchor{out up}{ - \northwest - \pgf@y=.5\pgf@y - \pgf@x=-.7\pgf@x - } - \anchor{out down}{ - \northwest - \pgf@y=-.5\pgf@y - \pgf@x=-.7\pgf@x - } - \anchor{out +}{ - \outline - \pgf@y=.5\pgf@y - \pgf@x=-.7\pgf@x - } - \anchor{out -}{ - \outline - \pgf@y=-.5\pgf@y - \pgf@x=-.7\pgf@x - } - \anchor{west}{ - \left - } - \anchor{east}{ - \left - \pgf@x=-.7\pgf@x - } - - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-.7\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-.7\pgf@x \pgf@y=-\pgf@y } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - - % Triangle - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} - \pgf@circ@res@step=\pgf@circ@res@right - \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - % Negative input terminal - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} - - % Positive input terminal - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} - - % Negative output terminal - \pgfpathmoveto{\pgfpoint - {0.7\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{0.3\pgf@circ@res@left}{.3\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@oplusup$-$\else$+$\fi} - - % Positive output terminal - \pgfpathmoveto{\pgfpoint - {0.7\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{0.3\pgf@circ@res@left}{.3\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@oplusup$+$\else$-$\fi} - - \pgfsetrectcap - % Draw them all! - \pgfusepath{draw} - - } -} - - -%% instrumentation amplifier diff output - -\pgfdeclareshape{fd inst amp} -{ - % when tikz calls the anchor it wants the relative position in the lengths - % \pgf@x \pgf@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{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{nw}{ - \northwest - } - \anchor{south}{ - \northwest - \pgf@y=-\pgf@y\pgf@x=0pt\relax - } - \anchor{north}{ - \northwest\pgf@x=0pt\relax - } - \savedanchor\left{% - \pgf@y=0pt - } - \anchor{leftedge} - {\left - \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x - } - \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{in up}{ - \inOneFixed - } - \anchor{in down}{ - \inOneFixed - \pgf@y=-\pgf@y - } - \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi - } - \anchor{-}{ - \inOne - } - \anchor{+}{ - \inOne - \pgf@y=-\pgf@y - } - \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/up pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} - } - \anchor{up}{ - \up - } - \anchor{down}{ - \up - \pgf@y=-\pgf@y - } - % reference voltage input anchors. - \savedanchor\refv{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/refv pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@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@y=-\pgf@y - } - \savedanchor\outport{ - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=-.5\pgf@x - \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi - } - \anchor{out}{ - \outport - \pgf@y=0pt - } - \anchor{out +}{ - \outport - } - \anchor{out -}{ - \outport - \pgf@y=-\pgf@y - } - \savedanchor\outportfixed{ - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=-.5\pgf@x - } - \anchor{out up}{ - \outportfixed - } - \anchor{out down}{ - \outportfixed - \pgf@y=-\pgf@y - } - % - \anchor{west}{ - \left - } - \anchor{east}{ - \left - \pgf@x=-\pgf@x - } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - - % let's start drawing the component - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - % - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - % main component, normally in thicker lines - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} - \pgf@circ@res@step=\pgf@circ@res@right - \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step - %first point (near output) - \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} - %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@up}} - % and then to the input "front up", "down", to the output short side "down" - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@down}} - % ...and close - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - % input terminal up - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} - % - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} - % - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} - - % input terminal down - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} - % - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} - % output leads down and up - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} % - \pgftext[right, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} % - \pgftext[right, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi} - % - \pgfsetrectcap - \pgfusepath{draw} - } -} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex index 657d0664f60..fdaad445ce1 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex @@ -38,7 +38,7 @@ \pgfpointorigin } \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgf@x=-\pgf@y } \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } @@ -58,13 +58,13 @@ \pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} - }{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}} } \behindforegroundpath{ \pgfscope - \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\ctikzvalof{color}} \pgfsetfillopacity{1.0} \pgfusepath{draw,fill} \endpgfscope @@ -79,7 +79,7 @@ \pgfpointorigin } \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgf@x=-\pgf@y } \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } @@ -99,16 +99,21 @@ \pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} - }{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}} } \behindforegroundpath{ \pgfscope - \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\ctikzvalof{color}} \ifx\tikz@fillcolor\pgfutil@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@circ@setifdefinedfill{draw, fill}{draw, fill} \else \pgfsetfillcolor{\tikz@fillcolor} \fi @@ -165,7 +170,7 @@ \pgfpathrectanglecorners {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfsetfillopacity{1.0} \pgfusepath{draw,fill} \endpgfscope @@ -218,9 +223,14 @@ \pgfpathrectanglecorners {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifx\tikz@fillcolor\pgfutil@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@circ@setifdefinedfill{draw, fill}{draw, fill} \else \pgfsetfillcolor{\tikz@fillcolor} \fi @@ -267,7 +277,7 @@ \pgfpathrectanglecorners {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfsetfillopacity{1.0} \pgfusepath{draw,fill} \endpgfscope @@ -310,9 +320,14 @@ \pgfpathrectanglecorners {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifx\tikz@fillcolor\pgfutil@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@circ@setifdefinedfill{draw, fill}{draw, fill} \else \pgfsetfillcolor{\tikz@fillcolor} \fi @@ -329,7 +344,7 @@ } % BNC size is 2.5 times the size of the internal "ocirc" \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgf@y=2.5\pgf@y \pgf@x=-\pgf@y } @@ -359,15 +374,15 @@ \pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} - }{\pgfpoint{2.5*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{2.5*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}} } \behindforegroundpath{ \pgfextracty{\pgf@circ@res@other}{\northwest} - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgfscope \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgfsetcolor{\ctikzvalof{color}} % external circle \pgfscope % clipping path: first a rectangle bigger then the shape @@ -422,7 +437,7 @@ \pgfpathrectanglecorners {\pgfpoint{0}{.5\pgflinewidth}} {\pgfpoint{0}{-.5\pgflinewidth}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfusepath{draw,fill} \endpgfscope } @@ -434,7 +449,7 @@ \pgfdeclareshape{currarrow}{ \savedanchor{\northeast}{% \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@x=.5\pgf@circ@res@step \pgf@y=\pgf@x% } @@ -452,20 +467,20 @@ \anchor{tip}{ \pgfpointorigin \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@x =\pgf@circ@res@step } \behindforegroundpath{ \pgfscope \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfusepath{draw,fill} \endpgfscope @@ -477,7 +492,7 @@ \pgfdeclareshape{flowarrow}{ \savedanchor{\northeast}{% \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@y=.5\pgf@circ@res@step \pgf@circ@res@step = \pgf@circ@Rlen \divide \pgf@circ@res@step by 4 @@ -497,7 +512,7 @@ \anchor{tip}{ \pgfpointorigin \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@x =\pgf@circ@res@step } \behindforegroundpath{ @@ -506,7 +521,7 @@ \divide \pgf@circ@res@step by 4 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfusepath{draw} \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}} \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}} @@ -519,7 +534,7 @@ \pgfdeclareshape{inputarrow}{ \savedanchor{\northeast}{% this is really not northeast, really -northwest \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@y=.5\pgf@circ@res@step \pgf@x=1.7\pgf@circ@res@step } @@ -551,7 +566,7 @@ \pgfpathlineto{\pgfpoint{0pt}{0pt}} \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfusepath{fill} \endpgfscope @@ -570,14 +585,31 @@ \pgfscope \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen \pgf@circ@res@step = 0.5\pgf@circ@res@step - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgf@circ@draworfill \endpgfscope } - } +%% box scaled with blocks + +\pgfdeclareshape{blockbox}{ + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen} + \pgfscope + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@step = 0.5\pgf@circ@res@step + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope + } +} % full nodes for wire crossing diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index c64f400d214..6c8df356076 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex @@ -10,11 +10,19 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Tripoles +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + +% Legacy spdt \pgfdeclareshape{spdt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{left}{% @@ -73,15 +81,14 @@ \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/margin}\pgf@circ@res@left + \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} @@ -107,14 +114,13 @@ \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} \endpgfscope - \pgfscope \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} \pgfpathlineto{ \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} } - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope } @@ -128,16 +134,20 @@ \long\def\pgfcircdeclarecutespdt#1#2#3{ \pgfdeclareshape{#1} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@x=.25\pgf@x } \savedanchor\midlever{ % these values are calculated when we create the definition of the shape. - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp \pgf@circ@res@down = -.5\pgf@y \pgf@circ@res@up = .5\pgf@y @@ -174,7 +184,7 @@ \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y @@ -226,7 +236,7 @@ \pgfcircdeclarecutespdt{cute spdt up arrow} {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} @@ -237,7 +247,7 @@ \pgfcircdeclarecutespdt{cute spdt mid arrow} {\pgfpoint{\pgf@circ@res@right}{0pt}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfsetarrowsstart{latexslim} \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} @@ -249,7 +259,7 @@ \pgfcircdeclarecutespdt{cute spdt down arrow} {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} @@ -288,7 +298,7 @@ \step \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax \advance\pgf@y by -#1\pgf@circ@res@step\relax - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@left + \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left \fi % or and nor \ifnum #2=2\relax @@ -298,11 +308,11 @@ \step \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax \advance\pgf@y by -#1\pgf@circ@res@step\relax - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/angle}}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/inner}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% \pgf@circ@res@temp=\pgf@y \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% @@ -315,12 +325,12 @@ \pgfextractx{\pgf@circ@res@left}{\southwest}% \pgfextractx{\pgf@circ@res@right}{\northeast}% \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/inner}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/distance}\pgf@circ@res@right + \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} % this compensates for the effect of the line width on the gap between the arcs \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% @@ -350,33 +360,37 @@ \long\def\pgfcircdeclarelogicport#1#2#3{% \pgfdeclareshape{american #1 port}% {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro\resize{% automatic - \pgf@circ@res@up = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen \pgf@circ@res@up = .5\pgf@circ@res@up \pgf@circ@res@down = -\pgf@circ@res@up - \pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/width}\pgf@circ@Rlen + \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen \pgf@circ@res@right = .5\pgf@circ@res@right \pgf@circ@res@left = -\pgf@circ@res@right }% \savedmacro\inputs{% get number of inputs \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% \ifnum\pgf@circ@res@count=0 - \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/inputs}\relax% + \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax% \fi \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi \def\inputs{\the\pgf@circ@res@count}% }% \savedanchor\step{% 1/2 gap at edges - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen \divide\pgf@circ@res@step by \pgf@circ@res@count \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% }% \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \savedanchor\left{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} - \savedanchor\right{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} - \savedanchor\origin{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}} + \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} + \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} + \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}} \anchor{center}{\origin}% for backwards compatibility \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} @@ -422,7 +436,7 @@ \pgfpoint{\pgf@circ@res@right}{0cm}} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} #3 } } @@ -436,20 +450,20 @@ \advance\pgf@circ@res@temp by -\pgf@circ@res@step \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left} {\pgf@circ@res@temp}} \advance\pgf@circ@res@count by -1 \repeat \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@right} + {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@left + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} @@ -466,20 +480,20 @@ \advance\pgf@circ@res@temp by -\pgf@circ@res@step \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left} {\pgf@circ@res@temp}} \advance\pgf@circ@res@count by -1 \repeat \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/circle width}\pgf@circ@res@right - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@right + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} @@ -496,11 +510,11 @@ } %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfcircdeclarelogicport{nor}{2}{ - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/angle}}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/inner}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% \pgfextracty{\pgf@circ@res@temp}{\step}% @@ -515,16 +529,16 @@ \advance\pgf@circ@res@count by -1 \repeat - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/angle}}% - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/circle width}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% + \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax \advance\pgf@circ@res@other by -\pgf@circ@res@step @@ -543,11 +557,11 @@ } %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfcircdeclarelogicport{or}{2}{ - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/angle}}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/inner}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% \pgfextracty{\pgf@circ@res@temp}{\step}% @@ -562,15 +576,15 @@ \advance\pgf@circ@res@count by -1 \repeat - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/angle}}% + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% @@ -583,12 +597,12 @@ %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfcircdeclarelogicport{xor}{3}{ \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/inner}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/distance}\pgf@circ@res@right + \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} % this compensates for the effect of the line width on the gap between the arcs \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% @@ -607,15 +621,15 @@ \advance\pgf@circ@res@count by -1 \repeat - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/angle}}% + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% @@ -634,12 +648,12 @@ %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfcircdeclarelogicport{xnor}{3}{ \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/inner}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/distance}\pgf@circ@res@right + \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} % this compensates for the effect of the line width on the gap between the arcs \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% @@ -658,16 +672,16 @@ \advance\pgf@circ@res@count by -1 \repeat - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/angle}}% - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/circle width}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}% + \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax \advance\pgf@circ@res@other by -\pgf@circ@res@step @@ -683,7 +697,7 @@ {\pgfpoint{0pt}{.5\pgf@circ@res@step}} \pgf@circ@draworfill - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@left + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc @@ -695,34 +709,54 @@ %%% Original one-input ports \pgfdeclareshape{american not port}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } - \savedanchor\left{% + \anchor{in}{ + \northwest \pgf@y=0pt } - \anchor{in}{ + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + } + \anchor{bin 1}{ \northwest \pgf@y=0pt + \pgf@x=0.7\pgf@x } \anchor{out}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } \anchor{center}{ \pgfpointorigin } \anchor{east}{ - \left - \pgf@x=-.8\pgf@x + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x } \anchor{west}{ - \left + \northwest + \pgf@y=0pt } \anchor{south}{ \northwest @@ -750,8 +784,7 @@ \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y @@ -759,10 +792,10 @@ \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgftransformxshift{.7\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left @@ -787,39 +820,161 @@ \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} \pgfusepath{draw} - } } -\pgfdeclareshape{invschmitt}{ +\pgfdeclareshape{american buffer port}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } - \savedanchor\left{% + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} +\pgfdeclareshape{invschmitt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x } \anchor{in}{ \northwest \pgf@y=0pt } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } \anchor{out}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } \anchor{center}{ \pgfpointorigin } \anchor{east}{ - \left - \pgf@x=-.8\pgf@x + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x } \anchor{west}{ - \left + \northwest + \pgf@y=0pt } \anchor{south}{ \northwest @@ -847,7 +1002,7 @@ \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y @@ -855,10 +1010,10 @@ \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgftransformxshift{.7\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left @@ -884,7 +1039,7 @@ \pgfusepath{draw} %draw inner shape - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} @@ -899,34 +1054,50 @@ } \pgfdeclareshape{schmitt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } - \savedanchor\left{% + \anchor{in}{ + \northwest \pgf@y=0pt } - \anchor{in}{ + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{bin 1}{ \northwest \pgf@y=0pt + \pgf@x=0.7\pgf@x } \anchor{out}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-.7\pgf@x + } \anchor{center}{ \pgfpointorigin } \anchor{east}{ - \left - \pgf@x=-.8\pgf@x + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x } \anchor{west}{ - \left + \northwest + \pgf@y=0pt } \anchor{south}{ \northwest @@ -954,7 +1125,7 @@ \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest @@ -963,16 +1134,14 @@ \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgftransformxshift{.7\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left \pgf@circ@res@step=.7\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} \pgfpathclose @@ -987,7 +1156,7 @@ \pgfusepath{draw} %draw inner shape - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} @@ -1014,40 +1183,47 @@ \long\def\pgfcircdeclareeurologicport#1#2#3#4{ \pgfdeclareshape{european #1 port} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro\resize{% automatic - \pgf@circ@res@up = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen \pgf@circ@res@up = .5\pgf@circ@res@up \pgf@circ@res@down = -\pgf@circ@res@up - \pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/width}\pgf@circ@Rlen + \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen \pgf@circ@res@right = .5\pgf@circ@res@right \pgf@circ@res@left = -\pgf@circ@res@right }% \savedmacro\inputs{% get number of inputs \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% \ifnum\pgf@circ@res@count=0 - \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/inputs}\relax% + \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax% \fi \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi \def\inputs{\the\pgf@circ@res@count}% }% \savedanchor\step{% 1/2 gap at edges - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen \divide\pgf@circ@res@step by #3 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% }% \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}% \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}% - \savedanchor\left{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% - \savedanchor\right{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% - \savedanchor\origin{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}% + \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% + \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@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}{\pgfpoint{\pgf@circ@res@left}{0pt}}% or \step + \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step \else \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{% \pgfmathloop% @@ -1088,17 +1264,17 @@ \pgfpoint{\pgf@circ@res@right}{0cm}} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathrectanglecorners - {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} - {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} + {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope \ifnum#3=1\relax \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% \else \pgfextracty{\pgf@circ@res@temp}{\step}% \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax @@ -1107,7 +1283,7 @@ \advance\pgf@circ@res@temp by -\pgf@circ@res@step \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left} + {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} {\pgf@circ@res@temp}} \advance\pgf@circ@res@count by -1 \repeat @@ -1115,23 +1291,20 @@ % \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{% - \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} + \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} % \edef\pgf@temp{not} \edef\pgf@circ@temp{#4} \ifx\pgf@temp\pgf@circ@temp % is a not - \pgfpathmoveto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/not height}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} \fi % \pgfusepath{draw} % \pgfpathmoveto{\pgfpointorigin} \pgftext{#2} - % - % - % } } } @@ -1139,31 +1312,42 @@ \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} \pgfcircdeclareeurologicport{not}{$1$}{1}{not} +\pgfcircdeclareeurologicport{buffer}{$1$}{1}{} \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} %% end european logic ports +%%%%%%%%%%%%%%%%%%%%%%%% +%% Transistors +%%%%%%%%%%%%%%%%%%%%%%%% + + \long\def\pgfcircdeclaretransistor#1#2#3{ \pgfdeclareshape{#1} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{ \pgfpointorigin } \savedanchor\northeast{% upper right - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y \pgf@x=0pt } \savedanchor\left{%center left \pgf@y=0pt - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen } \anchor{text}{ \northeast \pgf@y=.7\pgf@y - \pgf@x= \pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x= \pgf@circ@scaled@Rlen \pgf@x=0.1\pgf@x } \anchor{pathstart}{ % south @@ -1215,74 +1399,74 @@ } \anchor{B}{ \northeast - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y \left - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step } \anchor{base}{ \northeast - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y \left - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step } \anchor{G}{ \northeast - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y \left - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step } \anchor{gate}{ \northeast - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y \left - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step } \anchor{nobase}{ \left - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x } \anchor{nogate}{ \left - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x } \anchor{E}{ \northeast - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{emitter}{ \northeast - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{C}{ \northeast - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{collector}{ \northeast - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{S}{ \northeast - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{source}{ \northeast - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{D}{ \northeast - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{drain}{ \northeast - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y } #2 \backgroundpath{ \pgftransformationadjustments - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} % - \ifnum \pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction} > 0 + \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0 \pgf@circuit@trans@ntypetrue \else \pgf@circuit@trans@ntypefalse @@ -1293,6 +1477,7 @@ \pgf@circ@res@right = \pgf@x \left \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen % #3 % BODY DIODE @@ -1306,9 +1491,13 @@ \long\def\drawbodydiode#1{ \pgfscope - \pgftransformshift{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgftransformrotate{90} - \pgftransformscale{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode scale}} + % 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@circuit@fulldiode \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} \else @@ -1323,25 +1512,25 @@ \fi %Draw upper connection to body diode \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} \pgfusepath{draw} \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} \pgftransformscale{0.5} \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} \endpgfscope{} %Draw lower connection to body diode \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}} \pgfusepath{draw} \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} \pgftransformscale{0.5} \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} \endpgfscope @@ -1351,28 +1540,28 @@ \pgfcircdeclaretransistor{#1}{}{ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} %draw arrow depending on type of transistor @@ -1380,45 +1569,69 @@ \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse + \edef\@@anchor{center} \ifpgf@circuit@trans@ntype - \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/arrow pos}}{% - \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@down}% - }{% - \pgfpoint{\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}% - } + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip} + \pgftransformlineattime{1.0}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% + } + \fi \else - \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/arrow pos}}{% - \pgfpoint{\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}% - }{% - \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@up}% - } + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip} + \pgftransformlineattime{1.0}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \else + \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \fi \fi - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope \ifpgf@circuit@bpt@drawphoto \pgfscope \pgfsetarrowsstart{latexslim} \pgfpathmoveto{\pgfpointadd{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} \pgfpathlineto{\pgfpointadd{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}} \pgfusepath{draw} \pgfpathmoveto{\pgfpointadd{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}} \pgfpathlineto{\pgfpointadd{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} \pgfusepath{draw} @@ -1426,7 +1639,7 @@ \else \ifpgf@circuit@bpt@drawbase \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgfusepath{draw} @@ -1444,75 +1657,80 @@ %draw upper connection \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} \pgfusepath{draw} %draw thicker gate lines \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope %draw lower connection \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} - %draw arrow depending on type of transiytor + %draw arrow depending on type of transistor \pgfscope \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.5} + \fi \ifpgf@circuit@trans@ntype - \pgftransformlineattime{.5}{% + \pgftransformlineattime{\@@pos}{% \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@down}% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}% }{% \pgfpoint{\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}% + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}% } \else - \pgftransformlineattime{.5}{% + \pgftransformlineattime{\@@pos}{% \pgfpoint{\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}% + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}% }{% - \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@up}% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}% } \fi - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope %draw gate \ifpgf@circuit@trans@ntype \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} \else \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} \fi \pgfusepath{draw} } @@ -1523,131 +1741,148 @@ \declareigbt{Lnigbt} \declareigbt{Lpigbt} - \pgfcircdeclaretransistor{nmos}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope \ifpgf@circuit@mos@arrows \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgfresetnontranslationattimefalse - \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/arrow pos}}{% - \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}% - }{% - \pgfpoint - {\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}% - } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{tip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi \endpgfscope \fi \ifpgf@circuit@bpt@drawgate \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgfusepath{draw} \fi } - \pgfcircdeclaretransistor{pmos}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} \pgfusepath{draw} \ifpgf@circuit@mos@arrows \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgfresetnontranslationattimefalse - \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/arrow pos}}{% - \pgfpoint% - {\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}% - }{% - \pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}% - } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgftransformrotate{180} + \pgfnode{currarrow}{tip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{% + \pgfpoint% + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi \endpgfscope \fi \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \ifpgf@circuit@bpt@drawgate \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgfusepath{draw} \fi \ifpgf@circuit@pmos@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 - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left - \pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - {\pgf@circ@res@up+\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen} + {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} \ifpgf@circuit@pmos@emptycircle \pgfsetfillcolor{white} \fi @@ -1659,32 +1894,32 @@ \pgfcircdeclaretransistor{hemt}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base height}\pgf@circ@res@down}} - \pgfsetlinewidth{2\pgflinewidth} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgfusepath{draw} @@ -1695,101 +1930,111 @@ %top connection \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} \ifpgf@circuit@trans@depletiontype \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} \else \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up*0.45}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up*0.25}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down*0.25}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nfet/base height}\pgf@circ@res@down*0.45}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} \fi - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope %Bulk connection line \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} {\pgf@circ@res@up+\pgf@circ@res@down}} %bottom connection \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} %draw thick gate line \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope + % arrows \pgfscope \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse - - \pgftransformlineattime{.6}{% + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip} + \ifpgf@circuit@trans@ntype + \edef\@@pos{1.0} + \else + \edef\@@pos{0.0} + \fi + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% \pgfpoint {\pgf@circ@res@right}% {\pgf@circ@res@up+\pgf@circ@res@down}% }{% \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% {\pgf@circ@res@up+\pgf@circ@res@down}% } \ifpgf@circuit@trans@ntype - \else - \pgftransformrotate{180} - \fi - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} -\endpgfscope + \else + \pgftransformrotate{180} + \fi + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope % GATE CONNECTION \ifpgf@circuit@bpt@drawgate \ifpgf@circuit@trans@ntype \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} \else \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} \fi \pgfusepath{draw} \fi @@ -1805,13 +2050,11 @@ {#3} } - \pgfdeclaretransistorwrapperaddbulk{nfet}{}{% \pgf@circuit@trans@depletiontypefalse \drawfetcore{nfet} } - \pgfdeclaretransistorwrapperaddbulk{pfet}{}{% \pgf@circuit@trans@depletiontypefalse \drawfetcore{pfet} @@ -1831,15 +2074,12 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi } - - - % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{% \pgf@circuit@trans@depletiontypefalse @@ -1848,14 +2088,12 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} + \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi } - - % N-CHANNEL IGFET DEPLETION TYPE \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{% \pgf@circuit@trans@depletiontypetrue @@ -1870,7 +2108,7 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi @@ -1892,7 +2130,7 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/pigfete/gate height}\pgf@circ@res@up}} + \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}} \pgfnode{circ}{center}{}{}{} \endpgfscope \fi @@ -1904,7 +2142,6 @@ \drawfetcore{pigfetebulk} } - % P-CHANNEL IGFET DEPLETION TYPE \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{% \pgf@circuit@trans@depletiontypetrue @@ -1920,7 +2157,7 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@up}} + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi @@ -1929,78 +2166,83 @@ \pgfcircdeclaretransistor{njfet}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope + % arrow \pgfscope \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse - \pgftransformlineattime{.6}{% + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% \pgfpoint{\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}% + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% }{% \pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}% + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} \pgfusepath{draw} } - \pgfcircdeclaretransistor{pjfet}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope @@ -2008,74 +2250,76 @@ \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse - \pgftransformlineattime{.4}{% + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.4} + \fi + \pgftransformlineattime{\@@pos}{% \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% }{% \pgfpoint{\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope - \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} \pgfusepath{draw} } - \pgfdeclaretransistorwrapperaddbulk{isfet}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} % DRAIN CONNECTION \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} % DRAIN \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} \pgfusepath{draw} % GATE, DEPLETION TYPE \pgfscope %% added \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} %% added + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added \pgfusepath{draw} %% added \endpgfscope %% added % BULK \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth} {\pgf@circ@res@up+\pgf@circ@res@down}} % SOURCE \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} % SOURCE CONNECTION \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} - % SOLDER DOT at source-bulk connection \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi @@ -2084,291 +2328,54 @@ \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse - \pgftransformlineattime{.6}{% + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% \pgfpoint {\pgf@circ@res@right}% {\pgf@circ@res@up+\pgf@circ@res@down}% }{% \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}% {\pgf@circ@res@up+\pgf@circ@res@down}% } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope \pgfusepath{draw} % Wavy lines \pgfscope - \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves y sep}\pgf@circ@res@up}} - \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}} - \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves y sep}\pgf@circ@res@up}} - \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} - \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} \pgfusepath{draw} - \endpgfscope - -} - - -%% Black thyristor - -\pgfcircdeclarebipole{ - \anchor{gate}{ - \northeast - } - \anchor{anode}{ - \southwest - \pgf@y=0cm - } - \anchor{G}{ - \northeast - } - \anchor{cathode}{ - \northeast - \pgf@y=0cm - } -} -{\ctikzvalof{tripoles/thyristor/height 2}} -{fullthyristor}{\ctikzvalof{tripoles/thyristor/height}} -{\ctikzvalof{tripoles/thyristor/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - - \pgfscope - \pgftransformxshift{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfusepath{draw,fill} - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} \pgfusepath{draw} \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} - - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - -} - -%% Empty thyristor - -\pgfcircdeclarebipole{ - \anchor{gate}{ - \northeast - } - \anchor{anode}{ - \southwest - \pgf@y=0cm - } - \anchor{G}{ - \northeast - } - \anchor{cathode}{ - \northeast - \pgf@y=0cm - } -} -{\ctikzvalof{tripoles/thyristor/height 2}} -{emptythyristor}{\ctikzvalof{tripoles/thyristor/height}} -{\ctikzvalof{tripoles/thyristor/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - - \pgfscope - \pgftransformxshift{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathclose - \pgf@circ@draworfill - \pgfscope - % to allow filling, we need to draw explicitily the stroke here. - \pgfsetlinewidth{\pgfstartlinewidth} - \ifpgf@circuit@bipole@strokedsymbol - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{0pt}} - \pgfusepath{draw} - \fi - \endpgfscope - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} - - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - -} - -%% Empty triac - -\pgfcircdeclarebipole{ - \anchor{gate}{ - \northeast - } - \anchor{G}{ - \northeast - } - \anchor{anode}{ - \southwest - \pgf@y=0cm - } - \anchor{cathode}{ - \northeast - \pgf@y=0cm - } -} -{\ctikzvalof{tripoles/triac/height}} -{emptytriac} -{\ctikzvalof{tripoles/triac/height}} -{\ctikzvalof{tripoles/triac/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - - \pgf@circ@draworfill - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - } -%% Full triac +% end of transistors -\pgfcircdeclarebipole{ - \anchor{gate}{ - \northeast - } - \anchor{G}{ - \northeast - } - \anchor{anode}{ - \southwest - \pgf@y=0cm - } - \anchor{cathode}{ - \northeast - \pgf@y=0cm - } -} -{\ctikzvalof{tripoles/triac/height}} -{fulltriac} -{\ctikzvalof{tripoles/triac/height}} -{\ctikzvalof{tripoles/triac/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - - \pgfusepath{draw,fill} - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - -} +%%%%%%%%%%%%% +%% Switches +%%%%%%%%%%%%% \pgfcircdeclarebipole{ \anchor{out 1}{ @@ -2391,7 +2398,7 @@ \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} \pgfusepath{draw} \endpgfscope @@ -2419,15 +2426,20 @@ \pgfsetdash{}{0cm} } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% operational and instrumentation amplifiers +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfdeclareshape{op amp} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{south}{ @@ -2444,13 +2456,14 @@ } \anchor{leftedge} {\left - \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x } \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{in up}{ @@ -2460,12 +2473,12 @@ \inOneFixed \pgf@y=-\pgf@y } - \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi } @@ -2477,19 +2490,20 @@ \pgf@y=-\pgf@y } \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@circ@res@up = \pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/up pos}}{ + \ctikzvalof{tripoles/op amp/up pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}} } \anchor{up}{ \up @@ -2519,21 +2533,22 @@ \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + % Triangle \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step + \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} @@ -2542,40 +2557,43 @@ \pgf@circ@draworfill \endpgfscope + % Negative input terminal \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} - + {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + % Positive input terminal \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + % Output terminal \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}} \pgfsetrectcap \pgfusepath{draw} - - } } -%op amp shape as in european standard en 60617 +% Op amp shape as in european standard EN 60617 \pgfdeclareshape{en amp} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{south}{ @@ -2596,10 +2614,11 @@ \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x } \savedanchor\inOneFixed{% - \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y - \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{in up}{ @@ -2610,10 +2629,11 @@ \pgf@y=-\pgf@y } \savedanchor\inOne{% - \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y - \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi } @@ -2652,15 +2672,16 @@ \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen \pgfscope - \pgfsetlinewidth{\ctikzvalof{tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}} @@ -2696,14 +2717,446 @@ } } -%%Transkonduktanzverstärker +% Fully differential output op amp +% Contributed by Kristofer M. Monisit +\pgfdeclareshape{fd op amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\outline{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd op amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out up}{ + \northwest + \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out down}{ + \northwest + \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out +}{ + \outline + \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out -}{ + \outline + \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out}{% should not be used + \left + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + % Triangle + % Includes output terminals to ensure that diagonal joins are properly displayed + \pgfscope + \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step + + % Initial point (right vertex) + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + + % Negative output terminal + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}} + + % Top vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + + % Bottom vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + + % Positive output terminal + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}} + + % Right vertex + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + % Negative output terminal label + \pgftext[right, bottom, x=3pt, y=1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup$-$\else$+$\fi} + + % Positive output terminal label + \pgftext[right, top, x=3pt, y=-1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup$+$\else$-$\fi} + + \pgfsetrectcap + \pgfusepath{draw} + } +} + + +% Instrumentation amplifier with differential output +\pgfdeclareshape{fd inst amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@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@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd inst amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd inst amp/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@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@y=-\pgf@y + } + \savedanchor\outport{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{out}{ + \outport + \pgf@y=0pt + } + \anchor{out +}{ + \outport + } + \anchor{out -}{ + \outport + \pgf@y=-\pgf@y + } + \savedanchor\outportfixed{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + } + \anchor{out up}{ + \outportfixed + } + \anchor{out down}{ + \outportfixed + \pgf@y=-\pgf@y + } + % + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + % main component, normally in thicker lines + \pgfscope + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@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@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % input terminal up + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % input terminal down + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + % output leads down and up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} % + \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} % + \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi} + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Transconductance amplifier (Transkonduktanzverstärker) \pgfdeclareshape{gm amp} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{south}{ @@ -2718,13 +3171,14 @@ } \anchor{leftedge} {\left - \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x } \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{in up}{ @@ -2735,12 +3189,13 @@ \pgf@y=-\pgf@y } \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x - \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi } \anchor{-}{ \inOne @@ -2749,20 +3204,21 @@ \inOne \pgf@y=-\pgf@y } - \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@circ@res@up = \pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/up pos}}{ + \ctikzvalof{tripoles/gm amp/up pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}} } \anchor{up}{ \up @@ -2789,63 +3245,68 @@ \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } \anchor{text}{\northwest - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/op amp/port width}\pgf@x \pgfpoint{-.5\wd\pgfnodeparttextbox+.25\pgf@x}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step + \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step %Umrandung: - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0}} %geändert startpunkt neu am ausgangsstrich - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}%vom Ausgang nach oben + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}%vom Ausgang nach oben \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}%ecke links unten nach rechts unten + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@down}}%ecke links unten nach rechts unten \pgfpathclose \pgf@circ@draworfill \endpgfscope \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{0pt}} % + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} % \pgfsetrectcap \pgfusepath{draw} } } -%% instrumentation amplifier - +% Instrumentation amplifier \pgfdeclareshape{inst amp} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} % when tikz calls the anchor it wants the relative position in the lengths % \pgf@x \pgf@y % \pgfpoint* functions set that variables @@ -2854,9 +3315,10 @@ % savedanchors are internals and run on node creation (not use) % bounding-box top left \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{nw}{ @@ -2874,13 +3336,14 @@ } \anchor{leftedge} {\left - \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x } \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{in up}{ @@ -2891,10 +3354,11 @@ \pgf@y=-\pgf@y } \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi } @@ -2906,19 +3370,20 @@ \pgf@y=-\pgf@y } \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@circ@res@up = \pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/up pos}}{ + \ctikzvalof{tripoles/inst amp/up pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} } \anchor{up}{ \up @@ -2929,19 +3394,20 @@ } % reference voltage input anchors. \savedanchor\refv{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@circ@res@up = \pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/refv pos}}{ + \ctikzvalof{tripoles/inst amp/refv pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} } % we need both because they are normally drawn under the amp, and if you % mirror it vertically you need them @@ -2973,70 +3439,80 @@ % let's start drawing the component \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} % \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + % main component, normally in thicker lines \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step + \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step %first point (near output) - \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@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{1.4\pgf@circ@res@right}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} % and then to the input "front up", "down", to the output short side "down" \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}} % ...and close \pgfpathclose \pgf@circ@draworfill \endpgfscope - % input terminal - + + % Negative input terminal \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} % \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} % - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} - % input terminal + + % Positive input terminal \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} % \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} - % output lead + {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + % Output terminal \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} % + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} % % \pgfsetrectcap \pgfusepath{draw} } } -% instrumentation amplifier, with terminals for gain resistance between inputs +% Instrumentation amplifier with terminals for gain resistance between inputs \pgfdeclareshape{inst amp ra} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} % bounding-box top left \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{nw}{ @@ -3054,14 +3530,15 @@ } \anchor{leftedge} {\left - \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x } % inputs (+-) \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{in up}{ @@ -3072,10 +3549,11 @@ \pgf@y=-\pgf@y } \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi } @@ -3089,10 +3567,11 @@ % 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{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{ra up}{ @@ -3103,9 +3582,10 @@ \pgf@y=-\pgf@y } \savedanchor\raOne{% - \pgf@y=\pgf@circ@Rlen - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\pgf@circ@scaled@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi } @@ -3118,19 +3598,20 @@ } % power supplies \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@circ@res@up = \pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/up pos}}{ + \ctikzvalof{tripoles/inst amp ra/up pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.4\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} } \anchor{up}{ \up @@ -3141,19 +3622,20 @@ } % reference voltage input anchors. \savedanchor\refv{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen \pgf@y=0.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen \pgf@x=0.5\pgf@x \pgf@circ@res@up = \pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/refv pos}}{ + \ctikzvalof{tripoles/inst amp ra/refv pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.4\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} } % we need both because they are normally drawn under the amp, and if you % mirror it vertically you need them @@ -3185,29 +3667,33 @@ % drawing of the component \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right % main component, normally in thicker lines \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step + \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step %primer punto: la linea de salida (lado componente) - \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} - %from the exit to the top (short side)... (note that the .4 must be copied in \up anchor - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.4\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@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@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} % and then to the input "front up", "down", to the output short side "down" \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@down}} % ...and close \pgfpathclose \pgf@circ@draworfill @@ -3216,683 +3702,199 @@ % ra terminal - \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} % \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} % ra terminal + \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} % \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} - {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} - % input terminal - + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + + % Negative input terminal \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} % \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} % - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} - % input terminal + + % Positive input terminal \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} % \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} - % output lead + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + % Output terminal \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} % + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} % % \pgfsetrectcap \pgfusepath{draw} } } -%% Potentiometer -\pgfcircdeclarebipole{ - \anchor{wiper}{ - \northeast - \pgfpoint{0pt}{\pgf@y} - } - \anchor{W}{ - \northeast - \pgfpoint{0pt}{\pgf@y} - } -} -{\ctikzvalof{bipoles/potentiometer/height 2}} -{potentiometer}{\ctikzvalof{bipoles/potentiometer/height}} -{\ctikzvalof{bipoles/potentiometer/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} - \divide \pgf@circ@res@step by 12 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfsetbeveljoin - \pgfusepath{draw} - - \pgfscope - %\pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfusepath{draw} - \endpgfscope -} - - - - - -%% Generic tunable - -\pgfcircdeclarebipole{ - \anchor{wiper}{ - \northeast - \pgfpoint{0pt}{\pgf@y} - } -} -{\ctikzvalof{bipoles/generic potentiometer/height 2}} -{genericpotentiometer} -{\ctikzvalof{bipoles/generic potentiometer/height}} -{\ctikzvalof{bipoles/generic potentiometer/width}} -{ - - \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 14 - - \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill - \endpgfscope - \pgfscope - %\pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfusepath{draw} - \endpgfscope -} - - -\pgfdeclareshape{mixer} +% Buffer +% Contributed by Danilo Piazzalunga +\pgfdeclareshape{buffer} { - \savedanchor\northwest{ - \ifpgf@circuit@boxed - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \else - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/mixer/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/mixer/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \fi - } - \anchor{center}{ - \pgfpointorigin - } - \anchor{left}{% - \northwest - \pgf@y=0pt - } - \anchor{1}{ - \northwest - \pgf@y=0pt - } - \anchor{2}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{3}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{4}{ - \northwest - \pgf@y=\pgf@y - \pgf@x=0pt - } - \anchor{in 1}{ - \northwest - \pgf@y=0pt + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x } - \anchor{in1}{ - \northwest + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% \pgf@y=0pt } \anchor{in}{ \northwest \pgf@y=0pt } - \anchor{in 2}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{in2}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } \anchor{out}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{north}{ - \northwest - \pgf@x=0pt - } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y - } - \anchor{north east}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{north west}{ - \northwest - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@Rlen - - \pgfscope - \pgfstartlinewidth=\pgflinewidth - - % draw outer box - \ifpgf@circuit@boxed - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi - - % draw outer circle - \ifpgf@circuit@boxed - \pgf@circ@res@step=.7\pgf@circ@res@step - \pgfsetdash{}{0pt} % draw solid circle if boxed - \else - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \fi - \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} - \pgf@circ@draworfill - - % draw inner stuff - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpointorigin} - \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}} - \pgfpathmoveto{\pgfpointorigin} - \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}} - \pgfusepath{draw} - \endpgfscope - } -} + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} -\pgfdeclareshape{adder} -{ - \savedanchor\northwest{ - \ifpgf@circuit@boxed - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \else - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/adder/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/adder/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \fi - } - \anchor{center}{ - \pgfpointorigin - } - \anchor{left}{% - \northwest - \pgf@y=0pt - } - \anchor{1}{ - \northwest - \pgf@y=0pt - } - \anchor{2}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{3}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{4}{ - \northwest - \pgf@y=\pgf@y - \pgf@x=0pt - } - \anchor{in 1}{ - \northwest - \pgf@y=0pt - } - \anchor{in1}{ - \northwest - \pgf@y=0pt - } - \anchor{in}{ - \northwest - \pgf@y=0pt - } - \anchor{in 2}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{in2}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{out}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{north}{ - \northwest - \pgf@x=0pt - } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y - } - \anchor{north east}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{north west}{ - \northwest - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@Rlen + \pgfsetcolor{\ctikzvalof{color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen \pgfscope - \pgfstartlinewidth=\pgflinewidth - - % draw outer box - \ifpgf@circuit@boxed - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step - % draw outer circle - \ifpgf@circuit@boxed - \pgf@circ@res@step=.7\pgf@circ@res@step{} - \pgfsetdash{}{0pt} % draw solid circle if boxed - \else - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \fi - \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose \pgf@circ@draworfill + \endpgfscope - % draw inner stuff - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} - \pgfpathmoveto{\pgfpointorigin} - \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}} - \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}} - \pgfpathmoveto{\pgfpointorigin} - \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}} - \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} - \endpgfscope + \pgfusepath{draw} } } -\pgfdeclareshape{oscillator} +% plain amplifier, no symbols +\pgfdeclareshape{plain amp} { - \savedanchor\northwest{ - \ifpgf@circuit@boxed - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \else - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/oscillator/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/oscillator/width}\pgf@circ@Rlen - \fi - } - \anchor{center}{ - \pgfpointorigin - } - \anchor{north}{ - \northwest - \pgf@x=.5\pgf@x - } - \anchor{south}{ - \northwest + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x - \pgf@y=-\pgf@y - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=0pt } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y} - \anchor{north east}{ \northwest \pgf@x=0pt\relax} + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } - \anchor{text}{ - \pgf@x=-2\pgf@x - \advance \pgf@x by -.5\wd\pgfnodeparttextbox - \advance \pgf@y by -1.5\ht\pgfnodeparttextbox - } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@Rlen{} - - \pgfscope - \pgfstartlinewidth=\pgflinewidth - - \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east" - - % draw outer box - \ifpgf@circuit@boxed{} - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi - - % draw outer circle - \ifpgf@circuit@boxed - \pgf@circ@res@step=.7\pgf@circ@res@step{} - \pgfsetdash{}{0pt} % draw solid circle if boxed - \else - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \fi - \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} - \pgf@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@circ@res@step}{0\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} - - \pgfusepath{draw} - - \endpgfscope - } -} - -\pgfdeclareshape{circulator} -{ - \savedanchor\northwest{ - \ifpgf@circuit@boxed - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \else - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/circulator/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/circulator/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \fi - } - \anchor{center}{ - \pgfpointorigin - } - \anchor{left}{% - \northwest - \pgf@y=0pt - } - \anchor{1}{ - \northwest - \pgf@y=0pt - } - \anchor{2}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{3}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{north}{ - \northwest - \pgf@x=0pt - } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y - } - \anchor{north east}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{north west}{ - \northwest - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@Rlen - - \pgfscope - \pgfstartlinewidth=\pgflinewidth - - % draw outer box - \ifpgf@circuit@boxed - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi - - % draw outer circle - \ifpgf@circuit@boxed{} - \pgf@circ@res@step=.7\pgf@circ@res@step{} - \pgfsetdash{}{0pt} % draw solid circle if boxed - \else - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \fi - \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} - \pgf@circ@draworfill - - % inner arrow - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}} - \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step} - \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}} - \pgfusepath{draw} - - \endpgfscope - } -} - - -% Wilkinson divider -\pgfdeclareshape{wilkinson}{ - \anchor{center}{ - \northwest - \pgf@x=0pt + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% \pgf@y=0pt } - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/wilkinson/height}\pgf@circ@Rlen + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x= \pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/wilkinson/width}\pgf@x } - \anchor{north}{ - \northwest - \pgf@x=0pt + \anchor{-}{ + \inOne } - \anchor{south}{ - \northwest - \pgf@x=0pt + \anchor{+}{ + \inOne \pgf@y=-\pgf@y } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x + \anchor{in up}{ + \inOne } - \anchor{south west}{ - \northwest + \anchor{in down}{ + \inOne \pgf@y=-\pgf@y } - \anchor{north east}{ - \northwest - \pgf@x=-\pgf@x + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/plain amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} } - \anchor{north west}{ - \northwest + \anchor{up}{ + \up } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x + \anchor{down}{ + \up \pgf@y=-\pgf@y } - \anchor{in}{ + \anchor{out}{ \northwest \pgf@y=0pt - } - \anchor{out1}{ - \northwest \pgf@x=-\pgf@x - \pgf@y=-0.5\pgf@y - } - \anchor{out2}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=0.5\pgf@y - } - \anchor{text}{ - \northwest - \advance \pgf@y by 0.5\ht\pgfnodeparttextbox - \pgf@x=-.5\wd\pgfnodeparttextbox } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y @@ -3900,60 +3902,54 @@ \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgfstartlinewidth=\pgflinewidth - - % draw outer box - \pgf@circ@twoportbox + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step - % draw inner stuff - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} - \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@circ@res@right}{0pt}} - \pgftransformrotate{90} - - % calculate size of resistor - \ifpgf@circuit@europeanresistor - \pgfmathparse{\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width} / 2} - \pgftransformscale{\pgfmathresult} - \pgfnode{genericshape}{center}{}{pgf@generic}{\pgfusepath{fill}} - \else - \pgfmathparse{\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} - \pgftransformscale{\pgfmathresult} - \pgfnode{resistorshape}{center}{}{pgf@resistor}{\pgfusepath{fill}} - \fi - } + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} \pgfusepath{draw} - } } -% electromechanical device (motor/generator) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% electromechanical device (motor/generator) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfdeclareshape{elmech} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northwest{ - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/elmech/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/elmech/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{center}{ @@ -4017,13 +4013,53 @@ \anchor{north east}{ \northwest \pgf@x=-\pgf@x } \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@Rlen - \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@Rlen + \anchorborder{% + \@tempdima=\pgf@x\@tempdimb=\pgf@y + \northwest\pgf@circ@res@other=-\pgf@x + \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}} + } + \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x} + \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x} + \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block up right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=-0.5\pgf@x + } + \anchor{block up left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=0.5\pgf@x + } + \anchor{block down right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=-0.5\pgf@x + } + \anchor{block down left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=0.5\pgf@x + } + \behindbackgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen \pgfscope \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope % clip the bar: whole size minus the circle \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} @@ -4035,21 +4071,31 @@ \endpgfscope \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} \else \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} \fi - \pgfusepath{draw, fill} \endpgfscope } } +%%%%%%%%%%%%%%%%%%% +%% Magnetron +%%%%%%%%%%%%%%%%%%% + \pgfdeclareshape{magnetron} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northwest{ - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/magnetron/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/magnetron/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{center}{ @@ -4139,8 +4185,9 @@ \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@Rlen + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y @@ -4150,7 +4197,7 @@ \pgfscope \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} %create outer circle \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right} \pgf@circ@draworfill @@ -4190,7 +4237,9 @@ } } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Electronic tubes, submitted by J. op den Brouw +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Draw tube outline \def\pgf@circ@tubes@drawtube{% @@ -4219,166 +4268,162 @@ %% 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}{ - \anchor{center}{ - \pgfpointorigin - } - \savedanchor\northwest{% - \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen - \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen - % x and y should be half the Rlen - \pgf@y=\pgf@circ@res@up - \pgf@y=.5\pgf@y - \pgf@x=-\pgf@circ@res@right - \pgf@x=.5\pgf@x - } - \anchor{north} {% - \northwest - \pgf@x=0pt - } - \anchor{east}{% - \northwest - \pgf@x=-\pgf@x - \pgf@y=0pt - } - \anchor{south}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{west}{% - \northwest - \pgf@y=0pt - } - \anchor{north west}{% - \northwest - } - \anchor{north east}{% - \northwest - \pgf@x=-\pgf@x - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y - } - \anchor{anode} {% - \northwest - \pgf@x=0pt - } - \anchor{cathode}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x - } - \anchor{cathode 1}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x - } - \anchor{cathode 2}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x - } - \anchor{filament 1}{% - \northwest - \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} - \pgf@x=\pgfmathresult\pgf@x - \pgf@y=-\pgf@y - } - \anchor{filament 2}{% - \northwest - \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} - \pgf@x=-\pgfmathresult\pgf@x - \pgf@y=-\pgf@y - } - - % Extra anchors - #2 - - \backgroundpath{ - \pgfscope - % Line width for tripoles - \pgfsetlinewidth{\ctikzvalof{tripoles/thickness}\pgflinewidth} - - % Setup to draw tube - \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen - \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen - \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up - \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right - - % Tube fill color (if any) - \ifx\tikz@fillcolor\pgfutil@empty - \else - \pgfscope - \pgfsetfillcolor{\tikz@fillcolor} - \pgf@circ@tubes@drawtube - \pgfusepath{fill} - \endpgfscope - \fi - - % Tube outline - \pgf@circ@tubes@drawtube - - % Setup to draw grid, filament, anode and cathode - \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen - \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen - \pgf@circ@res@up=0.5\pgf@circ@res@up - \pgf@circ@res@right=0.5\pgf@circ@res@right - - % Grid drawing - #3 - - % Filament (is not drawn by default) - \ifpgf@circuit@tubes@filament - \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up - \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up - \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} - \pgf@xa=\pgfmathresult\pgf@circ@res@right - \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} - \pgf@ya=\pgfmathresult\pgf@circ@res@up - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} - \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} - \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} - \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} - \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} - \pgf@circuit@tubes@filamentfalse - \fi - - % Anode (or plate) - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north - \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} - - % Cathode - \ifpgf@circuit@tubes@nocathode - \pgf@circuit@tubes@nocathodefalse - \else - \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} - \ifpgf@circuit@tubes@fullcathode - \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} - \pgf@circuit@tubes@fullcathodefalse - \else - \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}} - \fi - \fi - - % Draw the background - \pgfusepath{draw} - - \endpgfscope - } - } + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + % x and y should be half the Rlen + \pgf@y=\pgf@circ@res@up + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@circ@res@right + \pgf@x=.5\pgf@x + } + \anchor{north} {% + \northwest + \pgf@x=0pt + } + \anchor{east}{% + \northwest + \pgf@x=-\pgf@x + \pgf@y=0pt + } + \anchor{south}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{west}{% + \northwest + \pgf@y=0pt + } + \anchor{north west}{% + \northwest + } + \anchor{north east}{% + \northwest + \pgf@x=-\pgf@x + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{anode} {% + \northwest + \pgf@x=0pt + } + \anchor{cathode}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 1}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 2}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{filament 1}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + \anchor{filament 2}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=-\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + + % Extra anchors + #2 + + \backgroundpath{ + \pgfscope + % Line width for tripoles + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@scaled@Rlen=\scaledRlen + + % Setup to draw tube + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up + \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + + % Tube outline + \pgf@circ@tubes@drawtube + + % Setup to draw grid, filament, anode and cathode + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=0.5\pgf@circ@res@up + \pgf@circ@res@right=0.5\pgf@circ@res@right + + % Tube fill color (if any) + \pgf@circ@draworfill + + % Grid drawing + #3 + + % Filament (is not drawn by default) + \ifpgf@circuit@tubes@filament + \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up + \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@xa=\pgfmathresult\pgf@circ@res@right + \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} + \pgf@ya=\pgfmathresult\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@filamentfalse + \fi + + % Anode (or plate) + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north + \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + + % Cathode + \ifpgf@circuit@tubes@nocathode + \pgf@circuit@tubes@nocathodefalse + \else + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \ifpgf@circuit@tubes@fullcathode + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@fullcathodefalse + \else + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}} + \fi + \fi + + % Draw the background + \pgfusepath{draw} + \endpgfscope + } + } } \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists @@ -4611,7 +4656,7 @@ \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} - + } \endinput diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex index 62c10016603..158ee2dd79c 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex @@ -100,46 +100,61 @@ \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}} \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}} +%% +\def\setscaledRlenforclass{% + \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname + \ifdefined\ctikzclass + \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale} + \pgfkeysifdefined{\pgf@temp} + {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen} + \else + \pgf@circ@scaled@Rlen=\pgf@circ@Rlen + \fi +} + %% Output routine for generic bipoles \def\pgf@circ@drawvoltagegeneric{ \pgfextra{ - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance} + % \typeout{NAME:\ctikzvalof{bipole/name}} + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance} \pgfkeysifdefined{\pgf@temp} { - \edef\partheight{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance}} - \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen)} + \edef\partheight{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}} + \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)} } { \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance} { \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}} - \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen)} + \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)} } {%calculate default value from part height - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height} + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height} \pgfkeysifdefined{\pgf@temp} { - \edef\partheight{0.5*\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height}} - \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen+0.2\pgf@circ@Rlen)} + \edef\partheight{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}} + \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen+0.2\pgf@circ@scaled@Rlen)} } { - \edef\tmpdistfromline{(.5\pgf@circ@Rlen)} %fallback to fixed value + \edef\tmpdistfromline{(.5\pgf@circ@scaled@Rlen)} %fallback to fixed value } } } + % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen} \ifnum \ctikzvalof{mirror value}=-1 \ifpgf@circuit@bipole@inverted \ifpgf@circuit@bipole@voltage@straight \def\distfromline{\tmpdistfromline} \else - \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen} \fi \else \ifpgf@circuit@bipole@voltage@straight \def\distfromline{-\tmpdistfromline} \else - \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen} \fi \fi \else @@ -147,13 +162,13 @@ \ifpgf@circuit@bipole@voltage@straight \def\distfromline{-\tmpdistfromline} \else - \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen} \fi \else \ifpgf@circuit@bipole@voltage@straight \def\distfromline{\tmpdistfromline} \else - \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen} \fi \fi \fi @@ -162,43 +177,73 @@ \else \def\pgf@circ@voltage@angle{-90} \fi - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node} + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node} \pgfkeysifdefined{\pgf@temp} - { \edef\distacefromnode{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node}} } - { \edef\distacefromnode{\ctikzvalof{voltage/distance from node}} } - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b} + { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} } + { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} } + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b} \pgfkeysifdefined{\pgf@temp} - { \edef\bumpb{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b}} } - { \edef\bumpb{\ctikzvalof{voltage/bump b}} } + { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} } + { \edef\bumpb{\ctikzvalof{voltage/bump b}} } \edef\shiftv{\ctikzvalof{voltage/shift}} - \pgfmathsetmacro{\bumpb}{\bumpb + \shiftv} %% adjust the bump is shift - \ifpgf@circuit@bipole@inverted - \pgfmathsetmacro{\shiftv}{-\shiftv} - \fi - \ifnum \ctikzvalof{mirror value} = -1 - \pgfmathsetmacro{\shiftv}{-\shiftv} - \fi + \newdimen{\absvshift} + \pgfmathsetlength{\absvshift}{\shiftv*\distfromline+\distfromline} + % put this to true to see the voltage label coordinate anchors + \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse } - % %\pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} is equal to the length of the currarrow - coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead - coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorstartnode)$) - + % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow + coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorstartnode)$) + coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp) coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$) - coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead - coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorendnode)$) + coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorendnode)$) + coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp) coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$) \ifpgf@circuit@bipole@voltage@below - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto) ! \shiftv!90 : (anchorendnode)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom) ! \shiftv!-90 : (anchorstartnode)$) - coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$) - coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$) + \ifpgf@circ@debugv + node [ocirc, fill=red] at (anchorstartnode) {} + node [ocirc, fill=blue] at (anchorendnode) {} + node [ocirc, fill=green] at (pgfcirc@Vto) {} + node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {} + node [odiamondpole, fill=green] at (pgfcirc@Vto@flat) {} + node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom@flat) {} + \fi + coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$) + coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$) + coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$) + coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$) + coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$) + \ifpgf@circ@debugv + node [odiamondpole, fill=green] at (pgfcirc@Vto) {} + node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {} + node [osquarepole, fill=red] at (pgfcirc@Vcont1) {} + node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {} + \fi \else - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto) ! -\shiftv!90 : (anchorendnode)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom) ! -\shiftv!-90 : (anchorstartnode)$) - coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$) - coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$) + \ifpgf@circ@debugv + node [ocirc, fill=red] at (anchorstartnode) {} + node [ocirc, fill=blue] at (anchorendnode) {} + node [ocirc, fill=green] at (pgfcirc@Vto) {} + node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {} + node [odiamondpole, fill=green] at (pgfcirc@Vto@flat) {} + node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom@flat) {} + \fi + coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (anchorendnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$) + coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$) + coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$) + coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$) + coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$) + \ifpgf@circ@debugv + node [odiamondpole, fill=green] at (pgfcirc@Vto) {} + node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {} + node [osquarepole, fill=red] at (pgfcirc@Vcont1) {} + node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {} + \fi \fi \ifpgf@circuit@europeanvoltage @@ -255,7 +300,7 @@ \pgfextra{ \edef\shiftv{\ctikzvalof{voltage/shift}} \edef\bumpa{\ctikzvalof{voltage/bump a}} - \pgfmathsetmacro{\bumpaplus}{\bumpa + \shiftv} + \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry. } \ifpgf@circuit@bipole@voltage@below coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$) @@ -264,6 +309,9 @@ coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$) coordinate (pgfcirc@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@Vcont1) at (pgfcirc@Vto) + coordinate (pgfcirc@Vcont2) at (pgfcirc@Vfrom) \ifpgf@circuit@europeanvoltage \ifpgf@circuit@bipole@voltage@backward (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vfrom) @@ -356,6 +404,15 @@ \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@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@where{-90} + \else + \def\pgf@circ@bipole@voltage@label@where{90} + \fi + + % magic to counteract the scale and yscale effects (there should be a better way...) \ifnum \ctikzvalof{mirror value}=-1 \ifpgf@circuit@bipole@voltage@below \pgf@circuit@bipole@voltage@belowfalse @@ -368,26 +425,27 @@ \ifpgf@circuit@bipole@voltage@below \pgf@circuit@bipole@voltage@belowfalse \else - \pgf@circuit@bipole@voltage@belowtrue \fi \fi - \ifpgf@circuit@bipole@voltage@below - \def\pgf@circ@bipole@voltage@label@where{-90} - \else - \def\pgf@circ@bipole@voltage@label@where{90} - \fi - + % take into account scaling + \setscaledRlenforclass - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance} + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance} \pgfkeysifdefined{\pgf@temp} - { \edef\eudist{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance}} } - { \edef\eudist{\ctikzvalof{voltage/european label distance}} } - \edef\shiftv{\ctikzvalof{voltage/shift}} - % adjust the label distance to the shift. - \pgfmathsetmacro{\eudistplus}{\eudist+\shiftv} - + { \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@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height} + \pgfkeysifdefined{\pgf@temp} + {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}} + \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}} + {\edef\partheight{(.5\pgf@circ@scaled@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! }%end pgfextra @@ -397,19 +455,21 @@ \pgf@circ@drawvoltagegeneric \fi - % (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where) %Zeile sinnlos!? \ifpgf@circuit@bipole@voltage@straight coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] at (Vlab) { \pgf@circ@finallabels{voltage/label} } \else - coordinate (Vlab) at ($(\ctikzvalof{bipole/name}.center) ! \ifpgf@circuit@europeanvoltage - \eudistplus + coordinate (Vlab) at ($(pgfcirc@Vcont1)!0.5!(pgfcirc@Vcont2)$) \else - \ctikzvalof{voltage/american label distance} - \fi ! - (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where)$) + coordinate (Vlab) at ($(pgfcirc@Vfrom)!0.5!(pgfcirc@Vto)$) + \ifpgf@circuit@bipole@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@circ@bipole@voltage@label@where :(pgfcirc@Vto)$) + \fi + \fi node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] at (Vlab) { \pgf@circ@finallabels{voltage/label} } \fi }%end drawvoltages diff --git a/Master/texmf-dist/tex/latex/circuitikz/circuitikz-0.9.3.sty b/Master/texmf-dist/tex/latex/circuitikz/circuitikz-0.9.3.sty new file mode 100644 index 00000000000..bf8e23a122b --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/circuitikz-0.9.3.sty @@ -0,0 +1,16743 @@ +% Copyright 2007-2019 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{0.9.3} +\def\pgfcircversiondate{2019/07/13} + +\ProvidesPackage{circuitikz-0.9.3} +[\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} + +% The options are listed in the manual in this order + +\DeclareOption{europeanvoltage}{ + \ctikzset{voltage=european} +} + +\DeclareOption{straightvoltages}{ + \pgf@circuit@bipole@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@circ@siunitxtrue +} + +\DeclareOption{nosiunitx}{ + \pgf@circ@siunitxfalse +} + +\DeclareOption{fulldiode}{ + \ctikzset{diode = full} +} + +\DeclareOption{emptydiode}{ + \ctikzset{diode = empty} +} + +\DeclareOption{strokediode}{ + \ctikzset{diode = stroke} +} + +\DeclareOption{arrowmos}{ + \pgf@circuit@mos@arrowstrue +} + +\DeclareOption{noarrowmos}{ + \pgf@circuit@mos@arrowsfalse +} + +\DeclareOption{fetbodydiode}{ + \pgf@circuit@fet@bodydiodetrue +} + +\DeclareOption{nofetbodydiode}{ + \pgf@circuit@fet@bodydiodefalse +} + +\DeclareOption{fetsolderdot}{ + \pgf@circuit@fet@solderdottrue +} + +\DeclareOption{nofetsolderdot}{ + \pgf@circuit@fet@solderdotfalse +} + +\DeclareOption{emptypmoscircle}{ + \pgf@circuit@pmos@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@circuit@pmos@emptycircletrue +} + +\DeclareOption{straightlabels}{ + \ctikzset{label/align = straight} +} + +\DeclareOption{rotatelabels}{ + \ctikzset{label/align = rotate} +} + +\DeclareOption{smartlabels}{ + \ctikzset{label/align = smart} +} + +\DeclareOption{compatibility}{ + \pgf@circuit@compattrue +} + +\DeclareOption{oldvoltagedirection}{ + \pgf@circ@oldvoltagedirectiontrue + \pgf@circ@explicitvdirtrue + \pgf@circ@fixbatteriesfalse +} +\DeclareOption{nooldvoltagedirection}{ + \pgf@circ@oldvoltagedirectionfalse + \pgf@circ@explicitvdirtrue + \pgf@circ@fixbatteriesfalse +} + +\DeclareOption{RPvoltages}{ + \pgf@circ@oldvoltagedirectiontrue + \pgf@circ@explicitvdirtrue + \pgf@circ@fixbatteriestrue +} +\DeclareOption{EFvoltages}{ + \pgf@circ@oldvoltagedirectionfalse + \pgf@circ@explicitvdirtrue + \pgf@circ@fixbatteriestrue +} + + +\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 +%% Counters + +\newcount\pgf@circ@count@a +\newcount\pgf@circ@count@b +\newcount\pgf@circ@count@c +%%%%%%%%%%%% +%% Dimensions + +% coordinates +\newdimen\pgf@circ@res@up +\newdimen\pgf@circ@res@down +\newdimen\pgf@circ@res@zero +\newdimen\pgf@circ@res@left +\newdimen\pgf@circ@res@right +\newdimen\pgf@circ@res@other +\newdimen\pgf@circ@res@step +\newdimen\pgf@circ@res@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@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{+-4\pgfutil@tempdima} + \pgfarrowsrightextend{+6\pgfutil@tempdima} +} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}} + {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}} + {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}} + {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}} + {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}} + {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}} + {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathclose + \pgfusepathqfill +} + +\pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} + +%% Macro to fill or draw + +\def\pgf@circ@draworfill{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgfusepath{draw} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} + \fi +} + +\def\pgf@circ@draworfillandclip{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgfusepath{draw, clip} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, clip, fill} + \fi +} + +\def\pgf@circ@maybefill{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgfusepath{discard} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{fill} + \fi +} +%% Keys + +\long\def\pgf@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}} + +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circuit@compat +\newif\ifpgf@circ@oldvoltagedirection % default false +\newif\ifpgf@circ@explicitvdir +\newif\ifpgf@circ@fixbatteries + +\ctikzset{voltage dir/.is choice} +\ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}} +\ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}} +\ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}} +\ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}} +\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}} + + +% Option ">" for twoports +\newif\ifpgf@circuit@inputarrow +\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/.is choice} +\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} + +% Option "boxed" for nodes and twoports +\newif\ifpgf@circuit@boxed +\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} +\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} + +% Option "dashed" for nodes and twoports +\newif\ifpgf@circuit@dashed +\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} +\ctikzset{dashed/.add code={}{\pgf@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@circ@Rlen +\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1}} +\pgf@circ@Rlen = 1.4cm + +\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/tlinestub/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} + +\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/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/vresistor/height/.initial=.6} +\ctikzset{bipoles/vresistor/width/.initial=.8} +\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@circuit@bipole@twolines +\pgf@circuit@bipole@twolinesfalse +% +\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/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/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/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= \fontsize{6}{0}\selectfont\boldmath} +\ctikzset{bipoles/pcapacitor/height/.initial=.6} +\ctikzset{bipoles/pcapacitor/width/.initial=.2} +\ctikzset{bipoles/pcapacitor/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} +\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} +\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} +\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} +\ctikzset{bipoles/generic/height/.initial=.30} +\ctikzset{bipoles/generic/width/.initial=.80} +\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/generic potentiometer/height/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} +\ctikzset{bipoles/generic potentiometer/width/.initial=.80} +\ctikzset{bipoles/ageneric/height/.initial=.30} +\ctikzset{bipoles/ageneric/width/.initial=.80} +\ctikzset{bipoles/memristor/height/.initial=.30} +\ctikzset{bipoles/memristor/wave height/.initial=.5} +\ctikzset{bipoles/memristor/width/.initial=.80} +\ctikzset{bipoles/tgeneric/height/.initial=.70} +\ctikzset{bipoles/tgeneric/width/.initial=.80} +\ctikzset{bipoles/tfullgeneric/height/.initial=.70} +\ctikzset{bipoles/tfullgeneric/width/.initial=.80} +\ctikzset{bipoles/fullgeneric/height/.initial=.30} +\ctikzset{bipoles/fullgeneric/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} +\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/qmeter/depth/.initial=.40} +\ctikzset{bipoles/qmeter/height/.initial=.80} +\ctikzset{bipoles/qmeter/width/.initial=.60} +\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/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/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} +% resistive sensor american style +\ctikzset{bipoles/resistivesens/height/.initial=.6} +\ctikzset{bipoles/resistivesens/width/.initial=.8} + +% crossing wires +\ctikzset{bipoles/crossing/size/.initial=.2} + +\newif\ifpgf@circuit@trans@depletiontype +\pgf@circuit@trans@depletiontypefalse + +\newif\ifpgf@circuit@mos@arrows +\ctikzset{tripoles/mos style/.is choice} +\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} +\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} + +% Option solderdot for fet +\newif\ifpgf@circuit@fet@solderdot +\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} +\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} + +% Option bodydiode for fet +\newif\ifpgf@circuit@fet@bodydiode +\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} +\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} + +% Option draw fet without gate connection +\newif\ifpgf@circuit@bpt@drawgate +\pgf@circuit@bpt@drawgatetrue +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} + +% Option draw bpt without base connection +\newif\ifpgf@circuit@bpt@drawbase +\pgf@circuit@bpt@drawbasetrue +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} + +% Option draw bpt with optical input +\newif\ifpgf@circuit@bpt@drawphoto +\pgf@circuit@bpt@drawphotofalse +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} + +% Option draw pmos with empty circle +\newif\ifpgf@circuit@pmos@emptycircle +\pgf@circuit@pmos@emptycirclefalse +\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +% Option draw pmos with no circle +\newif\ifpgf@circuit@pmos@nocircle +\pgf@circuit@pmos@nocirclefalse +\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +% back to normal +\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} + + +\newif\ifpgf@circuit@trans@ntype +\pgf@circuit@trans@ntypetrue %default true +%\newif\ifpgf@circuit@trans@ptype +%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@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/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/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/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/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/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} + +\newif\ifpgf@circuit@europeanlogicport +\ctikzset{logic ports/.is choice} +\ctikzset{logic ports/european/.code= {\pgf@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{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@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{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 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 not port/origin/.initial=0} + } +} + + +\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 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 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} +% +% switches for op amps +% changing input polarity +% +\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse +\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\pgfkeys{/tikz/input noinv down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +\ctikzset{input noinv down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +% +% changing output polarity (for fully diff objects) +% +\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue +\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} +\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} +% +\ctikzset{tripoles/op amp/width/.initial=1.7} +\ctikzset{tripoles/op amp/port width/.initial=.7} +\ctikzset{tripoles/op amp/height/.initial=1.4} +\ctikzset{tripoles/op amp/input height/.initial=.5} +\ctikzset{tripoles/op amp/up pos/.initial=.45} +\ctikzset{tripoles/op amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath}%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= \fontsize{10}{12}\selectfont}%absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial= \fontsize{12}{14}\selectfont}%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}$} + }, +} +\ctikzset{tripoles/gm amp/width/.initial=1.7} +\ctikzset{tripoles/gm amp/port width/.initial=.7} +\ctikzset{tripoles/gm amp/height/.initial=1.4} +\ctikzset{tripoles/gm amp/input height/.initial=.5} +\ctikzset{tripoles/gm amp/up pos/.initial=.45} +\ctikzset{tripoles/inst amp/width/.initial=1.7} % instrumentation amplifier, simple +\ctikzset{tripoles/inst amp/port width/.initial=.7} +\ctikzset{tripoles/inst amp/height/.initial=1.4} +\ctikzset{tripoles/inst amp/input height/.initial=.5} +\ctikzset{tripoles/inst amp/up pos/.initial=.4} +\ctikzset{tripoles/inst amp/refv pos/.initial=.7} +\ctikzset{tripoles/inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! +\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % instrumentation amplifier, diff output +\ctikzset{tripoles/fd inst amp/port width/.initial=.7} +\ctikzset{tripoles/fd inst amp/height/.initial=1.4} +\ctikzset{tripoles/fd inst amp/input height/.initial=.5} +\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} +\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} +\ctikzset{tripoles/fd inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! +\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % instrumentation amplifier with ra gain resistance added +\ctikzset{tripoles/inst amp ra/port width/.initial=.7} +\ctikzset{tripoles/inst amp ra/height/.initial=2.9} +\ctikzset{tripoles/inst amp ra/input height/.initial=.7} +\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} +\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} +\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} +\ctikzset{tripoles/inst amp ra/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! +\ctikzset{tripoles/plain amp/width/.initial=1.7} +\ctikzset{tripoles/plain amp/port width/.initial=.7} +\ctikzset{tripoles/plain amp/height/.initial=1.4} +\ctikzset{tripoles/plain amp/input height/.initial=.5} +\ctikzset{tripoles/plain amp/up pos/.initial=.45} + +\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} + \ctikzset{quadpoles/gyrator/width=0.6} + } +} + + +% +% multipoles +% +\ctikzset{multipoles/thickness/.initial=2} +\ctikzset{multipoles/font/.initial=\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@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue +\pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue +\pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +\ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@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@circuit@chip@topmark\pgf@circuit@chip@topmarktrue +\pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} +\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@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@circ@rotaryarrow\pgf@circ@rotaryarrowfalse +\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse +\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse +\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}} +\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@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/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@circuit@bipole@isvoltage +\ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage} +\newif\ifpgf@circuit@bipole@voltageoutsideofsymbol +\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol} +\newif\ifpgf@circuit@bipole@strokedsymbol +\ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol} +\newif\ifpgf@circuit@bipole@iscurrent +\ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent} + +\ctikzset{bipole/voltage/.is family} +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}} +\newif\ifpgf@circuit@bipole@voltage@below +\ctikzset{bipole/voltage/position/.is choice} +\ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}} +\ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}} + +\ctikzset{bipole/voltage/label/unit/.initial=} +\ctikzset{bipole/voltage/label/name/.initial=} + +\ctikzset{bipole/current/.is family} +\newif\ifpgf@circuit@bipole@current@backward +\ctikzset{bipole/current/direction/.is choice} +\ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}} +\ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}} +\newif\ifpgf@circuit@bipole@current@before +\ctikzset{bipole/current/x position/.is choice} +\ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}} +\ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}} +\newif\ifpgf@circuit@bipole@current@below +\ctikzset{bipole/current/y position/.is choice} +\ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}} +\ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}} +\ctikzset{bipole/current/label/unit/.initial=} +\ctikzset{bipole/current/label/name/.initial=} + +\ctikzset{bipole/flow/.is family} +\newif\ifpgf@circuit@bipole@flow@backward +\ctikzset{bipole/flow/direction/.is choice} +\ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}} +\ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}} +\newif\ifpgf@circuit@bipole@flow@before +\ctikzset{bipole/flow/x position/.is choice} +\ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}} +\ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}} +\newif\ifpgf@circuit@bipole@flow@below +\ctikzset{bipole/flow/y position/.is choice} +\ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}} +\ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@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@circuit@europeanresistor +\ctikzset{resistor/.is choice} +\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } +\ctikzset{resistor/european/.code = \pgf@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}}} + +\newif\ifpgf@circuit@strokediode +\newif\ifpgf@circuit@fulldiode +\pgf@circuit@strokediodefalse +\pgf@circuit@fulldiodefalse + +\ctikzset{diode/.is choice} +\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default +\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } +\ctikzset{diode/stroke/.code = \pgf@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@circ@siunitx +\newif\ifpgf@circ@siunitx@res + +\ctikzset{straight/.is choice} +\ctikzset{straightvoltage value/.initial=true} +\ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}} +\ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}} +\ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}} +\newif\ifpgf@circuit@bipole@voltage@straight +\ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight} + + +\ctikzset{voltage/.is family} +\ctikzset{voltage/distance from node/.initial=.5} %\pgf@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 +\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} + +\ctikzset{current/.is family} +\ctikzset{current/distance/.initial = .5} + + +\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{american resistors/.style = { \circuitikzbasekey/resistor = american } } +\tikzset{european resistors/.style = { \circuitikzbasekey/resistor = european } } + +\newif\ifpgf@circuit@europeangfsurgearrester +\ctikzset{gas filled surge arrester choice/.is choice} +\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue } } +\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@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 } } +\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 } } + +% I should try to make the tree clearer (this voltage conflicts with the options above) + +\newif\ifpgf@circuit@europeanvoltage +\ctikzset{voltage/.is choice} +\ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse } } +\ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue } } + +\newif\ifpgf@circuit@europeancurrent +\ctikzset{current/.is choice} +\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse } +\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue } + +% 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@circ@sevenseg@dot +\newif\ifpgf@circ@sevenseg@box +\def\pgf@circ@sevenseg@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@circ@sevenseg@dotfalse}} +\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} +\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} +\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} +% +\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@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@circ@sevenseg@boxfalse}} +\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@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@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse +\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse +\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse +\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} +\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} + +%%%---------- close: tex/pgfcirc.defines +%%%%%%%%%%% Springe nach tex/pgfcircutils +%%%---------- open: tex/pgfcircutils.tex +% Copyright 2007-2009 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@circ@handleSI#1{% + % \pgf@circ@siunitx@resfalse +% + % \edef\len{\stringlength[e]{#1}} + %\testmatchingchar[e]{#1}{\len}{>}% + %\ifmatchingchar% + % \ifnum\findchars{#1}{<}=0 + % \def\pgf@circ@handleSI@val{\substring{#1}{1}{\findchars{#1}{<}-1}} + %\def\pgf@circ@handleSI@unit{\substring{#1}{\findchars{#1}{<}-1}+1}{\stringlength{#1}} + %\pgf@circ@siunitx@restrue +% \else +% \fi + %\else + %\fi +%} + +\def\pgf@circ@handleSI#1{ + \noexpandarg + \def\pgf@temp{} + \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit] + \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len] + + \ifnum\pgf@circ@handleSI@unit@len=0 + \pgf@circ@siunitx@resfalse + \else + \IfEndWith{#1}{>}{ + \pgf@circ@siunitx@restrue + \noexpandarg + \StrBefore{#1}{<}[\pgf@circ@handleSI@val] + %\typeout{si |#1|} + }{ + \pgf@circ@siunitx@resfalse + %\typeout{no si |#1|} + } +\fi +} + +\def\pgf@circ@ifkeyempty#1{ + \pgfextra{ + \ctikzset{#1/.get=\pgf@circ@temp} + \edef\pgf@temp{} + } + \ifx\pgf@circ@temp\pgf@temp + } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Math routines + +\def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1} + +%%%---------- close: tex/pgfcircutils + +%%%%%%%%%%% Springe nach tex/pgfcircshapes +%%%---------- open: tex/pgfcircshapes.tex +% Copyright 2007-2009 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@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{center}{ + \pgfpointorigin + } +} + +%% Full terminal + +\pgfdeclareshape{circ}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + } + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Empty terminal + +\pgfdeclareshape{ocirc}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + } + + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifx\tikz@fillcolor\pgfutil@empty + \pgfsetfillcolor{white} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Diamond terminal + +\pgfdeclareshape{diamondpole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northwest} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgftransformrotate{45} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% Diamond terminal, unfilled + +\pgfdeclareshape{odiamondpole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northwest} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgftransformrotate{45} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifx\tikz@fillcolor\pgfutil@empty + \pgfsetfillcolor{white} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% square terminal, filled + +\pgfdeclareshape{squarepole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpointborderrectangle + {\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}} + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetfillopacity{1.0} + \pgfusepath{draw,fill} + \endpgfscope + } +} +%% square terminal, unfilled + +\pgfdeclareshape{osquarepole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpointborderrectangle + {\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}} + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifx\tikz@fillcolor\pgfutil@empty + \pgfsetfillcolor{white} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{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@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@y=2.5\pgf@y + \pgf@x=-\pgf@y + } + % center is on the opening + \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{zero}{ \pgfpointorigin } + \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + % geo-anchors + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{left}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{2.5*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{2.5*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + } + \behindforegroundpath{ + \pgfextracty{\pgf@circ@res@other}{\northwest} + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % external circle + \pgfscope + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}} + {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}} + % next the opening to the right + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}} + {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal circle + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step} + \pgf@circ@draworfill + % and the contact line to the right + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \endpgfscope + } +} + +%% Fill for correct rectangular joins + +\pgfdeclareshape{rectjoinfill}{ + \savedanchor{\northeast}{% + \pgf@x=.5\pgflinewidth% + \pgf@y=.5\pgflinewidth% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint{0}{.5\pgflinewidth}} + {\pgfpoint{0}{-.5\pgflinewidth}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw,fill} + \endpgfscope + } +} + + +%% Current arrow + +\pgfdeclareshape{currarrow}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@x=.5\pgf@circ@res@step + \pgf@y=\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@x =\pgf@circ@res@step + } + \behindforegroundpath{ + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + + \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw,fill} + + \endpgfscope + } +} + +%% Flow arrow + +\pgfdeclareshape{flowarrow}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@y=.5\pgf@circ@res@step + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + \pgf@x=\pgf@circ@res@step% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@x =\pgf@circ@res@step + } + \behindforegroundpath{ + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw} + \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}} + \endpgfscope + } +} + +%% Input arrow + +\pgfdeclareshape{inputarrow}{ + \savedanchor{\northeast}{% this is really not northeast, really -northwest + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \pgf@y=.5\pgf@circ@res@step + \pgf@x=1.7\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@x=0cm\relax} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \savedanchor{\tip}{ + \pgfpointorigin + } + \anchor{center}{ + \tip + } + \anchor{tip}{ + \tip + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 16 + + \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{fill} + + \endpgfscope + } +} + + +%% box + +\pgfdeclareshape{box}{ + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen + \pgf@circ@res@step = 0.5\pgf@circ@res@step + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope + } + +} + + +% full nodes for wire crossing + +\pgfdeclareshape{jump crossing} +{ + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \behindbackgroundpath{ + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % horizontal jumper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % vertical, broken path + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} +\pgfdeclareshape{plain crossing} +{ + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \behindbackgroundpath{ + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % horizontal jumper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % vertical, broken path + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +%%%---------- close: tex/pgfcircshapes +%%%%%%%%%%% Springe nach tex/pgfcircmonopoles +%%%---------- open: tex/pgfcircmonopoles.tex +% Copyright 2007-2009 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 + +%% Ground symbol +% #1 -> name +% #2 -> width +% #3 -> depth +% #4 -> code +\long\def\pgf@circ@declareground#1#2#3#4{ + \pgfdeclareshape{#1}{ + \savedanchor{\southeast}{ + \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgf@x=#2\pgf@x + \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgf@y=-#3\pgf@y + } + \anchor{north}{\pgfpointorigin} + \anchor{north east}{\southeast\pgf@y=0pt\relax} + \anchor{east}{\southeast\pgf@y=.5\pgf@y} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{center}{\pgfpointorigin} + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + #4 + \endpgfscope + } + } +} + + +\pgf@circ@declareground{ground}{0.6}{1.6}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{tlground}{0.6}{0.4}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +\pgf@circ@declareground{rground}{0.6}{1}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\ctikzvalof{monopoles/rground/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfsetroundcap\pgfusepath{draw} +} + +\pgf@circ@declareground{tground}{0.6}{0}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{sground}{0.6}{1.8}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}} + \pgfpathclose + \pgf@circ@draworfill +} + +% noiseless ground +\pgf@circ@declareground{nground}{0.9}{1.6}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpatharc{0}{180}{0.9\pgf@circ@res@step} + \pgfusepath{draw} +} + +% protective ground +\pgf@circ@declareground{pground}{0.9}{1.8}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step} + \pgfusepath{draw} +} + +% chassis ground +\pgf@circ@declareground{cground}{1}{2}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Contributed by @fotesan https://github.com/fotesan + +\pgf@circ@declareground{eground}{1.1}{1.7}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{eground2}{1.1}{1.7}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Contributed by Leonardo Azzinnari +\pgfdeclareshape{tlinestub}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen + \pgf@x=1.625\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen + \pgf@y=.25\pgf@circ@res@step% + } + % the center is on the left side of the shape for facility of usage + \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax} + \anchor{west}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=0cm\relax} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y} + \anchor{center}{\pgfpointorigin} + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + + \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen + + \pgfscope\begin{pgftransparencygroup} + \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgf@circ@maybefill + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfusepath{draw} + \end{pgftransparencygroup} \endpgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} + } +} + +%% New antennas without tails + +% main body +\def\pgf@circ@antennabody{% + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfsetbeveljoin + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Waves for the antennas. +\def\pgf@circ@antennawaves{% + \pgfscope + % define a triangle for clipping the waves + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathclose + \pgfusepath{clip} + % ...and build the waves as clipped circles + \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step + \pgfmathloop% + \ifnum\pgf@circ@count@a>2 + \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other} + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \pgfusepath{draw} + \endpgfscope +} + + +% additional shape with the waves +\pgfdeclareshape{waves}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0pt} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} + \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{north east}{\northeast} + \anchor{east}{\northeast\pgf@y=0pt} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@Rlen + \pgf@circ@res@step=0.5\pgf@circ@res@step + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfscope + % define a triangle for clipping the waves + \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}} + \pgfpathclose + \pgfusepath{clip} + % ...and build the waves as clipped circles + \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step + \pgfmathloop% + \ifnum\c@pgf@counta>1 + \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other} + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop + \pgfusepath{draw} + \endpgfscope + } +} + +% the three types of antennas: simple, TX, RX. Notice that you can flip them... + +\pgfdeclareshape{bareantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + } +} + +\pgfdeclareshape{bareTXantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{waves}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + \pgf@circ@antennawaves + } +} + +\pgfdeclareshape{bareRXantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{waves}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@x=-4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + \pgftransformxshift{-5.2\pgf@circ@res@step} + \pgf@circ@antennawaves + } +} + +% Microstrip monopoles + +\pgfdeclareshape{mslstub}{ + \savedanchor{\southeast}{ + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=-.5\pgf@y + } + \savedanchor{\northwest}{ + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\northwest\pgf@y=0pt\relax} + \anchor{left}{\northwest\pgf@y=0pt\relax} + \anchor{right}{\southeast\pgf@y=0pt\relax} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + } +} + +\pgfdeclareshape{msrstub}{ + \savedanchor{\southeast}{ + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt\relax + } + \savedanchor{\northwest}{ + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@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@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}} + \pgfpatharc{135}{45}{\pgf@circ@res@step} + \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}} + \pgfpatharc{45}{135}{\pgf@circ@res@up} + \pgfclosepath + % \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + } +} + +\pgfdeclareshape{msport}{ + \savedanchor{\southeast}{ + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=-.5\pgf@y + } + \savedanchor{\northwest}{ + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\northwest\pgf@y=0pt\relax} + \anchor{left}{\northwest\pgf@y=0pt\relax} + \anchor{right}{\southeast\pgf@y=0pt\relax} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + } +} +% Legacy antennas (with tails) + +\def\pgf@circ@shift@antenna@xy#1#2{% + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step + \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step +\relax} + +\pgfdeclareshape{antenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}} + \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + + \pgftransformxshift{ -4\pgf@circ@res@step } + + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + + +\pgfdeclareshape{txantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}} + % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step} + \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{3\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{4\pgf@circ@res@step} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + + +\pgfdeclareshape{rxantenna}{ + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}} + % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step} + \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}} + \pgfpatharc{150}{210}{3.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}} + \pgfpatharc{150}{210}{3\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}} + \pgfpatharc{150}{210}{2.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}} + \pgfpatharc{150}{210}{2\pgf@circ@res@step} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + +% Vcc +\pgfdeclareshape{vcc}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=3\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{south}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=2\pgf@circ@res@step + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +% Vee +\pgfdeclareshape{vee}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=-3\pgf@x% + } + \anchor{south}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{north}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{south east}{\northeast} + \anchor{south west}{\northeast\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@y=0pt\relax} + \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=-2\pgf@circ@res@step + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +% match +\pgfdeclareshape{match}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@Rlen + \pgf@x=2\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@Rlen + \pgf@y=.5\pgf@circ@res@step% + } + % the center is on the left side of the shape for facility of usage + \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax} + \anchor{west}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=0cm\relax} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\pgfpointorigin} + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@Rlen + \pgf@x=1.5\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \pgf@y=-1.5\ht\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@Rlen + + \pgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}} + \pgfusepath{fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \endpgfscope + } +} + +%%%---------- close: tex/pgfcircmonopoles +%%%%%%%%%%% Springe nach tex/pgfcircbipoles +%%%---------- open: tex/pgfcircbipoles.tex +% Copyright 2007-2009 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#1#2#3#4#5#6{ + \pgfdeclareshape{#3shape}{ + + \savedanchor{\northeast}{ + \pgf@y=#4\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=#5\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\northeastborder}{ + \pgf@y=#4\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=#5\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwestborder}{ + \pgf@y=-#2\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=-#5\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwest}{ + \pgf@y=-#2\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-#5\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\centerpoint}{ + \pgf@circ@res@down=-#2\pgf@circ@Rlen + \pgf@circ@res@up=#4\pgf@circ@Rlen + \pgfpointorigin + \pgf@y=\pgf@circ@res@up + \advance\pgf@y by\pgf@circ@res@down + \pgf@y=.5\pgf@y + } + \anchor{center}{\pgfpointorigin} + \anchor{n}{ + \northeast + \pgf@x=0cm + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{ne}{ + \northeast + } + \anchor{nw}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{e}{ + \northeast + \pgf@y=0cm + } + \anchor{s}{ + \southwest + \pgf@x=0cm + } + \anchor{south east}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \southwest + } + \anchor{se}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{sw}{ + \southwest + } + \anchor{w}{ + \southwest + \pgf@y=0cm + } + \anchor{north}{ + \northeast + \pgf@x=0cm + } + \anchor{east}{ + \northeast + \pgf@y=0cm + } + \anchor{south}{ + \southwest + \pgf@x=0cm + } + \anchor{west}{ + \southwest + \pgf@y=0cm + } + \anchor{right}{ + \northeast + \pgf@y=0cm + } + \anchor{above}{ + \northeast + \pgf@x=0cm + } + \anchor{left}{ + \southwest + \pgf@y=0cm + } + \anchor{below}{ + \southwest + \pgf@x=0cm + } + \anchor{a}{ + \northeast + \pgf@y=0cm + } + \anchor{b}{ + \southwest + \pgf@y=0cm + } + \savedanchor{\textanchor}{% + \pgf@y=\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \anchor{text}{ + \textanchor + } + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@right=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@right=\pgf@y + \fi + \ifdim\pgf@circ@res@right>0cm + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\northeastborder} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } + + #1 + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@zero = 0cm + \pgf@circ@res@left = -\pgf@x + \pgf@circ@res@right = \pgf@x + \southwest + \pgf@circ@res@down = \pgf@y + + \pgfstartlinewidth=\pgflinewidth + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + #6 + + \pgfsetlinewidth{\pgfstartlinewidth} + } + } +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Standard bipole shapes declarations + +%% Resistor +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/resistor/height}} +{resistor} +{\ctikzvalof{bipoles/resistor/height}} +{\ctikzvalof{bipoles/resistor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} +} + + + +%% Variable resistor +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vresistor/height}} +{vresistor} +{\ctikzvalof{bipoles/vresistor/height}} +{\ctikzvalof{bipoles/vresistor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + +%% Capacitor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitor} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + +} + +%% Capacitive sensor +\pgfcircdeclarebipole +{\anchor{label}{% + \southwest + \pgf@x=2.6\pgf@x + \pgf@y=1.4\pgf@y + }% +} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitivesens} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.4\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Polar Capacitor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/pcapacitor/height}} +{polarcapacitor} +{\ctikzvalof{bipoles/pcapacitor/height}} +{\ctikzvalof{bipoles/pcapacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/pcapacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgftransformrotate{-90} + \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + +} + +%% Electrolytic Capacitor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ecapacitor/height}} +{ecapacitor} +{\ctikzvalof{bipoles/ecapacitor/height}} +{\ctikzvalof{bipoles/ecapacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/ecapacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + \pgfsetrectcap + % % % Draw plus pole + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgf@circ@draworfill + % % Draw minus pole + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfsetfillcolor{black} + \pgfusepath{draw,fill} + \pgfsetfillcolor{black} + % % plus pole annotation + \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}] + {\pgfkeysvalueof{/tikz/circuitikz/bipoles/ecapacitor/font} $+$} +} + +%% Battery + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/battery/height}} +{battery} +{\ctikzvalof{bipoles/battery/height}} +{\ctikzvalof{bipoles/battery/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 6 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + + +%% Battery 1 % poles with equl thickness + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/battery1/height}} +{battery1} +{\ctikzvalof{bipoles/battery1/height}} +{\ctikzvalof{bipoles/battery1/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%% Battery 2 % negative pole thicker + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/battery2/height}} +{battery2} +{\ctikzvalof{bipoles/battery2/height}} +{\ctikzvalof{bipoles/battery2/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + + +%% cute inductor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{cuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% cute inductive sensor + +\pgfcircdeclarebipole +{% +{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.8\pgf@x + \pgf@y=2.6\pgf@y + }% +}} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{scuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + \pgfscope + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% cute choke + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cutechoke/lower coil height}} +{cutechoke} +{\ctikzvalof{bipoles/cutechoke/height}} +{\ctikzvalof{bipoles/cutechoke/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cutechoke/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}*\ctikzvalof{bipoles/cutechoke/cthick}\pgfstartlinewidth} + \pgfusepath{stroke} + + \ifpgf@circuit@bipole@twolines + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}*\ctikzvalof{bipoles/cutechoke/cthick}\pgfstartlinewidth} + \pgfusepath{stroke} + \fi +} + +%% variable cute inductor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vcuteinductor/lower coil height}} +{vcuteinductor} +{\ctikzvalof{bipoles/vcuteinductor/height}} +{\ctikzvalof{bipoles/vcuteinductor/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} +%% american inductor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/americaninductor/height 2}} +{americaninductor} +{\ctikzvalof{bipoles/americaninductor/height}} +{\ctikzvalof{bipoles/americaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + + +%% american inductive sensor + +\pgfcircdeclarebipole +{% +{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.8\pgf@x + \pgf@y=2.6\pgf@y + }% +}} +{\ctikzvalof{bipoles/americaninductor/height 2}} +{samericaninductor} +{\ctikzvalof{bipoles/americaninductor/height}} +{\ctikzvalof{bipoles/americaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + \pgfscope + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% variable american inductor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vamericaninductor/height 2}} +{vamericaninductor} +{\ctikzvalof{bipoles/vamericaninductor/height}} +{\ctikzvalof{bipoles/vamericaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@Rlen + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% Independent voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsource} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + +%% Independent voltage source - American style + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsourceam/height}} +{vsourceAM} +{\ctikzvalof{bipoles/vsourceam/height}} +{\ctikzvalof{bipoles/vsourceam/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifpgf@circ@oldvoltagedirection + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$} + \else + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$-$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$+$} + \fi +} + + + +%% Independent sinusoidal voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsourcesin/height}} +{vsourcesin} +{\ctikzvalof{bipoles/vsourcesin/height}} +{\ctikzvalof{bipoles/vsourcesin/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% Square Voltage source - contributed by Alistair Kwan +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsourcesquare/height}} +{vsourcesquare} +{\ctikzvalof{bipoles/vsourcesquare/height}} +{\ctikzvalof{bipoles/vsourcesquare/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}} + \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% Triangle Voltage source - contributed by Ralf Farkas +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsourcetri/height}} +{vsourcetri} +{\ctikzvalof{bipoles/vsourcetri/height}} +{\ctikzvalof{bipoles/vsourcetri/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% PV Source +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/pvsource/height}} +{pvsource} +{\ctikzvalof{bipoles/pvsource/height}} +{\ctikzvalof{bipoles/pvsource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}} + \pgfusepath{draw} + + %Arrow Part + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty Source +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/esource/height}} +{esource} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill +} + +%% DC Current Source with open shape +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/dcisource/height}} +{dcisource} +{\ctikzvalof{bipoles/dcisource/height}} +{\ctikzvalof{bipoles/dcisource/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@maybefill + \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}} + \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}} + \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up} + \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}} + \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} +%% DC-Voltage source +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/dcvsource/height}} +{dcvsource} +{\ctikzvalof{bipoles/dcvsource/height}} +{\ctikzvalof{bipoles/dcvsource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}} + \pgfusepath{draw} +} + + +%% Independent current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isource/height}} +{isource} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill +} + +%% Independent double oo source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/oosource/height}} +{oosource} +{\ctikzvalof{bipoles/oosource/height}} +{\ctikzvalof{bipoles/oosource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} + \pgf@circ@maybefill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right} + \pgf@circ@draworfill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} + \pgfusepath{draw} +} + + +%% Independent current source - American + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isourceam/height}} +{isourceAM} +{\ctikzvalof{bipoles/isourceam/height}} +{\ctikzvalof{bipoles/isourceam/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + + +%% Independent sinusoidal current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isource/height}} +{isourcesin} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + + +%% Controlled voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsource/height}} +{cvsource} +{\ctikzvalof{bipoles/cvsource/height}} +{\ctikzvalof{bipoles/cvsource/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + + + +%% Controlled voltage source - American +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsourceam/height}} +{cvsourceAM} +{\ctikzvalof{bipoles/cvsourceam/height}} +{\ctikzvalof{bipoles/cvsourceam/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifpgf@circ@oldvoltagedirection + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$} + \else + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$-$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$+$} + \fi +} + + +%% Controlled sinusoidal voltage source +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{cvsourcesin} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{\ctikzvalof{bipoles/cvsourcesin/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + + +%% Controlled sinusoidal current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{cisourcesin} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{\ctikzvalof{bipoles/cvsourcesin/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Controlled current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cisource/height}} +{cisource} +{\ctikzvalof{bipoles/cisource/height}} +{\ctikzvalof{bipoles/cisource/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + + +%% Controlled current source - American + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cisourceam/height}} +{cisourceAM} +{\ctikzvalof{bipoles/cisourceam/height}} +{\ctikzvalof{bipoles/cisourceam/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + +%% Cute Independent voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsourceC} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Cute Independent current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isource/height}} +{isourceC} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Cute Controlled voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cvsource/height}} +{cvsourceC} +{\ctikzvalof{bipoles/cvsource/height}} +{\ctikzvalof{bipoles/cvsource/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Cute Controlled current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/cisource/height}} +{cisourceC} +{\ctikzvalof{bipoles/cisource/height}} +{\ctikzvalof{bipoles/cisource/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Noise voltage source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsourceN} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + % + \pgf@circ@res@step=0.125\pgf@circ@Rlen\relax + \edef\pgf@noise@temp{dashed} + \edef\pgf@noise@fill{\pgfkeysvalueof{/tikz/circuitikz/bipoles/noise sources/fillcolor}} + \ifx\pgf@noise@temp\pgf@noise@fill + % fillable in this case + \pgf@circ@draworfillandclip + \pgfmathsetmacro{\thinner}{.5*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\thinner\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % + \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \else + \pgfsetfillcolor{\pgf@noise@fill} + \pgfusepath{draw,fill} + \fi + \endpgfscope + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Noise current source + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/isource/height}} +{isourceN} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + % + \pgf@circ@res@step=0.125\pgf@circ@Rlen\relax + \edef\pgf@noise@temp{dashed} + \edef\pgf@noise@fill{\pgfkeysvalueof{/tikz/circuitikz/bipoles/noise sources/fillcolor}} + \ifx\pgf@noise@temp\pgf@noise@fill + % fillable in this case + \pgf@circ@draworfillandclip + \pgfmathsetmacro{\thinner}{.5*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\thinner\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % + \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \else + \pgfsetfillcolor{\pgf@noise@fill} + \pgfusepath{draw,fill} + \fi + \endpgfscope + \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Black generic diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fulldiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Black Zener diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fullzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black alternative zigzag Zener diode +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fullzzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black Schottky diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fullsdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Black tunnel diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fulltdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black light emitting diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fulllediode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + +} + +%% Black photodiode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{fullpdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Black varcap + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/varcap/height}} +{fullvarcap} +{\ctikzvalof{bipoles/varcap/height}} +{\ctikzvalof{bipoles/varcap/width}} +{ + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgfsetlinewidth{\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfusepath{draw,fill} + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Code for the diode triangle +\def\pgf@circ@basicdiodeshape{ + % \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + % \endpgfscope +} + + +%% Empty generic diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptydiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty Zener diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptyzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty alternative zigzag Zener diode +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptyzzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} +%% Empty Schottky diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptysdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty tunnel diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptytdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty light emitting diode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptylediode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty photodiode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/diode/height}} +{emptypdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty varcap + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/varcap/height}} +{emptyvarcap} +{\ctikzvalof{bipoles/varcap/height}} +{\ctikzvalof{bipoles/varcap/width}} +{ + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgfsetlinewidth{\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty bidirectionaldiode + +\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/bidirectionaldiode/height}}{emptybidirectionaldiode}{\ctikzvalof{bipoles/bidirectionaldiode/height}}{\ctikzvalof{bipoles/bidirectionaldiode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + % \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + + +%% Full bidirectionaldiode + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{fullbidirectionaldiode} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{\ctikzvalof{bipoles/bidirectionaldiode/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw, fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% (Closing) SPST +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/spst/depth}} +{cspst} +{\ctikzvalof{bipoles/spst/height}} +{\ctikzvalof{bipoles/spst/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}} + \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfsetbeveljoin + \pgfusepath{draw} + \endpgfscope +} + +%% Opening SPST +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/spst/depth}} +{ospst} +{\ctikzvalof{bipoles/spst/height}} +{\ctikzvalof{bipoles/spst/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} + \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfsetbeveljoin + \pgfusepath{draw} + \endpgfscope +} + +%% Normal open Switch +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/nos/depth}} +{nos} +{\ctikzvalof{bipoles/nos/height}} +{\ctikzvalof{bipoles/nos/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{draw} +} + +%% Normal closed Switch +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ncs/depth}} +{ncs} +{\ctikzvalof{bipoles/ncs/height}} +{\ctikzvalof{bipoles/ncs/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Push Button +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{pushbutton} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} + +%% Normally closed Push Button +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{ncpushbutton} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}} + \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfusepath{draw} + % + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} +% cute switch "to" shapes help function +% #1 -> name +% #2 -> barposition +% #3 -> arrowcode +\long\def\pgfcircdeclarecutesw#1#2#3{ + \pgfcircdeclarebipole + { + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@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@y=0cm} + \anchor{cin}{\southwest\pgf@y=0cm} + \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius} + \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@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) + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}} + } +} + +%% closed cute switch +\pgfcircdeclarecutesw{cuteclosedswitch} + {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} + {} + +%% open cute switch +\pgfcircdeclarecutesw{cuteopenswitch} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + {} + +%% closing cute switch +\pgfcircdeclarecutesw{cuteclosingswitch} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + { + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}} + \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} + } + +%% opening cute switch +\pgfcircdeclarecutesw{cuteopeningswitch} + {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} + { + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} + \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} + } + + +% % METERINGSHAPE + \long\def\drawmeteringcircle{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \pgf@circ@res@step=1.2\pgf@circ@res@up + \fi + \fi + %draw connections to circle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + %draw circle + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + %draw arrow + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + } +%AMPEREMETER +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ammeter/height}} +{ammeter} +{\ctikzvalof{bipoles/ammeter/height}} +{\ctikzvalof{bipoles/ammeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\textbf{A}}{}{} +} +%OHMMETER +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ohmmeter/height}} +{ohmmeter} +{\ctikzvalof{bipoles/ohmmeter/height}} +{\ctikzvalof{bipoles/ohmmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\boldmath$\Omega$}{}{} +} +%VOLTMETER +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/voltmeter/height}} +{voltmeter} +{\ctikzvalof{bipoles/voltmeter/height}} +{\ctikzvalof{bipoles/voltmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\textbf{V}}{}{} + +} + +% oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 +\pgfcircdeclarebipole +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/oscope/height}} +{oscope} +{\ctikzvalof{bipoles/oscope/height}} +{\ctikzvalof{bipoles/oscope/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + % this would create a round (analog?) scope... + % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \endpgfscope + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + % grid + \pgfscope + \pgfsetlinewidth{0.5\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]% + {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfsetstrokeopacity{0.5} + \pgfusepath{draw} + \endpgfscope + % function displayed, thanks to + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} +%% 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}} +{ } + +%% Generic bipole - used as resistor by some (bleah) + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/generic/height}} +{generic} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill +} + + +%% fuse + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/fuse/height}} +{fuse} +{\ctikzvalof{bipoles/fuse/height}} +{\ctikzvalof{bipoles/fuse/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@draworfill +} + + + +%% Generic bipole, filled - used as inductor by some + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/fullgeneric/height}} +{fullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfusepath{draw,fill} +} + +%% Generic sensor, filled - used as inductive sensor by some + +\pgfcircdeclarebipole +{{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + \pgf@y=2\pgf@y + }% +}} +{\ctikzvalof{bipoles/fullgeneric/height}} +{sfullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw,fill} + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + + +%% Generic asymmetric bipole + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/ageneric/height}} +{ageneric} +{\ctikzvalof{bipoles/ageneric/height}} +{\ctikzvalof{bipoles/ageneric/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + + +%% asymmetric fuse + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/afuse/height}} +{afuse} +{\ctikzvalof{bipoles/afuse/height}} +{\ctikzvalof{bipoles/afuse/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + + + + +%% Memristor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/memristor/height}} +{memristor} +{\ctikzvalof{bipoles/memristor/height}} +{\ctikzvalof{bipoles/memristor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + + + + +%% Generic empty tunable + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/tgeneric/height}} +{tgeneric} +{\ctikzvalof{bipoles/tgeneric/height}} +{\ctikzvalof{bipoles/tgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Photoresistor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/photoresistor/height 2}} +{photoresistor} +{\ctikzvalof{bipoles/photoresistor/height}} +{\ctikzvalof{bipoles/photoresistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + + +%% Thermistor +\pgfcircdeclarebipole +{{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + \pgf@y=1.2\pgf@y + }% +}} +{\ctikzvalof{bipoles/thermistor/height}} +{thermistor} +{\ctikzvalof{bipoles/thermistor/height}} +{\ctikzvalof{bipoles/thermistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + + +%% Thermistor PTC +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/thermistorptc/height 2}} +{thermistorptc} +{\ctikzvalof{bipoles/thermistorptc/height}} +{\ctikzvalof{bipoles/thermistorptc/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Thermistor NTC +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/thermistorntc/height 2}} +{thermistorntc} +{\ctikzvalof{bipoles/thermistorntc/height}} +{\ctikzvalof{bipoles/thermistorntc/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% thermocouple +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/thermocouple/height 2}} +{thermocouple} +{\ctikzvalof{bipoles/thermocouple/height}} +{\ctikzvalof{bipoles/thermocouple/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} +} + +%% Varistor +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/varistor/height}} +{varistor} +{\ctikzvalof{bipoles/varistor/height}} +{\ctikzvalof{bipoles/varistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\tiny\textsf{U}}} +} + + + +%% Generic full tunable + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{tfullgeneric} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{\ctikzvalof{bipoles/tfullgeneric/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw,fill} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + + + + + +%% Variable Capacitor + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vcapacitor/height}} +{vcapacitor} +{\ctikzvalof{bipoles/vcapacitor/height}} +{\ctikzvalof{bipoles/vcapacitor/width}} +{ + %\pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfusepath{draw} +} + + +%% Piezoelectric Element + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/piezoelectric/height}} +{piezoelectric} +{\ctikzvalof{bipoles/piezoelectric/height}} +{\ctikzvalof{bipoles/piezoelectric/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + %% Outer markings + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + %% Inner Box + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left+4}{\pgf@circ@res@up-1}}{\pgfpoint{\pgf@circ@res@right-4}{\pgf@circ@res@down+1}} + \pgf@circ@draworfill + \endpgfscope +} + + + + + + +%% Lamp + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/lamp/height}} +{lamp} +{\ctikzvalof{bipoles/lamp/height}} +{\ctikzvalof{bipoles/lamp/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% bulb +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/bulb/height}} +{bulb} +{\ctikzvalof{bipoles/bulb/height}} +{\ctikzvalof{bipoles/bulb/width}} +{% + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + +% transmission line + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/tline/height}} +{tline} +{\ctikzvalof{bipoles/tline/height}} +{\ctikzvalof{bipoles/tline/width}} +{ + \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis + \begin{pgftransparencygroup} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} + \pgf@circ@draworfill + \end{pgftransparencygroup} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{stroke} +} + +% microstrip transmission line + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/mstline/height}} +{mstline} +{\ctikzvalof{bipoles/mstline/height}} +{\ctikzvalof{bipoles/mstline/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill +} +%% SQUID added by Cor Molenaar 5 March 2010 + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/squid/height}} +{squid} +{\ctikzvalof{bipoles/squid/height}} +{\ctikzvalof{bipoles/squid/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}} + + \pgfusepath{draw} +} + + + +% Generic barrier added by Cor Molenaar 5 March 2010 + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/barrier/height}} +{barrier} +{\ctikzvalof{bipoles/barrier/height}} +{\ctikzvalof{bipoles/barrier/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + + \pgfusepath{draw} +} + + +% Contributed by Danilo Piazzalunga + +\pgfdeclareshape{buffer} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfscope + \pgfsetlinewidth{2\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + } +} + + + + + +\pgfdeclareshape{plain amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgfsetlinewidth{2\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + + + + + } +} + + +%% Draw the two-port fillable box +\def\pgf@circ@twoportbox{ + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope +} + +%% Generic two port box +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/twoport/height}} +{twoport} +{\ctikzvalof{bipoles/twoport/height}} +{\ctikzvalof{bipoles/twoport/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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 +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vco/width}} +{vco} +{\ctikzvalof{bipoles/twoport/width}} +{\ctikzvalof{bipoles/vco/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw circle + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} + \pgf@circ@draworfill + \endpgfscope + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + +} + +%% bandpass filter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/bandpass/width}} +{bandpass} +{\ctikzvalof{bipoles/bandpass/width}} +{\ctikzvalof{bipoles/bandpass/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandstop filter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/bandstop/width}} +{bandstop} +{\ctikzvalof{bipoles/bandstop/width}} +{\ctikzvalof{bipoles/bandstop/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% highpass filter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/highpass/width}} +{highpass} +{\ctikzvalof{bipoles/highpass/width}} +{\ctikzvalof{bipoles/highpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% lowpass filter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/lowpass/width}} +{lowpass} +{\ctikzvalof{bipoles/lowpass/width}} +{\ctikzvalof{bipoles/lowpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% ADC +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/adc/width}} +{adc} +{\ctikzvalof{bipoles/adc/width}} +{\ctikzvalof{bipoles/adc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{A} + \def\textii{D} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DAC +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/dac/width}} +{dac} +{\ctikzvalof{bipoles/dac/width}} +{\ctikzvalof{bipoles/dac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{D} + \def\textii{A} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DSP +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/dsp/width}} +{dsp} +{\ctikzvalof{bipoles/dsp/width}} +{\ctikzvalof{bipoles/dsp/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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 +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/fft/width}} +{fft} +{\ctikzvalof{bipoles/fft/width}} +{\ctikzvalof{bipoles/fft/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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 +\pgfcircdeclarebipole +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{amp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgf@circ@draworfill + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} +} + + +%% variable amplifier +\pgfcircdeclarebipole +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{vamp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + + % draw arrow + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% pi attenuator +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/piattenuator/width}} +{piattenuator} +{\ctikzvalof{bipoles/piattenuator/width}} +{\ctikzvalof{bipoles/piattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable pi attenuator +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{vpiattenuator} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% T attenuator +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/tattenuator/width}} +{tattenuator} +{\ctikzvalof{bipoles/tattenuator/width}} +{\ctikzvalof{bipoles/tattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable T attenuator +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/vtattenuator/width}} +{vtattenuator} +{\ctikzvalof{bipoles/vtattenuator/width}} +{\ctikzvalof{bipoles/vtattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% phase shifter +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{phaseshifter} +{\ctikzvalof{bipoles/phaseshifter/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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 +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{vphaseshifter} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@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@circ@res@left}{0.65\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% detector +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/detector/width}} +{detector} +{\ctikzvalof{bipoles/detector/width}} +{\ctikzvalof{bipoles/detector/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@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@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \ifpgf@circuit@fulldiode + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} + \else + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} + \fi + +} + + + + +%% european gas filled surge arrester + +\pgfcircdeclarebipole +{} +{\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}} +{ + + %\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + %\divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@draworfill + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{draw} + + \endpgfscope +} + + + + +%% american gas filled surge arrester + +\pgfcircdeclarebipole +{} +{\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@circ@res@left}{\pgf@circ@res@zero}} + \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latex} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope{} + + \pgfcircle{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/size}\pgf@circ@res@down} + \pgfusepath{fill} +} + +% % MECHANICAL SYMBOLS + +%% mechanical capacitance - stiffness/spring + +\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/spring/height}}{spring}{\ctikzvalof{bipoles/spring/height}}{\ctikzvalof{bipoles/spring/width}}{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% mechanical inductance - mass +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/mass/box height}} +{mass} +{\ctikzvalof{bipoles/mass/height}} +{\ctikzvalof{bipoles/mass/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} +} + +%% mechanical resistor - damper +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/damper/height}} +{damper} +{\ctikzvalof{bipoles/damper/height}} +{\ctikzvalof{bipoles/damper/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill + + % line into the damper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {\pgf@circ@res@zero}} + \pgfusepath{stroke} + + % damper box + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} + +} +%% mechanical viscoelastic element, suggested by @alex +%% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz +\pgfcircdeclarebipole +{} % 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@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill + + % spring into the damper + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}} + \pgfusepath{stroke} + \endpgfscope + % damper box + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} + +} + + +\pgfcircdeclarebipole +{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + }% +} +{\ctikzvalof{bipoles/resistivesens/height}} +{resistivesens} +{\ctikzvalof{bipoles/resistivesens/height}} +{\ctikzvalof{bipoles/resistivesens/width}} +{% + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% crossing bipole (but see also nodes) +\pgfcircdeclarebipole + {} + {\ctikzvalof{bipoles/crossing/size}} + {crossing} + {\ctikzvalof{bipoles/crossing/size}} + {\ctikzvalof{bipoles/crossing/size}}{ + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope + } + +%% loudspeaker and microphone + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/loudspeaker/depth}} +{loudspeaker} +{\ctikzvalof{bipoles/loudspeaker/height}} +{\ctikzvalof{bipoles/loudspeaker/width}}{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}} + \pgfpathclose + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill +} + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/mic/depth}} +{mic} +{\ctikzvalof{bipoles/mic/height}} +{\ctikzvalof{bipoles/mic/width}}{ + + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}} + % 0.25358 is 0.6-0.4*cos(30) + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + + \pgfusepath{draw} + \endpgfscope +} + +% generic round meter with always horizontal text, no arrow +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/esource/height}} +{rmeter} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + % draw the text label + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgftransformrotate{\rot} + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% generic round meter with always horizontal text, with arrow +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/esource/height}} +{rmeterwa} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + % draw the text label + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/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@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next open a circle into it + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@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@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% generic square meter with always horizontal text +\pgfcircdeclarebipole +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/smeter/height}} +{smeter} +{\ctikzvalof{bipoles/smeter/height}} +{\ctikzvalof{bipoles/smeter/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % 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@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% probles qucs style: +% #1 : name +% #2 : extra code +\long\def\pgfcirc@qucsprobe#1#2{ + \pgfcircdeclarebipole + { + \anchor{v+}{\southwest\pgf@x=0.6\pgf@x} + \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + } + {\ctikzvalof{bipoles/qmeter/depth}} + {#1} + {\ctikzvalof{bipoles/qmeter/height}} + {\ctikzvalof{bipoles/qmeter/width}} + { + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + \def\@starta{103}\def\@stopa{77} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfscope + \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgf@circ@draworfill + \endpgfscope + #2 + \endpgfscope + } +} + +\pgfcirc@qucsprobe{qiprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} +} + +\pgfcirc@qucsprobe{qvprobe}{ + \pgfmathsetlength{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfusepath{draw} + \pgfscope + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope +} + +\pgfcirc@qucsprobe{qpprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} + \pgfmathsetlength{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope +} + + +% current loop for oscope and similar: stylized + +\pgfcircdeclarebipole +{ + \anchor{i}{\northeast\pgf@x=0pt\relax} + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % external ellipse + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathellipse{\pgfpointorigin}{ + \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ + \pgfpoint{0.4\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +% current loop for oscope and similar: real (double connection) + +\pgfcircdeclarebipole +{ + \anchor{i+}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{i-}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop2} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + % must be the same than internal i+ and i- anchors definition + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} + \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % external ellipse + \pgfscope + \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathmoveto{\@plus} + \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + % I use ...left and ---right as temporal lengths here to avoid defining more + \pgfextractx{\pgf@circ@res@left}{\@plus} + \pgfextractx{\pgf@circ@res@right}{\@minus} + \pgfpathmoveto{\@plus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\@minus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +% end of pgfcircbipoles.tex +%%%---------- close: tex/pgfcircbipoles +%%%%%%%%%%% Springe nach tex/pgfcirctripoles +%%%---------- open: tex/pgfcirctripoles.tex +% Copyright 2007-2009 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 + +\pgfdeclareshape{spdt}{ + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out 1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{out 2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/margin}\pgf@circ@res@left + + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} + \endpgfscope + + + \pgfscope + \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} + {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} + } + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\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} + { + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/width}\pgf@circ@Rlen + \pgf@x=.25\pgf@x + } + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@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@y=0pt} + \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x } + \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius} + \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius} + \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y } + + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + % terminals + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + + } + } +} + +\pgfcircdeclarecutespdt{cute spdt up} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt mid} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{} + +\pgfcircdeclarecutespdt{cute spdt down} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt up arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} + \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt mid arrow} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} + \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt down arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} + \pgfpatharc{-50}{70}{1.5\pgf@circ@res@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@users.noreply.github.com> +%% + +\newcount\pgf@circ@res@count% reserve global register + +\def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter +{% + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@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@circ@logicport@baseinput#1#2#3% +{% + % and and nand + \ifnum #2=1\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@left + \fi + % or and nor + \ifnum #2=2\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/angle}}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgf@y + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgf@x=\pgf@circ@res@other + \fi + % xor and xnor + \ifnum #2=3\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@circ@res@temp=\pgf@y + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgf@x=\pgf@circ@res@other + \fi + % european + \ifnum #2=4\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@other}{\left}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgf@circ@res@other + \fi +}% + +%%% american +\long\def\pgfcircdeclarelogicport#1#2#3{% + \pgfdeclareshape{american #1 port}% + {% + \savedmacro\resize{% automatic + \pgf@circ@res@up = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/height}\pgf@circ@Rlen + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgf@circ@res@down = -\pgf@circ@res@up + \pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/width}\pgf@circ@Rlen + \pgf@circ@res@right = .5\pgf@circ@res@right + \pgf@circ@res@left = -\pgf@circ@res@right + }% + \savedmacro\inputs{% get number of inputs + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% + \ifnum\pgf@circ@res@count=0 + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/inputs}\relax% + \fi + \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi + \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi + \def\inputs{\the\pgf@circ@res@count}% + }% + \savedanchor\step{% 1/2 gap at edges + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/height}\pgf@circ@Rlen + \divide\pgf@circ@res@step by \pgf@circ@res@count + \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% + }% + \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \savedanchor\left{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} + \savedanchor\right{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} + \savedanchor\origin{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/origin}\pgf@circ@res@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@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{% + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@circ@res@count% + \else% + %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above + }% + %}{}% + \repeatpgfmathloop% + } + + \anchor{out}{\northeast\pgf@y=0pt} + \anchor{bout}{\right\pgf@y=0pt} + + + \anchor{left}{\left}% edges of component mius leads + \anchor{right}{\right} + + \anchor{north east}{\northeast}% see \Compass macro + \anchor{south west}{\southwest} + \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfpoint{0cm}{\pgf@circ@res@up}} + \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{0cm}} + \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfpoint{0cm}{\pgf@circ@res@down}} + \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{0cm}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + #3 + } +} +} +%%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{and}{1}{ + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@left + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up} + \pgfpathclose + \pgf@circ@draworfill + } +%%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfcircdeclarelogicport{nand}{1}{ + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up} + \pgfpathclose + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgf@circ@draworfill +} +%%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{nor}{2}{ + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/angle}}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/port width}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/angle}}% + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/circle width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + \advance\pgf@circ@res@other by -\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgf@circ@draworfill +} +%%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{or}{2}{ + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/angle}}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/port width}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/angle}}% + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + + \pgf@circ@draworfill +} +%%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{xor}{3}{ + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/port width}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/angle}}% + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + \pgf@circ@draworfill + + \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% + + \pgfusepath{draw} +} +%%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{xnor}{3}{ + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/angle}}% + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/circle width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + \advance\pgf@circ@res@other by -\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + \pgf@circ@draworfill + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@left + \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% + + \pgfusepath{draw} +} + +%%% Original one-input ports + +\pgfdeclareshape{american not port}{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \left + \pgf@x=-.8\pgf@x + } + \anchor{west}{ + \left + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgf@circ@draworfill + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + } +} + +\pgfdeclareshape{invschmitt}{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \left + \pgf@x=-.8\pgf@x + } + \anchor{west}{ + \left + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + %draw inner shape + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} + +\pgfdeclareshape{schmitt}{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \left + \pgf@x=-.8\pgf@x + } + \anchor{west}{ + \left + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + %draw inner shape + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} + + +%%% start european logic ports, from John Kormylo +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% + +% #1 - name +% #2 - text inside +% #3 - number of inputs +% #4 = is it a not? + +\long\def\pgfcircdeclareeurologicport#1#2#3#4{ + \pgfdeclareshape{european #1 port} + { + \savedmacro\resize{% automatic + \pgf@circ@res@up = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/height}\pgf@circ@Rlen + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgf@circ@res@down = -\pgf@circ@res@up + \pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/width}\pgf@circ@Rlen + \pgf@circ@res@right = .5\pgf@circ@res@right + \pgf@circ@res@left = -\pgf@circ@res@right + }% + \savedmacro\inputs{% get number of inputs + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% + \ifnum\pgf@circ@res@count=0 + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/inputs}\relax% + \fi + \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi + \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi + \def\inputs{\the\pgf@circ@res@count}% + }% + \savedanchor\step{% 1/2 gap at edges + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/height}\pgf@circ@Rlen + \divide\pgf@circ@res@step by #3 + \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% + }% + \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}% + \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}% + \savedanchor\left{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \savedanchor\right{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% + \savedanchor\origin{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/origin}\pgf@circ@res@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}{\pgfpoint{\pgf@circ@res@left}{0pt}}% or \step + \else + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{% + \pgfmathloop% + \ifnum\pgfmathcounter>#3% + \else% + %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant + \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above + }% + %}{}% + \repeatpgfmathloop% + } + \fi + \anchor{out}{\northeast\pgf@y=0pt} + \anchor{bout}{\right\pgf@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@circ@res@up}{\northeast}% + \pgfpoint{0cm}{\pgf@circ@res@up}} + \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{0cm}} + \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfpoint{0cm}{\pgf@circ@res@down}} + \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{0cm}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfpathrectanglecorners + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + \ifnum#3=1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \else + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + %\pgf@circ@res@count = #3\relax% redundant + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{% + \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} + % + \edef\pgf@temp{not} + \edef\pgf@circ@temp{#4} + \ifx\pgf@temp\pgf@circ@temp % is a not + \pgfpathmoveto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/not height}\pgf@circ@res@up}} + \fi + % + \pgfusepath{draw} + % + \pgfpathmoveto{\pgfpointorigin} + \pgftext{#2} + % + % + % + } + } +} +\pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{not}{$1$}{1}{not} +\pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} + +%% end european logic ports + +\long\def\pgfcircdeclaretransistor#1#2#3{ + \pgfdeclareshape{#1} + { + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northeast{% upper right + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=0pt + } + \savedanchor\left{%center left + \pgf@y=0pt + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/width}\pgf@circ@Rlen + } + \anchor{text}{ + \northeast + \pgf@y=.7\pgf@y + \pgf@x= \pgf@circ@Rlen + \pgf@x=0.1\pgf@x + } + \anchor{pathstart}{ % south + \northeast + \pgf@y=-\pgf@y + } + \anchor{pathend}{ + \northeast + } + \anchor{north}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=\pgf@circ@res@step + \pgf@x=.5\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \northeast + \pgf@y=0pt + } + \anchor{south}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=-\pgf@circ@res@step + \pgf@x=.5\pgf@x + } + \anchor{south west}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=-\pgf@circ@res@step + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=\pgf@circ@res@step + } + \anchor{south east}{ + \northeast + \pgf@y=-\pgf@y + } + \anchor{B}{ + \northeast + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{base}{ + \northeast + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{G}{ + \northeast + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{gate}{ + \northeast + \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{nobase}{ + \left + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@x + } + \anchor{nogate}{ + \left + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@x + } + \anchor{E}{ + \northeast + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{emitter}{ + \northeast + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{C}{ + \northeast + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{collector}{ + \northeast + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{S}{ + \northeast + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{source}{ + \northeast + \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{D}{ + \northeast + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + \anchor{drain}{ + \northeast + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + } + #2 + \backgroundpath{ + \pgftransformationadjustments + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % + \ifnum \pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction} > 0 + \pgf@circuit@trans@ntypetrue + \else + \pgf@circuit@trans@ntypefalse + \fi + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = \pgf@x + \left + \pgf@circ@res@left = \pgf@x + % + #3 + % BODY DIODE + \ifpgf@circuit@fet@bodydiode + \drawbodydiode{#1} + \fi + % + } +} +} + +\long\def\drawbodydiode#1{ + \pgfscope + \pgftransformshift{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgftransformrotate{90} + \pgftransformscale{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode scale}} + \ifpgf@circuit@fulldiode + \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} + \else + \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} + \fi + \endpgfscope + % Draw stroke line + \ifpgf@circuit@strokediode + \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} + \pgfusepath{stroke} + \fi + %Draw upper connection to body diode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgftransformscale{0.5} + \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} + \endpgfscope{} + %Draw lower connection to body diode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgftransformscale{0.5} + \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} + \endpgfscope +} + +\long\def\declarebpt#1{ + \pgfcircdeclaretransistor{#1}{}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + %draw arrow depending on type of transistor + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@ntype + \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/arrow pos}}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/arrow pos}}{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \fi + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \ifpgf@circuit@bpt@drawphoto + \pgfscope + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointadd{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpointadd{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} + \pgfusepath{draw} + \endpgfscope + \else + \ifpgf@circuit@bpt@drawbase + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + \fi + } +} + +\declarebpt{npn} +\declarebpt{pnp} + +\long\def\declareigbt#1{ + \pgfcircdeclaretransistor{#1}{} + { + %draw upper connection + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + %draw thicker gate lines + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + %draw lower connection + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + %draw arrow depending on type of transiytor + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@ntype + \pgftransformlineattime{.5}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{.5}{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@up}% + } + \fi + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + %draw gate + \ifpgf@circuit@trans@ntype + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@up}} + \fi + \pgfusepath{draw} + } +} + +\declareigbt{pigbt} +\declareigbt{nigbt} +\declareigbt{Lnigbt} +\declareigbt{Lpigbt} + + +\pgfcircdeclaretransistor{nmos}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + \ifpgf@circuit@mos@arrows + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/arrow pos}}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \fi + + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi +} + + +\pgfcircdeclaretransistor{pmos}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + \ifpgf@circuit@mos@arrows + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/arrow pos}}{% + \pgfpoint% + {\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \fi + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + + + \pgfusepath{draw} + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + \ifpgf@circuit@pmos@nocircle\else + \pgfpathcircle{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left - \pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + {\pgf@circ@res@up+\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + \ifpgf@circuit@pmos@emptycircle + \pgfsetfillcolor{white} + \fi + \pgfusepath{draw,fill} + \fi +} + +%% HEMT FET Transistor +\pgfcircdeclaretransistor{hemt}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} +} + +\long\def\drawfetcore#1{ + \pgftransformationadjustments + %top connection + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + \ifpgf@circuit@trans@depletiontype + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + \else + + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up*0.45}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up*0.25}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down*0.25}} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nfet/base height}\pgf@circ@res@down*0.45}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + \fi + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + %Bulk connection line + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + + %bottom connection + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + %draw thick gate line + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + + \pgftransformlineattime{.6}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + }{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + } + \ifpgf@circuit@trans@ntype + \else + \pgftransformrotate{180} + \fi + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} +\endpgfscope + +% GATE CONNECTION +\ifpgf@circuit@bpt@drawgate + \ifpgf@circuit@trans@ntype + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} + {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +\fi + +} + +\long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3 +{\pgfcircdeclaretransistor{#1}{ + \anchor{bulk}{\left\pgf@x=0pt} + \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt + #2 + } + {#3} +} + + +\pgfdeclaretransistorwrapperaddbulk{nfet}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nfet} +} + + +\pgfdeclaretransistorwrapperaddbulk{pfet}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pfet} +} + +% N-CHANNEL IGFET ENHANCEMENT TYPE +\pgfdeclaretransistorwrapperaddbulk{nigfete}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nigfete} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} +\fi +} + + + + +% N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector +\pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nigfetebulk} + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + + + +% N-CHANNEL IGFET DEPLETION TYPE +\pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{nigfetd} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +% P-CHANNEL IGFET ENHANCEMENT TYPE +\pgfdeclaretransistorwrapperaddbulk{pigfete}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pigfete} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/pigfete/gate height}\pgf@circ@res@up}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope + \fi +} + +% P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector +\pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pigfetebulk} +} + + +% P-CHANNEL IGFET DEPLETION TYPE +\pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{pigfetd} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@up}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +\pgfcircdeclaretransistor{njfet}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{.6}{% + \pgfpoint{\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfusepath{draw} +} + + +\pgfcircdeclaretransistor{pjfet}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{.4}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + }{% + \pgfpoint{\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} +} + + +\pgfdeclaretransistorwrapperaddbulk{isfet}{}{% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + % DRAIN CONNECTION + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@up}} + % DRAIN + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + % GATE, DEPLETION TYPE + \pgfscope %% added + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} %% added + \pgfusepath{draw} %% added + \endpgfscope %% added + + % BULK + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + + % SOURCE + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@down}} + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi + % ARROW + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{.6}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + }{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfusepath{draw} + + % Wavy lines + \pgfscope + \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave width}\pgf@circ@res@up}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + + +%% Black thyristor + +\pgfcircdeclarebipole{ + \anchor{gate}{ + \northeast + } + \anchor{anode}{ + \southwest + \pgf@y=0cm + } + \anchor{G}{ + \northeast + } + \anchor{cathode}{ + \northeast + \pgf@y=0cm + } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{fullthyristor}{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Empty thyristor + +\pgfcircdeclarebipole{ + \anchor{gate}{ + \northeast + } + \anchor{anode}{ + \southwest + \pgf@y=0cm + } + \anchor{G}{ + \northeast + } + \anchor{cathode}{ + \northeast + \pgf@y=0cm + } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{emptythyristor}{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Empty triac + +\pgfcircdeclarebipole{ + \anchor{gate}{ + \northeast + } + \anchor{G}{ + \northeast + } + \anchor{anode}{ + \southwest + \pgf@y=0cm + } + \anchor{cathode}{ + \northeast + \pgf@y=0cm + } +} +{\ctikzvalof{tripoles/triac/height}} +{emptytriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Full triac + +\pgfcircdeclarebipole{ + \anchor{gate}{ + \northeast + } + \anchor{G}{ + \northeast + } + \anchor{anode}{ + \southwest + \pgf@y=0cm + } + \anchor{cathode}{ + \northeast + \pgf@y=0cm + } +} +{\ctikzvalof{tripoles/triac/height}} +{fulltriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +\pgfcircdeclarebipole{ + \anchor{out 1}{ + \northeast + \pgf@y=0cm + } + \anchor{out 2}{ + \northeast + \pgf@y=.8\pgf@y + } +} +{\ctikzvalof{tripoles/toggleswitch/height 2}} +{toggleswitch} +{\ctikzvalof{tripoles/toggleswitch/height}} +{\ctikzvalof{tripoles/toggleswitch/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} + \pgfusepath{draw} + + + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetdash{}{0cm} +} + +%% operational and instrumentation amplifiers + +\pgfdeclareshape{op amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfsetrectcap + \pgfusepath{draw} + + + } +} + +%op amp shape as in european standard en 60617 +\pgfdeclareshape{en amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + { + \left + \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgfsetlinewidth{\ctikzvalof{tripoles/thickness}\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfsetrectcap + \pgfusepath{draw} + + + \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}} + % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$} + } +} + +%%Transkonduktanzverstärker +\pgfdeclareshape{gm amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{\northwest + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + \pgfpoint{-.5\wd\pgfnodeparttextbox+.25\pgf@x}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + %Umrandung: + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0}} %geändert startpunkt neu am ausgangsstrich + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}%vom Ausgang nach oben + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}%ecke links unten nach rechts unten + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{0pt}} % + \pgfsetrectcap + \pgfusepath{draw} + + } +} + +%% instrumentation amplifier + +\pgfdeclareshape{inst amp} +{ + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@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{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/refv pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@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@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % main component, normally in thicker lines + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % input terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % input terminal + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + % output lead + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% instrumentation amplifier, with terminals for gain resistance between inputs +\pgfdeclareshape{inst amp ra} +{ + \anchor{center}{\pgfpointorigin} + % bounding-box top left + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + % inputs (+-) + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@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{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{ra up}{ + \inOneFixed + } + \anchor{ra down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\raOne{% + \pgf@y=\pgf@circ@Rlen + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{ra-}{ + \raOne + } + \anchor{ra+}{ + \raOne + \pgf@y=-\pgf@y + } + % power supplies + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.4\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \pgf@y=0.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen + \pgf@x=0.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/refv pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.4\pgf@circ@res@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@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % drawing of the component + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + % main component, normally in thicker lines + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + %primer punto: la linea de salida (lado componente) + \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} + %from the exit to the top (short side)... (note that the .4 must be copied in \up anchor + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.4\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.4\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % ra terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % ra terminal + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % input terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % input terminal + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + % output lead + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} + } +} +%% Potentiometer +\pgfcircdeclarebipole{ + \anchor{wiper}{ + \northeast + \pgfpoint{0pt}{\pgf@y} + } + \anchor{W}{ + \northeast + \pgfpoint{0pt}{\pgf@y} + } +} +{\ctikzvalof{bipoles/potentiometer/height 2}} +{potentiometer}{\ctikzvalof{bipoles/potentiometer/height}} +{\ctikzvalof{bipoles/potentiometer/width}} +{ + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} + + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + + + +%% Generic tunable + +\pgfcircdeclarebipole{ + \anchor{wiper}{ + \northeast + \pgfpoint{0pt}{\pgf@y} + } +} +{\ctikzvalof{bipoles/generic potentiometer/height 2}} +{genericpotentiometer} +{\ctikzvalof{bipoles/generic potentiometer/height}} +{\ctikzvalof{bipoles/generic potentiometer/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + +\pgfdeclareshape{mixer} +{ + \savedanchor\northwest{ + \ifpgf@circuit@boxed + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/mixer/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/mixer/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{adder} +{ + \savedanchor\northwest{ + \ifpgf@circuit@boxed + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/adder/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/adder/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{oscillator} +{ + \savedanchor\northwest{ + \ifpgf@circuit@boxed + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \else + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/oscillator/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/oscillator/width}\pgf@circ@Rlen + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{north}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y} + \anchor{north east}{ \northwest \pgf@x=0pt\relax} + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{text}{ + \pgf@x=-2\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@Rlen{} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east" + + % draw outer box + \ifpgf@circuit@boxed{} + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@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@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{circulator} +{ + \savedanchor\northwest{ + \ifpgf@circuit@boxed + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/circulator/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/circulator/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{3}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed{} + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % inner arrow + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}} + \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + + +% Wilkinson divider +\pgfdeclareshape{wilkinson}{ + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/wilkinson/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/wilkinson/width}\pgf@x + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{out2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@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@circ@res@right}{0pt}} + \pgftransformrotate{90} + + % calculate size of resistor + \ifpgf@circuit@europeanresistor + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{genericshape}{center}{}{pgf@generic}{\pgfusepath{fill}} + \else + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{resistorshape}{center}{}{pgf@resistor}{\pgfusepath{fill}} + \fi + } + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +% electromechanical device (motor/generator) +\pgfdeclareshape{elmech} +{ + \savedanchor\northwest{ + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/elmech/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/elmech/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@Rlen + \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope % clip the bar: whole size minus the circle + \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgfseteorule + \pgfusepath{clip} + \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfsetfillcolor{black} + \pgfusepath{fill, draw} + \endpgfscope + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \ifx\tikz@fillcolor\pgfutil@empty + \pgfsetfillcolor{white} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfusepath{draw, fill} + \endpgfscope + } +} + +\pgfdeclareshape{magnetron} +{ + \savedanchor\northwest{ + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/magnetron/width}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/magnetron/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{anode}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{cathode1}{ + \northwest + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(105)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(105)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture + } + \anchor{cathode2}{ + \northwest + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(75)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(75)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@Rlen + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + %create outer circle + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right} + \pgf@circ@draworfill + %create chambers + \foreach \angle in {45,135,225,315}{ + \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}} + \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}} + } + \pgfsetroundcap + \pgfusepath{draw} + \pgfscope + %draw connection from outside + %anode + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}} + %cathodes + \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + %create cathode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + %create anode + \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + } +} + +% Electronic tubes, submitted by J. op den Brouw + +% Draw tube outline +\def\pgf@circ@tubes@drawtube{% + \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfutil@tempdima=\pgf@circ@res@right + \advance\pgfutil@tempdima by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} + \pgfpatharc{90}{-90}{\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} + \pgfpatharc{270}{90}{\pgf@circ@res@up} + \else + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} + \pgfutil@tempdima=\pgf@circ@res@up + \advance\pgfutil@tempdima by -\pgf@circ@res@right + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpatharc{180}{0}{\pgf@circ@res@right} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} + \pgfpatharc{180}{0}{-\pgf@circ@res@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}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen + % x and y should be half the Rlen + \pgf@y=\pgf@circ@res@up + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@circ@res@right + \pgf@x=.5\pgf@x + } + \anchor{north} {% + \northwest + \pgf@x=0pt + } + \anchor{east}{% + \northwest + \pgf@x=-\pgf@x + \pgf@y=0pt + } + \anchor{south}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{west}{% + \northwest + \pgf@y=0pt + } + \anchor{north west}{% + \northwest + } + \anchor{north east}{% + \northwest + \pgf@x=-\pgf@x + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{anode} {% + \northwest + \pgf@x=0pt + } + \anchor{cathode}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 1}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 2}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{filament 1}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + \anchor{filament 2}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=-\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + + % Extra anchors + #2 + + \backgroundpath{ + \pgfscope + % Line width for tripoles + \pgfsetlinewidth{\ctikzvalof{tripoles/thickness}\pgflinewidth} + + % Setup to draw tube + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen + \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up + \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + + % Tube fill color (if any) + \ifx\tikz@fillcolor\pgfutil@empty + \else + \pgfscope + \pgfsetfillcolor{\tikz@fillcolor} + \pgf@circ@tubes@drawtube + \pgfusepath{fill} + \endpgfscope + \fi + + % Tube outline + \pgf@circ@tubes@drawtube + + % Setup to draw grid, filament, anode and cathode + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen + \pgf@circ@res@up=0.5\pgf@circ@res@up + \pgf@circ@res@right=0.5\pgf@circ@res@right + + % Grid drawing + #3 + + % Filament (is not drawn by default) + \ifpgf@circuit@tubes@filament + \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up + \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@xa=\pgfmathresult\pgf@circ@res@right + \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} + \pgf@ya=\pgfmathresult\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@filamentfalse + \fi + + % Anode (or plate) + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north + \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + + % Cathode + \ifpgf@circuit@tubes@nocathode + \pgf@circuit@tubes@nocathodefalse + \else + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \ifpgf@circuit@tubes@fullcathode + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@fullcathodefalse + \else + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@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@y=\ctikzvalof{tubes/grid shift}\pgf@y + } + \anchor{control} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } +} +{ + % Grid protrusion + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{tetrode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \pgfutil@tempdima=0.5\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgfutil@tempdimb=0.5\pgfutil@tempdimb + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{pentode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } + \anchor{suppressor} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{pentode suppressor to cathode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \ifnum\pgf@circ@count@a>1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} + \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat + % Grid: connection from suppressor to cathode + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + +} + +%%%---------- close: tex/pgfcirctripoles +%%%%%%%%%%% Springe nach tex/pgfcircquadpoles +%%%---------- open: tex/pgfcircquadpoles.tex +% Copyright 2007-2009 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} + { + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=.5\pgf@circ@Rlen + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + } + \anchor{A2}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{B1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{A1}{ + \northwest + } + \anchor{B2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + %% notice for the dot anchors: I use the cute inductors as reference + %% size; if you change one you have to change all of them. + \anchor{inner dot A1}{ + \northwest + \pgfmathsetlength\pgf@x{\stretto*\pgf@x + + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} + } + \anchor{outer dot A1}{ + \northwest + \pgfmathsetlength\pgf@x{\stretto*\pgf@x - + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} + } + \anchor{inner dot A2}{ + \northwest + \pgfmathsetlength\pgf@x{\stretto*\pgf@x + + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} + } + \anchor{outer dot A2}{ + \northwest + \pgfmathsetlength\pgf@x{\stretto*\pgf@x - + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} + } + \anchor{inner dot B1}{ + \northwest + \pgfmathsetlength\pgf@x{-\stretto*\pgf@x - + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} + } + \anchor{outer dot B1}{ + \northwest + \pgfmathsetlength\pgf@x{-\stretto*\pgf@x + + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} + } + \anchor{inner dot B2}{ + \northwest + \pgfmathsetlength\pgf@x{-\stretto*\pgf@x - + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} + } + \anchor{outer dot B2}{ + \northwest + \pgfmathsetlength\pgf@x{-\stretto*\pgf@x + + \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} + \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{base}{ + \northwest + \pgf@x=0pt + } + #3 + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + #2 + } + } +} + + +\def\pgf@circ@drawtransformerbasicanchor{ + \pgfkeysvalueof{/tikz/circuitikz/quadpoles/trans/height} + \anchor{AA2}{ + \northwest + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + } + \anchor{BB1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + } + \anchor{AA1}{ + \northwest + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + } + \anchor{BB2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + } +} + +\def\pgf@circ@drawtransformerbasicbody{ + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@up}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@down}% + } + + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \fi% + \fi% + + + \endpgfscope + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@down}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@up}% + } + + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \fi% + \fi% + + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@inductor1}{b}} + + \pgfpathmoveto{\pgfpointanchor{pgf@inductor1}{a}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@inductor2}{a}} + + \pgfpathmoveto{\pgfpointanchor{pgf@inductor2}{b}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + +} + + +\pgfcircdeclarequadpole{transformer}{ + \pgf@circ@drawtransformerbasicbody +}{\pgf@circ@drawtransformerbasicanchor} + +\pgfcircdeclarequadpole{transformer core}{ + + \pgf@circ@drawtransformerbasicbody + + \pgfmoveto{\pgfpoint% + {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@right}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint + {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@right}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + \pgfmoveto{\pgfpoint% + {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@left}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint + {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@left}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgfusepath{draw} +}{\pgf@circ@drawtransformerbasicanchor} + + +\pgfcircdeclarequadpole{gyrator}{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{.7*\stretto\pgf@circ@res@down}} + \pgfpatharc{90}{270}{.7*\stretto\pgf@circ@res@down} + + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{.7*\stretto\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{.7*\stretto\pgf@circ@res@down} + \pgfusepath{draw} + +}{} + +%% four-port +% defines a general outer box for four-ports +% TikZ usage: +% \draw (0,0) node[coupler](coup){\SI{-3}{dB}} +% (coup.port1) to[short,-o] ++(-1,0) +% + +\long\def\pgfcircdeclarefourport#1#2{ + \pgfdeclareshape{#1}{ + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=.5\pgf@circ@Rlen + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{port1}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{port2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{port3}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{port4}{ + \northwest + \pgf@y=0.5\pgf@y + } + \anchor{1}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{3}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{4}{ + \northwest + \pgf@y=0.5\pgf@y + } + + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % draw inner stuff + #2 + + % draw inner text + \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + } + } +} + +% four-port +\pgfcircdeclarefourport{fourport}{} + + +% straight coupler +\pgfcircdeclarefourport{coupler}{ + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfsetarrows{latex-latex} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfsetarrows{latex-latex} + \pgfusepath{draw} +} + +% "bended" coupler +\pgfcircdeclarefourport{coupler2}{ + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}} + \pgfpatharc{180}{90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}} + \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope +} + +% contrib Kristofer M. Monisit + +\pgfdeclareshape{fd op amp} +{ + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\outline{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out up}{ + \northwest + \pgf@y=.5\pgf@y + \pgf@x=-.7\pgf@x + } + \anchor{out down}{ + \northwest + \pgf@y=-.5\pgf@y + \pgf@x=-.7\pgf@x + } + \anchor{out +}{ + \outline + \pgf@y=.5\pgf@y + \pgf@x=-.7\pgf@x + } + \anchor{out -}{ + \outline + \pgf@y=-.5\pgf@y + \pgf@x=-.7\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-.7\pgf@x + } + + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-.7\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-.7\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + % Triangle + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + + % Negative output terminal + \pgfpathmoveto{\pgfpoint + {0.7\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{0.3\pgf@circ@res@left}{.3\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@oplusup$-$\else$+$\fi} + + % Positive output terminal + \pgfpathmoveto{\pgfpoint + {0.7\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{0.3\pgf@circ@res@left}{.3\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@oplusup$+$\else$-$\fi} + + \pgfsetrectcap + % Draw them all! + \pgfusepath{draw} + + } +} + + +%% instrumentation amplifier diff output + +\pgfdeclareshape{fd inst amp} +{ + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@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{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/up pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/refv pos}}{ + \pgfpoint{ + \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@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@y=-\pgf@y + } + \savedanchor\outport{ + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{out}{ + \outport + \pgf@y=0pt + } + \anchor{out +}{ + \outport + } + \anchor{out -}{ + \outport + \pgf@y=-\pgf@y + } + \savedanchor\outportfixed{ + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen + \pgf@x=-.5\pgf@x + } + \anchor{out up}{ + \outportfixed + } + \anchor{out down}{ + \outportfixed + \pgf@y=-\pgf@y + } + % + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % main component, normally in thicker lines + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % input terminal up + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + + % input terminal down + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + % output leads down and up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} % + \pgftext[right, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} % + \pgftext[right, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi} + % + \pgfsetrectcap + \pgfusepath{draw} + } +} +%%%---------- close: tex/pgfcircquadpoles +%%%%%%%%%%% Springe nach tex/pgfcircmultipoles +%%%---------- open: tex/pgfcircmultipoles.tex +% Copyright 2007-2009 by Massimo Redaelli +% Copyright 2019 by Romano Giannetti +% +% 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 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% counters for pin accounting... +\def\pgf@circ@dip@pin@shift{0.5} +\def\pgf@circ@qfp@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\numpins{% + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins}% + \def\numpins{\the\pgf@circ@count@a} + } + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength\pgf@x{((\numpins) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}% + }% + \saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}}} + \saveddimen{\width}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}}} + \saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength\pgf@y{0.5*((\numpins) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}} + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}\pgf@circ@Rlen + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}\pgf@circ@Rlen + \pgfscope% (for the line width) + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/thickness}\pgflinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% + \pgf@circ@draworfill + %% upside mark + \ifpgf@circuit@chip@topmark + \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left} + \fi + \pgfusepath{stroke}% + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + % Adding the pin number + \ifpgf@circuit@chip@shownumbers + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@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@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + \def\mytext{\pgfkeysvalueof{/tikz/circuitikz/multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \fi + \endpgfscope + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \edef\padfrac{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pad fraction}} + \ifnum\padfrac>0 + \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac + % left side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % right side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \else + % left side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % right side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + \pgfusepath{stroke} + \endpgfscope + \fi + }% + % \pgf@sh@s@<name of the shape here> contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@dipchip{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins\relax + \pgfmathloop% + \ifnum\pgf@circ@count@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@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% + } + +% QFP (quad flat package) chips + +\pgfdeclareshape{qfpchip}{ + \savedmacro\numpins{% + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}% + \def\numpins{\the\pgf@circ@count@a} + } + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength\pgf@x{((\numpins+2) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + }% + \saveddimen\width{% + \pgfmathsetlength\pgf@x{((\numpins+2) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + }% + \saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}}} + \saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength\pgf@y{0.5*((\numpins+2) + *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + \pgf@x=-\pgf@y + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}\pgf@circ@Rlen + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}\pgf@circ@Rlen + \pgfscope% (for the line width) + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/thickness}\pgflinewidth} + %% upside mark + \ifpgf@circuit@chip@topmark + \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}} + \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@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@circ@draworfill + % Adding the pin number + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \ifpgf@circuit@chip@shownumbers + \pgf@circ@count@a=\numpins% + \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@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@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + \def\mytext{\pgfkeysvalueof{/tikz/circuitikz/multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \fi + \endpgfscope + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins% + \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \edef\padfrac{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pad fraction}} + \ifnum\padfrac>0 + \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac + % left side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % bottom side pads + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + % right side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % top side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \else + % left side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % bottom side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + % right side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % top side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \pgfusepath{stroke} + \endpgfscope + \fi + }% + % \pgf@sh@s@<name of the shape here> contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins% + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop% + }% + } + +%% anchors for DIP +\def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \c@pgf@countc=\numpins\relax + \divide\c@pgf@countc by 2 + \ifnum #1 > \the\c@pgf@countc + % right side + \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing} + \else + \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing} +\fi +} + +%% anchors for QFP +\def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \c@pgf@countc=\numpins\relax + \divide\c@pgf@countc by 4 + \ifnum #1 > \the\c@pgf@countc + \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2 + \ifnum #1 > \the\c@pgf@countb + \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3 + \ifnum #1 > \the\c@pgf@countb + % 3*npins/4 < pin, top side + \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@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@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}% + \fi + \else + % npins/4 < pin <= 2*npins/4, bottom side + \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}% + \fi + \else + % <= npins/4, left side + \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}% + \fi +} + + +%% Rotary Switch + +\pgfdeclareshape{rotaryswitch} +{ + \savedanchor\northeast{% + % 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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@Rlen + \pgf@circ@res@temp} + } + \savedanchor\northwest{% + % 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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp} + } + \savedanchor\central{% + % 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@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp} + } + % external square limits + \savedanchor\extnorthwest{% + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35) + \pgf@x=2.5\pgf@x % external square size + \pgf@y=-\pgf@x %square thing when angle=180? + } + \saveddimen{\width}{\pgfmathsetlength\pgf@x{0.3052*\pgf@circ@Rlen*\ctikzvalof{tripoles/spdt/width}}} + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@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@circ@res@temp=-\pgf@x + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)} + } + % center anchors + \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius} + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt} + \anchor{ain}{ \northwest \pgf@y=0pt} + + \anchor{center}{ \central \pgf@y=0pt } + \anchor{east}{ \northeast \pgf@y=0pt } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \central \pgf@y=-\pgf@y } + \anchor{north}{ \central } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northeast } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northeast \pgf@y=-\pgf@y } + + \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width} + \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width} + \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width} + \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width} + \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width} + \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width} + \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width} + \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width} + \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width} + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@res@right = \width + \pgf@circ@res@left = -\width + + \pgfscope %wiper + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + + \ifpgf@circ@rotaryarrow + \pgfscope % arrow + \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node + \pgftransformrotate{\wiper} + \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}} + \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right} + \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi + \pgfusepath{draw} + \endpgfscope + \fi + + % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa} + \pgf@circ@count@a=\channels\relax + \pgfmathsetmacro{\currenta}{-\angle} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right} + \pgfscope + \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}} + \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}} + \endpgfscope + \pgfmathsetmacro{\currenta}{\currenta+\stepa} + % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right} + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + + \pgfscope % input + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + } + % \pgf@sh@s@<name of the shape here> contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\channels\relax + \pgfmathloop% + \ifnum\pgf@circ@count@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@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +\def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer + \pgf@circ@res@temp=\width + \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} + \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius} + \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)} + \advance\pgf@x by -\pgf@circ@res@temp +} + +\def\pgf@circ@rotarysqanchor#1{% external square anchors + \pgf@circ@res@temp=\width + \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} + \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}} + \advance\pgf@x by -\pgf@circ@res@temp +} + +% Seven segments displays + +\pgfdeclareshape{bare7seg}{ + \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}} + \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness + \ifpgf@circ@sevenseg@dot + \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}} + \else + \pgf@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@x}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen}} + \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}} + \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}} + \savedanchor{\southwest}{% both negative + \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} + \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} + } + \savedanchor{\northeast}{% both positive + \ifpgf@circ@sevenseg@dot + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}} + \else + \pgf@circ@res@other=0pt + \fi + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}} + } + \savedanchor{\topright}{% anchor without the box sep and the thickness + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen} + } + \anchor{center}{\pgfpointorigin} + \anchor{north west}{\southwest\pgf@y=-\pgf@y} + \anchor{north east}{\northeast} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\southwest} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0pt} + \anchor{south}{\southwest\pgf@x=0pt} + \anchor{west}{\southwest\pgf@y=0pt} + \anchor{a}{\topright\pgf@x=0pt} + \anchor{b}{\topright\pgf@y=0.5\pgf@y} + \anchor{c}{\topright\pgf@y=-0.5\pgf@y} + \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y} + \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{g}{\pgfpointorigin} + \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace} + \behindbackgroundpath{% + \southwest % I do not want the dot here, it will stick out + \pgf@circ@res@up = -\pgf@y + \pgf@circ@res@down = \pgf@y + \pgf@circ@res@right = \pgf@x + \pgf@circ@res@left = -\pgf@x + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/thickness}\pgflinewidth} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfpathrectanglecorners% + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}} + \ifpgf@circ@sevenseg@box + \pgf@circ@draworfill + \else + \pgf@circ@maybefill + \fi + \endpgfscope + \edef\bits{\ctikzvalof{seven seg/bits}} + \pgfscope + \pfg@circ@sseg@drawbits{\bits} + \endpgfscope + \pgfscope + \ifpgf@circ@sevenseg@dot + \pgf@circ@sseg@drawdots + \fi + \endpgfscope + } +} + +\def\pgf@circ@sseg@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@circ@sseg@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@circ@sseg@drawbits#1{% #1 must be 7 bits + \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic... + \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}} + \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}} + % \pgfsetroundcap + \pgfsetarrowsstart{Triangle Cap[]} + \pgfsetarrowsend{Triangle Cap[]} + % segments + \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width} + \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap} + \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap} + \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width} + \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap} + \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap} + \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt} +} +\def\pgf@circ@sseg@drawdots{% dots + \edef\what{empty} + \ifx\what\pgf@circ@sevenseg@dotstate + % do nothing + \else + \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}} + \edef\what{off} + \ifx\what\pgf@circ@sevenseg@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@circ@res@other}{-\width}}{\pgf@circ@res@other} + \pgfusepath{draw,fill} + \fi +} +%%%---------- close: tex/pgfcircmultipoles + +%%%%%%%%%%% Springe nach tex/pgfcirclabel +%%%---------- open: tex/pgfcirclabel.tex +% Copyright 2007-2009 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 + +%% Options +\ctikzset{label/.style = { l=#1 } } +\ctikzset{l/.code = { + \pgfkeys{/tikz/circuitikz/bipole/label/name=#1} + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@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@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@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@circ@ls{.75ex} % labelspace to have just one point to change + +\def\pgf@circ@drawlabels#1{ + \pgfextra{ + % This function will be called with argument #1 equal + % to "label" or "annotation" form pgfcircpath.tex. + % pgf@circ@direction is the direction of the path, + % its value is set in pgfcircpath.tex + \pgfmathsubtract{\pgf@circ@direction}{90} + \pgfmathround{\pgfmathresult} % avoid precision loss errors + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}} + \ifnum \pgf@circ@temp < 0 + \pgfmathadd{\pgf@circ@labanc}{180} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc} + % + % normalize the angle values + % + \pgfmathmod{\pgf@circ@labanc}{360} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + % + \ifpgf@circuit@bipole@inverted + \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % + \ifnum \ctikzvalof{mirror value} = -1 + \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc} + } + %Firstly, place a coordinate directly at the edge of the shape + (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (labelcoor) + %now decide, which labels should be drawn + \pgfextra{ + \edef\pgf@temp{\ctikzvalof{label/align}} + \def\pgf@circ@temp{straight} + } + \ifx\pgf@temp\pgf@circ@temp %straight + \pgf@circ@drawreglabels{#1} + \else + \pgfextra{\def\pgf@circ@temp{rotate}} + \ifx\pgf@temp\pgf@circ@temp %rotate + \pgf@circ@drawrotlabels{#1} + \else% smart + \pgf@circ@drawsmartlabels{#1} + \fi + \fi +} + + +\def\pgf@circ@drawsmartlabels#1{ + \pgfextra{ + \pgfmathmod{\pgf@circ@direction}{90} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \ifnum \pgfcircmathresult > 20 + \ifnum \pgfcircmathresult < 70 + \pgf@circ@drawrotlabels{#1} + \else + \pgf@circ@drawreglabels{#1} + \fi + \else + \pgf@circ@drawreglabels{#1} + \fi + } + + +\def\pgf@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{\tmp}{\tmp}{\tmp}{\myscale}{\tmp}{\tmp} + \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@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@circ@res@temp=1.5\pgf@circ@res@temp + \fi + %Calculate rotation of the label from direction and strip decimals + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + % rotate the label at second or third quadrant: + \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270 + \pgfmathsubtract{\pgf@circ@direction}{180} + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + %invert the space relationships due to rotated strings + \ifnum \ctikzvalof{bipole/#1/position}>0 + \pgf@circ@res@temp=1.5\pgf@circ@res@temp + \fi + \fi\fi + \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90} + \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + % reset cm is not working correctly here + (labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(labelcoor) + node[anchor=mid, rotate=\pgfcirclabrot](\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}} +} + +\def\pgf@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{\tmp}{\tmp}{\tmp}{\myscale}{\tmp}{\tmp} + \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale} + \pgfmathadd{\pgf@circ@labanc}{90} + \pgfmathround{\pgfmathresult} + \def\pgf@circ@labanctext{\pgf@circ@labanc} + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + %Values around 90 are at both y-axis + \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96 + \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}} + \ifnum \pgf@circ@labpos > 180 + \ifnum \ctikzvalof{bipole/#1/position} > 0 + \pgfextra{\def\pgf@circ@labanctext{mid west}} + \else + \pgfextra{\def\pgf@circ@labanctext{mid east}} + \fi + \else + \ifnum \ctikzvalof{bipole/#1/position} > 0 + \pgfextra{\def\pgf@circ@labanctext{mid east}} + \else + \pgfextra{\def\pgf@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@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@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \pgfextra{\def\pgf@circ@labanctext{north}}%north + \fi + \else + \ifnum \pgf@circ@labanc < 90 + % shift, as above + (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \ifnum \pgf@circ@labanc > 180 + % this shouldn't happen, but somehow it does (270 degree anchors) + % shift, as above + (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \pgfextra{\def\pgf@circ@labanctext{north}}%north + \fi + \fi + \fi + \fi\fi + (labelcoor) node[anchor=\pgf@circ@labanctext, + inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, + ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}% + } +} + +\def\pgf@circ@finallabels#1{% + \edef\pgf@temp{}% + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}% + \ifx\pgf@temp\pgf@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@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@valign, l2 valign=c, + l2 halign/.store in=\ltwo@halign, l2 halign=l, +} +\ctikzset{l2base/.code n args={2}{ + \pgfkeys{/tikz/circuitikz/bipole/label/name=% + \bgroup + \setlength{\tabcolsep}{2pt}% + \def\ltwo@tabu{\tabular[\ltwo@valign]}% + \expandafter\ltwo@tabu\expandafter{\ltwo@halign}% + #1\\ #2% + \endtabular + \egroup + }% + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#2} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@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 2007-2009 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 + + +\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@circuit@bipole@isvoltage + \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above, + \circuitikzbasekey/bipole/voltage/direction=forward} + \else + \ifpgf@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@circ@oldvoltagedirection + \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries + \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below, + \circuitikzbasekey/bipole/voltage/direction=forward} + \fi\fi + \else + \ifpgf@circuit@bipole@iscurrent + \ifpgf@circuit@bipole@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@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp} + \else + \fi + \else + \fi + } +} + +% american voltage font selection and symbol definition +% the default font command is {} --- nothing +\def\pgf@circ@avfont{\ctikzvalof{voltage/american font}} +% +% plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex) +% notice that the double braces are needed to be able +% to use \boldmath in the font (although it is semi-deprecated...) +% +\def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}} +\def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}} + +%% Output routine for generic bipoles + +\def\pgf@circ@drawvoltagegeneric{ + \pgfextra{ + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance} + \pgfkeysifdefined{\pgf@temp} + { + \edef\partheight{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance}} + \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen)} + } + { + \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance} + { + \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}} + \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen)} + } + {%calculate default value from part height + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height} + \pgfkeysifdefined{\pgf@temp} + { + \edef\partheight{0.5*\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height}} + \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen+0.2\pgf@circ@Rlen)} + } + { + \edef\tmpdistfromline{(.5\pgf@circ@Rlen)} %fallback to fixed value + } + } + } + \ifnum \ctikzvalof{mirror value}=-1 + \ifpgf@circuit@bipole@inverted + \ifpgf@circuit@bipole@voltage@straight + \def\distfromline{\tmpdistfromline} + \else + \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \fi + \else + \ifpgf@circuit@bipole@voltage@straight + \def\distfromline{-\tmpdistfromline} + \else + \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \fi + \fi + \else + \ifpgf@circuit@bipole@inverted + \ifpgf@circuit@bipole@voltage@straight + \def\distfromline{-\tmpdistfromline} + \else + \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \fi + \else + \ifpgf@circuit@bipole@voltage@straight + \def\distfromline{\tmpdistfromline} + \else + \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \fi + \fi + \fi + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@voltage@angle{90} + \else + \def\pgf@circ@voltage@angle{-90} + \fi + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node} + \pgfkeysifdefined{\pgf@temp} + { \edef\distacefromnode{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node}} } + { \edef\distacefromnode{\ctikzvalof{voltage/distance from node}} } + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b} + \pgfkeysifdefined{\pgf@temp} + { \edef\bumpb{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b}} } + { \edef\bumpb{\ctikzvalof{voltage/bump b}} } + \edef\shiftv{\ctikzvalof{voltage/shift}} + \pgfmathsetmacro{\bumpb}{\bumpb + \shiftv} %% adjust the bump is shift + \ifpgf@circuit@bipole@inverted + \pgfmathsetmacro{\shiftv}{-\shiftv} + \fi + \ifnum \ctikzvalof{mirror value} = -1 + \pgfmathsetmacro{\shiftv}{-\shiftv} + \fi + } + % %\pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} is equal to the length of the currarrow + coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorstartnode)$) + + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$) + coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorendnode)$) + + coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$) + + \ifpgf@circuit@bipole@voltage@below + coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto) ! \shiftv!90 : (anchorendnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom) ! \shiftv!-90 : (anchorstartnode)$) + coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$) + coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$) + \else + coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto) ! -\shiftv!90 : (anchorendnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom) ! -\shiftv!-90 : (anchorstartnode)$) + coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$) + coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$) + \fi + + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@straight + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} + \else + (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} + \fi + \else + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vto) .. controls (pgfcirc@Vcont2) and (pgfcirc@Vcont1) .. + node[currarrow, sloped, allow upside down, pos=1] {} + (pgfcirc@Vfrom) + \else + (pgfcirc@Vfrom) .. controls (pgfcirc@Vcont1) and (pgfcirc@Vcont2) .. + node[currarrow, sloped, allow upside down, pos=1] {} + (pgfcirc@Vto) + \fi + \fi + \else + \ifpgf@circuit@bipole@voltage@backward + \ifpgf@circ@oldvoltagedirection + (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} + (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} + \else + (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} + (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} + \fi + \else + \ifpgf@circ@oldvoltagedirection + (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} + (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} + \else + (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} + (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} + \fi + \fi + \fi +} + +%% Output routine for voltage sources +\def\pgf@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 + \shiftv} + } + \ifpgf@circuit@bipole@voltage@below + coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$) + coordinate (pgfcirc@Vto) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$) + \else + coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$) + coordinate (pgfcirc@Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$) + \fi + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vfrom) + \else + (pgfcirc@Vfrom) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vto) + \fi + \else% american voltage + \ifpgf@circuit@bipole@voltageoutsideofsymbol + % if it is a battery, must put + and - + + \ifpgf@circ@fixbatteries + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + \else + (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + \fi + \else + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + \else + (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + \fi + \fi + \fi + \fi +} + +%% Output routine +\def\pgf@circ@drawvoltage{% node name + \pgfextra{ %WARNING: indentation is probably wrong + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north west} + \else + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{west} + \else + \def\pgf@circ@bipole@voltage@label@anchor{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south west} + \else \def\pgf@circ@bipole@voltage@label@anchor{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south} + \else\def\pgf@circ@bipole@voltage@label@anchor{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \else\def\pgf@circ@bipole@voltage@label@anchor{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{east} + \else \def\pgf@circ@bipole@voltage@label@anchor{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north east} + \else\def\pgf@circ@bipole@voltage@label@anchor{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi\fi + \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi\fi + + \ifnum \ctikzvalof{mirror value}=-1 + \ifpgf@circuit@bipole@voltage@below + \pgf@circuit@bipole@voltage@belowfalse + \else + \pgf@circuit@bipole@voltage@belowtrue + \fi + \fi + + \ifpgf@circuit@bipole@inverted + \ifpgf@circuit@bipole@voltage@below + \pgf@circuit@bipole@voltage@belowfalse + \else + + \pgf@circuit@bipole@voltage@belowtrue + \fi + \fi + + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@where{-90} + \else + \def\pgf@circ@bipole@voltage@label@where{90} + \fi + + + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance} + \pgfkeysifdefined{\pgf@temp} + { \edef\eudist{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance}} } + { \edef\eudist{\ctikzvalof{voltage/european label distance}} } + \edef\shiftv{\ctikzvalof{voltage/shift}} + % adjust the label distance to the shift. + \pgfmathsetmacro{\eudistplus}{\eudist+\shiftv} + + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + }%end pgfextra + + \ifpgf@circuit@bipole@isvoltage + \pgf@circ@drawvoltagegenerator + \else + \pgf@circ@drawvoltagegeneric + \fi + + % (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where) %Zeile sinnlos!? + \ifpgf@circuit@bipole@voltage@straight + coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] + at (Vlab) { \pgf@circ@finallabels{voltage/label} } + \else + coordinate (Vlab) at ($(\ctikzvalof{bipole/name}.center) ! + \ifpgf@circuit@europeanvoltage + \eudistplus + \else + \ctikzvalof{voltage/american label distance} + \fi ! + (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where)$) + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] at (Vlab) { \pgf@circ@finallabels{voltage/label} } + \fi +}%end drawvoltages +%%%---------- close: tex/pgfcircvoltage +%%%%%%%%%%% Springe nach tex/pgfcirccurrent +%%%---------- open: tex/pgfcirccurrent.tex +% Copyright 2007-2009 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 + +%% 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@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp} + \else + \fi + \else + \fi + %reverse current direction for voltage sources + \ifpgf@circ@oldvoltagedirection\else + \ifpgf@circuit@bipole@isvoltage + \ifpgf@circuit@bipole@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@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@circ@drawcurrent{ + \pgfextra{ + \edef\pgf@circ@ffffff{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@bipole@current@label@where{-90} + \else + \def\pgf@circ@bipole@current@label@where{+90} + \fi + } + + \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} + \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line + (\tikztostart)--(\tikztotarget) + \else% normal bipole or source + \ifpgf@circuit@bipole@current@before + (\tikztostart)--(anchorstartnode) + \else + (anchorendnode)--(\tikztotarget) + \fi + \fi + \ifpgf@circuit@bipole@current@backward + \pgfextra{ + \pgfmathsubtract{\pgf@circ@ffffff}{180} + \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \fi + coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf@circ@ffffff](Iarrow) + (Iarrow.\pgf@circ@bipole@current@label@where) node[anchor=\pgf@circ@dir]{\pgf@circ@finallabels{current/label}} +} + +%%%---------- close: tex/pgfcirccurrent +%%%%%%%%%%% Springe nach tex/pgfcircflow +%%%---------- open: tex/pgfcircflow.tex +% Copyright 2007-2009 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 + +%% 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@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +} +} + +%% Output routine +\def\pgf@circ@drawflow{ + \pgfextra{ + \edef\pgf@circ@ffffff{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@bipole@flow@label@where{-90} + \else + \def\pgf@circ@bipole@flow@label@where{+90} + \fi + } + + \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} + \ifx\pgf@circ@temp\pgf@temp%draw flow at a short at middle of the line + (\tikztostart)--(\tikztotarget) + \else% normal bipole or source + \ifpgf@circuit@bipole@flow@before + (\tikztostart)--(anchorstartnode) + \else + (anchorendnode)--(\tikztotarget) + \fi + \fi + \pgfextra{ + \ifpgf@circuit@bipole@flow@backward + \ifpgf@circuit@bipole@flow@below + \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \else + \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \fi + \pgfmathsubtract{\pgf@circ@ffffff}{180} + \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \else + \ifpgf@circuit@bipole@flow@below + \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \else + \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \fi + \fi + } + coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf@circ@ffffff,yshift=\flow@offset](Farrowpos) + (Farrowpos.\pgf@circ@bipole@flow@label@where) node[anchor=\pgf@circ@dir]{ \pgf@circ@finallabels{flow/label}} +} + +%%%---------- close: tex/pgfcircflow + +% notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning +\ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages,americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels} + +\ProcessOptions\relax + +%%%%%%%%%%% Springe nach tex/pgfcircpath +%%%---------- open: tex/pgfcircpath.tex + +\def\pgf@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@circuit@bipole@invertedtrue}} +\ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}} +\ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}} +\newif\ifpgf@circuit@bipole@inverted +\ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted} + +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@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@explicit@center@anchor#1{ + \pgfutil@ifundefined{pgf@sh@ns@#1} + { + %This coordinate is no node(but a relative position or a coordinate), no further handling needed + }{ + \pgfutil@in@.{#1} + \ifpgfutil@in@ + % Anchor is used, do nothing! + \else% + \let\tikz@moveto@waiting=\relax + \pgfpathmoveto{\tikz@last@position}%force movement, because tikz@moveto@waiting + \edef#1{#1.center}%ensure using center anchor + \fi +} +} + + +%% Generic bipole path +\def\pgf@circ@bipole@path#1#2{ + + \pgfextra{ + \set@explicit@center@anchor{\tikztostart} + \set@explicit@center@anchor{\tikztotarget} + \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates + \ctikzset{bipole/kind = #1} + \edef\pgf@temp{\ctikzvalof{bipole/name}} + \def\pgf@circ@temp{} + \ifx\pgf@temp\pgf@circ@temp % if it has not a name + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = #2\pgf@circ@rand} % create it + \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}} + \pgfmathround{\pgfmathresult} + \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path + \pgfsyssoftpath@setcurrentpath{\myp@th} + } + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \ifx\pgf@temp\pgf@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@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}] + (\ctikzvalof{bipole/name}) {} + \ifpgf@circuit@bipole@inverted + \ifcsname pgf@anchor@#1shape@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@anchor@#1shape@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@temp{open}\def\pgf@circ@temp{#1}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open + \else + (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode) + (anchorendnode) -- (\ctikzvalof{bipole/name}end.center) + \fi + + \drawpoles + \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi + \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi + \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi + \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi + \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \ifx\pgf@temp\pgf@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@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}} + \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi + \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} } + \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi +} + +%% Path definitions +\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi} +\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi} +\def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi} +\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi} +\def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}} +\def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}} +\def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}} +\def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}} +\def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} +\def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}} +\def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}} +\def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}} +\def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}} +\def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}} +\def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} +\def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}} +\def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}} +\def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} +\def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}} +\def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}} +\def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}} +\def\pgf@circ@inductor@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductor@path{#1}% + \else% + \pgf@circ@americaninductor@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@vinductor@path#1{ + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@veuropeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@vcuteinductor@path{#1}% + \else% + \pgf@circ@vamericaninductor@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@inductivesens@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductivesens@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductivesens@path{#1}% + \else% + \pgf@circ@americaninductivesens@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} +\def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}} +\def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}} +\def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}} +\def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}} +\def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}} +\def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}} +\def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}} +\def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}} +\def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}} +\def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}} +\def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}} +\def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}} +\def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}} +\def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}} +\def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}} +\def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}} +\def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}} +\def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}} +\def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}} +\def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} +\def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} +\def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} +\def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} +\def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}} +\def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}} +\def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}} +\def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}} +\def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}} +\def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}} +\def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}} +\def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}} +\def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}} +\def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}} +\def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}} +\def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}} +\def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}} +\def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}} +\def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} +\def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} +\def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}} +\def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}} +\def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}} +\def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}} +\def\pgf@circ@empty@path#1{} +\def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}} +\def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}} +\def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}} +\def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}} +\def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}} +\def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}} +\def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}} +\def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}} +\def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}} +\def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}} +\def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}} +\def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}} +\def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}} +\def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}} + +\def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} +\def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}} +\def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}} + +\def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}} +\def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}} +\def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}} +\def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}} +\def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}} +\def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}} +\def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}} +\def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}} +\def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}} +\def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}} +\def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}} +\def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}} +\def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}} +\def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}} +\def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}} +\def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}} +\def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}} +\def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}} +\def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}} + +%%Mechanical +\def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}} +\def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}} +\def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}} +\def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}} + +%% Styles + +\def\comnpatname{\ifpgf@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@circ@spring@path, l=#1}} +\compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}} +\compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}} +\compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}} +\compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}} +\compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}} +\compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}} +\compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}} +\compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}} +\compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}} +\compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}} +\compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}} +\compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} +\compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}} +\compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}} +\compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}} +\compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}} +\compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}} +\compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}} +\compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +\compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +\compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}} +\compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}} +\compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}} +\compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}} +\compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} +\compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}} +\compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}} +\compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} +\compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}} +\compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}} +\compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}} +\compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}} +\compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}} +\compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}} +\compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}} +\compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}} +\compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}} +\compattikzset{transmission line/.style = {tline = #1}} +\compattikzset{TL/.style = {tline = #1}} +\compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}} +\compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesquare@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcetri@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} + +\compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}} +\compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}} + + +\compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}} +\compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}} +\compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}} +\compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}} +\compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}} +\compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}} +\compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}} + +\compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}} +\compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}} + +\compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}} +\compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}} +\compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}} +\compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}} +\compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}} + +\compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}} +\compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}} +\compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}} +\compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}} +\compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}} +\compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}} +\compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}} +\compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}} +\compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}} +\compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}} +\compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}} +\compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}} +\compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}} +\compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}} +\compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}} +\compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}} +\compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}} +\compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}} +\compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}} + +% % % % % % +% % Begin of Diodes +% % % % % % + +\def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}} +\def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}} +\def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}} +\def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}} +\def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}} +\def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}} +\def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}} +\def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}} +\def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}} +\def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}} +\def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}} +\def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}} +\def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}} +\def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}} +\def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}} +\def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}} +\def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}} +\def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}} + +\compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}} +\compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}} +\compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}} +\compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}} +\compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}} +\compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}} +\compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}} +\compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}} +\compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}} +\compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}} +\compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}} + +\compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}} +\compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}} +\compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}} +\compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}} +\compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}} +\compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}} +\compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}} +\compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}} +\compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}} +\compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}} +\compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}} + +\compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}} +\compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}} +\compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}} +\compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}} +\compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}} +\compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}} +\compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}} +\compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}} +\compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}} +%\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}} + +\def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@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@circuit@fulldiode full \else empty \fi triac}}%no stroke triac! +\compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@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@circ@memristor@path}} +\compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} +\compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}} +\compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} +\compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} +\compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} +\compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} +\compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} +\compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} +\compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} +\compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}} + +\compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}} +\compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}} +\compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}} +\tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}} + +% cute switches +%% closed cute switch +\def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}} +\compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}} +\compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}} + +%% open cute switch +\def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}} +\compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}} +\compattikzset{cosw/.style= {\comnpatname cute open switch= #1}} + +%% closing cute switch +\def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}} +\compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}} +\compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}} + +%% opening cute switch +\def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}} +\compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}} +\compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}} + + +% short forms +\compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}} + +\compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}} +\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosource@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{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}} +\compattikzset{pC/.style = {\comnpatname polar 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@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@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@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@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@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} + +% cute sources +\def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}} +\compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceC@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@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}} +\compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@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@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}} +\compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceC@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@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}} +\compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@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@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}} +\compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceN@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@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}} +\compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@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@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}} +\compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}} +\compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} +\compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}} +\compattikzset{sR/.style= {\comnpatname resistive sensor= #1}} + +\compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}} +\compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}} + +\compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}} +\compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}} +\compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}} +\compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@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@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}} +\compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}} +\compattikzset{xing/.style= {\comnpatname crossing= #1}} + +%% loudspeaker and microphone + +\def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}} +\compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}} + +\def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}} +\compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}} + +% more instrument +\def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}} +\compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}} +\def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}} +\compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}} +\def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}} +\compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}} +% current loop probes +\def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}} +\compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}} +\def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}} +\compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}} +% qucs-style probes +\def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}} +\compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}} +\def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}} +\compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}} +\def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}} +\compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}} + + +% Transistor like bipoles + +\def\pgf@circ@trans@path#1#2{ + \pgfextra{ + \edef\pgf@temp{\pgfkeysvalueof{/tikz/circuitikz/bipole/name}} + \def\pgf@circ@temp{#2} + \ifx\pgf@temp\pgf@circ@temp % if it has not a name + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = trans\pgf@circ@rand} % create it + \fi + } + \ifpgf@circuit@bipole@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@circ@direction{\pgfmathresult} + } + ($(\tikztostart) ! .5 ! (\tikztotarget)$) + node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}] + (\ctikzvalof{bipole/name}) {} node {\ctikzvalof{bipole/label/name}} + \ifcsname pgf@anchor@#1@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 + \pgfextra{ + \pgfcircresetpath + } + (\tikztotarget) \tikztonodes % e si continua +} + + +\def\pgf@circ@definetranspath#1{ + \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}} +} + +\pgf@circ@definetranspath{elmech} +\pgf@circ@definetranspath{nmos} +\pgf@circ@definetranspath{pmos} +\pgf@circ@definetranspath{hemt} +\pgf@circ@definetranspath{npn} +\pgf@circ@definetranspath{pnp} +\pgf@circ@definetranspath{nfet} +\pgf@circ@definetranspath{nigfete} +\pgf@circ@definetranspath{nigfetd} +\pgf@circ@definetranspath{nigfetebulk} +\pgf@circ@definetranspath{pfet} +\pgf@circ@definetranspath{pigfete} +\pgf@circ@definetranspath{pigfetd} +\pgf@circ@definetranspath{pigfetebulk} +\pgf@circ@definetranspath{njfet} +\pgf@circ@definetranspath{pjfet} +\pgf@circ@definetranspath{pigbt} +\pgf@circ@definetranspath{nigbt} +\pgf@circ@definetranspath{Lpigbt} +\pgf@circ@definetranspath{Lnigbt} +%%%---------- close: tex/pgfcircpath + +\ifpgf@circ@siunitx + \RequirePackage{xstring}[2009/03/13] + %\expandafter\let\csname angstrom\endcsname\relax + \RequirePackage{siunitx} +\fi + +\ifpgf@circ@explicitvdir\else + \PackageWarningNoLine{circuitikz}{% + You did not specify one of the voltage directions:\MessageBreak + \space\space oldvoltagedirection, nooldvoltagedirection, \MessageBreak + \space\space RPvoltages or EFvoltages \MessageBreak + Default directions may have changed, \MessageBreak + please check the manual% + } +\fi + +\newenvironment{circuitikz}{\begin{tikzpicture}}{\end{tikzpicture}} +%override (unused) circuitikz environment for compability to externalization) +\let\circuitikz\tikzpicture +\let\endcircuitikz\endtikzpicture + +\endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty index c480dc90ff6..ea827867ef6 100644 --- a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty +++ b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty @@ -9,8 +9,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{0.9.3} -\def\pgfcircversiondate{2019/07/13} +\def\pgfcircversion{0.9.4} +\def\pgfcircversiondate{2019/08/30} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] |