diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex | 3309 |
1 files changed, 1677 insertions, 1632 deletions
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 |