From ce57a48ad32828c6b55ab174a7ae857475dbdd22 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 31 Aug 2019 21:18:52 +0000 Subject: circuitikz (31aug19) git-svn-id: svn://tug.org/texlive/trunk@52002 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/generic/circuitikz/ctikzstyle-example.tex | 11 + .../tex/generic/circuitikz/ctikzstyle-legacy.tex | 136 + .../tex/generic/circuitikz/ctikzstyle-romano.tex | 74 + .../tex/generic/circuitikz/pgfcirc.defines.tex | 663 ++- .../tex/generic/circuitikz/pgfcircbipoles.tex | 5057 ++++++++++---------- .../tex/generic/circuitikz/pgfcirclabel.tex | 6 +- .../tex/generic/circuitikz/pgfcircmonopoles.tex | 502 +- .../tex/generic/circuitikz/pgfcircmultipoles.tex | 143 +- .../tex/generic/circuitikz/pgfcircpath.tex | 9 +- .../tex/generic/circuitikz/pgfcircquadpoles.tex | 1195 +++-- .../tex/generic/circuitikz/pgfcircshapes.tex | 90 +- .../tex/generic/circuitikz/pgfcirctripoles.tex | 3413 ++++++------- .../tex/generic/circuitikz/pgfcircvoltage.tex | 180 +- 13 files changed, 6237 insertions(+), 5242 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-example.tex create mode 100644 Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex create mode 100644 Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex (limited to 'Master/texmf-dist/tex/generic') diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-example.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-example.tex new file mode 100644 index 00000000000..c9719314c68 --- /dev/null +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-example.tex @@ -0,0 +1,11 @@ +% example style for circuits +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +\tikzset{example circuit style/.style={% + \circuitikzbasekey/.cd,% + amplifiers/fill=blue!20!white, +},% end .style +}% end \tikzset +% +\endinput + diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex new file mode 100644 index 00000000000..2e33283dc4b --- /dev/null +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex @@ -0,0 +1,136 @@ +% legacy style for circuits --- useful as a base for designing your style +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +% +\tikzset{legacy circuit style/.style={\circuitikzbasekey/.cd,% +% Resistors +resistors/scale=1.0, +resistors/width=0.8, +resistors/zigs=3, +resistors/fill=none, +resistors/thickness=none, +% +% Capacitors +capacitors/scale=1.0, +capacitors/fill=none, +capacitors/thickness=none, +% +% Inductors (and transformers) +inductors/scale=1.0, +inductors/fill=none, +inductors/thickness=none, +% these two are not set because the default is different in american and cute coils +% inductors/width=0.6, % it's 0.8 for american coils +% inductors/coils=5, % it's 4 for american coils +% +% Diodes +diodes/scale=1.0, +diodes/fill=none, +diodes/thickness=none, +% +% Batteries +batteries/scale=1.0, +batteries/fill=none, +batteries/thickness=none, +% +% Independent sources (the round ones) +sources/scale=1.0, +sources/fill=none, +sources/thickness=none, +% Dependent sources (the diamond-shaped ones) +csources/scale=1.0, +csources/fill=none, +csources/thickness=none, +% +% Instruments +instruments/scale=1.0, +instruments/fill=none, +instruments/thickness=none, +% +% Mechanical analogy +mechanicals/scale=1.0, +mechanicals/fill=none, +mechanicals/thickness=none, +% +% Misc component (look at the manual) +misc/scale=1.0, +misc/fill=none, +misc/thickness=none, +% +% Block diagrams +blocks/scale=1.0, +blocks/fill=none, +blocks/thickness=none, +% +% Ground symbols +grounds/scale=1.0, +grounds/fill=none, +grounds/thickness=none, +% +% Power supplies (but look at the manual, you can do more) +power supplies/scale=1.0, +power supplies/fill=none, +power supplies/thickness=none, +% +% Transistors +transistors/scale=1.0, +transistors/fill=none, +transistors/thickness=none, +tripoles/mos style=no arrows, % it can be "arrows" +tripoles/pmos style=fullcircle, % it can be "fullcircle", "nocircle" +transistors/arrow pos=legacy, % it can be "end" +% +% Vacuum tubes +tubes/scale=1.0, +tubes/fill=none, +tubes/thickness=none, +% +% RF components +RF/scale=1.0, +RF/fill=none, +RF/thickness=none, +% +% Electromechanical +electromechanicals/scale=1.0, +electromechanicals/fill=none, +electromechanicals/thickness=none, +% +% Amplifiers +amplifiers/scale=1.0, +amplifiers/fill=none, +amplifiers/thickness=none, +% +% Switches (they're a bit special, look the manual) +switches/scale=1.0, +switches/fill=none, +switches/thickness=none, +% +% Logic ports +logic ports/scale=1.0, +logic ports/fill=none, +logic ports/thickness=none, +logic ports origin=legacy, % it can be "center" (better) +% +% Integrated circuits +chips/scale=1.0, +chips/fill=none, +chips/thickness=none, +% +% Displays +displays/scale=1.0, +displays/fill=none, +displays/thickness=none, +% +% Nodes width (connectors, etc +nodes width=.04, +% +% Arrows size +current arrow scale=16, +},% end .style +}% end \tikzset +% You can add more commands here +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +% +\endinput + diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex new file mode 100644 index 00000000000..fabba4abf29 --- /dev/null +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex @@ -0,0 +1,74 @@ +% romano style for circuitikz +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +\tikzset{romano circuit style/.style={% +\circuitikzbasekey/.cd,% +% Resistors +resistors/scale=0.8, +resistors/thickness=1.0, +% +% Capacitors +capacitors/scale=0.7, +capacitors/thickness=1.0, +% +% Inductors (and transformers) +inductors/scale=0.8, +inductors/thickness=1.0, +% +% Diodes +diodes/scale=0.6, +diodes/thickness=1.0, +% +% Batteries +batteries/scale=1.0, +batteries/thickness=2.0, +% +% Sources (the round and diamond-shaped ones!) +sources/scale=0.9, +sources/thickness=1.0, +csources/scale=0.9, +csources/thickness=1.0, +bipoles/noise sources/fillcolor=dashed, +% +% Instruments +instruments/scale=1.0, +% +% Ground symbols +grounds/scale=1.0, +grounds/thickness=1.0, +% +% Transistors +transistors/scale=1.3, +transistors/thickness=3.0, +tripoles/mos style=arrows, % it can be "arrows" +tripoles/pmos style=emptycircle, % it can be "fullcircle", "nocircle" +transistors/arrow pos=end, % it can be "end" +% +% Amplifiers +amplifiers/scale=1.0, +amplifiers/thickness=3.0, +% +% Logic ports +logic ports/scale=1.0, +logic ports/thickness=2.0, +logic ports origin=center, % it can be "center" (better) +% +% Switches +bipoles/cuteswitch/thickness=0.5, +% +% Integrated circuits +chips/scale=1.0, +chips/thickness=3.0, +% +% other options for romano style +bipoles/crossing/size=0.4, +% I am not sure I like them... +% monopoles/vcc/arrow={Triangle[width=0.8*\scaledwidth, length=\scaledwidth]}, +% monopoles/vee/arrow={Triangle[width=0.8*\scaledwidth, length=\scaledwidth]}, +},% end .style +}% end \tikzset +% You can add more commands here +% Do not use LaTeX commands if you want it to be compatible with ConTeXt +% Do not add spurious spaces +\endinput + diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index 22bcf58f930..200230b50a5 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex @@ -1,4 +1,17 @@ -%% Counters +%% Key managements + +\long\def\pgf@circ@comment#1{} + +\def\circuitikzbasekey{/tikz/circuitikz} + +\pgfkeys{\circuitikzbasekey/.is family} + +\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}} +\let\ctikzset\circuitikzset +\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}} +\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}} + +%% Temporary Counters \newcount\pgf@circ@count@a \newcount\pgf@circ@count@b @@ -51,11 +64,32 @@ \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} +\def\pgf@circ@setifdefinedfill#1#2{% + % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none: + % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2} + \ifdefined\ctikzclass + \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}% + {% yes, it's defined + \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}% + \ifx\@@tmp\@@none % but it's none + \pgfusepath{#2}% + \else + \pgfsetfillcolor{\@@tmp}% + \pgfusepath{#1}% + \fi + }{% the class is defined but the fill key not; use #2 + \pgfusepath{#2}% + } + \else + \pgfusepath{#2}% + \fi +} + %% Macro to fill or draw \def\pgf@circ@draworfill{% \ifx\tikz@fillcolor\pgfutil@empty - \pgfusepath{draw} + \pgf@circ@setifdefinedfill{draw,fill}{draw} \else \pgfsetfillcolor{\tikz@fillcolor} \pgfusepath{draw, fill} @@ -64,6 +98,7 @@ \def\pgf@circ@draworfillandclip{% \ifx\tikz@fillcolor\pgfutil@empty + \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip} \pgfusepath{draw, clip} \else \pgfsetfillcolor{\tikz@fillcolor} @@ -73,24 +108,37 @@ \def\pgf@circ@maybefill{% \ifx\tikz@fillcolor\pgfutil@empty - \pgfusepath{discard} + \pgf@circ@setifdefinedfill{fill}{discard} \else \pgfsetfillcolor{\tikz@fillcolor} \pgfusepath{fill} \fi } -%% Keys - -\long\def\pgf@circ@comment#1{} -\def\circuitikzbasekey{/tikz/circuitikz} - -\pgfkeys{\circuitikzbasekey/.is family} +%% Macros for setting linewidth +% #1 is the legacy class (bipoles, tripoles) etc +% #2 is the reference linewidth +\def\pgf@circ@setlinewidth#1#2{% + \ifdefined\ctikzclass + \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}% + {% yes, it's defined + \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}% + \ifx\@@tmp\@@none % but it's none + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class + \else + \pgfsetlinewidth{\@@tmp #2}% + \fi + }{ % key not defined, do the legacy thing + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% + }% Ok, do nothing + \else % no class + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% + \fi +} +% use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case +\ctikzset{none/thickness/.initial=1.0} % do not touch -\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}} -\let\ctikzset\circuitikzset -\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}} -\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}} +% voltage options \newif\ifpgf@circ@siunitx \newif\ifpgf@circuit@compat @@ -105,7 +153,6 @@ \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}} \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}} - % Option ">" for twoports \newif\ifpgf@circuit@inputarrow \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} @@ -139,8 +186,130 @@ % Base len for all circuitikz \newdimen\pgf@circ@Rlen -\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1}} +% scaled length for internal use in scalable shapes +\newdimen\pgf@circ@scaled@Rlen +\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}} \pgf@circ@Rlen = 1.4cm +% by default scale is 1.0 +\pgf@circ@scaled@Rlen=\pgf@circ@Rlen + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% main style definitions +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +% load a style file: search ctikzstyle-NAME.tex in path +\def\ctikzloadstyle#1{% + \edef\pgf@temp{#1}% + % guard against re-loading + \expandafter\ifx\csname pgf@circ@style@\pgf@temp @loaded\endcsname\relax% + \expandafter\global\expandafter\let\csname pgf@circ@style@\pgf@temp @loaded\endcsname=\pgfutil@empty + \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{% + \tikzerror{I did not find the circuitikz style #1}}% + \fi +} + +% global style parameters +\ctikzset{default/scale/.initial=1.0} % do not touch +\ctikzset{default/fill/.initial=none} % do not touch +\ctikzset{default/thickness/.initial=none} % do not touch +% default is use as the generic default style for bipoles + +% mostly bipoles: + +\ctikzset{resistors/scale/.initial=1.0} +\ctikzset{resistors/fill/.initial=none} +\ctikzset{resistors/thickness/.initial=none} + +\ctikzset{capacitors/scale/.initial=1.0} +\ctikzset{capacitors/fill/.initial=none} +\ctikzset{capacitors/thickness/.initial=none} + +\ctikzset{inductors/scale/.initial=1.0} +\ctikzset{inductors/fill/.initial=none} +\ctikzset{inductors/thickness/.initial=none} + +\ctikzset{diodes/scale/.initial=1.0} +\ctikzset{diodes/fill/.initial=none} +\ctikzset{diodes/thickness/.initial=none} + +\ctikzset{batteries/scale/.initial=1.0} +\ctikzset{batteries/fill/.initial=none} +\ctikzset{batteries/thickness/.initial=none} + +\ctikzset{sources/scale/.initial=1.0} +\ctikzset{sources/fill/.initial=none} +\ctikzset{sources/thickness/.initial=none} + +\ctikzset{csources/scale/.initial=1.0} +\ctikzset{csources/fill/.initial=none} +\ctikzset{csources/thickness/.initial=none} + +\ctikzset{instruments/scale/.initial=1.0} +\ctikzset{instruments/fill/.initial=none} +\ctikzset{instruments/thickness/.initial=none} + +\ctikzset{mechanicals/scale/.initial=1.0} +\ctikzset{mechanicals/fill/.initial=none} +\ctikzset{mechanicals/thickness/.initial=none} + +\ctikzset{misc/scale/.initial=1.0} +\ctikzset{misc/fill/.initial=none} +\ctikzset{misc/thickness/.initial=none} + +\ctikzset{blocks/scale/.initial=1.0} +\ctikzset{blocks/fill/.initial=none} +\ctikzset{blocks/thickness/.initial=none} + +% mostly nodes + +\ctikzset{grounds/scale/.initial=1.0} +\ctikzset{grounds/fill/.initial=none} +\ctikzset{grounds/thickness/.initial=none} + +\ctikzset{power supplies/scale/.initial=1.0} +\ctikzset{power supplies/fill/.initial=none} +\ctikzset{power supplies/thickness/.initial=none} + +\ctikzset{transistors/scale/.initial=1.0} +\ctikzset{transistors/fill/.initial=none} +\ctikzset{transistors/thickness/.initial=none} + +\ctikzset{tubes/scale/.initial=1.0} +\ctikzset{tubes/fill/.initial=none} +\ctikzset{tubes/thickness/.initial=none} + +\ctikzset{RF/scale/.initial=1.0} +\ctikzset{RF/fill/.initial=none} +\ctikzset{RF/thickness/.initial=none} + +\ctikzset{electromechanicals/scale/.initial=1.0} +\ctikzset{electromechanicals/fill/.initial=none} +\ctikzset{electromechanicals/thickness/.initial=none} + +% transformers go with inductors +\ctikzset{amplifiers/scale/.initial=1.0} +\ctikzset{amplifiers/fill/.initial=none} +\ctikzset{amplifiers/thickness/.initial=none} + +\ctikzset{switches/scale/.initial=1.0} +\ctikzset{switches/fill/.initial=none} +\ctikzset{switches/thickness/.initial=none} + +\ctikzset{logic ports/scale/.initial=1.0} +\ctikzset{logic ports/fill/.initial=none} +\ctikzset{logic ports/thickness/.initial=none} + +\ctikzset{chips/scale/.initial=1.0} +\ctikzset{chips/fill/.initial=none} +\ctikzset{chips/thickness/.initial=none} + +\ctikzset{displays/scale/.initial=1.0} +\ctikzset{displays/fill/.initial=none} +\ctikzset{displays/thickness/.initial=none} + +% grounds and power supplies \ctikzset{monopoles/.is family} \ctikzset{monopoles/ground/width/.initial=.25} @@ -155,7 +324,6 @@ \ctikzset{monopoles/chassis/width/.initial=.25} \ctikzset{monopoles/alternative chassis/width/.initial=.25} \ctikzset{monopoles/equipotentiality/width/.initial=.25} -\ctikzset{monopoles/tlinestub/width/.initial=.25} \ctikzset{monopoles/antenna/width/.initial=.25} \ctikzset{monopoles/antenna/label/xanchor/.initial=.4} \ctikzset{monopoles/antenna/label/yanchor/.initial=.75} @@ -169,6 +337,7 @@ \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1} \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5} \ctikzset{monopoles/waves/width/.initial=0.5} + % microstrips \ctikzset{bipoles/mstline/height/.initial=0.3} \ctikzset{bipoles/mstline/width/.initial=1.2} @@ -185,11 +354,34 @@ \ctikzset{bipoles/mic/depth/.initial=.0} \ctikzset{bipoles/mic/width/.initial=.8} +% Zig Zag resistors +\ctikzset{resistors/zigs/.initial=3} +\ctikzset{resistors/width/.code={% + \ctikzset{bipoles/resistor/width=#1}% + \ctikzset{bipoles/vresistor/width=#1}% + \ctikzset{bipoles/potentiometer/width=#1}% + \ctikzset{bipoles/resistivesens/width=#1}% + \ctikzset{bipoles/photoresistor/width=#1}% + \ctikzset{bipoles/thermistor/width=#1}% + \ctikzset{bipoles/thermistorntc/width=#1}% + \ctikzset{bipoles/thermistorptc/width=#1}% + \ctikzset{bipoles/varistor/width=#1}% + \ctikzset{bipoles/generic/width=#1}% + \ctikzset{bipoles/generic potentiometer/width=#1}% + \ctikzset{bipoles/ageneric/width=#1}% + \ctikzset{bipoles/tgeneric/width=#1}% +}} +% zigzag resistor \ctikzset{bipoles/resistor/height/.initial=.3} \ctikzset{bipoles/resistor/width/.initial=.8} \ctikzset{bipoles/potentiometer/height/.initial=.8} \ctikzset{bipoles/potentiometer/height 2/.initial=.3} \ctikzset{bipoles/potentiometer/width/.initial=.8} +\ctikzset{bipoles/vresistor/height/.initial=.6} +\ctikzset{bipoles/vresistor/width/.initial=.8} +\ctikzset{bipoles/resistivesens/height/.initial=.6} +\ctikzset{bipoles/resistivesens/width/.initial=.8} +% square resistors \ctikzset{bipoles/photoresistor/height/.initial=.6} \ctikzset{bipoles/photoresistor/height 2/.initial=.3} \ctikzset{bipoles/photoresistor/width/.initial=.8} @@ -207,8 +399,48 @@ \ctikzset{bipoles/varistor/main/.initial=.7} \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7 \ctikzset{bipoles/varistor/width/.initial=.8} -\ctikzset{bipoles/vresistor/height/.initial=.6} -\ctikzset{bipoles/vresistor/width/.initial=.8} +\ctikzset{bipoles/generic/height/.initial=.30} +\ctikzset{bipoles/generic/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} +\ctikzset{bipoles/generic potentiometer/width/.initial=.80} +\ctikzset{bipoles/ageneric/height/.initial=.30} +\ctikzset{bipoles/tgeneric/height/.initial=.70} +\ctikzset{bipoles/tgeneric/width/.initial=.80} +\ctikzset{bipoles/ageneric/width/.initial=.80} + +%% Capacitors +\ctikzset{bipoles/capacitor/height/.initial=.6} +\ctikzset{bipoles/capacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/height/.initial=.5} +\ctikzset{bipoles/ecapacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/font/.initial= \fontsize{6}{0}\selectfont\boldmath} +\ctikzset{bipoles/pcapacitor/height/.initial=.6} +\ctikzset{bipoles/pcapacitor/width/.initial=.2} +\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/vcapacitor/height/.initial=.6} +\ctikzset{bipoles/vcapacitor/width/.initial=.5} +\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} +\ctikzset{bipoles/piezoelectric/height/.initial=.7} +\ctikzset{bipoles/piezoelectric/width/.initial=.5} + +% Inductors +\ctikzset{inductors/coils/.code={% + \ctikzset{bipoles/cuteinductor/coils=#1}% + \ctikzset{bipoles/cutechoke/coils=#1}% + \ctikzset{bipoles/americaninductor/coils=#1}% + \ctikzset{bipoles/vcuteinductor/coils=#1}% + \ctikzset{bipoles/vamericaninductor/coils=#1}% +}} +\ctikzset{inductors/width/.code={% + \ctikzset{bipoles/cuteinductor/width=#1}% + \ctikzset{bipoles/cutechoke/width=#1}% + \ctikzset{bipoles/americaninductor/width=#1}% + \ctikzset{bipoles/vcuteinductor/width=#1}% + \ctikzset{bipoles/vamericaninductor/width=#1}% + \ctikzset{bipoles/fullgeneric/width=#1}% + \ctikzset{bipoles/tfullgeneric/width=#1}% +}} \ctikzset{bipoles/cuteinductor/height/.initial=.3} \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15} \ctikzset{bipoles/cuteinductor/width/.initial=.6} @@ -223,8 +455,12 @@ \ctikzset{bipoles/cutechoke/cstep/.initial=.3} \ctikzset{bipoles/cutechoke/cdist/.initial=1.3} \ctikzset{bipoles/cutechoke/cthick/.initial=1} -\newif\ifpgf@circuit@bipole@twolines -\pgf@circuit@bipole@twolinesfalse +\newif\ifpgf@circuit@bipole@twolineschoke +\pgf@circuit@bipole@twolineschokefalse +\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +\ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} % \ctikzset{bipoles/americaninductor/height/.initial=.3} \ctikzset{bipoles/americaninductor/height 2/.initial=.1} @@ -241,6 +477,13 @@ \ctikzset{bipoles/vamericaninductor/width/.initial=.8} \ctikzset{bipoles/vamericaninductor/coils/.initial=4} \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15} +\ctikzset{bipoles/tfullgeneric/height/.initial=.70} +\ctikzset{bipoles/tfullgeneric/width/.initial=.80} +\ctikzset{bipoles/fullgeneric/height/.initial=.30} +\ctikzset{bipoles/fullgeneric/width/.initial=.80} + +% Sources + \ctikzset{bipoles/esource/height/.initial=.60} \ctikzset{bipoles/esource/width/.initial=.60} \ctikzset{bipoles/pvsource/height/.initial=.60} @@ -275,6 +518,8 @@ \ctikzset{bipoles/cisource/width/.initial=.7} \ctikzset{bipoles/cisourceam/height/.initial=.7} \ctikzset{bipoles/cisourceam/width/.initial=.7} +\ctikzset{bipoles/ecsource/height/.initial=.7} +\ctikzset{bipoles/ecsource/width/.initial=.7} \ctikzset{bipoles/cvsource/height/.initial=.7} \ctikzset{bipoles/cvsource/width/.initial=.7} \ctikzset{bipoles/cvsourceam/height/.initial=.7} @@ -284,25 +529,15 @@ \ctikzset{bipoles/cisourcesin/width/.initial=.7} \ctikzset{bipoles/cvsourcesin/height/.initial=.7} \ctikzset{bipoles/cvsourcesin/width/.initial=.7} -\ctikzset{bipoles/capacitor/height/.initial=.6} -\ctikzset{bipoles/capacitor/width/.initial=.2} -\ctikzset{bipoles/ecapacitor/height/.initial=.5} -\ctikzset{bipoles/ecapacitor/width/.initial=.2} -\ctikzset{bipoles/ecapacitor/font/.initial= \fontsize{6}{0}\selectfont\boldmath} -\ctikzset{bipoles/pcapacitor/height/.initial=.6} -\ctikzset{bipoles/pcapacitor/width/.initial=.2} -\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} -\ctikzset{bipoles/vcapacitor/height/.initial=.6} -\ctikzset{bipoles/vcapacitor/width/.initial=.5} -\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} -\ctikzset{bipoles/piezoelectric/height/.initial=.7} -\ctikzset{bipoles/piezoelectric/width/.initial=.5} \ctikzset{bipoles/battery/height/.initial=.6} \ctikzset{bipoles/battery/width/.initial=.3} \ctikzset{bipoles/battery1/height/.initial=.6} \ctikzset{bipoles/battery1/width/.initial=.3} \ctikzset{bipoles/battery2/height/.initial=.6} \ctikzset{bipoles/battery2/width/.initial=.3} + +% diodes + \ctikzset{bipoles/diode/height/.initial=.50} \ctikzset{bipoles/diode/width/.initial=.40} \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} @@ -311,6 +546,9 @@ \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} \ctikzset{bipoles/varcap/height/.initial=.50} \ctikzset{bipoles/varcap/width/.initial=.45} + +% switches + \ctikzset{bipoles/spst/height/.initial=.35} \ctikzset{bipoles/spst/width/.initial=.35} \ctikzset{bipoles/spst/depth/.initial=.2} @@ -320,8 +558,9 @@ \ctikzset{bipoles/ncs/height/.initial=.35} \ctikzset{bipoles/ncs/width/.initial=.35} \ctikzset{bipoles/ncs/depth/.initial=.2} -\ctikzset{bipoles/generic/height/.initial=.30} -\ctikzset{bipoles/generic/width/.initial=.80} + +% misc + \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30} @@ -335,20 +574,9 @@ \ctikzset{bipoles/fuse/width/.initial=.50} \ctikzset{bipoles/afuse/height/.initial=.20} \ctikzset{bipoles/afuse/width/.initial=.50} -\ctikzset{bipoles/generic potentiometer/height/.initial=.80} -\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} -\ctikzset{bipoles/generic potentiometer/width/.initial=.80} -\ctikzset{bipoles/ageneric/height/.initial=.30} -\ctikzset{bipoles/ageneric/width/.initial=.80} \ctikzset{bipoles/memristor/height/.initial=.30} \ctikzset{bipoles/memristor/wave height/.initial=.5} \ctikzset{bipoles/memristor/width/.initial=.80} -\ctikzset{bipoles/tgeneric/height/.initial=.70} -\ctikzset{bipoles/tgeneric/width/.initial=.80} -\ctikzset{bipoles/tfullgeneric/height/.initial=.70} -\ctikzset{bipoles/tfullgeneric/width/.initial=.80} -\ctikzset{bipoles/fullgeneric/height/.initial=.30} -\ctikzset{bipoles/fullgeneric/width/.initial=.80} \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages \ctikzset{bipoles/open/voltage/straight label distance/.initial=0} @@ -415,13 +643,12 @@ \ctikzset{bipoles/phaseshifter/width/.initial=.7} \ctikzset{bipoles/vphaseshifter/width/.initial=.7} \ctikzset{bipoles/detector/width/.initial=.7} -% resistive sensor american style -\ctikzset{bipoles/resistivesens/height/.initial=.6} -\ctikzset{bipoles/resistivesens/width/.initial=.8} % crossing wires \ctikzset{bipoles/crossing/size/.initial=.2} +% Transistors starts here + \newif\ifpgf@circuit@trans@depletiontype \pgf@circuit@trans@depletiontypefalse @@ -473,6 +700,7 @@ % Option draw pmos with empty circle \newif\ifpgf@circuit@pmos@emptycircle \pgf@circuit@pmos@emptycirclefalse +\ctikzset{tripoles/pmos style/.is choice} \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} % Option draw pmos with no circle @@ -483,7 +711,12 @@ % back to normal \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} - +% arrows at the end, the correct way +\newif\ifpgf@circuit@trans@arrowatend +\pgf@circuit@trans@arrowatendfalse +\ctikzset{transistors/arrow pos/.is choice} +\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} +\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} \newif\ifpgf@circuit@trans@ntype \pgf@circuit@trans@ntypetrue %default true @@ -742,56 +975,60 @@ \newif\ifpgf@circuit@europeanlogicport \ctikzset{logic ports/.is choice} \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue - \tikzset{and port/.style={shape=european and port}} - \tikzset{or port/.style={shape=european or port}} - \tikzset{xor port/.style={shape=european xor port}} - \tikzset{not port/.style={shape=european not port}} - \tikzset{nand port/.style={shape=european nand port}} - \tikzset{nor port/.style={shape=european nor port}} - \tikzset{xnor port/.style={shape=european xnor port}} - } } + \tikzset{and port/.style={shape=european and port}}% + \tikzset{or port/.style={shape=european or port}}% + \tikzset{xor port/.style={shape=european xor port}}% + \tikzset{buffer port/.style={shape=european buffer port}}% + \tikzset{not port/.style={shape=european not port}}% + \tikzset{nand port/.style={shape=european nand port}}% + \tikzset{nor port/.style={shape=european nor port}}% + \tikzset{xnor port/.style={shape=european xnor port}}% +}} \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse - \tikzset{and port/.style={shape=american and port}} - \tikzset{or port/.style={shape=american or port}} - \tikzset{xor port/.style={shape=american xor port}} - \tikzset{not port/.style={shape=american not port}} - \tikzset{nand port/.style={shape=american nand port}} - \tikzset{nor port/.style={shape=american nor port}} - \tikzset{xnor port/.style={shape=american xnor port}} - } } + \tikzset{and port/.style={shape=american and port}}% + \tikzset{or port/.style={shape=american or port}}% + \tikzset{xor port/.style={shape=american xor port}}% + \tikzset{buffer port/.style={shape=american buffer port}}% + \tikzset{not port/.style={shape=american not port}}% + \tikzset{nand port/.style={shape=american nand port}}% + \tikzset{nor port/.style={shape=american nor port}}% + \tikzset{xnor port/.style={shape=american xnor port}}% +}} \ctikzset{logic ports origin/.is choice} -\ctikzset{logic ports origin/legacy/.code= { - \ctikzset{tripoles/american and port/origin/.initial=0.8} - \ctikzset{tripoles/american nand port/origin/.initial=0.8} - \ctikzset{tripoles/american nor port/origin/.initial=0.8} - \ctikzset{tripoles/american or port/origin/.initial=0.8} - \ctikzset{tripoles/american xor port/origin/.initial=0.8} - \ctikzset{tripoles/american xnor port/origin/.initial=0.8} - \ctikzset{tripoles/european and port/origin/.initial=0.8} - \ctikzset{tripoles/european nand port/origin/.initial=0.8} - \ctikzset{tripoles/european or port/origin/.initial=0.8} - \ctikzset{tripoles/european nor port/origin/.initial=0.8} - \ctikzset{tripoles/european xor port/origin/.initial=0.8} - \ctikzset{tripoles/european xnor port/origin/.initial=0.8} - \ctikzset{tripoles/european not port/origin/.initial=0.8} - } +\ctikzset{logic ports origin/legacy/.code={ + \ctikzset{tripoles/american and port/origin/.initial=0.8}% + \ctikzset{tripoles/american nand port/origin/.initial=0.8}% + \ctikzset{tripoles/american nor port/origin/.initial=0.8}% + \ctikzset{tripoles/american or port/origin/.initial=0.8}% + \ctikzset{tripoles/american xor port/origin/.initial=0.8}% + \ctikzset{tripoles/american xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european and port/origin/.initial=0.8}% + \ctikzset{tripoles/european nand port/origin/.initial=0.8}% + \ctikzset{tripoles/european or port/origin/.initial=0.8}% + \ctikzset{tripoles/european nor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european buffer port/origin/.initial=0.8}% + \ctikzset{tripoles/european not port/origin/.initial=0.8}% + }% } -\ctikzset{logic ports origin/center/.code= { - \ctikzset{tripoles/american and port/origin/.initial=0} - \ctikzset{tripoles/american nand port/origin/.initial=0} - \ctikzset{tripoles/american nor port/origin/.initial=0} - \ctikzset{tripoles/american or port/origin/.initial=0} - \ctikzset{tripoles/american xor port/origin/.initial=0} - \ctikzset{tripoles/american xnor port/origin/.initial=0} - \ctikzset{tripoles/european and port/origin/.initial=0} - \ctikzset{tripoles/european nand port/origin/.initial=0} - \ctikzset{tripoles/european or port/origin/.initial=0} - \ctikzset{tripoles/european nor port/origin/.initial=0} - \ctikzset{tripoles/european xor port/origin/.initial=0} - \ctikzset{tripoles/european xnor port/origin/.initial=0} - \ctikzset{tripoles/european not port/origin/.initial=0} - } +\ctikzset{logic ports origin/center/.code={% + \ctikzset{tripoles/american and port/origin/.initial=0}% + \ctikzset{tripoles/american nand port/origin/.initial=0}% + \ctikzset{tripoles/american nor port/origin/.initial=0}% + \ctikzset{tripoles/american or port/origin/.initial=0}% + \ctikzset{tripoles/american xor port/origin/.initial=0}% + \ctikzset{tripoles/american xnor port/origin/.initial=0}% + \ctikzset{tripoles/european and port/origin/.initial=0}% + \ctikzset{tripoles/european nand port/origin/.initial=0}% + \ctikzset{tripoles/european or port/origin/.initial=0}% + \ctikzset{tripoles/european nor port/origin/.initial=0}% + \ctikzset{tripoles/european xor port/origin/.initial=0}% + \ctikzset{tripoles/european xnor port/origin/.initial=0}% + \ctikzset{tripoles/european buffer port/origin/.initial=0}% + \ctikzset{tripoles/european not port/origin/.initial=0}% + }% } @@ -876,6 +1113,12 @@ \ctikzset{tripoles/european nand port/height/.initial=.65} \ctikzset{tripoles/european nand port/reserved/.initial=.6} \ctikzset{tripoles/european nand port/input height/.initial=.6} +\ctikzset{tripoles/european buffer port/width/.initial=1.4} +\ctikzset{tripoles/european buffer port/not height/.initial=.3} +\ctikzset{tripoles/european buffer port/not width/.initial=.8} +\ctikzset{tripoles/european buffer port/height/.initial=.65} +\ctikzset{tripoles/european buffer port/reserved/.initial=.6} +\ctikzset{tripoles/european buffer port/input height/.initial=0} \ctikzset{tripoles/european not port/width/.initial=1.4} \ctikzset{tripoles/european not port/not height/.initial=.3} \ctikzset{tripoles/european not port/not width/.initial=.8} @@ -907,6 +1150,8 @@ \ctikzset{tripoles/european xor port/inputs/.initial=2} \ctikzset{tripoles/european xnor port/origin/.initial=0.8} \ctikzset{tripoles/european xnor port/inputs/.initial=2} +\ctikzset{tripoles/european buffer port/origin/.initial=0.8} +\ctikzset{tripoles/european buffer port/inputs/.initial=1}% \ctikzset{tripoles/european not port/origin/.initial=0.8} \ctikzset{tripoles/european not port/inputs/.initial=1}% %%% parameters that are not used anymore after multi-input @@ -940,61 +1185,88 @@ \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} -% -\ctikzset{tripoles/op amp/width/.initial=1.7} -\ctikzset{tripoles/op amp/port width/.initial=.7} -\ctikzset{tripoles/op amp/height/.initial=1.4} -\ctikzset{tripoles/op amp/input height/.initial=.5} -\ctikzset{tripoles/op amp/up pos/.initial=.45} -\ctikzset{tripoles/op amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath}%absolute font size needed! + +% Operational amplifier +\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/op amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath} % Absolute font size needed! + +% Fully differential operational amplifier +\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation +\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/fd op amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath} % Absolute font size needed! + \ctikzset{tripoles/en amp/width/.initial=1.7} \ctikzset{tripoles/en amp/port width/.initial=.7} \ctikzset{tripoles/en amp/height/.initial=1.6} \ctikzset{tripoles/en amp/input height/.initial=.3} \ctikzset{tripoles/en amp/up pos/.initial=.45} -\ctikzset{tripoles/en amp/font/.initial= \fontsize{10}{12}\selectfont}%absolute font size needed! -\ctikzset{tripoles/en amp/font2/.initial= \fontsize{12}{14}\selectfont}%absolute font size needed! +\ctikzset{tripoles/en amp/font/.initial= \fontsize{10}{12}\selectfont} % Absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial= \fontsize{12}{14}\selectfont} % Absolute font size needed! \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} \tikzset{ - en amp text/.code = { - \ctikzsetvalof{tripoles/en amp/text}{#1} + en amp text/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{#1}% }, - en amp text A/.code = { - \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$} + en amp text A/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% }, } -\ctikzset{tripoles/gm amp/width/.initial=1.7} -\ctikzset{tripoles/gm amp/port width/.initial=.7} -\ctikzset{tripoles/gm amp/height/.initial=1.4} -\ctikzset{tripoles/gm amp/input height/.initial=.5} -\ctikzset{tripoles/gm amp/up pos/.initial=.45} -\ctikzset{tripoles/inst amp/width/.initial=1.7} % instrumentation amplifier, simple -\ctikzset{tripoles/inst amp/port width/.initial=.7} -\ctikzset{tripoles/inst amp/height/.initial=1.4} -\ctikzset{tripoles/inst amp/input height/.initial=.5} -\ctikzset{tripoles/inst amp/up pos/.initial=.4} -\ctikzset{tripoles/inst amp/refv pos/.initial=.7} -\ctikzset{tripoles/inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! -\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % instrumentation amplifier, diff output -\ctikzset{tripoles/fd inst amp/port width/.initial=.7} -\ctikzset{tripoles/fd inst amp/height/.initial=1.4} -\ctikzset{tripoles/fd inst amp/input height/.initial=.5} -\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} -\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} -\ctikzset{tripoles/fd inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! -\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % instrumentation amplifier with ra gain resistance added -\ctikzset{tripoles/inst amp ra/port width/.initial=.7} -\ctikzset{tripoles/inst amp ra/height/.initial=2.9} -\ctikzset{tripoles/inst amp ra/input height/.initial=.7} -\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} -\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} -\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} -\ctikzset{tripoles/inst amp ra/font/.initial= \fontsize{10}{0}\selectfont\boldmath}%absolute font size needed! -\ctikzset{tripoles/plain amp/width/.initial=1.7} -\ctikzset{tripoles/plain amp/port width/.initial=.7} -\ctikzset{tripoles/plain amp/height/.initial=1.4} -\ctikzset{tripoles/plain amp/input height/.initial=.5} -\ctikzset{tripoles/plain amp/up pos/.initial=.45} + +% Transconductance amplifier +\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid +\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/gm amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath} % Absolute font size needed! + +% Instrumentation amplifier +\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath} % Absolute font size needed! + +% Instrumentation amplifier with differential output +\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation +\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/fd inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath} % Absolute font size needed! + +% Instrumentation amplifier with gain resistor terminals +\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width +\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid +\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid +\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation +\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation +\ctikzset{tripoles/inst amp ra/font/.initial= \fontsize{10}{0}\selectfont\boldmath} % Absolute font size needed! + +% Plain amplifier +\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position \ctikzset{tripoles/thyristor/height/.initial=1.10} \ctikzset{tripoles/thyristor/height 2/.initial=.5} @@ -1055,26 +1327,25 @@ \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} \ctikzset{quadpoles style/.is choice} -\ctikzset{quadpoles style/inward/.code={ % default value - \ctikzset{quadpoles/transformer/inner=0.4} - \ctikzset{quadpoles/transformer/width=1.5} - \ctikzset{quadpoles/transformer core/inner=0.4} - \ctikzset{quadpoles/transformer core/width=1.5} - \ctikzset{quadpoles/gyrator/inner=0.4} - \ctikzset{quadpoles/gyrator/width=1.5} - } +\ctikzset{quadpoles style/inward/.code={% default value + \ctikzset{quadpoles/transformer/inner=0.4}% + \ctikzset{quadpoles/transformer/width=1.5}% + \ctikzset{quadpoles/transformer core/inner=0.4}% + \ctikzset{quadpoles/transformer core/width=1.5}% + \ctikzset{quadpoles/gyrator/inner=0.4}% + \ctikzset{quadpoles/gyrator/width=1.5}% + }% } -\ctikzset{quadpoles style/inline/.code={ % now horizontal baffle - \ctikzset{quadpoles/transformer/inner=1} - \ctikzset{quadpoles/transformer/width=0.6} - \ctikzset{quadpoles/transformer core/inner=1} - \ctikzset{quadpoles/transformer core/width=0.6} - \ctikzset{quadpoles/gyrator/inner=1} - \ctikzset{quadpoles/gyrator/width=0.6} - } +\ctikzset{quadpoles style/inline/.code={% now horizontal baffle + \ctikzset{quadpoles/transformer/inner=1}% + \ctikzset{quadpoles/transformer/width=0.6}% + \ctikzset{quadpoles/transformer core/inner=1}% + \ctikzset{quadpoles/transformer core/width=0.6}% + \ctikzset{quadpoles/gyrator/inner=1} % FIXME + \ctikzset{quadpoles/gyrator/width=0.6}% + }% } - % % multipoles % @@ -1129,7 +1400,7 @@ \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}} \tikzset{% - rotary switch/.style args={#1in#2wiper#3}{ + rotary switch/.style args={#1in#2wiper#3}{% shape=rotaryswitch, /tikz/circuitikz/multipoles/rotary/channels=#1, /tikz/circuitikz/multipoles/rotary/angle=#2, @@ -1152,11 +1423,11 @@ /tikz/circuitikz/multipoles/rotary/arrow=both, }, % Notice that these should be the same as the initial values of the keys - rotary switch/.default={5 in 60 wiper 20 }, - rotary switch -/.default={5 in 60 wiper 20 }, - rotary switch <-/.default={5 in 60 wiper 20 }, - rotary switch ->/.default={5 in 60 wiper 20 }, - rotary switch <->/.default={5 in 60 wiper 20 }, + rotary switch/.default={5 in 60 wiper 20}, + rotary switch -/.default={5 in 60 wiper 20}, + rotary switch <-/.default={5 in 60 wiper 20}, + rotary switch ->/.default={5 in 60 wiper 20}, + rotary switch <->/.default={5 in 60 wiper 20}, } % %Mechanical section @@ -1174,8 +1445,8 @@ \ctikzset{bipole/.is family} -\ctikzset{bipole/kind/.initial = } -\ctikzset{bipole/name/.initial = } +\ctikzset{bipole/kind/.initial=} +\ctikzset{bipole/name/.initial=} \newif\ifpgf@circuit@bipole@isvoltage \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage} \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol @@ -1261,9 +1532,9 @@ \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} -\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full }} -\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty }} -\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke }} +\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}} +\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}} +\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}} \ctikzset{thickness/.initial=2} \ctikzset{color/.initial=black} @@ -1333,40 +1604,40 @@ \ctikzset{current/distance/.initial = .5} -\tikzset{american currents/.style = { \circuitikzbasekey/current = american } } -\tikzset{european currents/.style = { \circuitikzbasekey/current = european } } -\tikzset{american voltages/.style = { \circuitikzbasekey/voltage = american } } -\tikzset{european voltages/.style = { \circuitikzbasekey/voltage = european } } -\tikzset{american resistors/.style = { \circuitikzbasekey/resistor = american } } -\tikzset{european resistors/.style = { \circuitikzbasekey/resistor = european } } +\tikzset{american currents/.style = {\circuitikzbasekey/current = american}} +\tikzset{european currents/.style = {\circuitikzbasekey/current = european}} +\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}} +\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}} +\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} +\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}} \newif\ifpgf@circuit@europeangfsurgearrester \ctikzset{gas filled surge arrester choice/.is choice} -\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue } } -\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse } } - -\tikzset{american gas filled surge arrester set/.style = { \circuitikzbasekey/gas filled surge arrester choice=american } } -\tikzset{european gas filled surge arrester set/.style = { \circuitikzbasekey/gas filled surge arrester choice=european } } -\tikzset{american inductors/.style = { \circuitikzbasekey/inductor = american } } -\tikzset{european inductors/.style = { \circuitikzbasekey/inductor = european } } -\tikzset{cute inductors/.style = { \circuitikzbasekey/inductor = cute } } -\tikzset{american ports/.style = { \circuitikzbasekey/logic ports = american } } -\tikzset{european ports/.style = { \circuitikzbasekey/logic ports = european } } -\tikzset{european/.style = { european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set} } -\tikzset{american/.style = { american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set} } -\tikzset{cute/.style = { european currents, european voltages, american resistors, cute inductors, american ports } } +\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}} +\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}} + +\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}} +\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}} +\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}} +\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}} +\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}} +\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}} +\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}} +\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}} +\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}} +\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}} % I should try to make the tree clearer (this voltage conflicts with the options above) \newif\ifpgf@circuit@europeanvoltage \ctikzset{voltage/.is choice} -\ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse } } -\ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue } } +\ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse}} +\ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue}} \newif\ifpgf@circuit@europeancurrent \ctikzset{current/.is choice} -\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse } -\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue } +\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse} +\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue} % noise sources \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} @@ -1401,8 +1672,8 @@ \ctikzset{seven seg/bits/.initial=0000000} -\ctikzset{seven seg/value/.code={ - \edef\@@tmp{#1} +\ctikzset{seven seg/value/.code={% + \edef\@@tmp{#1}% \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi @@ -1435,13 +1706,13 @@ }} \tikzset{% - seven segment val/.style args={#1dot#2box#3}{ + seven segment val/.style args={#1dot#2box#3}{% shape=bare7seg, /tikz/circuitikz/seven seg/value=#1, /tikz/circuitikz/seven seg/dot=#2, /tikz/circuitikz/seven seg/box=#3, }, - seven segment bits/.style args={#1dot#2box#3}{ + seven segment bits/.style args={#1dot#2box#3}{% shape=bare7seg, /tikz/circuitikz/seven seg/bits=#1, /tikz/circuitikz/seven seg/dot=#2, diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index bf024ec473f..0048efb8924 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -14,42 +14,59 @@ % #4 - upper y-size of the bipole (from the center) % #5 - width of the bipole % #6 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipole{% + \pgfcircdeclarebipolescaled{default}} - -\long\def\pgfcircdeclarebipole#1#2#3#4#5#6{ - \pgfdeclareshape{#3shape}{ - +%% Generic macro for defining a bipole shape +% #1 - scale factor +% #2 - additional anchors +% #3 - lower y-size of the bipole (from the center). +% #4 - #shape is the name of the shape +% #5 - upper y-size of the bipole (from the center) +% #6 - width of the bipole +% #7 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{ + \pgfdeclareshape{#4shape}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\northeast}{ - \pgf@y=#4\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=#5\pgf@circ@Rlen + \pgf@x=#6\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \savedanchor{\northeastborder}{ - \pgf@y=#4\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y - \pgf@x=#5\pgf@circ@Rlen + \pgf@x=#6\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x } \savedanchor{\southwestborder}{ - \pgf@y=-#2\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y - \pgf@x=-#5\pgf@circ@Rlen + \pgf@x=-#6\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x } \savedanchor{\southwest}{ - \pgf@y=-#2\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-#5\pgf@circ@Rlen + \pgf@x=-#6\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \savedanchor{\centerpoint}{ - \pgf@circ@res@down=-#2\pgf@circ@Rlen - \pgf@circ@res@up=#4\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen + \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen \pgfpointorigin \pgf@y=\pgf@circ@res@up \advance\pgf@y by\pgf@circ@res@down @@ -163,10 +180,10 @@ \fi } - #1 + #2 \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northeast \pgf@circ@res@up = \pgf@y @@ -175,10 +192,10 @@ \pgf@circ@res@right = \pgf@x \southwest \pgf@circ@res@down = \pgf@y - + \pgf@circ@scaled@Rlen=\scaledRlen \pgfstartlinewidth=\pgflinewidth \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! - #6 + #7 \pgfsetlinewidth{\pgfstartlinewidth} } @@ -187,180 +204,456 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Standard bipole shapes declarations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Resistor -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/resistor/height}} -{resistor} -{\ctikzvalof{bipoles/resistor/height}} -{\ctikzvalof{bipoles/resistor/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} - \divide \pgf@circ@res@step by 12 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfsetbeveljoin - \pgfusepath{draw} -} - +%%%%%%%%%%%%%%%%%%%%%%%% +% Resistive components +%%%%%%%%%%%%%%%%%%%%%%%% +%% Short circuit -%% Variable resistor +%%% NOTICE that the short is really NOT drawn; we trust the fact that its +%%% natural length is zero. \pgfcircdeclarebipole {} -{\ctikzvalof{bipoles/vresistor/height}} -{vresistor} -{\ctikzvalof{bipoles/vresistor/height}} -{\ctikzvalof{bipoles/vresistor/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} - \divide \pgf@circ@res@step by 12 +{0} +{short} +{0} +{0} +{ } - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} +%% Open circuit +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/open/height}} +{open} +{\ctikzvalof{bipoles/open/height}} +{\ctikzvalof{bipoles/open/width}} +{ } - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfsetbeveljoin - \pgfusepath{draw} +%% Generic bipole - used as resistor by some (bleah) +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/generic/height}} +{generic} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} +%% Generic empty tunable +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/tgeneric/height}} +{tgeneric} +{\ctikzvalof{bipoles/tgeneric/height}} +{\ctikzvalof{bipoles/tgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill \pgfscope \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfusepath{draw} \endpgfscope } +%% Generic asymmetric bipole +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/ageneric/height}} +{ageneric} +{\ctikzvalof{bipoles/ageneric/height}} +{\ctikzvalof{bipoles/ageneric/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} -%% Capacitor - -\pgfcircdeclarebipole +%% Memristor +\pgfcircdeclarebipolescaled{resistors} {} -{\ctikzvalof{bipoles/capacitor/height}} -{capacitor} -{\ctikzvalof{bipoles/capacitor/height}} -{\ctikzvalof{bipoles/capacitor/width}} +{\ctikzvalof{bipoles/memristor/height}} +{memristor} +{\ctikzvalof{bipoles/memristor/height}} +{\ctikzvalof{bipoles/memristor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 14 - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfusepath{draw} + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} } -%% Capacitive sensor -\pgfcircdeclarebipole -{\anchor{label}{% - \southwest - \pgf@x=2.6\pgf@x - \pgf@y=1.4\pgf@y - }% -} -{\ctikzvalof{bipoles/capacitor/height}} -{capacitivesens} -{\ctikzvalof{bipoles/capacitor/height}} -{\ctikzvalof{bipoles/capacitor/width}} +%% Photoresistor +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/photoresistor/height 2}} +{photoresistor} +{\ctikzvalof{bipoles/photoresistor/height}} +{\ctikzvalof{bipoles/photoresistor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} \pgfscope - \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.4\pgf@circ@res@down}} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} \pgfusepath{draw} \endpgfscope } -%% Polar Capacitor +%% Thermistor +\pgfcircdeclarebipolescaled{resistors} +{{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + \pgf@y=1.2\pgf@y + }% +}} +{\ctikzvalof{bipoles/thermistor/height}} +{thermistor} +{\ctikzvalof{bipoles/thermistor/height}} +{\ctikzvalof{bipoles/thermistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope -\pgfcircdeclarebipole + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + +%% Thermistor PTC +\pgfcircdeclarebipolescaled{resistors} {} -{\ctikzvalof{bipoles/pcapacitor/height}} -{polarcapacitor} -{\ctikzvalof{bipoles/pcapacitor/height}} -{\ctikzvalof{bipoles/pcapacitor/width}} +{\ctikzvalof{bipoles/thermistorptc/height 2}} +{thermistorptc} +{\ctikzvalof{bipoles/thermistorptc/height}} +{\ctikzvalof{bipoles/thermistorptc/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/pcapacitor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} +} +%% Thermistor NTC +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/thermistorntc/height 2}} +{thermistorntc} +{\ctikzvalof{bipoles/thermistorntc/height}} +{\ctikzvalof{bipoles/thermistorntc/width}} +{ \pgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgftransformrotate{-90} - \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} - \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} - \pgfusepath{draw} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} } -%% Electrolytic Capacitor +%% Generic tunable +\pgfcircdeclarebipolescaled{resistors}{ + \anchor{wiper}{ + \northeast + \pgfpoint{0pt}{\pgf@y} + } +} +{\ctikzvalof{bipoles/generic potentiometer/height 2}} +{genericpotentiometer} +{\ctikzvalof{bipoles/generic potentiometer/height}} +{\ctikzvalof{bipoles/generic potentiometer/width}} +{ -\pgfcircdeclarebipole -{} + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Zig zag resistores +\def\pgf@circ@zigzag#1{% + \divide \pgf@circ@res@step by \numexpr4*\zigs\relax + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \pgf@circ@count@a=\zigs\relax + % first half zig + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}} + \pgfmathloop% + \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times + \ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}} + \repeatpgfmathloop% + % last zig and a half + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} +} + +%% Resistor +\pgfcircdeclarebipolescaled{resistors} +{ +\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/resistor/height}} +{resistor} +{\ctikzvalof{bipoles/resistor/height}} +{\ctikzvalof{bipoles/resistor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{1} +} + + +%% Variable resistor +\pgfcircdeclarebipolescaled{resistors} +{ +\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/vresistor/height}} +{vresistor} +{\ctikzvalof{bipoles/vresistor/height}} +{\ctikzvalof{bipoles/vresistor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{.5} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Potentiometer +\pgfcircdeclarebipolescaled{resistors} +{ + \anchor{wiper}{\northeast\pgfpoint{0pt}{\pgf@y}} + \anchor{W}{\northeast\pgfpoint{0pt}{\pgf@y}} + \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/potentiometer/height 2}} +{potentiometer}{\ctikzvalof{bipoles/potentiometer/height}} +{\ctikzvalof{bipoles/potentiometer/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{1} + + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Resistive sensor +\pgfcircdeclarebipolescaled{resistors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.4\pgf@x}% + \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/resistivesens/height}} +{resistivesens} +{\ctikzvalof{bipoles/resistivesens/height}} +{\ctikzvalof{bipoles/resistivesens/width}} +{% + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{.5} + + \pgfscope + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%%%%% +%% Capacitors +%%%%%%%%%%%%% + +%% Plain Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitor} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + +} + +%% Capacitive sensor +\pgfcircdeclarebipolescaled{capacitors} +{ + \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}% +} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitivesens} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Polar Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/pcapacitor/height}} +{polarcapacitor} +{\ctikzvalof{bipoles/pcapacitor/height}} +{\ctikzvalof{bipoles/pcapacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgftransformrotate{-90} + \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + +} + +%% Electrolytic Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} {\ctikzvalof{bipoles/ecapacitor/height}} {ecapacitor} {\ctikzvalof{bipoles/ecapacitor/height}} {\ctikzvalof{bipoles/ecapacitor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/ecapacitor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 \pgfsetrectcap % % % Draw plus pole - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} @@ -378,137 +671,96 @@ \pgfsetfillcolor{black} % % plus pole annotation \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}] - {\pgfkeysvalueof{/tikz/circuitikz/bipoles/ecapacitor/font} $+$} + {\ctikzvalof{bipoles/ecapacitor/font} $+$} } -%% Battery - -\pgfcircdeclarebipole +%% Variable Capacitor +\pgfcircdeclarebipolescaled{capacitors} {} -{\ctikzvalof{bipoles/battery/height}} -{battery} -{\ctikzvalof{bipoles/battery/height}} -{\ctikzvalof{bipoles/battery/width}} +{\ctikzvalof{bipoles/vcapacitor/height}} +{vcapacitor} +{\ctikzvalof{bipoles/vcapacitor/height}} +{\ctikzvalof{bipoles/vcapacitor/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 6 - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \ifpgf@circ@fixbatteries - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \else + \pgfscope + \pgfsetarrowsend{latexslim} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} - \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetlinewidth{\pgfstartlinewidth} \pgfusepath{draw} } -%% Battery 1 % poles with equl thickness +%% Piezoelectric Element -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{capacitors} {} -{\ctikzvalof{bipoles/battery1/height}} -{battery1} -{\ctikzvalof{bipoles/battery1/height}} -{\ctikzvalof{bipoles/battery1/width}} +{\ctikzvalof{bipoles/piezoelectric/height}} +{piezoelectric} +{\ctikzvalof{bipoles/piezoelectric/height}} +{\ctikzvalof{bipoles/piezoelectric/width}} { - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \ifpgf@circ@fixbatteries - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen + % \divide \pgf@circ@res@step by 5 - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \else - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + %% Outer markings + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} - \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfusepath{draw} + + %% Inner Box + \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10 + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners + {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}} + {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope } -%% Battery 2 % negative pole thicker +%%%%%%%%%%%%%%% +%% Inductors +%%%%%%%%%%%%%%% -\pgfcircdeclarebipole +%% cute inductor +\pgfcircdeclarebipolescaled{inductors} {} -{\ctikzvalof{bipoles/battery2/height}} -{battery2} -{\ctikzvalof{bipoles/battery2/height}} -{\ctikzvalof{bipoles/battery2/width}} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{cuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} { - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \ifpgf@circ@fixbatteries - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfsetlinewidth{3\pgflinewidth} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \else - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfsetlinewidth{3\pgflinewidth} - \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} - \fi - \pgfusepath{draw} -} - - -%% cute inductor - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/cuteinductor/lower coil height}} -{cuteinductor} -{\ctikzvalof{bipoles/cuteinductor/height}} -{\ctikzvalof{bipoles/cuteinductor/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments \pgfmathsetlength{\pgf@circ@res@other}%width of small coil - {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} @@ -523,30 +775,24 @@ } %% cute inductive sensor - -\pgfcircdeclarebipole -{% +\pgfcircdeclarebipolescaled{inductors} {% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.8\pgf@x - \pgf@y=2.6\pgf@y - }% -}} + \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% +} {\ctikzvalof{bipoles/cuteinductor/lower coil height}} {scuteinductor} {\ctikzvalof{bipoles/cuteinductor/height}} {\ctikzvalof{bipoles/cuteinductor/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \pgfmathsetlength{\pgf@circ@res@other}%width of small coil - {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} @@ -567,23 +813,22 @@ } %% cute choke - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/cutechoke/lower coil height}} {cutechoke} {\ctikzvalof{bipoles/cutechoke/height}} {\ctikzvalof{bipoles/cutechoke/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \pgfmathsetlength{\pgf@circ@res@other}%width of small coil - {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)} + {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)} \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/cutechoke/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2} + {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}} @@ -598,35 +843,36 @@ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}*\ctikzvalof{bipoles/cutechoke/cthick}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} \pgfusepath{stroke} - \ifpgf@circuit@bipole@twolines + \ifpgf@circuit@bipole@twolineschoke \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}*\ctikzvalof{bipoles/cutechoke/cthick}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} \pgfusepath{stroke} \fi } %% variable cute inductor - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/vcuteinductor/lower coil height}} {vcuteinductor} {\ctikzvalof{bipoles/vcuteinductor/height}} {\ctikzvalof{bipoles/vcuteinductor/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \pgfmathsetlength{\pgf@circ@res@other}%width of small coil - {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)} + {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)} \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} + {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} \pgfscope \pgfsetarrowsend{latexslim} @@ -646,22 +892,22 @@ \pgfsetbeveljoin \pgfusepath{stroke} } -%% american inductor -\pgfcircdeclarebipole +%% american inductor +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/americaninductor/height 2}} {americaninductor} {\ctikzvalof{bipoles/americaninductor/height}} {\ctikzvalof{bipoles/americaninductor/width}} { - \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} \divide \pgf@circ@res@step by 2 - \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} @@ -675,28 +921,22 @@ %% american inductive sensor - -\pgfcircdeclarebipole -{% +\pgfcircdeclarebipolescaled{inductors} {% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.8\pgf@x - \pgf@y=2.6\pgf@y - }% -}} + \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% +} {\ctikzvalof{bipoles/americaninductor/height 2}} {samericaninductor} {\ctikzvalof{bipoles/americaninductor/height}} {\ctikzvalof{bipoles/americaninductor/width}} { - \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} \divide \pgf@circ@res@step by 2 - \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} @@ -715,21 +955,20 @@ } %% variable american inductor - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{inductors} {} {\ctikzvalof{bipoles/vamericaninductor/height 2}} {vamericaninductor} {\ctikzvalof{bipoles/vamericaninductor/height}} {\ctikzvalof{bipoles/vamericaninductor/width}} { - \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@Rlen - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils} \divide \pgf@circ@res@step by 2 - \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@Rlen + \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}} @@ -748,10 +987,183 @@ \endpgfscope } +%% Generic bipole, filled - used as inductor by some +\pgfcircdeclarebipolescaled{inductors} +{} +{\ctikzvalof{bipoles/fullgeneric/height}} +{fullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} -%% Independent voltage source + \pgfusepath{draw,fill} +} -\pgfcircdeclarebipole +%% Generic sensor, filled - used as inductive sensor by some +\pgfcircdeclarebipolescaled{inductors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}% +} +{\ctikzvalof{bipoles/fullgeneric/height}} +{sfullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw,fill} + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + +%% Generic full tunable +\pgfcircdeclarebipolescaled{inductors} +{} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{tfullgeneric} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{\ctikzvalof{bipoles/tfullgeneric/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw,fill} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%% +%% Battery +%%%%%%%%%%% + +%% Battery +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery/height}} +{battery} +{\ctikzvalof{bipoles/battery/height}} +{\ctikzvalof{bipoles/battery/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 6 + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + + +%% Battery 1 % poles with equl thickness + +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery1/height}} +{battery1} +{\ctikzvalof{bipoles/battery1/height}} +{\ctikzvalof{bipoles/battery1/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%% Battery 2 % negative pole thicker + +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery2/height}} +{battery2} +{\ctikzvalof{bipoles/battery2/height}} +{\ctikzvalof{bipoles/battery2/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%%%%%%%%%%% +%% Round and diamond sources +%%%%%%%%%%% + +%% Independent voltage source +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsource/height}} {vsource} @@ -759,7 +1171,7 @@ {\ctikzvalof{bipoles/vsource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -768,10 +1180,8 @@ \pgfusepath{draw} } - %% Independent voltage source - American style - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsourceam/height}} {vsourceAM} @@ -779,10 +1189,10 @@ {\ctikzvalof{bipoles/vsourceam/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifpgf@circ@oldvoltagedirection \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$} \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$} @@ -792,11 +1202,8 @@ \fi } - - %% Independent sinusoidal voltage source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsourcesin/height}} {vsourcesin} @@ -804,7 +1211,7 @@ {\ctikzvalof{bipoles/vsourcesin/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -821,14 +1228,14 @@ } % Square Voltage source - contributed by Alistair Kwan -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsourcesquare/height}} {vsourcesquare} {\ctikzvalof{bipoles/vsourcesquare/height}} {\ctikzvalof{bipoles/vsourcesquare/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill \pgf@circ@res@up = .5\pgf@circ@res@up @@ -845,7 +1252,7 @@ } % Triangle Voltage source - contributed by Ralf Farkas -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsourcetri/height}} {vsourcetri} @@ -853,7 +1260,7 @@ {\ctikzvalof{bipoles/vsourcetri/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -870,7 +1277,7 @@ %% PV Source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/pvsource/height}} {pvsource} @@ -878,7 +1285,7 @@ {\ctikzvalof{bipoles/pvsource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} \pgf@circ@draworfill @@ -889,7 +1296,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}} @@ -911,7 +1318,7 @@ } %% Empty Source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/esource/height}} {esource} @@ -919,20 +1326,20 @@ {\ctikzvalof{bipoles/esource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill } %% DC Current Source with open shape -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/dcisource/height}} {dcisource} {\ctikzvalof{bipoles/dcisource/height}} {\ctikzvalof{bipoles/dcisource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpointorigin} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@maybefill @@ -951,8 +1358,9 @@ \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} \endpgfscope } + %% DC-Voltage source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/dcvsource/height}} {dcvsource} @@ -960,7 +1368,7 @@ {\ctikzvalof{bipoles/dcvsource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}} @@ -970,10 +1378,8 @@ \pgfusepath{draw} } - %% Independent current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isource/height}} {isource} @@ -981,7 +1387,7 @@ {\ctikzvalof{bipoles/isource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} @@ -989,8 +1395,7 @@ } %% Independent double oo source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/oosource/height}} {oosource} @@ -998,7 +1403,7 @@ {\ctikzvalof{bipoles/oosource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} \pgf@circ@maybefill @@ -1010,10 +1415,8 @@ \pgfusepath{draw} } - %% Independent current source - American - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isourceam/height}} {isourceAM} @@ -1021,7 +1424,7 @@ {\ctikzvalof{bipoles/isourceam/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -1034,10 +1437,8 @@ \endpgfscope } - %% Independent sinusoidal current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isource/height}} {isourcesin} @@ -1045,7 +1446,7 @@ {\ctikzvalof{bipoles/isource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill @@ -1059,13 +1460,29 @@ \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} \pgfusepath{draw} \endpgfscope - } +%% Empty controlled source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/ecsource/height}} +{ecsource} +{\ctikzvalof{bipoles/ecsource/height}} +{\ctikzvalof{bipoles/ecsource/width}} +{ -%% Controlled voltage source + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} -\pgfcircdeclarebipole + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill +} + +%% Controlled voltage source +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsource/height}} {cvsource} @@ -1073,7 +1490,7 @@ {\ctikzvalof{bipoles/cvsource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} @@ -1087,18 +1504,15 @@ \pgfusepath{draw} } - - - %% Controlled voltage source - American -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsourceam/height}} {cvsourceAM} {\ctikzvalof{bipoles/cvsourceam/height}} {\ctikzvalof{bipoles/cvsourceam/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} @@ -1106,7 +1520,7 @@ \pgfpathclose \pgf@circ@draworfill - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifpgf@circ@oldvoltagedirection \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$} \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$} @@ -1116,9 +1530,8 @@ \fi } - %% Controlled sinusoidal voltage source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsourcesin/height}} {cvsourcesin} @@ -1126,7 +1539,7 @@ {\ctikzvalof{bipoles/cvsourcesin/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -1149,11 +1562,8 @@ \endpgfscope } - - %% Controlled sinusoidal current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsourcesin/height}} {cisourcesin} @@ -1161,7 +1571,7 @@ {\ctikzvalof{bipoles/cvsourcesin/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -1185,8 +1595,7 @@ } %% Controlled current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cisource/height}} {cisource} @@ -1194,7 +1603,7 @@ {\ctikzvalof{bipoles/cisource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} @@ -1208,17 +1617,15 @@ \pgfusepath{draw} } - %% Controlled current source - American - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cisourceam/height}} {cisourceAM} {\ctikzvalof{bipoles/cisourceam/height}} {\ctikzvalof{bipoles/cisourceam/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} @@ -1236,26 +1643,25 @@ } %% Cute Independent voltage source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsource/height}} {vsourceC} {\ctikzvalof{bipoles/vsource/height}} {\ctikzvalof{bipoles/vsource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfsetroundcap\pgfusepath{draw} } -%% Cute Independent current source -\pgfcircdeclarebipole +%% Cute Independent current source +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isource/height}} {isourceC} @@ -1263,32 +1669,32 @@ {\ctikzvalof{bipoles/isource/width}} { \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} \pgfsetroundcap\pgfusepath{draw} } -%% Cute Controlled voltage source -\pgfcircdeclarebipole +%% Cute Controlled voltage source +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cvsource/height}} {cvsourceC} {\ctikzvalof{bipoles/cvsource/height}} {\ctikzvalof{bipoles/cvsource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgf@circ@draworfill - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} @@ -1296,22 +1702,21 @@ } %% Cute Controlled current source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{csources} {} {\ctikzvalof{bipoles/cisource/height}} {cisourceC} {\ctikzvalof{bipoles/cisource/height}} {\ctikzvalof{bipoles/cisource/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgf@circ@draworfill - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}} @@ -1319,8 +1724,7 @@ } %% Noise voltage source - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/vsource/height}} {vsourceN} @@ -1328,17 +1732,18 @@ {\ctikzvalof{bipoles/vsource/width}} { \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} % - \pgf@circ@res@step=0.125\pgf@circ@Rlen\relax + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax \edef\pgf@noise@temp{dashed} - \edef\pgf@noise@fill{\pgfkeysvalueof{/tikz/circuitikz/bipoles/noise sources/fillcolor}} + \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}} \ifx\pgf@noise@temp\pgf@noise@fill % fillable in this case \pgf@circ@draworfillandclip - \pgfmathsetmacro{\thinner}{.5*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} - \pgfsetlinewidth{\thinner\pgfstartlinewidth} + \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thinner\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step @@ -1366,7 +1771,7 @@ \pgfusepath{draw,fill} \fi \endpgfscope - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} @@ -1374,7 +1779,7 @@ } %% Noise current source -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{sources} {} {\ctikzvalof{bipoles/isource/height}} {isourceN} @@ -1383,17 +1788,18 @@ { \pgfpointorigin \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} % - \pgf@circ@res@step=0.125\pgf@circ@Rlen\relax + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax \edef\pgf@noise@temp{dashed} - \edef\pgf@noise@fill{\pgfkeysvalueof{/tikz/circuitikz/bipoles/noise sources/fillcolor}} + \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}} \ifx\pgf@noise@temp\pgf@noise@fill % fillable in this case \pgf@circ@draworfillandclip - \pgfmathsetmacro{\thinner}{.5*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} - \pgfsetlinewidth{\thinner\pgfstartlinewidth} + \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thinner\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step @@ -1421,15 +1827,19 @@ \pgfusepath{draw,fill} \fi \endpgfscope - \pgfmathsetmacro{\@@thicker}{3*\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}} + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} \pgfsetroundcap\pgfusepath{draw} } -%% Black generic diode -\pgfcircdeclarebipole +%%%%%%%%%%%%%% +%% Diodes +%%%%%%%%%%%%%% + +%% Black generic diode +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fulldiode} @@ -1437,7 +1847,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} @@ -1453,8 +1863,7 @@ } %% Black Zener diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fullzdiode} @@ -1462,7 +1871,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} @@ -1479,7 +1888,7 @@ } %% Black alternative zigzag Zener diode -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fullzzdiode} @@ -1487,7 +1896,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} @@ -1505,8 +1914,7 @@ } %% Black Schottky diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fullsdiode} @@ -1514,7 +1922,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1536,8 +1944,7 @@ } %% Black tunnel diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fulltdiode} @@ -1545,7 +1952,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1563,8 +1970,7 @@ } %% Black light emitting diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fulllediode} @@ -1572,7 +1978,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1597,8 +2003,7 @@ } %% Black photodiode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {fullpdiode} @@ -1606,7 +2011,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgftransformxshift{\pgf@circ@res@left} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1630,15 +2035,14 @@ } %% Black varcap - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/varcap/height}} {fullvarcap} {\ctikzvalof{bipoles/varcap/height}} {\ctikzvalof{bipoles/varcap/width}} { - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgfsetlinewidth{\pgf@circ@res@temp} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} @@ -1663,7 +2067,7 @@ \pgfpathclose \pgf@circ@draworfill \pgfscope - % to allow filling, we need to draw explicitily the stroke here. + % to allow filling, we need to draw explicitly the stroke here. \pgfsetlinewidth{\pgfstartlinewidth} \ifpgf@circuit@bipole@strokedsymbol \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} @@ -1674,17 +2078,15 @@ % \endpgfscope } - %% Empty generic diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptydiode} {\ctikzvalof{bipoles/diode/height}} {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \endpgfscope @@ -1694,8 +2096,7 @@ } %% Empty Zener diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptyzdiode} @@ -1703,7 +2104,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape @@ -1715,7 +2116,7 @@ } %% Empty alternative zigzag Zener diode -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptyzzdiode} @@ -1723,7 +2124,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape @@ -1735,8 +2136,7 @@ \endpgfscope } %% Empty Schottky diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptysdiode} @@ -1744,7 +2144,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} @@ -1760,8 +2160,7 @@ } %% Empty tunnel diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptytdiode} @@ -1769,7 +2168,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} @@ -1781,8 +2180,7 @@ } %% Empty light emitting diode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptylediode} @@ -1790,7 +2188,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \endpgfscope @@ -1809,8 +2207,7 @@ } %% Empty photodiode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/diode/height}} {emptypdiode} @@ -1818,7 +2215,7 @@ {\ctikzvalof{bipoles/diode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope \pgf@circ@basicdiodeshape \endpgfscope @@ -1837,15 +2234,14 @@ } %% Empty varcap - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/varcap/height}} {emptyvarcap} {\ctikzvalof{bipoles/varcap/height}} {\ctikzvalof{bipoles/varcap/width}} { - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgfsetlinewidth{\pgf@circ@res@temp} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} @@ -1871,44 +2267,44 @@ } %% Empty bidirectionaldiode - -\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/bidirectionaldiode/height}}{emptybidirectionaldiode}{\ctikzvalof{bipoles/bidirectionaldiode/height}}{\ctikzvalof{bipoles/bidirectionaldiode/width}} +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{emptybidirectionaldiode} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{\ctikzvalof{bipoles/bidirectionaldiode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgf@circ@draworfill - % \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfsetlinewidth{\pgfstartlinewidth} + \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} } - %% Full bidirectionaldiode - -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{diodes} {} {\ctikzvalof{bipoles/bidirectionaldiode/height}} {fullbidirectionaldiode} @@ -1916,7 +2312,7 @@ {\ctikzvalof{bipoles/bidirectionaldiode/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right @@ -1942,18 +2338,227 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfusepath{draw} +} + +%% Black thyristor +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{fullthyristor} +{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Empty thyristor + +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{emptythyristor} +{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Empty triac +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/triac/height}} +{emptytriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Full triac +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/triac/height}} +{fulltriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} } +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + %% (Closing) SPST -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/spst/depth}} {cspst} {\ctikzvalof{bipoles/spst/height}} {\ctikzvalof{bipoles/spst/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} @@ -1969,7 +2574,7 @@ } %% Opening SPST -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/spst/depth}} {ospst} @@ -1977,7 +2582,7 @@ {\ctikzvalof{bipoles/spst/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} @@ -1993,7 +2598,7 @@ } %% Normal open Switch -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/nos/depth}} {nos} @@ -2001,7 +2606,7 @@ {\ctikzvalof{bipoles/nos/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfsetbuttcap @@ -2009,14 +2614,14 @@ } %% Normal closed Switch -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/ncs/depth}} {ncs} {\ctikzvalof{bipoles/ncs/height}} {\ctikzvalof{bipoles/ncs/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} @@ -2028,14 +2633,14 @@ } %% Push Button -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/pushbutton/height 2}} {pushbutton} {\ctikzvalof{bipoles/pushbutton/height}} {\ctikzvalof{bipoles/pushbutton/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}} @@ -2049,16 +2654,17 @@ } %% Normally closed Push Button -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{switches} {} {\ctikzvalof{bipoles/pushbutton/height 2}} {ncpushbutton} {\ctikzvalof{bipoles/pushbutton/height}} {\ctikzvalof{bipoles/pushbutton/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + % Warning, if the nodes will have a class, we have to touch this. + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}} \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}} @@ -2075,12 +2681,13 @@ % #2 -> barposition % #3 -> arrowcode \long\def\pgfcircdeclarecutesw#1#2#3{ - \pgfcircdeclarebipole + \pgfcircdeclarebipolescaled{switches} { \savedanchor\midlever{ % these values are calculated when we create the definition of the shape. - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp \pgf@circ@res@down = -.5\pgf@y \pgf@circ@res@up = .5\pgf@y @@ -2090,6 +2697,7 @@ } % radius of the connector % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % If cnnecting nodes are scaled, we have to modify this \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} % shapename \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} @@ -2108,7 +2716,8 @@ {\ctikzvalof{bipoles/cuteswitch/width}}{ \pgfscope % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + % If cnnecting nodes are scaled, we have to modify this + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp \pgfsetlinewidth{2\pgf@circ@res@temp} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} @@ -2139,7 +2748,7 @@ \pgfcircdeclarecutesw{cuteclosingswitch} {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}} \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right} @@ -2151,7 +2760,7 @@ \pgfcircdeclarecutesw{cuteopeningswitch} {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right} @@ -2159,42 +2768,46 @@ \pgfusepath{draw} } +%%%%%%%%%%%%%%%%% +%% Instruments +%%%%%%%%%%%%%%%%% % % METERINGSHAPE - \long\def\drawmeteringcircle{ - \def\pgf@circ@temp{right} +\long\def\drawmeteringcircle{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} \ifx\tikz@res@label@pos\pgf@circ@temp \pgf@circ@res@step=-1.2\pgf@circ@res@up \else - \def\pgf@circ@temp{below} - \ifx\tikz@res@label@pos\pgf@circ@temp - \pgf@circ@res@step=-1.2\pgf@circ@res@up - \else - \pgf@circ@res@step=1.2\pgf@circ@res@up - \fi + \pgf@circ@res@step=1.2\pgf@circ@res@up \fi - %draw connections to circle - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \fi + %draw connections to circle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + %draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + %draw arrow + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfusepath{draw} - %draw circle - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} - \pgf@circ@draworfill - \endpgfscope - %draw arrow - \pgfscope - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - } + \endpgfscope +} + %AMPEREMETER -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{instruments} {} {\ctikzvalof{bipoles/ammeter/height}} {ammeter} @@ -2205,7 +2818,7 @@ \pgfnode{circle}{center}{\textbf{A}}{}{} } %OHMMETER -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{instruments} {} {\ctikzvalof{bipoles/ohmmeter/height}} {ohmmeter} @@ -2216,7 +2829,7 @@ \pgfnode{circle}{center}{\boldmath$\Omega$}{}{} } %VOLTMETER -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{instruments} {} {\ctikzvalof{bipoles/voltmeter/height}} {voltmeter} @@ -2229,7 +2842,7 @@ } % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 -\pgfcircdeclarebipole +\pgfcircdeclarebipolescaled{instruments} { \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} @@ -2245,7 +2858,7 @@ {\ctikzvalof{bipoles/oscope/height}} {\ctikzvalof{bipoles/oscope/width}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfextracty{\pgf@circ@res@up}{\northeast} \pgfextractx{\pgf@circ@res@right}{\northeast} \pgfextractx{\pgf@circ@res@left}{\southwest} @@ -2275,7 +2888,7 @@ \pgfusepath{draw} \endpgfscope % function displayed, thanks to - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}} @@ -2284,855 +2897,970 @@ \pgfusepath{draw} \endpgfscope } -%% Short circuit -%%% NOTICE that the short is really NOT drawn; we trust the fact that its -%%% natural length is zero. -\pgfcircdeclarebipole -{} -{0} -{short} -{0} -{0} -{ } - -%% Open circuit - -\pgfcircdeclarebipole +% generic round meter with always horizontal text, no arrow +\pgfcircdeclarebipolescaled{instruments} {} -{\ctikzvalof{bipoles/open/height}} -{open} -{\ctikzvalof{bipoles/open/height}} -{\ctikzvalof{bipoles/open/width}} -{ } - -%% Generic bipole - used as resistor by some (bleah) - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/generic/height}} -{generic} -{\ctikzvalof{bipoles/generic/height}} -{\ctikzvalof{bipoles/generic/width}} +{\ctikzvalof{bipoles/esource/height}} +{rmeter} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} { - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill + % draw the text label + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgftransformrotate{\rot} + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope } - -%% fuse - -\pgfcircdeclarebipole +% generic round meter with always horizontal text, with arrow +\pgfcircdeclarebipolescaled{instruments} {} -{\ctikzvalof{bipoles/fuse/height}} -{fuse} -{\ctikzvalof{bipoles/fuse/height}} -{\ctikzvalof{bipoles/fuse/width}} +{\ctikzvalof{bipoles/esource/height}} +{rmeterwa} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} { - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfusepath{draw} - - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill + % draw the text label + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetlinewidth{\pgfstartlinewidth} + % arrow: create a center hole to have better visual + \pgfscope + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next open a circle into it + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfsetarrowsend{latexslim} + % the arrow is better if it has a bit of breath and it's not 45º + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope } - - -%% Generic bipole, filled - used as inductor by some - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/fullgeneric/height}} -{fullgeneric} -{\ctikzvalof{bipoles/fullgeneric/height}} -{\ctikzvalof{bipoles/fullgeneric/width}} -{ - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfusepath{draw,fill} -} - -%% Generic sensor, filled - used as inductive sensor by some - -\pgfcircdeclarebipole -{{% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.4\pgf@x - \pgf@y=2\pgf@y - }% -}} -{\ctikzvalof{bipoles/fullgeneric/height}} -{sfullgeneric} -{\ctikzvalof{bipoles/fullgeneric/height}} -{\ctikzvalof{bipoles/fullgeneric/width}} +% generic square meter with always horizontal text +\pgfcircdeclarebipolescaled{instruments} { - - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfusepath{draw,fill} - %\pgfscope - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}} - \pgfusepath{draw} - %\endpgfscope + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } } - - -%% Generic asymmetric bipole - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/ageneric/height}} -{ageneric} -{\ctikzvalof{bipoles/ageneric/height}} -{\ctikzvalof{bipoles/ageneric/width}} +{\ctikzvalof{bipoles/smeter/height}} +{smeter} +{\ctikzvalof{bipoles/smeter/height}} +{\ctikzvalof{bipoles/smeter/width}} { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgf@circ@draworfill \endpgfscope - - \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{stroke,fill} + % get the rotation + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + % the metering window + \pgfscope + \def\@starta{105}\def\@stopa{75} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope } +% probes qucs style: +% #1 : name +% #2 : extra code +\long\def\pgfcirc@qucsprobe#1#2{ + \pgfcircdeclarebipolescaled{instruments} + { + \anchor{v+}{\southwest\pgf@x=0.6\pgf@x} + \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + } + {\ctikzvalof{bipoles/qmeter/depth}} + {#1} + {\ctikzvalof{bipoles/qmeter/height}} + {\ctikzvalof{bipoles/qmeter/width}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + \def\@starta{103}\def\@stopa{77} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfscope + \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgf@circ@draworfill + \endpgfscope + #2 + \endpgfscope + } +} -%% asymmetric fuse - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/afuse/height}} -{afuse} -{\ctikzvalof{bipoles/afuse/height}} -{\ctikzvalof{bipoles/afuse/width}} -{ - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} +\pgfcirc@qucsprobe{qiprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} +} +\pgfcirc@qucsprobe{qvprobe}{ + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfusepath{draw} \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfusepath{draw} \endpgfscope - - \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{stroke,fill} } - - - -%% Memristor - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/memristor/height}} -{memristor} -{\ctikzvalof{bipoles/memristor/height}} -{\ctikzvalof{bipoles/memristor/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 14 - - \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill - \endpgfscope +\pgfcirc@qucsprobe{qpprobe}{ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}} - + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfusepath{draw} - - \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{stroke,fill} -} - - - - -%% Generic empty tunable - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/tgeneric/height}} -{tgeneric} -{\ctikzvalof{bipoles/tgeneric/height}} -{\ctikzvalof{bipoles/tgeneric/width}} -{ - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} \pgfusepath{draw} \endpgfscope } -%% Photoresistor - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/photoresistor/height 2}} -{photoresistor} -{\ctikzvalof{bipoles/photoresistor/height}} -{\ctikzvalof{bipoles/photoresistor/width}} +% current loop for oscope and similar: stylized +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{i}{\northeast\pgf@x=0pt\relax} + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} { + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right \pgfscope - \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 + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathellipse{\pgfpointorigin}{ + \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ + \pgfpoint{0.4\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} \endpgfscope +} +% current loop for oscope and similar: real (double connection) +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{i+}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{i-}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop2} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + % must be the same than internal i+ and i- anchors definition + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} + \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathmoveto{\@plus} + \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + % I use ...left and ---right as temporal lengths here to avoid defining more + \pgfextractx{\pgf@circ@res@left}{\@plus} + \pgfextractx{\pgf@circ@res@right}{\@minus} + \pgfpathmoveto{\@plus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\@minus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} \endpgfscope } - - -%% Thermistor -\pgfcircdeclarebipole -{{% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.4\pgf@x - \pgf@y=1.2\pgf@y - }% -}} -{\ctikzvalof{bipoles/thermistor/height}} -{thermistor} -{\ctikzvalof{bipoles/thermistor/height}} -{\ctikzvalof{bipoles/thermistor/width}} +%% Varistor +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/varistor/height}} +{varistor} +{\ctikzvalof{bipoles/varistor/height}} +{\ctikzvalof{bipoles/varistor/width}} { \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill \endpgfscope - %\pgfscope \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfusepath{draw} - %\endpgfscope + + \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\tiny\textsf{U}}} } +%%%%%%%%%%%%%% +%% RF bipoles +%%%%%%%%%%%%%% -%% Thermistor PTC -\pgfcircdeclarebipole +% transmission line +\pgfcircdeclarebipolescaled{RF} {} -{\ctikzvalof{bipoles/thermistorptc/height 2}} -{thermistorptc} -{\ctikzvalof{bipoles/thermistorptc/height}} -{\ctikzvalof{bipoles/thermistorptc/width}} +{\ctikzvalof{bipoles/tline/height}} +{tline} +{\ctikzvalof{bipoles/tline/height}} +{\ctikzvalof{bipoles/tline/width}} { - \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis + \begin{pgftransparencygroup} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} \pgf@circ@draworfill - \endpgfscope - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - + \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} + \pgf@circ@draworfill + \end{pgftransparencygroup} \pgfsetlinewidth{\pgfstartlinewidth} - \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} - \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{stroke} } -%% Thermistor NTC -\pgfcircdeclarebipole +% microstrip transmission line +\pgfcircdeclarebipolescaled{RF} {} -{\ctikzvalof{bipoles/thermistorntc/height 2}} -{thermistorntc} -{\ctikzvalof{bipoles/thermistorntc/height}} -{\ctikzvalof{bipoles/thermistorntc/width}} +{\ctikzvalof{bipoles/mstline/height}} +{mstline} +{\ctikzvalof{bipoles/mstline/height}} +{\ctikzvalof{bipoles/mstline/width}} { + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + +%%%%%%%%%%%%%%%%%%% +%% Block diagrams +%%%%%%%%%%%%%%%%%%% + +%% Draw the two-port fillable box +\def\pgf@circ@twoportbox{ \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope - - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} } -%% thermocouple -\pgfcircdeclarebipole +%% Generic two port box +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/thermocouple/height 2}} -{thermocouple} -{\ctikzvalof{bipoles/thermocouple/height}} -{\ctikzvalof{bipoles/thermocouple/width}} +{\ctikzvalof{bipoles/twoport/height}} +{twoport} +{\ctikzvalof{bipoles/twoport/height}} +{\ctikzvalof{bipoles/twoport/width}} { + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} - \pgfusepath{draw} } -%% Varistor -\pgfcircdeclarebipole +%% voltage controled oscillator +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/varistor/height}} -{varistor} -{\ctikzvalof{bipoles/varistor/height}} -{\ctikzvalof{bipoles/varistor/width}} +{\ctikzvalof{bipoles/vco/width}} +{vco} +{\ctikzvalof{bipoles/twoport/width}} +{\ctikzvalof{bipoles/vco/width}} { + \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw circle \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} \pgf@circ@draworfill \endpgfscope + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi - \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\tiny\textsf{U}}} + % draw inner sine waves + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} } - - -%% Generic full tunable - -\pgfcircdeclarebipole +%% bandpass filter +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/tfullgeneric/height}} -{tfullgeneric} -{\ctikzvalof{bipoles/tfullgeneric/height}} -{\ctikzvalof{bipoles/tfullgeneric/width}} +{\ctikzvalof{bipoles/bandpass/width}} +{bandpass} +{\ctikzvalof{bipoles/bandpass/width}} +{\ctikzvalof{bipoles/bandpass/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 14 - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfusepath{draw,fill} + \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 - \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} - \endpgfscope -} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} -%% Variable Capacitor + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} -\pgfcircdeclarebipole +%% bandstop filter +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/vcapacitor/height}} -{vcapacitor} -{\ctikzvalof{bipoles/vcapacitor/height}} -{\ctikzvalof{bipoles/vcapacitor/width}} +{\ctikzvalof{bipoles/bandstop/width}} +{bandstop} +{\ctikzvalof{bipoles/bandstop/width}} +{\ctikzvalof{bipoles/bandstop/width}} { - %\pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/width}\pgf@circ@Rlen - \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right + \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfusepath{draw} + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi - \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} - \endpgfscope + % draw outer box + \pgf@circ@twoportbox - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt}% always draw solid line for inner symbol + \pgfsetarrows{-}%never draw arrows \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} \pgfusepath{draw} -} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} -%% Piezoelectric Element + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} -\pgfcircdeclarebipole +%% highpass filter +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/piezoelectric/height}} -{piezoelectric} -{\ctikzvalof{bipoles/piezoelectric/height}} -{\ctikzvalof{bipoles/piezoelectric/width}} +{\ctikzvalof{bipoles/highpass/width}} +{highpass} +{\ctikzvalof{bipoles/highpass/width}} +{\ctikzvalof{bipoles/highpass/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 5 + \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 - %% Outer markings - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} \pgfusepath{draw} - %% Inner Box - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left+4}{\pgf@circ@res@up-1}}{\pgfpoint{\pgf@circ@res@right-4}{\pgf@circ@res@down+1}} - \pgf@circ@draworfill - \endpgfscope + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} } +%% lowpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/lowpass/width}} +{lowpass} +{\ctikzvalof{bipoles/lowpass/width}} +{\ctikzvalof{bipoles/lowpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi -%% Lamp + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/lamp/height}} -{lamp} -{\ctikzvalof{bipoles/lamp/height}} -{\ctikzvalof{bipoles/lamp/width}} -{ + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} \pgfusepath{draw} } -%% bulb -\pgfcircdeclarebipole +%% ADC +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/bulb/height}} -{bulb} -{\ctikzvalof{bipoles/bulb/height}} -{\ctikzvalof{bipoles/bulb/width}} -{% - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}} - \pgf@circ@draworfill +{\ctikzvalof{bipoles/adc/width}} +{adc} +{\ctikzvalof{bipoles/adc/width}} +{\ctikzvalof{bipoles/adc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} - \pgfsetbeveljoin - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfusepath{draw} -} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi -% transmission line + % draw outer box + \pgf@circ@twoportbox -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/tline/height}} -{tline} -{\ctikzvalof{bipoles/tline/height}} -{\ctikzvalof{bipoles/tline/width}} -{ - \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis - \begin{pgftransparencygroup} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgf@circ@draworfill - \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} - {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} - \pgf@circ@draworfill - \end{pgftransparencygroup} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfusepath{stroke} -} - -% microstrip transmission line - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/mstline/height}} -{mstline} -{\ctikzvalof{bipoles/mstline/height}} -{\ctikzvalof{bipoles/mstline/width}} -{ - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill -} -%% SQUID added by Cor Molenaar 5 March 2010 - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/squid/height}} -{squid} -{\ctikzvalof{bipoles/squid/height}} -{\ctikzvalof{bipoles/squid/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}} - - \pgfusepath{draw} -} - - - -% Generic barrier added by Cor Molenaar 5 March 2010 - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/barrier/height}} -{barrier} -{\ctikzvalof{bipoles/barrier/height}} -{\ctikzvalof{bipoles/barrier/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + % rotate inner symbol + \def\texti{A} + \def\textii{D} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{D} + \def\textii{A} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{D} + \def\textii{A} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{A} + \def\textii{D} + \fi\fi + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} -} - - -% Contributed by Danilo Piazzalunga - -\pgfdeclareshape{buffer} -{ - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{west}{ \northwest \pgf@y=0pt } - \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } - \anchor{north}{ \northwest \pgf@x=0pt } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \savedanchor\left{% - \pgf@y=0pt - } - \anchor{in}{ - \northwest - \pgf@y=0pt - } - \anchor{out}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfscope - \pgfsetlinewidth{2\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} - \pgf@circ@res@step=\pgf@circ@res@right - \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - - } -} - - - - - -\pgfdeclareshape{plain amp} -{ - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{west}{ \northwest \pgf@y=0pt } - \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } - \anchor{north}{ \northwest \pgf@x=0pt } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \savedanchor\left{% - \pgf@y=0pt - } - \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{-}{ - \inOne - } - \anchor{+}{ - \inOne - \pgf@y=-\pgf@y - } - \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/up pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{0pt}} - } - \anchor{up}{ - \up - } - \anchor{down}{ - \up - \pgf@y=-\pgf@y - } - \anchor{out}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - - \pgfscope - \pgfsetlinewidth{2\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} - \pgf@circ@res@step=\pgf@circ@res@right - \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}} - - - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - - - - - } -} - - -%% Draw the two-port fillable box -\def\pgf@circ@twoportbox{ - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgf@circ@draworfill - \endpgfscope + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} } -%% Generic two port box -\pgfcircdeclarebipole +%% DAC +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/twoport/height}} -{twoport} -{\ctikzvalof{bipoles/twoport/height}} -{\ctikzvalof{bipoles/twoport/width}} +{\ctikzvalof{bipoles/dac/width}} +{dac} +{\ctikzvalof{bipoles/dac/width}} +{\ctikzvalof{bipoles/dac/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgf@circ@res@other = \pgf@circ@res@left \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed \pgfsetdash{{0.1cm}{0.1cm}}{0cm} \fi + % draw outer box \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } \fi % rotate inner symbol + \def\texti{D} + \def\textii{A} \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{A} + \def\textii{D} \pgftransformrotate{270} \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{A} + \def\textii{D} \pgftransformrotate{180} \fi\fi \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 \pgftransformrotate{90} + \def\texti{D} + \def\textii{A} \fi\fi % draw inner symbol - \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} } -%% voltage controled oscillator -\pgfcircdeclarebipole +%% DSP +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/vco/width}} -{vco} -{\ctikzvalof{bipoles/twoport/width}} -{\ctikzvalof{bipoles/vco/width}} +{\ctikzvalof{bipoles/dsp/width}} +{dsp} +{\ctikzvalof{bipoles/dsp/width}} +{\ctikzvalof{bipoles/dsp/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3142,15 +3870,13 @@ \ifpgf@circuit@dashed \pgfsetdash{{0.1cm}{0.1cm}}{0cm} \fi - % draw circle - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} - \pgf@circ@draworfill - \endpgfscope + + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3161,35 +3887,26 @@ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 \pgftransformrotate{270} \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 \pgftransformrotate{180} \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 \pgftransformrotate{90} \fi\fi - % draw inner sine waves - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{DSP}} } -%% bandpass filter -\pgfcircdeclarebipole +%% FFT +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/bandpass/width}} -{bandpass} -{\ctikzvalof{bipoles/bandpass/width}} -{\ctikzvalof{bipoles/bandpass/width}} +{\ctikzvalof{bipoles/fft/width}} +{fft} +{\ctikzvalof{bipoles/fft/width}} +{\ctikzvalof{bipoles/fft/width}} { - - \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3205,7 +3922,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3216,125 +3933,172 @@ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 \pgftransformrotate{270} \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 \pgftransformrotate{180} \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 \pgftransformrotate{90} \fi\fi % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} - \pgfusepath{draw} + \pgftext[center,x=0,y=0]{\textsf{FFT}} +} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} +%% Amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{amp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} - \pgfusepath{draw} + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgf@circ@draworfill + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} } -%% bandstop filter -\pgfcircdeclarebipole + +%% variable amplifier +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/bandstop/width}} -{bandstop} -{\ctikzvalof{bipoles/bandstop/width}} -{\ctikzvalof{bipoles/bandstop/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{vamp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen \ifpgf@circuit@dashed \pgfsetdash{{0.1cm}{0.1cm}}{0cm} \fi % draw outer box - \pgf@circ@twoportbox + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + % draw input arrow \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } \fi - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi - % draw inner symbol - \pgfsetdash{}{0pt}% always draw solid line for inner symbol - \pgfsetarrows{-}%never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} - \pgfusepath{draw} + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + + % draw arrow + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} \pgfusepath{draw} } -%% highpass filter -\pgfcircdeclarebipole +%% pi attenuator +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/highpass/width}} -{highpass} -{\ctikzvalof{bipoles/highpass/width}} -{\ctikzvalof{bipoles/highpass/width}} +{\ctikzvalof{bipoles/piattenuator/width}} +{piattenuator} +{\ctikzvalof{bipoles/piattenuator/width}} +{\ctikzvalof{bipoles/piattenuator/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3350,7 +4114,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3361,10 +4125,7 @@ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 \pgftransformrotate{270} \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 \pgftransformrotate{90} \fi\fi @@ -3372,43 +4133,26 @@ \pgfsetdash{}{0pt} % always draw solid line for inner symbol \pgfsetarrows{-} %never draw arrows \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} \pgfusepath{draw} } -%% lowpass filter -\pgfcircdeclarebipole +%% variable pi attenuator +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/lowpass/width}} -{lowpass} -{\ctikzvalof{bipoles/lowpass/width}} -{\ctikzvalof{bipoles/lowpass/width}} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{vpiattenuator} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{\ctikzvalof{bipoles/vpiattenuator/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3424,7 +4168,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3435,10 +4179,7 @@ \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 \pgftransformrotate{270} \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 \pgftransformrotate{90} \fi\fi @@ -3446,43 +4187,31 @@ \pgfsetdash{}{0pt} % always draw solid line for inner symbol \pgfsetarrows{-} %never draw arrows \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} \pgfusepath{draw} } -%% ADC -\pgfcircdeclarebipole +%% T attenuator +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/adc/width}} -{adc} -{\ctikzvalof{bipoles/adc/width}} -{\ctikzvalof{bipoles/adc/width}} +{\ctikzvalof{bipoles/tattenuator/width}} +{tattenuator} +{\ctikzvalof{bipoles/tattenuator/width}} +{\ctikzvalof{bipoles/tattenuator/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3498,53 +4227,42 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } \fi % rotate inner symbol - \def\texti{A} - \def\textii{D} \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \def\texti{D} - \def\textii{A} \pgftransformrotate{270} \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \def\texti{D} - \def\textii{A} - \pgftransformrotate{180} - \fi\fi \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 \pgftransformrotate{90} - \def\texti{A} - \def\textii{D} \fi\fi % draw inner symbol \pgfsetdash{}{0pt} % always draw solid line for inner symbol \pgfsetarrows{-} %never draw arrows \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} \pgfusepath{draw} - - \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} - \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} } -%% DAC -\pgfcircdeclarebipole +%% variable T attenuator +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/dac/width}} -{dac} -{\ctikzvalof{bipoles/dac/width}} -{\ctikzvalof{bipoles/dac/width}} +{\ctikzvalof{bipoles/vtattenuator/width}} +{vtattenuator} +{\ctikzvalof{bipoles/vtattenuator/width}} +{\ctikzvalof{bipoles/vtattenuator/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3560,53 +4278,47 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } \fi % rotate inner symbol - \def\texti{D} - \def\textii{A} \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \def\texti{A} - \def\textii{D} \pgftransformrotate{270} \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \def\texti{A} - \def\textii{D} - \pgftransformrotate{180} - \fi\fi \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 \pgftransformrotate{90} - \def\texti{D} - \def\textii{A} \fi\fi % draw inner symbol \pgfsetdash{}{0pt} % always draw solid line for inner symbol \pgfsetarrows{-} %never draw arrows \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} \pgfusepath{draw} - \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} - \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} } -%% DSP -\pgfcircdeclarebipole +%% phase shifter +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/dsp/width}} -{dsp} -{\ctikzvalof{bipoles/dsp/width}} -{\ctikzvalof{bipoles/dsp/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} +{phaseshifter} +{\ctikzvalof{bipoles/phaseshifter/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3622,7 +4334,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3640,19 +4352,19 @@ \pgftransformrotate{90} \fi\fi - % draw inner symbol - \pgftext[center,x=0,y=0]{\textsf{DSP}} + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} } -%% FFT -\pgfcircdeclarebipole +%% variable phase shifter +\pgfcircdeclarebipolescaled{blocks} {} -{\ctikzvalof{bipoles/fft/width}} -{fft} -{\ctikzvalof{bipoles/fft/width}} -{\ctikzvalof{bipoles/fft/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} +{vphaseshifter} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{\ctikzvalof{bipoles/vphaseshifter/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} @@ -3668,7 +4380,7 @@ \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } @@ -3686,1214 +4398,493 @@ \pgftransformrotate{90} \fi\fi - % draw inner symbol - \pgftext[center,x=0,y=0]{\textsf{FFT}} + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} + \pgfusepath{draw} } -%% Amplifier -\pgfcircdeclarebipole +%% detector +\pgfcircdeclarebipolescaled{blocks} {} +{\ctikzvalof{bipoles/detector/width}} +{detector} +{\ctikzvalof{bipoles/detector/width}} +{\ctikzvalof{bipoles/detector/width}} { - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{amp} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step \ifpgf@circuit@dashed \pgfsetdash{{0.1cm}{0.1cm}}{0cm} \fi % draw outer box - \ifpgf@circuit@boxed - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \pgf@circ@draworfill - \fi + \pgf@circ@twoportbox - % draw input arrow \ifpgf@circuit@inputarrow { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } \fi - \ifpgf@circuit@boxed - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn - \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{0.8\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \ifpgf@circuit@fulldiode + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} \else - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} \fi - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} +} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} - \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} +%%%%%%%%%%%%%%%%%%%%%%% +%% MECHANICAL SYMBOLS +%%%%%%%%%%%%%%%%%%%%%%% - \pgfpathclose - \pgf@circ@draworfill +%% mechanical capacitance - stiffness/spring - % draw inner text - \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} -} +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/spring/height}} +{spring} +{\ctikzvalof{bipoles/spring/height}} +{\ctikzvalof{bipoles/spring/width}}{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16} -%% variable amplifier -\pgfcircdeclarebipole -{} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} } -{vamp} + +%% mechanical inductance - mass +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/mass/box height}} +{mass} +{\ctikzvalof{bipoles/mass/height}} +{\ctikzvalof{bipoles/mass/width}} { - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} } + +%% mechanical resistor - damper +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/damper/height}} +{damper} +{\ctikzvalof{bipoles/damper/height}} +{\ctikzvalof{bipoles/damper/width}} { - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi + \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill - % draw outer box - \ifpgf@circuit@boxed - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi + % line into the damper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {\pgf@circ@res@zero}} + \pgfusepath{stroke} - % draw input arrow - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi + % damper box + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \ifpgf@circuit@boxed - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn - \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box - \else - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \fi + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} +} +%% mechanical viscoelastic element, suggested by @alex +%% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz +\pgfcircdeclarebipolescaled{mechanicals} +{} % extra anchors +{\ctikzvalof{bipoles/damper/height}} % depth (under the path line) +{viscoe} % name +{\ctikzvalof{bipoles/damper/height}} % height (above the path line) +{\ctikzvalof{bipoles/damper/width}} % width +{ % draw the bipole + \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} - \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + % spring into the damper + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}} + \pgfusepath{stroke} + \endpgfscope + % damper box + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} - % draw inner text - \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} - % draw arrow - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} - \pgfusepath{draw} } -%% pi attenuator +%%%%%%%%%%%%%%%% +%% Crossing +%%%%%%%%%%%%%%%% + +%% crossing bipole (but see also nodes) \pgfcircdeclarebipole {} -{\ctikzvalof{bipoles/piattenuator/width}} -{piattenuator} -{\ctikzvalof{bipoles/piattenuator/width}} -{\ctikzvalof{bipoles/piattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 2 +{\ctikzvalof{bipoles/crossing/size}} +{crossing} +{\ctikzvalof{bipoles/crossing/size}} +{\ctikzvalof{bipoles/crossing/size}}{ + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope +} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step +%%%%%%%%%%%%%%%%%%%%%%%%% +%% Miscellaneous bipoles +%%%%%%%%%%%%%%%%%%%%%%%%% - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi +%% loudspeaker and microphone - % draw outer box - \pgf@circ@twoportbox +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/loudspeaker/depth}} +{loudspeaker} +{\ctikzvalof{bipoles/loudspeaker/height}} +{\ctikzvalof{bipoles/loudspeaker/width}}{ - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/mic/depth}} +{mic} +{\ctikzvalof{bipoles/mic/height}} +{\ctikzvalof{bipoles/mic/width}}{ - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}} + % 0.25358 is 0.6-0.4*cos(30) + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope } -%% variable pi attenuator -\pgfcircdeclarebipole +%% european gas filled surge arrester +\pgfcircdeclarebipolescaled{misc} {} -{\ctikzvalof{bipoles/vpiattenuator/width}} -{vpiattenuator} -{\ctikzvalof{bipoles/vpiattenuator/width}} -{\ctikzvalof{bipoles/vpiattenuator/width}} +{\ctikzvalof{bipoles/european gas filled surge arrester/height}} +{european gas filled surge arrester} +{\ctikzvalof{bipoles/european gas filled surge arrester/height}} +{\ctikzvalof{bipoles/european gas filled surge arrester/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 2 - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi + \pgf@circ@draworfill - % draw outer box - \pgf@circ@twoportbox + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi + \endpgfscope +} - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi +%% american gas filled surge arrester +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/american gas filled surge arrester/height}} +{american gas filled surge arrester} +{\ctikzvalof{bipoles/american gas filled surge arrester/height}} +{\ctikzvalof{bipoles/american gas filled surge arrester/width}}{ - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} \pgfusepath{draw} - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% T attenuator -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/tattenuator/width}} -{tattenuator} -{\ctikzvalof{bipoles/tattenuator/width}} -{\ctikzvalof{bipoles/tattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} - % draw outer box - \pgf@circ@twoportbox + \pgfscope + \pgfsetarrowsend{latex} - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope{} - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} + \pgfcircle{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\ctikzvalof{bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\ctikzvalof{bipoles/american gas filled surge arrester/size}\pgf@circ@res@down} + \pgfusepath{fill} } -%% variable T attenuator -\pgfcircdeclarebipole +%% thermocouple +\pgfcircdeclarebipolescaled{misc} {} -{\ctikzvalof{bipoles/vtattenuator/width}} -{vtattenuator} -{\ctikzvalof{bipoles/vtattenuator/width}} -{\ctikzvalof{bipoles/vtattenuator/width}} +{\ctikzvalof{bipoles/thermocouple/height 2}} +{thermocouple} +{\ctikzvalof{bipoles/thermocouple/height}} +{\ctikzvalof{bipoles/thermocouple/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} \pgfusepath{draw} - - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} \pgfusepath{draw} } -%% phase shifter -\pgfcircdeclarebipole +%% fuse +\pgfcircdeclarebipolescaled{misc} {} -{\ctikzvalof{bipoles/phaseshifter/width}} -{phaseshifter} -{\ctikzvalof{bipoles/phaseshifter/width}} -{\ctikzvalof{bipoles/phaseshifter/width}} +{\ctikzvalof{bipoles/fuse/height}} +{fuse} +{\ctikzvalof{bipoles/fuse/height}} +{\ctikzvalof{bipoles/fuse/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - % draw outer box - \pgf@circ@twoportbox + \pgf@circ@draworfill +} - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi +%% asymmetric fuse +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/afuse/height}} +{afuse} +{\ctikzvalof{bipoles/afuse/height}} +{\ctikzvalof{bipoles/afuse/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope - % inner symbol - \pgftext[center,x=0,y=0]{\Large$\varphi$} + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} } -%% variable phase shifter -\pgfcircdeclarebipole +%% SQUID added by Cor Molenaar 5 March 2010 +\pgfcircdeclarebipolescaled{misc} {} -{\ctikzvalof{bipoles/phaseshifter/width}} -{vphaseshifter} -{\ctikzvalof{bipoles/vphaseshifter/width}} -{\ctikzvalof{bipoles/vphaseshifter/width}} +{\ctikzvalof{bipoles/squid/height}} +{squid} +{\ctikzvalof{bipoles/squid/height}} +{\ctikzvalof{bipoles/squid/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 2 + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}} - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi + \pgfusepath{draw} +} - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi +% Generic barrier added by Cor Molenaar 5 March 2010 +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/barrier/height}} +{barrier} +{\ctikzvalof{bipoles/barrier/height}} +{\ctikzvalof{bipoles/barrier/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - % inner symbol - \pgftext[center,x=0,y=0]{\Large$\varphi$} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} \pgfusepath{draw} } -%% detector -\pgfcircdeclarebipole +%% Lamp +\pgfcircdeclarebipolescaled{misc} {} -{\ctikzvalof{bipoles/detector/width}} -{detector} -{\ctikzvalof{bipoles/detector/width}} -{\ctikzvalof{bipoles/detector/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % draw inner stuff - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{0.8\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} - \pgfusepath{draw} - - \ifpgf@circuit@fulldiode - \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width}} - \pgftransformscale{\pgfmathresult} - \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} - \else - \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width}} - \pgftransformscale{\pgfmathresult} - \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} - \fi - -} - - - - -%% european gas filled surge arrester - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/european gas filled surge arrester/height}} -{european gas filled surge arrester} -{\ctikzvalof{bipoles/european gas filled surge arrester/height}} -{\ctikzvalof{bipoles/european gas filled surge arrester/width}} +{\ctikzvalof{bipoles/lamp/height}} +{lamp} +{\ctikzvalof{bipoles/lamp/height}} +{\ctikzvalof{bipoles/lamp/width}} { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - %\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen - %\divide \pgf@circ@res@step by 14 - - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill - - \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfusepath{draw} - - \endpgfscope -} - - - - -%% american gas filled surge arrester - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/american gas filled surge arrester/height}} -{american gas filled surge arrester} -{\ctikzvalof{bipoles/american gas filled surge arrester/height}} -{\ctikzvalof{bipoles/american gas filled surge arrester/width}}{ - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfusepath{draw} - - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} - \pgf@circ@draworfill - \endpgfscope - - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}} \pgfusepath{draw} - - \pgfscope - \pgfsetarrowsend{latex} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfusepath{draw} - \endpgfscope{} - - \pgfcircle{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/size}\pgf@circ@res@down} - \pgfusepath{fill} -} - -% % MECHANICAL SYMBOLS - -%% mechanical capacitance - stiffness/spring - -\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/spring/height}}{spring}{\ctikzvalof{bipoles/spring/height}}{\ctikzvalof{bipoles/spring/width}}{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - - \pgfmathsetlength{\pgf@circ@res@step} - {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} - \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} - \pgfsetbuttcap - \pgfsetbeveljoin - \pgfusepath{stroke} } -%% mechanical inductance - mass -\pgfcircdeclarebipole +%% bulb +\pgfcircdeclarebipolescaled{misc} {} -{\ctikzvalof{bipoles/mass/box height}} -{mass} -{\ctikzvalof{bipoles/mass/height}} -{\ctikzvalof{bipoles/mass/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}} +{\ctikzvalof{bipoles/bulb/height}} +{bulb} +{\ctikzvalof{bipoles/bulb/height}} +{\ctikzvalof{bipoles/bulb/width}} +{% + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}} \pgf@circ@draworfill - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfsetrectcap - \pgfsetmiterjoin - \pgfusepath{stroke} -} - -%% mechanical resistor - damper -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/damper/height}} -{damper} -{\ctikzvalof{bipoles/damper/height}} -{\ctikzvalof{bipoles/damper/width}} -{ - \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgf@circ@maybefill - - % line into the damper \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} - {\pgf@circ@res@zero}} - \pgfusepath{stroke} - - % damper box - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - - \pgfsetrectcap - \pgfsetmiterjoin - \pgfusepath{stroke} - - % damper vertical element - \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} - {.8\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} - {.8\pgf@circ@res@up}} - \pgfsetbuttcap - \pgfusepath{stroke} - -} -%% mechanical viscoelastic element, suggested by @alex -%% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz -\pgfcircdeclarebipole -{} % extra anchors -{\ctikzvalof{bipoles/damper/height}} % depth (under the path line) -{viscoe} % name -{\ctikzvalof{bipoles/damper/height}} % height (above the path line) -{\ctikzvalof{bipoles/damper/width}} % width -{ % draw the bipole - \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgf@circ@maybefill - - % spring into the damper - \pgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}} - \pgfusepath{stroke} - \endpgfscope - % damper box - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - - \pgfsetrectcap - \pgfsetmiterjoin - \pgfusepath{stroke} - - % damper vertical element - \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} - {.8\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} - {.8\pgf@circ@res@up}} - \pgfsetbuttcap - \pgfusepath{stroke} - -} - - -\pgfcircdeclarebipole -{% anchor for labelling the type of dependency - \anchor{label}{% - \southwest - \pgf@x=0.4\pgf@x - }% -} -{\ctikzvalof{bipoles/resistivesens/height}} -{resistivesens} -{\ctikzvalof{bipoles/resistivesens/height}} -{\ctikzvalof{bipoles/resistivesens/width}} -{% - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} - \divide \pgf@circ@res@step by 12 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} - - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} - \advance\pgf@circ@res@other by 2\pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}} - \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfusepath{draw} - - \pgfscope - \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} - \pgfusepath{draw} - \endpgfscope -} - -%% crossing bipole (but see also nodes) -\pgfcircdeclarebipole - {} - {\ctikzvalof{bipoles/crossing/size}} - {crossing} - {\ctikzvalof{bipoles/crossing/size}} - {\ctikzvalof{bipoles/crossing/size}}{ - \pgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} - \pgfsetbeveljoin - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfusepath{draw} - \endpgfscope - } - -%% loudspeaker and microphone - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/loudspeaker/depth}} -{loudspeaker} -{\ctikzvalof{bipoles/loudspeaker/height}} -{\ctikzvalof{bipoles/loudspeaker/width}}{ - - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}} - {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}} - \pgfpathclose - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} - \pgf@circ@draworfill -} - -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/mic/depth}} -{mic} -{\ctikzvalof{bipoles/mic/height}} -{\ctikzvalof{bipoles/mic/width}}{ - - \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} - \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up} - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - \pgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}} - % 0.25358 is 0.6-0.4*cos(30) - \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfusepath{draw} - - \pgfusepath{draw} - \endpgfscope -} - -% generic round meter with always horizontal text, no arrow -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/esource/height}} -{rmeter} -{\ctikzvalof{bipoles/esource/height}} -{\ctikzvalof{bipoles/esource/width}} -{ - \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} - \pgf@circ@draworfill - % draw the text label - % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} - % and unrotate the scope - \pgfscope - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgftransformrotate{\rot} - \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} - \endpgfscope -} - -% generic round meter with always horizontal text, with arrow -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/esource/height}} -{rmeterwa} -{\ctikzvalof{bipoles/esource/height}} -{\ctikzvalof{bipoles/esource/width}} -{ - \pgfpointorigin - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} - \pgf@circ@draworfill - % draw the text label - % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} - % and unrotate the scope - \pgfscope - \pgftransformrotate{\rot} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgfsetlinewidth{\pgfstartlinewidth} - % arrow: create a center hole to have better visual - \pgfscope - % clipping path: first a rectangle bigger then the shape - % to avoid problems with the line thickness - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} - {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} - % next open a circle into it - \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}} - % do the difference and clip before drawing - \pgfseteorule - \pgfusepath{clip} - \pgfsetarrowsend{latexslim} - % the arrow is better if it has a bit of breath and it's not 45º - \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - \pgftext[center]{\ctikzvalof{bipoles/twoport/text}} - \endpgfscope -} - -% generic square meter with always horizontal text -\pgfcircdeclarebipole -{ - \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} - \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} - % put the node text above and centered - \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } -} -{\ctikzvalof{bipoles/smeter/height}} -{smeter} -{\ctikzvalof{bipoles/smeter/height}} -{\ctikzvalof{bipoles/smeter/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\southwest} - \pgfextracty{\pgf@circ@res@down}{\southwest} - \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} - \pgfscope - \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgf@circ@draworfill - \endpgfscope - % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} - % and unrotate the scope - \pgfscope - \pgftransformrotate{\rot} - % the metering window - \pgfscope - \def\@starta{105}\def\@stopa{75} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}} - \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up} - \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} - \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} - \pgfclosepath - \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}} - \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}} - \endpgfscope -} - -% probles qucs style: -% #1 : name -% #2 : extra code -\long\def\pgfcirc@qucsprobe#1#2{ - \pgfcircdeclarebipole - { - \anchor{v+}{\southwest\pgf@x=0.6\pgf@x} - \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x} - % put the node text above and centered - \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } - } - {\ctikzvalof{bipoles/qmeter/depth}} - {#1} - {\ctikzvalof{bipoles/qmeter/height}} - {\ctikzvalof{bipoles/qmeter/width}} - { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\southwest} - \pgfextracty{\pgf@circ@res@down}{\southwest} - \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} - \pgfscope - \pgfscope - \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgf@circ@draworfill - \endpgfscope - \def\@starta{103}\def\@stopa{77} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfscope - \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}} - \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up} - \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} - \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} - \pgfclosepath - \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}} - \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgf@circ@draworfill - \endpgfscope - #2 - \endpgfscope - } -} - -\pgfcirc@qucsprobe{qiprobe}{ - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfusepath{draw} - \pgfnode{currarrow}{center}{}{}{} -} - -\pgfcirc@qucsprobe{qvprobe}{ - \pgfmathsetlength{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}} - \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} - \pgfusepath{draw} - \pgfscope - % "+" and "-", drawn so that they scale correctly - \pgfsetlinewidth{2\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} - \pgfusepath{draw} - \endpgfscope -} - -\pgfcirc@qucsprobe{qpprobe}{ - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfusepath{draw} - \pgfnode{currarrow}{center}{}{}{} - \pgfmathsetlength{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfscope - % "+" and "-", drawn so that they scale correctly - \pgfsetlinewidth{2\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfusepath{draw} - \endpgfscope -} - - -% current loop for oscope and similar: stylized - -\pgfcircdeclarebipole -{ - \anchor{i}{\northeast\pgf@x=0pt\relax} - \anchor{text}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } -} -{\ctikzvalof{bipoles/iloop/height}} -{iloop} -{\ctikzvalof{bipoles/iloop/height}} -{\ctikzvalof{bipoles/iloop/width}} -{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@down=-\pgf@circ@res@up - \pgf@circ@res@left=-\pgf@circ@res@right - \pgfscope - \pgfstartlinewidth=\pgflinewidth - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - % external ellipse - \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} - % clipping path: first a rectangle bigger then the shape - % to avoid problems with the line thickness - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} - {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} - % next the opening to the left - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} - {\pgfpoint{0pt}{.1\pgf@circ@res@up}} - % do the difference and clip before drawing - \pgfseteorule - \pgfusepath{clip} - \pgfpathellipse{\pgfpointorigin}{ - \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ - \pgfpoint{0.4\pgf@circ@res@right}{0pt}} - \pgfusepath{draw} - \endpgfscope - % internal wire - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - % and the contact line up - \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope -} - - -% current loop for oscope and similar: real (double connection) - -\pgfcircdeclarebipole -{ - \anchor{i+}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgf@y=\pgf@circ@res@up - } - \anchor{i-}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgf@y=\pgf@circ@res@up - } - \anchor{text}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } -} -{\ctikzvalof{bipoles/iloop/height}} -{iloop2} -{\ctikzvalof{bipoles/iloop/height}} -{\ctikzvalof{bipoles/iloop/width}} -{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@down=-\pgf@circ@res@up - \pgf@circ@res@left=-\pgf@circ@res@right - % must be the same than internal i+ and i- anchors definition - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} - \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} - \pgfscope - \pgfstartlinewidth=\pgflinewidth - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - % external ellipse - \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} - % clipping path: first a rectangle bigger then the shape - % to avoid problems with the line thickness - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} - {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} - % next the opening to the left - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} - {\pgfpoint{0pt}{.1\pgf@circ@res@up}} - % do the difference and clip before drawing - \pgfseteorule - \pgfusepath{clip} - \pgfpathmoveto{\@plus} - \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfusepath{draw} - \endpgfscope - % internal wire - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - % and the contact line up - % I use ...left and ---right as temporal lengths here to avoid defining more - \pgfextractx{\pgf@circ@res@left}{\@plus} - \pgfextractx{\pgf@circ@res@right}{\@minus} - \pgfpathmoveto{\@plus} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathmoveto{\@minus} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex index 4dc91d9eb66..0d14585846c 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex @@ -272,9 +272,9 @@ \fi% } -\ctikzset{text/.style = { t=#1 } } -\ctikzset{t/.code = { - \ctikzsetvalof{bipoles/twoport/text}{#1} +\ctikzset{text/.style={t=#1}} +\ctikzset{t/.code={% + \ctikzsetvalof{bipoles/twoport/text}{#1}% }} %%%% Stacked labels diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex index c6fe8bfdb29..88ca4711daf 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex @@ -9,6 +9,12 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Monopoles +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%% +%% Grounds +%%%%%%%%%%%%% + %% Ground symbol % #1 -> name @@ -17,10 +23,13 @@ % #4 -> code \long\def\pgf@circ@declareground#1#2#3#4{ \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\southeast}{ - \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen \pgf@x=#2\pgf@x - \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen \pgf@y=-#3\pgf@y } \anchor{north}{\pgfpointorigin} @@ -35,7 +44,8 @@ \anchor{right}{\pgfpointorigin} \anchor{center}{\pgfpointorigin} \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen \pgfscope \pgfstartlinewidth=\pgflinewidth #4 @@ -50,7 +60,7 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} @@ -61,7 +71,7 @@ } \pgf@circ@declareground{tlground}{0.6}{0.4}{ - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} @@ -78,7 +88,7 @@ \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\ctikzvalof{monopoles/rground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} @@ -90,7 +100,7 @@ \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} @@ -103,7 +113,7 @@ \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} @@ -118,7 +128,7 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} @@ -133,11 +143,14 @@ % protective ground \pgf@circ@declareground{pground}{0.9}{1.8}{ + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step} + \pgf@circ@draworfill \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} @@ -145,8 +158,6 @@ \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} \pgfusepath{draw} - \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step} - \pgfusepath{draw} } % chassis ground @@ -155,7 +166,7 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} @@ -166,14 +177,14 @@ } % Contributed by @fotesan https://github.com/fotesan - +% european ground \pgf@circ@declareground{eground}{1.1}{1.7}{ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} @@ -197,7 +208,7 @@ \pgfusepath{draw} \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/monopoles/tground/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} @@ -213,13 +224,148 @@ \pgfusepath{draw} } +%%%%%%%%%%%%%%%%%% +%% Power supplies +%%%%%%%%%%%%%%%%%% + +% Vcc +\pgfdeclareshape{vcc}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080 + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}% + } + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=3\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{south}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=2\pgf@circ@res@step + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +% Vee +\pgfdeclareshape{vee}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080 + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}% + } + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=-3\pgf@x% + } + \anchor{south}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{north}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{south east}{\northeast} + \anchor{south west}{\northeast\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@y=0pt\relax} + \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=-2\pgf@circ@res@step + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +%%%%%%%%%%%%%%%% +%% RF elements +%%%%%%%%%%%%%%%% + +% Legacy tlinestub % Contributed by Leonardo Azzinnari \pgfdeclareshape{tlinestub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\northeast}{% - \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen - \pgf@x=1.625\pgf@circ@res@step - \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen - \pgf@y=.25\pgf@circ@res@step% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@x=1.2\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@y=.2\pgf@circ@res@step% } % the center is on the left side of the shape for facility of usage \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} @@ -234,7 +380,9 @@ \behindforegroundpath{ \pgfstartlinewidth=\pgflinewidth - \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@circ@res@step=0.6\pgf@circ@scaled@Rlen \pgfscope\begin{pgftransparencygroup} \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} @@ -243,7 +391,7 @@ \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step} \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgf@circ@draworfill \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} \pgfusepath{draw} @@ -256,13 +404,14 @@ %% New antennas without tails -% main body +% main body of antennas \def\pgf@circ@antennabody{% \pgfstartlinewidth=\pgflinewidth - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}} @@ -296,12 +445,14 @@ \endpgfscope } - % additional shape with the waves \pgfdeclareshape{waves}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step \pgf@y=\pgf@circ@res@step } @@ -322,9 +473,10 @@ \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} \anchor{north west}{\northeast\pgf@x=-\pgf@x} \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen \pgf@circ@res@step=0.5\pgf@circ@res@step - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfscope % define a triangle for clipping the waves \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}} @@ -347,9 +499,12 @@ % the three types of antennas: simple, TX, RX. Notice that you can flip them... \pgfdeclareshape{bareantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step \pgf@y=2\pgf@circ@res@step } @@ -377,12 +532,21 @@ } \pgfdeclareshape{bareTXantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step \pgf@y=2\pgf@circ@res@step } + \savedanchor{\savedwaves}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x @@ -390,12 +554,7 @@ \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax } - \anchor{waves}{ - \northeast - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen - \pgf@x=4.2\pgf@circ@res@step - \pgf@y=\pgf@circ@res@step - } + \anchor{waves}{\savedwaves} \anchor{top}{\northeast\pgf@x=0pt} \anchor{right}{\northeast\pgf@y=0.5\pgf@y} \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} @@ -415,24 +574,28 @@ } \pgfdeclareshape{bareRXantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step \pgf@y=2\pgf@circ@res@step } + \savedanchor{\savedwaves}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=-4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax } - \anchor{waves}{ - \northeast - \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@Rlen - \pgf@x=-4.2\pgf@circ@res@step - \pgf@y=\pgf@circ@res@step - } + \anchor{waves}{\savedwaves} \anchor{top}{\northeast\pgf@x=0pt} \anchor{right}{\northeast\pgf@y=0.5\pgf@y} \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} @@ -455,16 +618,20 @@ % Microstrip monopoles \pgfdeclareshape{mslstub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\southeast}{ - \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x - \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen \pgf@y=-.5\pgf@y } \savedanchor{\northwest}{ - \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen \pgf@x=-.5\pgf@x - \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y } \anchor{north}{\northwest\pgf@x=0pt\relax} @@ -493,7 +660,7 @@ \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} \pgfstartlinewidth=\pgflinewidth \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope @@ -501,15 +668,19 @@ } \pgfdeclareshape{msrstub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\southeast}{ - \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x \pgf@y=0pt\relax } \savedanchor{\northwest}{ - \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen \pgf@x=-.5\pgf@x - \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y } \anchor{north}{\northwest\pgf@x=0pt\relax} @@ -541,29 +712,32 @@ \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}} \pgfusepath{draw} - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}} \pgfpatharc{135}{45}{\pgf@circ@res@step} \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}} \pgfpatharc{45}{135}{\pgf@circ@res@up} \pgfclosepath - % \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope } } \pgfdeclareshape{msport}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\southeast}{ - \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x - \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen \pgf@y=-.5\pgf@y } \savedanchor{\northwest}{ - \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen \pgf@x=-.5\pgf@x - \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y } \anchor{north}{\northwest\pgf@x=0pt\relax} @@ -592,7 +766,7 @@ \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up} \pgfstartlinewidth=\pgflinewidth \pgfscope - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} @@ -603,29 +777,32 @@ \endpgfscope } } -% Legacy antennas (with tails) +% Legacy antennas (with tails) \def\pgf@circ@shift@antenna@xy#1#2{% - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step \relax} +% Legacy antenna \pgfdeclareshape{antenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth \pgf@y=4\pgf@circ@res@step } - \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}} - \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax} - \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax} - \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}} - \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{0}{2}} - \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} - \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}} - \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}} \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x @@ -633,7 +810,8 @@ } \behindforegroundpath{ \pgfstartlinewidth=\pgflinewidth - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen \pgftransformxshift{ -4\pgf@circ@res@step } @@ -648,8 +826,8 @@ \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfusepath{draw} \endpgfscope \pgfsetlinewidth{\pgfstartlinewidth} @@ -657,22 +835,25 @@ } } - +% Legacy TX antenna \pgfdeclareshape{txantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth \pgf@y=4\pgf@circ@res@step } - \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} - \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} - \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} - \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} - \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{4}{2}} - \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} - \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} - \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x @@ -680,7 +861,8 @@ } \behindforegroundpath{ \pgfstartlinewidth=\pgflinewidth - \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} @@ -695,8 +877,8 @@ \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfusepath{draw} \endpgfscope \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}} @@ -715,22 +897,25 @@ } } - +% Legacy RX antenna \pgfdeclareshape{rxantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor{\northeast}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth \pgf@y=4\pgf@circ@res@step } - \anchor{north}{\northeast\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} - \anchor{east}{\northeast\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} - \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} - \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} - \anchor{north east}{\northeast\pgf@circ@shift@antenna@xy{4}{2}} - \anchor{north west}{\northeast\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} - \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} - \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} \anchor{text}{ \northeast \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x @@ -738,7 +923,8 @@ } \behindforegroundpath{ \pgfstartlinewidth=\pgflinewidth - \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} @@ -753,8 +939,8 @@ \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfusepath{draw} \endpgfscope @@ -770,115 +956,18 @@ \pgfpatharc{150}{210}{2\pgf@circ@res@step} \pgfusepath{draw} \pgfsetlinewidth{\pgfstartlinewidth} - } } -% Vcc -\pgfdeclareshape{vcc}{ - \savedanchor{\northeast}{% - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@circ@res@step - \pgf@y=3\pgf@x% - } - \anchor{north}{\northeast\pgf@x=0cm\relax} - \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} - \anchor{south}{\pgfpointorigin} - \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} - \anchor{north east}{\northeast} - \anchor{north west}{\northeast\pgf@x=-\pgf@x} - \anchor{south east}{\northeast\pgf@y=0pt\relax} - \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} - \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} - \pgf@x=0pt - \pgf@y=2\pgf@circ@res@step - \advance \pgf@y by 0.5\ht\pgfnodeparttextbox - \pgf@x=-.5\wd\pgfnodeparttextbox - } - \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgfscope - \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy} - \ifx\pgf@temp\pgf@circ@temp - \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - \else - \pgfsetarrowsend{\pgf@circ@temp} - \fi - \pgfpathmoveto{\pgfpointorigin} - \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}} - \pgfusepath{draw} - \endpgfscope - } -} - -% Vee -\pgfdeclareshape{vee}{ - \savedanchor{\northeast}{% - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@circ@res@step - \pgf@y=-3\pgf@x% - } - \anchor{south}{\northeast\pgf@x=0cm\relax} - \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} - \anchor{north}{\pgfpointorigin} - \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} - \anchor{south east}{\northeast} - \anchor{south west}{\northeast\pgf@x=-\pgf@x} - \anchor{north east}{\northeast\pgf@y=0pt\relax} - \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} - \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} - \pgf@x=0pt - \pgf@y=-2\pgf@circ@res@step - \advance \pgf@y by -1.5\ht\pgfnodeparttextbox - \pgf@x=-.5\wd\pgfnodeparttextbox - } - - \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen - \pgfscope - \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy} - \ifx\pgf@temp\pgf@circ@temp - - \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \else - \pgfsetarrowsend{\pgf@circ@temp} - \fi - \pgfpathmoveto{\pgfpointorigin} - \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} - \pgfusepath{draw} - \endpgfscope - } -} - -% match +% Legacy match \pgfdeclareshape{match}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor{\northeast}{% - \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen \pgf@x=2\pgf@circ@res@step - \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@Rlen + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen \pgf@y=.5\pgf@circ@res@step% } % the center is on the left side of the shape for facility of usage @@ -894,13 +983,15 @@ \pgfpointorigin } \anchor{text}{ - \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen \pgf@x=1.5\pgf@x \advance \pgf@x by -.5\wd\pgfnodeparttextbox \pgf@y=-1.5\ht\pgfnodeparttextbox } \behindforegroundpath{ - \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen \pgfscope \pgfpathmoveto{\pgfpointorigin} @@ -913,7 +1004,6 @@ \pgfusepath{fill} \pgfsetlinewidth{\pgfstartlinewidth} - \endpgfscope } } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex index 04734a19543..ab2b0d4e77a 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex @@ -12,7 +12,11 @@ %% Multipoles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% counters for pin accounting... +%%%%%%%%% +%% Chips +%%%%%%%%% + +% let's use the same shifts everywhere, no magic numbers \def\pgf@circ@dip@pin@shift{0.5} \def\pgf@circ@qfp@pin@shift{0.25} @@ -25,8 +29,10 @@ % DIP (dual in line package) chips \pgfdeclareshape{dipchip}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro\numpins{% - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins}% + \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}% \def\numpins{\the\pgf@circ@count@a} } \savedanchor\centerpoint{% @@ -38,17 +44,25 @@ \anchor{center}{\origin} \anchor{text}{\centerpoint}% to adjust text \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@x{((\numpins) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}% + *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}% }% - \saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}}} - \saveddimen{\width}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}}} - \saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}} + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} % standard anchors \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@y{0.5*((\numpins) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}% - \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}} + *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}} } \anchor{dot}{\northwest \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} @@ -77,10 +91,11 @@ \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}\pgf@circ@Rlen - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen \pgfscope% (for the line width) - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% \pgf@circ@draworfill %% upside mark @@ -89,7 +104,7 @@ \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left} \fi \pgfusepath{stroke}% - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} % Adding the pin number \ifpgf@circuit@chip@shownumbers \pgf@circ@count@a=\numpins\relax @@ -104,7 +119,7 @@ \pgfmathsetmacro{\quadrant}{0} \fi \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} - \def\mytext{\pgfkeysvalueof{/tikz/circuitikz/multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} \pgfmathloop% \ifnum\pgf@circ@count@a>0 \ifcase\quadrant % rotation 0 @@ -158,12 +173,12 @@ \endpgfscope \ifdim\pgf@circ@res@other>0pt \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth} + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} \pgf@circ@count@a=\numpins\relax \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a \pgfmathloop% \ifnum\pgf@circ@count@a>0 - \edef\padfrac{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pad fraction}} + \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}} \ifnum\padfrac>0 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac % left side pads @@ -214,8 +229,10 @@ % QFP (quad flat package) chips \pgfdeclareshape{qfpchip}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro\numpins{% - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}% + \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}% \def\numpins{\the\pgf@circ@count@a} } \savedanchor\centerpoint{% @@ -227,19 +244,26 @@ \anchor{center}{\origin} \anchor{text}{\centerpoint}% to adjust text \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@x{((\numpins+2) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% }% \saveddimen\width{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@x{((\numpins+2) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% }% - \saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}}} - \saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}} + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} % standard anchors \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgfmathsetlength\pgf@y{0.5*((\numpins+2) - *\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}% + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% \pgf@x=-\pgf@y } \anchor{dot}{\northwest @@ -269,10 +293,11 @@ \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}\pgf@circ@Rlen - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen \pgfscope% (for the line width) - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} %% upside mark \ifpgf@circuit@chip@topmark \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}} @@ -287,7 +312,7 @@ \pgfpathclose \pgf@circ@draworfill % Adding the pin number - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifpgf@circuit@chip@shownumbers \pgf@circ@count@a=\numpins% \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a @@ -301,7 +326,7 @@ \pgfmathsetmacro{\quadrant}{0} \fi \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} - \def\mytext{\pgfkeysvalueof{/tikz/circuitikz/multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} \pgfmathloop% \ifnum\pgf@circ@count@a>0 \ifcase\quadrant % rotation 0 @@ -395,12 +420,12 @@ \endpgfscope \ifdim\pgf@circ@res@other>0pt \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth} + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} \pgf@circ@count@a=\numpins% \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a \pgfmathloop% \ifnum\pgf@circ@count@a>0 - \edef\padfrac{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pad fraction}} + \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}} \ifnum\padfrac>0 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac % left side pads @@ -498,53 +523,62 @@ \fi } - +%%%%%%%%%%%%%%%%% %% Rotary Switch +%%%%%%%%%%%%%%%%% \pgfdeclareshape{rotaryswitch} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northeast{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt % the magic number is 0.25/cos(35) % try to recalculate it for the actual switch - \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=.3052\pgf@circ@res@temp \edef\a{\ctikzvalof{multipoles/rotary/angle}} \edef\r{\ctikzvalof{nodes width}} - \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@Rlen + \pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp} } \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt % the magic number is 0.25/cos(35) % try to recalculate it for the actual switch - \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=.3052\pgf@circ@res@temp \edef\a{\ctikzvalof{multipoles/rotary/angle}} \edef\r{\ctikzvalof{nodes width}} - \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp} } \savedanchor\central{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt % the magic number is 0.25/cos(35) % try to recalculate it for the actual switch - \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=.3052\pgf@circ@res@temp \edef\a{\ctikzvalof{multipoles/rotary/angle}} \edef\r{\ctikzvalof{nodes width}} - \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp} } % external square limits \savedanchor\extnorthwest{% - \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35) \pgf@x=2.5\pgf@x % external square size \pgf@y=-\pgf@x %square thing when angle=180? } - \saveddimen{\width}{\pgfmathsetlength\pgf@x{0.3052*\pgf@circ@Rlen*\ctikzvalof{tripoles/spdt/width}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}} % radius of the connector % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} @@ -590,7 +624,7 @@ \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgf@circ@res@right = \width \pgf@circ@res@left = -\width @@ -607,7 +641,7 @@ \ifpgf@circ@rotaryarrow \pgfscope % arrow \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node \pgftransformrotate{\wiper} \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}} @@ -679,9 +713,13 @@ \advance\pgf@x by -\pgf@circ@res@temp } +%%%%%%%%%%%%%%%%%%%%%%%%%% % Seven segments displays +%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfdeclareshape{bare7seg}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}} \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness \ifpgf@circ@sevenseg@dot @@ -692,29 +730,34 @@ } % The object extension is more or less (-width/2,-width) to (width/2,width) % and adjusted for line thickness (both sides) and eventually the dot - \saveddimen{\width}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}} \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}} \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}} \savedanchor{\southwest}{% both negative - \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} - \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} } \savedanchor{\northeast}{% both positive + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \ifpgf@circ@sevenseg@dot \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}} \else \pgf@circ@res@other=0pt \fi - \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}} - \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}} } \savedanchor{\topright}{% anchor without the box sep and the thickness - \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen} } \anchor{center}{\pgfpointorigin} \anchor{north west}{\southwest\pgf@y=-\pgf@y} @@ -740,8 +783,8 @@ \pgf@circ@res@right = \pgf@x \pgf@circ@res@left = -\pgf@x \pgfscope - \pgfsetlinewidth{\ctikzvalof{multipoles/thickness}\pgflinewidth} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfsetcolor{\ctikzvalof{color}} \pgfpathrectanglecorners% {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex index bc10b95dc44..0c9bfc12093 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex @@ -59,6 +59,7 @@ %% Generic bipole path +%% I am not user what the second argument is needed for \def\pgf@circ@bipole@path#1#2{ \pgfextra{ @@ -70,7 +71,7 @@ \def\pgf@circ@temp{} \ifx\pgf@temp\pgf@circ@temp % if it has not a name \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} - \ctikzset{bipole/name = #2\pgf@circ@rand} % create it + \ctikzset{bipole/name = #1\pgf@circ@rand} % create it (re-usage should not create problem, but...) \fi } @@ -278,6 +279,7 @@ \def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}} \def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}} \def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} +\def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}} \def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} \def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} \def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} @@ -404,6 +406,7 @@ \compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} \compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} \compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} \compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} \compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} \compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} @@ -638,6 +641,7 @@ \compattikzset{vsource/.style = {\comnpatname voltage source = #1}} \compattikzset{isource/.style = {\comnpatname current source = #1}} \compattikzset{cisource/.style = {\comnpatname controlled current source = #1}} +\compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}} \compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}} \compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}} \compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}} @@ -792,7 +796,7 @@ \def\pgf@circ@trans@path#1#2{ \pgfextra{ - \edef\pgf@temp{\pgfkeysvalueof{/tikz/circuitikz/bipole/name}} + \edef\pgf@temp{\ctikzvalof{bipole/name}} \def\pgf@circ@temp{#2} \ifx\pgf@temp\pgf@circ@temp % if it has not a name \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} @@ -823,6 +827,7 @@ (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left) (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center) \fi + \drawpoles \pgfextra{ \pgfcircresetpath } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex index fc9960b4a09..1ab0f935b6d 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex @@ -13,6 +13,8 @@ \long\def\pgfcircdeclarequadpole#1#2#3{ \pgfdeclareshape{#1} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{ \northwest \pgf@x=0pt @@ -20,10 +22,50 @@ } \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=.5\pgf@circ@Rlen - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + \pgf@x=.5\pgf@circ@scaled@Rlen + \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x + } + %% we define the upper right (positive coord) dot (which is B1) + \savedanchor{\innerdot}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=.5\pgf@circ@scaled@Rlen + \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa + % by default use the cute inductor size + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2} + % check if it's american + \edef\pgf@circ@temp{\ctikzvalof{inductor}} + \edef\pgf@temp{american} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2} + \fi + % check if it's european + \edef\pgf@temp{european} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2} + \fi + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen} + } + \savedanchor{\outerdot}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=.5\pgf@circ@scaled@Rlen + \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa + % by default use the cute inductor size + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2} + % check if it's american + \edef\pgf@circ@temp{\ctikzvalof{inductor}} + \edef\pgf@temp{american} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2} + \fi + % check if it's european + \edef\pgf@temp{european} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2} + \fi + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen} } \anchor{A2}{ \northwest @@ -41,56 +83,16 @@ \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - %% notice for the dot anchors: I use the cute inductors as reference - %% size; if you change one you have to change all of them. - \anchor{inner dot A1}{ - \northwest - \pgfmathsetlength\pgf@x{\stretto*\pgf@x + - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} - } - \anchor{outer dot A1}{ - \northwest - \pgfmathsetlength\pgf@x{\stretto*\pgf@x - - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} - } - \anchor{inner dot A2}{ - \northwest - \pgfmathsetlength\pgf@x{\stretto*\pgf@x + - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} - } - \anchor{outer dot A2}{ - \northwest - \pgfmathsetlength\pgf@x{\stretto*\pgf@x - - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} - } - \anchor{inner dot B1}{ - \northwest - \pgfmathsetlength\pgf@x{-\stretto*\pgf@x - - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} - } - \anchor{outer dot B1}{ - \northwest - \pgfmathsetlength\pgf@x{-\stretto*\pgf@x + - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{0.5*\pgf@circ@Rlen} - } - \anchor{inner dot B2}{ - \northwest - \pgfmathsetlength\pgf@x{-\stretto*\pgf@x - - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} - } - \anchor{outer dot B2}{ - \northwest - \pgfmathsetlength\pgf@x{-\stretto*\pgf@x + - \ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@Rlen/2} - \pgfmathsetlength\pgf@y{-0.5*\pgf@circ@Rlen} - } + %% dot's anchors + \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x} + \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x} + \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{inner dot B1}{\innerdot} + \anchor{outer dot B1}{\outerdot} + \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y} + \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y} + % geographical \anchor{north}{ \northwest \pgf@x=0pt @@ -131,7 +133,7 @@ } #3 \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y @@ -145,34 +147,34 @@ \def\pgf@circ@drawtransformerbasicanchor{ - \pgfkeysvalueof{/tikz/circuitikz/quadpoles/trans/height} + \ctikzvalof{quadpoles/trans/height} \anchor{AA2}{ \northwest - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x \pgf@x=.7\pgf@x \pgf@y=-\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } \anchor{BB1}{ \northwest \pgf@x=-\pgf@x - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x \pgf@x=.7\pgf@x - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } \anchor{AA1}{ \northwest - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x \pgf@x=.7\pgf@x - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } \anchor{BB2}{ \northwest \pgf@x=-\pgf@x - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/width1}\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x \pgf@x=.7\pgf@x \pgf@y=-\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/transformer/height1}\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } } @@ -282,7 +284,7 @@ {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% } - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgfusepath{draw} }{\pgf@circ@drawtransformerbasicanchor} @@ -301,35 +303,665 @@ \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{.7*\stretto\pgf@circ@res@down}} - \pgfpatharc{90}{270}{.7*\stretto\pgf@circ@res@down} - - \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{.7*\stretto\pgf@circ@res@up}} - \pgfpatharc{-90}{90}{.7*\stretto\pgf@circ@res@down} - \pgfusepath{draw} + \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}} + \pgfpatharc{-90}{90}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpatharc{90}{270}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill }{} -%% four-port -% defines a general outer box for four-ports -% TikZ usage: -% \draw (0,0) node[coupler](coup){\SI{-3}{dB}} -% (coup.port1) to[short,-o] ++(-1,0) -% +%%%%%%%%%%%%%%%%%%%% +%% Block elements +%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{mixer} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{adder} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + } +} + +\pgfdeclareshape{oscillator} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \else + \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{north}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y} + \anchor{north east}{ \northwest \pgf@x=0pt\relax} + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{text}{ + \pgf@x=-2\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east" + + % draw outer box + \ifpgf@circuit@boxed{} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner sine waves + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{circulator} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{3}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed{} + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % inner arrow + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}} + \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } + } + + +% Wilkinson divider +\pgfdeclareshape{wilkinson}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x + } + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{out2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + % draw inner resisitor - european or american style is recognised + { + \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgftransformrotate{90} + + % calculate size of resistor + \ifpgf@circuit@europeanresistor + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \else + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \fi + } + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}} + + \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +%% couplers generics \long\def\pgfcircdeclarefourport#1#2{ + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{ \northwest \pgf@x=0pt \pgf@y=0pt } \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=.5\pgf@circ@Rlen - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + \pgf@x=.5\pgf@circ@scaled@Rlen + \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x } \anchor{north}{ \northwest @@ -408,20 +1040,21 @@ \pgf@x=-.5\wd\pgfnodeparttextbox } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen \pgfstartlinewidth=\pgflinewidth % draw outer box - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfusepath{draw} + \pgf@circ@draworfill % draw inner stuff #2 @@ -435,7 +1068,6 @@ % four-port \pgfcircdeclarefourport{fourport}{} - % straight coupler \pgfcircdeclarefourport{coupler}{ \pgfsetlinewidth{\pgfstartlinewidth} @@ -490,398 +1122,3 @@ \endpgfscope } -% contrib Kristofer M. Monisit - -\pgfdeclareshape{fd op amp} -{ - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \savedanchor\outline{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi - } - \anchor{south}{ - \northwest - \pgf@y=-\pgf@y\pgf@x=0pt\relax - } - \anchor{north}{ - \northwest\pgf@x=0pt\relax - } - \savedanchor\left{% - \pgf@y=0pt - } - \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{in up}{ - \inOneFixed - } - \anchor{in down}{ - \inOneFixed - \pgf@y=-\pgf@y - } - \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi - } - \anchor{-}{ - \inOne - } - \anchor{+}{ - \inOne - \pgf@y=-\pgf@y - } - \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/up pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{0pt}} - } - \anchor{up}{ - \up - } - \anchor{down}{ - \up - \pgf@y=-\pgf@y - } - \anchor{out up}{ - \northwest - \pgf@y=.5\pgf@y - \pgf@x=-.7\pgf@x - } - \anchor{out down}{ - \northwest - \pgf@y=-.5\pgf@y - \pgf@x=-.7\pgf@x - } - \anchor{out +}{ - \outline - \pgf@y=.5\pgf@y - \pgf@x=-.7\pgf@x - } - \anchor{out -}{ - \outline - \pgf@y=-.5\pgf@y - \pgf@x=-.7\pgf@x - } - \anchor{west}{ - \left - } - \anchor{east}{ - \left - \pgf@x=-.7\pgf@x - } - - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-.7\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-.7\pgf@x \pgf@y=-\pgf@y } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - - % Triangle - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} - \pgf@circ@res@step=\pgf@circ@res@right - \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - % Negative input terminal - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} - - % Positive input terminal - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} - - % Negative output terminal - \pgfpathmoveto{\pgfpoint - {0.7\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{0.3\pgf@circ@res@left}{.3\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@oplusup$-$\else$+$\fi} - - % Positive output terminal - \pgfpathmoveto{\pgfpoint - {0.7\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{0.3\pgf@circ@res@left}{.3\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/font} \ifpgf@circuit@oa@oplusup$+$\else$-$\fi} - - \pgfsetrectcap - % Draw them all! - \pgfusepath{draw} - - } -} - - -%% instrumentation amplifier diff output - -\pgfdeclareshape{fd inst amp} -{ - % when tikz calls the anchor it wants the relative position in the lengths - % \pgf@x \pgf@y - % \pgfpoint* functions set that variables - % anchors are visible outside and run on use - \anchor{center}{\pgfpointorigin} - % savedanchors are internals and run on node creation (not use) - % bounding-box top left - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{nw}{ - \northwest - } - \anchor{south}{ - \northwest - \pgf@y=-\pgf@y\pgf@x=0pt\relax - } - \anchor{north}{ - \northwest\pgf@x=0pt\relax - } - \savedanchor\left{% - \pgf@y=0pt - } - \anchor{leftedge} - {\left - \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x - } - \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{in up}{ - \inOneFixed - } - \anchor{in down}{ - \inOneFixed - \pgf@y=-\pgf@y - } - \savedanchor\inOne{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi - } - \anchor{-}{ - \inOne - } - \anchor{+}{ - \inOne - \pgf@y=-\pgf@y - } - \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/up pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} - } - \anchor{up}{ - \up - } - \anchor{down}{ - \up - \pgf@y=-\pgf@y - } - % reference voltage input anchors. - \savedanchor\refv{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/refv pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} - } - % we need both because they are normally drawn under the amp, and if you - % mirror it vertically you need them - \anchor{refv up}{ - \refv - } - \anchor{refv down}{ - \refv - \pgf@y=-\pgf@y - } - \savedanchor\outport{ - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=-.5\pgf@x - \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi - } - \anchor{out}{ - \outport - \pgf@y=0pt - } - \anchor{out +}{ - \outport - } - \anchor{out -}{ - \outport - \pgf@y=-\pgf@y - } - \savedanchor\outportfixed{ - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/width}\pgf@circ@Rlen - \pgf@x=-.5\pgf@x - } - \anchor{out up}{ - \outportfixed - } - \anchor{out down}{ - \outportfixed - \pgf@y=-\pgf@y - } - % - \anchor{west}{ - \left - } - \anchor{east}{ - \left - \pgf@x=-\pgf@x - } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - - % let's start drawing the component - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - % - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - % main component, normally in thicker lines - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} - \pgf@circ@res@step=\pgf@circ@res@right - \advance\pgf@circ@res@step by -\pgf@circ@res@left - \pgf@circ@res@step=.7\pgf@circ@res@step - %first point (near output) - \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} - %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@up}} - % and then to the input "front up", "down", to the output short side "down" - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.6\pgf@circ@res@down}} - % ...and close - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - % input terminal up - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} - % - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} - % - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} - - % input terminal down - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} - % - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} - % output leads down and up - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}} % - \pgftext[right, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}} % - \pgftext[right, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/port width}\pgf@circ@res@right}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi} - % - \pgfsetrectcap - \pgfusepath{draw} - } -} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex index 657d0664f60..fdaad445ce1 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex @@ -38,7 +38,7 @@ \pgfpointorigin } \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgf@x=-\pgf@y } \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } @@ -58,13 +58,13 @@ \pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} - }{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}} } \behindforegroundpath{ \pgfscope - \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\ctikzvalof{color}} \pgfsetfillopacity{1.0} \pgfusepath{draw,fill} \endpgfscope @@ -79,7 +79,7 @@ \pgfpointorigin } \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgf@x=-\pgf@y } \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } @@ -99,16 +99,21 @@ \pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} - }{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}} } \behindforegroundpath{ \pgfscope - \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\ctikzvalof{color}} \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white \pgfsetfillcolor{white} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} \else \pgfsetfillcolor{\tikz@fillcolor} \fi @@ -165,7 +170,7 @@ \pgfpathrectanglecorners {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfsetfillopacity{1.0} \pgfusepath{draw,fill} \endpgfscope @@ -218,9 +223,14 @@ \pgfpathrectanglecorners {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white \pgfsetfillcolor{white} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} \else \pgfsetfillcolor{\tikz@fillcolor} \fi @@ -267,7 +277,7 @@ \pgfpathrectanglecorners {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfsetfillopacity{1.0} \pgfusepath{draw,fill} \endpgfscope @@ -310,9 +320,14 @@ \pgfpathrectanglecorners {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white \pgfsetfillcolor{white} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} \else \pgfsetfillcolor{\tikz@fillcolor} \fi @@ -329,7 +344,7 @@ } % BNC size is 2.5 times the size of the internal "ocirc" \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgf@y=2.5\pgf@y \pgf@x=-\pgf@y } @@ -359,15 +374,15 @@ \pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} - }{\pgfpoint{2.5*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}{2.5*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}} + }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}} } \behindforegroundpath{ \pgfextracty{\pgf@circ@res@other}{\northwest} - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen \pgfscope \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\ctikzvalof{bipoles/thickness}\pgflinewidth} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgfsetcolor{\ctikzvalof{color}} % external circle \pgfscope % clipping path: first a rectangle bigger then the shape @@ -422,7 +437,7 @@ \pgfpathrectanglecorners {\pgfpoint{0}{.5\pgflinewidth}} {\pgfpoint{0}{-.5\pgflinewidth}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfusepath{draw,fill} \endpgfscope } @@ -434,7 +449,7 @@ \pgfdeclareshape{currarrow}{ \savedanchor{\northeast}{% \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@x=.5\pgf@circ@res@step \pgf@y=\pgf@x% } @@ -452,20 +467,20 @@ \anchor{tip}{ \pgfpointorigin \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@x =\pgf@circ@res@step } \behindforegroundpath{ \pgfscope \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfusepath{draw,fill} \endpgfscope @@ -477,7 +492,7 @@ \pgfdeclareshape{flowarrow}{ \savedanchor{\northeast}{% \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@y=.5\pgf@circ@res@step \pgf@circ@res@step = \pgf@circ@Rlen \divide \pgf@circ@res@step by 4 @@ -497,7 +512,7 @@ \anchor{tip}{ \pgfpointorigin \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@x =\pgf@circ@res@step } \behindforegroundpath{ @@ -506,7 +521,7 @@ \divide \pgf@circ@res@step by 4 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfusepath{draw} \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}} \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}} @@ -519,7 +534,7 @@ \pgfdeclareshape{inputarrow}{ \savedanchor{\northeast}{% this is really not northeast, really -northwest \pgf@circ@res@step = \pgf@circ@Rlen - \divide \pgf@circ@res@step by \pgfkeysvalueof{/tikz/circuitikz/current arrow scale} + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} \pgf@y=.5\pgf@circ@res@step \pgf@x=1.7\pgf@circ@res@step } @@ -551,7 +566,7 @@ \pgfpathlineto{\pgfpoint{0pt}{0pt}} \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfusepath{fill} \endpgfscope @@ -570,14 +585,31 @@ \pgfscope \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen \pgf@circ@res@step = 0.5\pgf@circ@res@step - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} \pgf@circ@draworfill \endpgfscope } - } +%% box scaled with blocks + +\pgfdeclareshape{blockbox}{ + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen} + \pgfscope + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@step = 0.5\pgf@circ@res@step + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope + } +} % full nodes for wire crossing diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index c64f400d214..6c8df356076 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex @@ -10,11 +10,19 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Tripoles +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + +% Legacy spdt \pgfdeclareshape{spdt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{left}{% @@ -73,15 +81,14 @@ \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/margin}\pgf@circ@res@left + \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} @@ -107,14 +114,13 @@ \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} \endpgfscope - \pgfscope \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} \pgfpathlineto{ \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} } - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope } @@ -128,16 +134,20 @@ \long\def\pgfcircdeclarecutespdt#1#2#3{ \pgfdeclareshape{#1} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/spdt/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen \pgf@x=.25\pgf@x } \savedanchor\midlever{ % these values are calculated when we create the definition of the shape. - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/cuteswitch/height}\pgf@circ@Rlen - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp \pgf@circ@res@down = -.5\pgf@y \pgf@circ@res@up = .5\pgf@y @@ -174,7 +184,7 @@ \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y @@ -226,7 +236,7 @@ \pgfcircdeclarecutespdt{cute spdt up arrow} {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} @@ -237,7 +247,7 @@ \pgfcircdeclarecutespdt{cute spdt mid arrow} {\pgfpoint{\pgf@circ@res@right}{0pt}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfsetarrowsstart{latexslim} \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} @@ -249,7 +259,7 @@ \pgfcircdeclarecutespdt{cute spdt down arrow} {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} { - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} @@ -288,7 +298,7 @@ \step \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax \advance\pgf@y by -#1\pgf@circ@res@step\relax - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@left + \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left \fi % or and nor \ifnum #2=2\relax @@ -298,11 +308,11 @@ \step \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax \advance\pgf@y by -#1\pgf@circ@res@step\relax - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/angle}}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/inner}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% \pgf@circ@res@temp=\pgf@y \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% @@ -315,12 +325,12 @@ \pgfextractx{\pgf@circ@res@left}{\southwest}% \pgfextractx{\pgf@circ@res@right}{\northeast}% \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/inner}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #3 port/distance}\pgf@circ@res@right + \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} % this compensates for the effect of the line width on the gap between the arcs \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% @@ -350,33 +360,37 @@ \long\def\pgfcircdeclarelogicport#1#2#3{% \pgfdeclareshape{american #1 port}% {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro\resize{% automatic - \pgf@circ@res@up = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen \pgf@circ@res@up = .5\pgf@circ@res@up \pgf@circ@res@down = -\pgf@circ@res@up - \pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/width}\pgf@circ@Rlen + \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen \pgf@circ@res@right = .5\pgf@circ@res@right \pgf@circ@res@left = -\pgf@circ@res@right }% \savedmacro\inputs{% get number of inputs \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% \ifnum\pgf@circ@res@count=0 - \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/inputs}\relax% + \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax% \fi \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi \def\inputs{\the\pgf@circ@res@count}% }% \savedanchor\step{% 1/2 gap at edges - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen \divide\pgf@circ@res@step by \pgf@circ@res@count \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% }% \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \savedanchor\left{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} - \savedanchor\right{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} - \savedanchor\origin{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}} + \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} + \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} + \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}} \anchor{center}{\origin}% for backwards compatibility \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} @@ -422,7 +436,7 @@ \pgfpoint{\pgf@circ@res@right}{0cm}} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} #3 } } @@ -436,20 +450,20 @@ \advance\pgf@circ@res@temp by -\pgf@circ@res@step \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left} {\pgf@circ@res@temp}} \advance\pgf@circ@res@count by -1 \repeat \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@right} + {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american and port/port width}\pgf@circ@res@left + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} @@ -466,20 +480,20 @@ \advance\pgf@circ@res@temp by -\pgf@circ@res@step \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left} {\pgf@circ@res@temp}} \advance\pgf@circ@res@count by -1 \repeat \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/circle width}\pgf@circ@res@right - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nand port/port width}\pgf@circ@res@right + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} @@ -496,11 +510,11 @@ } %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfcircdeclarelogicport{nor}{2}{ - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/angle}}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/inner}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% \pgfextracty{\pgf@circ@res@temp}{\step}% @@ -515,16 +529,16 @@ \advance\pgf@circ@res@count by -1 \repeat - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/angle}}% - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american nor port/circle width}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% + \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax \advance\pgf@circ@res@other by -\pgf@circ@res@step @@ -543,11 +557,11 @@ } %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfcircdeclarelogicport{or}{2}{ - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/angle}}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/inner}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% \pgfextracty{\pgf@circ@res@temp}{\step}% @@ -562,15 +576,15 @@ \advance\pgf@circ@res@count by -1 \repeat - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american or port/angle}}% + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% @@ -583,12 +597,12 @@ %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfcircdeclarelogicport{xor}{3}{ \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/inner}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/distance}\pgf@circ@res@right + \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} % this compensates for the effect of the line width on the gap between the arcs \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% @@ -607,15 +621,15 @@ \advance\pgf@circ@res@count by -1 \repeat - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/angle}}% + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% @@ -634,12 +648,12 @@ %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfcircdeclarelogicport{xnor}{3}{ \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/inner}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% - \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xor port/distance}\pgf@circ@res@right + \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} % this compensates for the effect of the line width on the gap between the arcs \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% @@ -658,16 +672,16 @@ \advance\pgf@circ@res@count by -1 \repeat - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@right + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \edef\pgf@circ@math@angle{\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/angle}}% - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/circle width}\pgf@circ@res@right + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}% + \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax \advance\pgf@circ@res@other by -\pgf@circ@res@step @@ -683,7 +697,7 @@ {\pgfpoint{0pt}{.5\pgf@circ@res@step}} \pgf@circ@draworfill - \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american xnor port/port width}\pgf@circ@res@left + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc @@ -695,34 +709,54 @@ %%% Original one-input ports \pgfdeclareshape{american not port}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } - \savedanchor\left{% + \anchor{in}{ + \northwest \pgf@y=0pt } - \anchor{in}{ + \anchor{in 1}{ \northwest \pgf@y=0pt } + \anchor{bin}{ + \northwest + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } \anchor{out}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } \anchor{center}{ \pgfpointorigin } \anchor{east}{ - \left - \pgf@x=-.8\pgf@x + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x } \anchor{west}{ - \left + \northwest + \pgf@y=0pt } \anchor{south}{ \northwest @@ -750,8 +784,7 @@ \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y @@ -759,10 +792,10 @@ \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgftransformxshift{.7\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left @@ -787,39 +820,161 @@ \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} \pgfusepath{draw} - } } -\pgfdeclareshape{invschmitt}{ +\pgfdeclareshape{american buffer port}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } - \savedanchor\left{% + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{bout}{ + \northwest \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} +\pgfdeclareshape{invschmitt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x } \anchor{in}{ \northwest \pgf@y=0pt } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } \anchor{out}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } \anchor{center}{ \pgfpointorigin } \anchor{east}{ - \left - \pgf@x=-.8\pgf@x + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x } \anchor{west}{ - \left + \northwest + \pgf@y=0pt } \anchor{south}{ \northwest @@ -847,7 +1002,7 @@ \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y @@ -855,10 +1010,10 @@ \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgftransformxshift{.7\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left @@ -884,7 +1039,7 @@ \pgfusepath{draw} %draw inner shape - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} @@ -899,34 +1054,50 @@ } \pgfdeclareshape{schmitt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{\pgfpointorigin} \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } - \savedanchor\left{% + \anchor{in}{ + \northwest \pgf@y=0pt } - \anchor{in}{ + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{bin 1}{ \northwest \pgf@y=0pt + \pgf@x=0.7\pgf@x } \anchor{out}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-.7\pgf@x + } \anchor{center}{ \pgfpointorigin } \anchor{east}{ - \left - \pgf@x=-.8\pgf@x + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x } \anchor{west}{ - \left + \northwest + \pgf@y=0pt } \anchor{south}{ \northwest @@ -954,7 +1125,7 @@ \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest @@ -963,16 +1134,14 @@ \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right - \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgftransformxshift{.7\pgf@circ@res@left} \pgf@circ@res@step=\pgf@circ@res@right \advance\pgf@circ@res@step by -\pgf@circ@res@left \pgf@circ@res@step=.7\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} \pgfpathclose @@ -987,7 +1156,7 @@ \pgfusepath{draw} %draw inner shape - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} @@ -1014,40 +1183,47 @@ \long\def\pgfcircdeclareeurologicport#1#2#3#4{ \pgfdeclareshape{european #1 port} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedmacro\resize{% automatic - \pgf@circ@res@up = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen \pgf@circ@res@up = .5\pgf@circ@res@up \pgf@circ@res@down = -\pgf@circ@res@up - \pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/width}\pgf@circ@Rlen + \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen \pgf@circ@res@right = .5\pgf@circ@res@right \pgf@circ@res@left = -\pgf@circ@res@right }% \savedmacro\inputs{% get number of inputs \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% \ifnum\pgf@circ@res@count=0 - \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/inputs}\relax% + \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax% \fi \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi \def\inputs{\the\pgf@circ@res@count}% }% \savedanchor\step{% 1/2 gap at edges - \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen \divide\pgf@circ@res@step by #3 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% }% \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}% \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}% - \savedanchor\left{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% - \savedanchor\right{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% - \savedanchor\origin{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}% + \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% + \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}% \anchor{center}{\origin}% for backwards compatibility % the text anchor overlaps the logic symbol \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}% % create input anchors \ifnum#3=1\relax - \anchor{in}{\pgfpoint{\pgf@circ@res@left}{0pt}}% or \step + \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step \else \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{% \pgfmathloop% @@ -1088,17 +1264,17 @@ \pgfpoint{\pgf@circ@res@right}{0cm}} \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \pgfscope - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathrectanglecorners - {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} - {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} + {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope \ifnum#3=1\relax \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% \else \pgfextracty{\pgf@circ@res@temp}{\step}% \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax @@ -1107,7 +1283,7 @@ \advance\pgf@circ@res@temp by -\pgf@circ@res@step \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@left} + {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} {\pgf@circ@res@temp}} \advance\pgf@circ@res@count by -1 \repeat @@ -1115,23 +1291,20 @@ % \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{% - \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} + \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} % \edef\pgf@temp{not} \edef\pgf@circ@temp{#4} \ifx\pgf@temp\pgf@circ@temp % is a not - \pgfpathmoveto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/reserved}\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/european #1 port/not height}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} \fi % \pgfusepath{draw} % \pgfpathmoveto{\pgfpointorigin} \pgftext{#2} - % - % - % } } } @@ -1139,31 +1312,42 @@ \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} \pgfcircdeclareeurologicport{not}{$1$}{1}{not} +\pgfcircdeclareeurologicport{buffer}{$1$}{1}{} \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} %% end european logic ports +%%%%%%%%%%%%%%%%%%%%%%%% +%% Transistors +%%%%%%%%%%%%%%%%%%%%%%%% + + \long\def\pgfcircdeclaretransistor#1#2#3{ \pgfdeclareshape{#1} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \anchor{center}{ \pgfpointorigin } \savedanchor\northeast{% upper right - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y \pgf@x=0pt } \savedanchor\left{%center left \pgf@y=0pt - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen } \anchor{text}{ \northeast \pgf@y=.7\pgf@y - \pgf@x= \pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x= \pgf@circ@scaled@Rlen \pgf@x=0.1\pgf@x } \anchor{pathstart}{ % south @@ -1215,74 +1399,74 @@ } \anchor{B}{ \northeast - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y \left - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step } \anchor{base}{ \northeast - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y \left - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step } \anchor{G}{ \northeast - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y \left - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step } \anchor{gate}{ \northeast - \pgf@circ@res@step=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@y + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y \left - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@circ@res@step + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step } \anchor{nobase}{ \left - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x } \anchor{nogate}{ \left - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x } \anchor{E}{ \northeast - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{emitter}{ \northeast - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{C}{ \northeast - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{collector}{ \northeast - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{S}{ \northeast - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{source}{ \northeast - \pgf@y=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{D}{ \northeast - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y } \anchor{drain}{ \northeast - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y } #2 \backgroundpath{ \pgftransformationadjustments - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} % - \ifnum \pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/curr direction} > 0 + \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0 \pgf@circuit@trans@ntypetrue \else \pgf@circuit@trans@ntypefalse @@ -1293,6 +1477,7 @@ \pgf@circ@res@right = \pgf@x \left \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen % #3 % BODY DIODE @@ -1306,9 +1491,13 @@ \long\def\drawbodydiode#1{ \pgfscope - \pgftransformshift{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgftransformrotate{90} - \pgftransformscale{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode scale}} + % diode scale and bodydiode scale interacts. We want the size of the diode + % proportional to the transistor, so we will: + % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale + \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}} + \pgftransformscale{\@@BDscale} \ifpgf@circuit@fulldiode \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} \else @@ -1323,25 +1512,25 @@ \fi %Draw upper connection to body diode \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} \pgfusepath{draw} \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} \pgftransformscale{0.5} \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} \endpgfscope{} %Draw lower connection to body diode \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}} \pgfusepath{draw} \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} \pgftransformscale{0.5} \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} \endpgfscope @@ -1351,28 +1540,28 @@ \pgfcircdeclaretransistor{#1}{}{ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} %draw arrow depending on type of transistor @@ -1380,45 +1569,69 @@ \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse + \edef\@@anchor{center} \ifpgf@circuit@trans@ntype - \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/arrow pos}}{% - \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@down}% - }{% - \pgfpoint{\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}% - } + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip} + \pgftransformlineattime{1.0}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% + } + \fi \else - \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/arrow pos}}{% - \pgfpoint{\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}% - }{% - \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height 2}\pgf@circ@res@up}% - } + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip} + \pgftransformlineattime{1.0}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \else + \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \fi \fi - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope \ifpgf@circuit@bpt@drawphoto \pgfscope \pgfsetarrowsstart{latexslim} \pgfpathmoveto{\pgfpointadd{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} \pgfpathlineto{\pgfpointadd{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}} \pgfusepath{draw} \pgfpathmoveto{\pgfpointadd{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}} \pgfpathlineto{\pgfpointadd{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} \pgfusepath{draw} @@ -1426,7 +1639,7 @@ \else \ifpgf@circuit@bpt@drawbase \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgfusepath{draw} @@ -1444,75 +1657,80 @@ %draw upper connection \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} \pgfusepath{draw} %draw thicker gate lines \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope %draw lower connection \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} - %draw arrow depending on type of transiytor + %draw arrow depending on type of transistor \pgfscope \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.5} + \fi \ifpgf@circuit@trans@ntype - \pgftransformlineattime{.5}{% + \pgftransformlineattime{\@@pos}{% \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@down}% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}% }{% \pgfpoint{\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}% + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}% } \else - \pgftransformlineattime{.5}{% + \pgftransformlineattime{\@@pos}{% \pgfpoint{\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}% + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}% }{% - \pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height 2}\pgf@circ@res@up}% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}% } \fi - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope %draw gate \ifpgf@circuit@trans@ntype \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} \else \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} \fi \pgfusepath{draw} } @@ -1523,131 +1741,148 @@ \declareigbt{Lnigbt} \declareigbt{Lpigbt} - \pgfcircdeclaretransistor{nmos}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope \ifpgf@circuit@mos@arrows \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgfresetnontranslationattimefalse - \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/arrow pos}}{% - \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}% - }{% - \pgfpoint - {\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}% - } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{tip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi \endpgfscope \fi \ifpgf@circuit@bpt@drawgate \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgfusepath{draw} \fi } - \pgfcircdeclaretransistor{pmos}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} \pgfusepath{draw} \ifpgf@circuit@mos@arrows \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgfresetnontranslationattimefalse - \pgftransformlineattime{\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/arrow pos}}{% - \pgfpoint% - {\pgf@circ@res@right}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}% - }{% - \pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}% - } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgftransformrotate{180} + \pgfnode{currarrow}{tip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{% + \pgfpoint% + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi \endpgfscope \fi \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \ifpgf@circuit@bpt@drawgate \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgfusepath{draw} \fi \ifpgf@circuit@pmos@nocircle\else + % we are not scaling the circle with the MOS --- I think it's better to have it + % coherent with the poles/nodes of the rest of the circuit. \pgfpathcircle{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left - \pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} - {\pgf@circ@res@up+\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen} + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen} + {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} \ifpgf@circuit@pmos@emptycircle \pgfsetfillcolor{white} \fi @@ -1659,32 +1894,32 @@ \pgfcircdeclaretransistor{hemt}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base height}\pgf@circ@res@down}} - \pgfsetlinewidth{2\pgflinewidth} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} \pgfusepath{draw} @@ -1695,101 +1930,111 @@ %top connection \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} \ifpgf@circuit@trans@depletiontype \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} \else \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up*0.45}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@up*0.25}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down*0.25}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nfet/base height}\pgf@circ@res@down*0.45}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} \fi - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope %Bulk connection line \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} {\pgf@circ@res@up+\pgf@circ@res@down}} %bottom connection \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} %draw thick gate line \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope + % arrows \pgfscope \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse - - \pgftransformlineattime{.6}{% + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip} + \ifpgf@circuit@trans@ntype + \edef\@@pos{1.0} + \else + \edef\@@pos{0.0} + \fi + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% \pgfpoint {\pgf@circ@res@right}% {\pgf@circ@res@up+\pgf@circ@res@down}% }{% \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% {\pgf@circ@res@up+\pgf@circ@res@down}% } \ifpgf@circuit@trans@ntype - \else - \pgftransformrotate{180} - \fi - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} -\endpgfscope + \else + \pgftransformrotate{180} + \fi + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope % GATE CONNECTION \ifpgf@circuit@bpt@drawgate \ifpgf@circuit@trans@ntype \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} \else \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/gate width}\pgf@circ@res@left} - {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/conn height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} \fi \pgfusepath{draw} \fi @@ -1805,13 +2050,11 @@ {#3} } - \pgfdeclaretransistorwrapperaddbulk{nfet}{}{% \pgf@circuit@trans@depletiontypefalse \drawfetcore{nfet} } - \pgfdeclaretransistorwrapperaddbulk{pfet}{}{% \pgf@circuit@trans@depletiontypefalse \drawfetcore{pfet} @@ -1831,15 +2074,12 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi } - - - % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{% \pgf@circuit@trans@depletiontypefalse @@ -1848,14 +2088,12 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} + \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi } - - % N-CHANNEL IGFET DEPLETION TYPE \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{% \pgf@circuit@trans@depletiontypetrue @@ -1870,7 +2108,7 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi @@ -1892,7 +2130,7 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/pigfete/gate height}\pgf@circ@res@up}} + \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}} \pgfnode{circ}{center}{}{}{} \endpgfscope \fi @@ -1904,7 +2142,6 @@ \drawfetcore{pigfetebulk} } - % P-CHANNEL IGFET DEPLETION TYPE \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{% \pgf@circuit@trans@depletiontypetrue @@ -1920,7 +2157,7 @@ \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@up}} + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi @@ -1929,78 +2166,83 @@ \pgfcircdeclaretransistor{njfet}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope + % arrow \pgfscope \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse - \pgftransformlineattime{.6}{% + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% \pgfpoint{\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}% + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% }{% \pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}% + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/njfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} \pgfusepath{draw} } - \pgfcircdeclaretransistor{pjfet}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} \pgfscope \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfusepath{draw} \endpgfscope @@ -2008,74 +2250,76 @@ \pgfslopedattimetrue \pgfallowupsidedownattimetrue \pgfresetnontranslationattimefalse - \pgftransformlineattime{.4}{% + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.4} + \fi + \pgftransformlineattime{\@@pos}{% \pgfpoint% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% }{% \pgfpoint{\pgf@circ@res@left}% - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% } - \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} \endpgfscope - \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} \pgfusepath{draw} } - \pgfdeclaretransistorwrapperaddbulk{isfet}{}{% \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} % DRAIN CONNECTION \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} % DRAIN \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} \pgfusepath{draw} % GATE, DEPLETION TYPE \pgfscope %% added \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base height}\pgf@circ@res@down}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} %% added + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added \pgfusepath{draw} %% added \endpgfscope %% added % BULK \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} {\pgf@circ@res@up+\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth} {\pgf@circ@res@up+\pgf@circ@res@down}} % SOURCE \pgfpathmoveto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/base width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/isfet/gate height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} % SOURCE CONNECTION \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} - % SOLDER DOT at source-bulk connection \ifpgf@circuit@fet@solderdot \pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/nigfete/gate height}\pgf@circ@res@down}} + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} \pgfnode{circ}{center}{}{}{} \endpgfscope{} \fi @@ -2084,329 +2328,92 @@ \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}} + \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}{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}{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} - \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}{-\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 - } +% end of transistors -%% Black thyristor +%%%%%%%%%%%%% +%% Switches +%%%%%%%%%%%%% \pgfcircdeclarebipole{ - \anchor{gate}{ + \anchor{out 1}{ \northeast - } - \anchor{anode}{ - \southwest \pgf@y=0cm } - \anchor{G}{ - \northeast - } - \anchor{cathode}{ + \anchor{out 2}{ \northeast - \pgf@y=0cm + \pgf@y=.8\pgf@y } } -{\ctikzvalof{tripoles/thyristor/height 2}} -{fullthyristor}{\ctikzvalof{tripoles/thyristor/height}} -{\ctikzvalof{tripoles/thyristor/width}} +{\ctikzvalof{tripoles/toggleswitch/height 2}} +{toggleswitch} +{\ctikzvalof{tripoles/toggleswitch/height}} +{\ctikzvalof{tripoles/toggleswitch/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 - + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} \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{.3\pgf@circ@res@left}{0pt}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\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}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfusepath{draw} - -} - -%% Empty thyristor - -\pgfcircdeclarebipole{ - \anchor{gate}{ - \northeast - } - \anchor{anode}{ - \southwest - \pgf@y=0cm - } - \anchor{G}{ - \northeast - } - \anchor{cathode}{ - \northeast - \pgf@y=0cm - } -} -{\ctikzvalof{tripoles/thyristor/height 2}} -{emptythyristor}{\ctikzvalof{tripoles/thyristor/height}} -{\ctikzvalof{tripoles/thyristor/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - - \pgfscope - \pgftransformxshift{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathclose - \pgf@circ@draworfill - \pgfscope - % to allow filling, we need to draw explicitily the stroke here. - \pgfsetlinewidth{\pgfstartlinewidth} - \ifpgf@circuit@bipole@strokedsymbol - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{0pt}} - \pgfusepath{draw} - \fi - \endpgfscope - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} - - \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - -} - -%% Empty triac - -\pgfcircdeclarebipole{ - \anchor{gate}{ - \northeast - } - \anchor{G}{ - \northeast - } - \anchor{anode}{ - \southwest - \pgf@y=0cm - } - \anchor{cathode}{ - \northeast - \pgf@y=0cm - } -} -{\ctikzvalof{tripoles/triac/height}} -{emptytriac} -{\ctikzvalof{tripoles/triac/height}} -{\ctikzvalof{tripoles/triac/width}} -{ - - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - - \pgf@circ@draworfill - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - -} - -%% Full triac - -\pgfcircdeclarebipole{ - \anchor{gate}{ - \northeast - } - \anchor{G}{ - \northeast - } - \anchor{anode}{ - \southwest - \pgf@y=0cm - } - \anchor{cathode}{ - \northeast - \pgf@y=0cm - } -} -{\ctikzvalof{tripoles/triac/height}} -{fulltriac} -{\ctikzvalof{tripoles/triac/height}} -{\ctikzvalof{tripoles/triac/width}} -{ - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - - \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - - \pgfusepath{draw,fill} - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - - \pgfusepath{draw} - -} - -\pgfcircdeclarebipole{ - \anchor{out 1}{ - \northeast - \pgf@y=0cm - } - \anchor{out 2}{ - \northeast - \pgf@y=.8\pgf@y - } -} -{\ctikzvalof{tripoles/toggleswitch/height 2}} -{toggleswitch} -{\ctikzvalof{tripoles/toggleswitch/height}} -{\ctikzvalof{tripoles/toggleswitch/width}} -{ - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} - \pgfusepath{draw} - \pgfscope - \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} - \pgfusepath{draw} - - - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm} @@ -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,35 +2717,44 @@ } } -%%Transkonduktanzverstärker -\pgfdeclareshape{gm amp} +% 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{% - \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/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=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/width}\pgf@circ@Rlen + \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@y=-\pgf@y\pgf@x=0pt\relax } \anchor{north}{ - \northwest + \northwest\pgf@x=0pt\relax } \savedanchor\left{% \pgf@y=0pt } - \anchor{leftedge} - {\left - \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x - } \savedanchor\inOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen + \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=\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/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}{ @@ -2735,10 +2765,11 @@ \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/fd op 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/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 } @@ -2750,19 +2781,20 @@ \pgf@y=-\pgf@y } \savedanchor\up{% - \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/fd op 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/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{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/up pos}}{ + \ctikzvalof{tripoles/fd op amp/up pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{0pt}} + {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}} } \anchor{up}{ \up @@ -2771,81 +2803,121 @@ \up \pgf@y=-\pgf@y } - \anchor{out}{ + \anchor{out up}{ \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x + \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=-\pgf@x + \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=-\pgf@x } + \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=-\pgf@x \pgf@y=-\pgf@y } - - \anchor{text}{\northwest - \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x - \pgfpoint{-.5\wd\pgfnodeparttextbox+.25\pgf@x}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - + \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\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 \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 - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgftransformxshift{.7\pgf@circ@res@left} + \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=.7\pgf@circ@res@step - %Umrandung: - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0}} %geändert startpunkt neu am ausgangsstrich - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}%vom Ausgang nach oben - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}%ecke links unten nach rechts unten + \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} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/fd op 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/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} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/gm amp/input height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/fd op 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/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} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{0pt}} % \pgfsetrectcap \pgfusepath{draw} - } } -%% instrumentation amplifier -\pgfdeclareshape{inst amp} +% 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 @@ -2854,9 +2926,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/fd 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/fd inst amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{nw}{ @@ -2864,23 +2937,24 @@ } \anchor{south}{ \northwest - \pgf@y=-\pgf@y + \pgf@y=-\pgf@y\pgf@x=0pt\relax } \anchor{north}{ - \northwest + \northwest\pgf@x=0pt\relax } \savedanchor\left{% \pgf@y=0pt } \anchor{leftedge} {\left - \pgf@x = \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@x + \pgf@x = \ctikzvalof{tripoles/fd inst 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/fd 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/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}{ @@ -2891,10 +2965,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/fd 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/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 } @@ -2906,19 +2981,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/fd 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/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{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/up pos}}{ + \ctikzvalof{tripoles/fd inst amp/up pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} + {\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 @@ -2929,19 +3005,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/fd 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/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{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/refv pos}}{ + \ctikzvalof{tripoles/fd inst amp/refv pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} + \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.6\pgf@circ@res@up}} + {\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 @@ -2952,11 +3029,42 @@ \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}{ - \northwest + \outport \pgf@y=0pt - \pgf@x=-\pgf@x } + \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 } @@ -2968,101 +3076,110 @@ \anchor{north east}{ \northwest \pgf@x=-\pgf@x } \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} % let's start drawing the component \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \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/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=.7\pgf@circ@res@step + \pgf@circ@res@step=\ctikzvalof{tripoles/fd 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/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{1.4\pgf@circ@res@right}{.6\pgf@circ@res@up}} + \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{1.4\pgf@circ@res@right}{.6\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 - + + % input terminal up \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@up}} + {\ctikzvalof{tripoles/fd 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/fd inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd 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/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 + + % input terminal down \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} % \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/input height}\pgf@circ@res@down}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} - % output lead - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} % + {\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} } } -% instrumentation amplifier, with terminals for gain resistance between inputs -\pgfdeclareshape{inst amp ra} +% 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} - % 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/gm amp/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/gm 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 + \pgf@y=-\pgf@y } \anchor{north}{ - \northwest\pgf@x=0pt\relax + \northwest } \savedanchor\left{% \pgf@y=0pt } \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 - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x + \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=\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}{ \inOneFixed @@ -3072,10 +3189,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/gm amp/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/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 } @@ -3086,51 +3204,21 @@ \inOne \pgf@y=-\pgf@y } - % R ampli anchors. They are by default at 20% more than R-length distance - % you can change that with the `ra pos` key (use 0.5 for one-R). - \savedanchor\raOneFixed{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - } - \anchor{ra up}{ - \inOneFixed - } - \anchor{ra down}{ - \inOneFixed - \pgf@y=-\pgf@y - } - \savedanchor\raOne{% - \pgf@y=\pgf@circ@Rlen - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen - \pgf@x=.5\pgf@x - \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi - } - \anchor{ra-}{ - \raOne - } - \anchor{ra+}{ - \raOne - \pgf@y=-\pgf@y - } - % power supplies - \savedanchor\up{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen + \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/inst amp ra/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/inst amp ra/up pos}}{ + \ctikzvalof{tripoles/gm amp/up pos}}{ \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/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}{.4\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}} } \anchor{up}{ \up @@ -3139,31 +3227,6 @@ \up \pgf@y=-\pgf@y } - % reference voltage input anchors. - \savedanchor\refv{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/height}\pgf@circ@Rlen - \pgf@y=0.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/width}\pgf@circ@Rlen - \pgf@x=0.5\pgf@x - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgfpointlineattime{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/refv pos}}{ - \pgfpoint{ - \pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} - {\pgf@circ@res@up}} - {\pgfpoint{.7\pgf@circ@res@right}{.4\pgf@circ@res@up}} - } - % we need both because they are normally drawn under the amp, and if you - % mirror it vertically you need them - \anchor{refv up}{ - \refv - } - \anchor{refv down}{ - \refv - \pgf@y=-\pgf@y - } \anchor{out}{ \northwest \pgf@y=0pt @@ -3181,718 +3244,657 @@ \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}} + \anchor{text}{\northwest + \pgf@x=\ctikzvalof{tripoles/op amp/port width}\pgf@x + \pgfpoint{-.5\wd\pgfnodeparttextbox+.25\pgf@x}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - % 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 - % 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/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 - %primer punto: la linea de salida (lado componente) - \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{0}} - %from the exit to the top (short side)... (note that the .4 must be copied in \up anchor - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.4\pgf@circ@res@up}} - % and then to the input "front up", "down", to the output short side "down" - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{1.4\pgf@circ@res@right}{.4\pgf@circ@res@down}} - % ...and close + \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step + %Umrandung: + \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{\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 - % ra terminal - - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} - % - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} - % ra terminal + - \pgfpathmoveto{\pgfpoint - {\pgf@circ@res@left} - {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} - % - \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} - {-\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} - % input terminal - \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}} - % + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}} - % - \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + {\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} + - % input terminal + \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} - {\pgfkeysvalueof{/tikz/circuitikz/tripoles/inst amp ra/input height}\pgf@circ@res@down}} - % + {\ctikzvalof{tripoles/gm amp/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/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{.7\pgf@circ@res@right}{0pt}} % - % + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/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} +% Instrumentation amplifier +\pgfdeclareshape{inst 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 - \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 + \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/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x } - \anchor{1}{ + \anchor{nw}{ \northwest - \pgf@y=0pt } - \anchor{2}{ + \anchor{south}{ \northwest \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{3}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x } - \anchor{4}{ + \anchor{north}{ \northwest - \pgf@y=\pgf@y - \pgf@x=0pt } - \anchor{in 1}{ - \northwest + \savedanchor\left{% \pgf@y=0pt } - \anchor{in1}{ - \northwest - \pgf@y=0pt + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x } - \anchor{in}{ - \northwest - \pgf@y=0pt + \savedanchor\inOneFixed{% + \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=\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 2}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt + \anchor{in up}{ + \inOneFixed } - \anchor{in2}{ - \northwest + \anchor{in down}{ + \inOneFixed \pgf@y=-\pgf@y - \pgf@x=0pt } - \anchor{out}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x + \savedanchor\inOne{% + \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=\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 } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt + \anchor{-}{ + \inOne } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y } - \anchor{west}{ - \northwest - \pgf@y=0pt + \savedanchor\up{% + \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=-\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{ + \ctikzvalof{tripoles/inst amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\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{south}{ - \northwest - \pgf@x=0pt + \anchor{up}{ + \up + } + \anchor{down}{ + \up \pgf@y=-\pgf@y } - \anchor{north}{ - \northwest - \pgf@x=0pt + % reference voltage input anchors. + \savedanchor\refv{% + \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=-\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{ + \ctikzvalof{tripoles/inst amp/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\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{south west}{ - \northwest + % we need both because they are normally drawn under the amp, and if you + % mirror it vertically you need them + \anchor{refv up}{ + \refv + } + \anchor{refv down}{ + \refv \pgf@y=-\pgf@y } - \anchor{north east}{ + \anchor{out}{ \northwest + \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{north west}{ - \northwest + \anchor{west}{ + \left } - \anchor{south east}{ - \northwest + \anchor{east}{ + \left \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 + \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 } - \pgfscope - \pgfstartlinewidth=\pgflinewidth + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - % draw outer box - \ifpgf@circuit@boxed - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi + % 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 - % 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} + % 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/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/inst amp/port width}\pgf@circ@res@step + %first point (near output) + \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{\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{\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 - - % 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 + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \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} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\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{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} } } -\pgfdeclareshape{adder} +% Instrumentation amplifier with terminals for gain resistance between inputs +\pgfdeclareshape{inst amp ra} { - \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 + \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{% + \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=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x } - \anchor{left}{% + \anchor{nw}{ \northwest - \pgf@y=0pt } - \anchor{1}{ + \anchor{south}{ \northwest - \pgf@y=0pt + \pgf@y=-\pgf@y\pgf@x=0pt\relax } - \anchor{2}{ - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt + \anchor{north}{ + \northwest\pgf@x=0pt\relax } - \anchor{3}{ - \northwest + \savedanchor\left{% \pgf@y=0pt - \pgf@x=-\pgf@x } - \anchor{4}{ - \northwest - \pgf@y=\pgf@y - \pgf@x=0pt + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x } - \anchor{in 1}{ - \northwest - \pgf@y=0pt + % inputs (+-) + \savedanchor\inOneFixed{% + \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=\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{in1}{ - \northwest - \pgf@y=0pt + \anchor{in up}{ + \inOneFixed } - \anchor{in}{ - \northwest - \pgf@y=0pt + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y } - \anchor{in 2}{ - \northwest + \savedanchor\inOne{% + \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=\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 + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne \pgf@y=-\pgf@y - \pgf@x=0pt } - \anchor{in2}{ - \northwest + % R ampli anchors. They are by default at 20% more than R-length distance + % you can change that with the `ra pos` key (use 0.5 for one-R). + \savedanchor\raOneFixed{% + \pgfmathsetlength{\pgf@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=\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}{ + \inOneFixed + } + \anchor{ra down}{ + \inOneFixed \pgf@y=-\pgf@y - \pgf@x=0pt } - \anchor{out}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x + \savedanchor\raOne{% + \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 } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt + \anchor{ra-}{ + \raOne } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x + \anchor{ra+}{ + \raOne + \pgf@y=-\pgf@y } - \anchor{west}{ - \northwest - \pgf@y=0pt + % power supplies + \savedanchor\up{% + \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=-\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{ + \ctikzvalof{tripoles/inst amp ra/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\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{south}{ - \northwest - \pgf@x=0pt + \anchor{up}{ + \up + } + \anchor{down}{ + \up \pgf@y=-\pgf@y } - \anchor{north}{ - \northwest - \pgf@x=0pt + % reference voltage input anchors. + \savedanchor\refv{% + \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=-\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{ + \ctikzvalof{tripoles/inst amp ra/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\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{south west}{ - \northwest + % we need both because they are normally drawn under the amp, and if you + % mirror it vertically you need them + \anchor{refv up}{ + \refv + } + \anchor{refv down}{ + \refv \pgf@y=-\pgf@y } - \anchor{north east}{ + \anchor{out}{ \northwest + \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{north west}{ - \northwest + \anchor{west}{ + \left } - \anchor{south east}{ - \northwest + \anchor{east}{ + \left \pgf@x=-\pgf@x - \pgf@y=-\pgf@y } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \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 } - \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@Rlen + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - \pgfscope - \pgfstartlinewidth=\pgflinewidth + % drawing of the component + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} - % draw outer box - \ifpgf@circuit@boxed - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi + \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 - % 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} + % main component, normally in thicker lines + \pgfscope + \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=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step + %primer punto: la linea de salida (lado componente) + \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{\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 + \endpgfscope - % draw inner stuff - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpointorigin} - \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}} - \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}} - \pgfpathmoveto{\pgfpointorigin} - \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}} - \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}} - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/tripoles/thickness}\pgflinewidth} - \pgfusepath{draw} + % ra terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\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} + {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\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} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\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{\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} - \endpgfscope + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\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{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} } } -\pgfdeclareshape{oscillator} -{ - \savedanchor\northwest{ - \ifpgf@circuit@boxed - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/twoport/width}\pgf@circ@Rlen - \else - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/oscillator/width}\pgf@circ@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/oscillator/width}\pgf@circ@Rlen - \fi - } - \anchor{center}{ - \pgfpointorigin - } - \anchor{north}{ - \northwest +% Buffer +% Contributed by Danilo Piazzalunga +\pgfdeclareshape{buffer} +{ + \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{south}{ - \northwest - \pgf@x=.5\pgf@x - \pgf@y=-\pgf@y + \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{east}{ + \anchor{in}{ \northwest \pgf@y=0pt - \pgf@x=0pt } - \anchor{west}{ + \anchor{out}{ \northwest \pgf@y=0pt + \pgf@x=-\pgf@x } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y} - \anchor{north east}{ \northwest \pgf@x=0pt\relax} - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } - \anchor{text}{ - \pgf@x=-2\pgf@x - \advance \pgf@x by -.5\wd\pgfnodeparttextbox - \advance \pgf@y by -1.5\ht\pgfnodeparttextbox - } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - - \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@Rlen{} - \pgfscope - \pgfstartlinewidth=\pgflinewidth + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east" + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} - % draw outer box - \ifpgf@circuit@boxed{} - \pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi + \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 + \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 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}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} - \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} - \endpgfscope + \pgfusepath{draw} } } -\pgfdeclareshape{circulator} +% 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 - \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 + \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 + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% \pgf@y=0pt } - \savedanchor\northwest{% - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/wilkinson/height}\pgf@circ@Rlen + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x= \pgf@circ@Rlen + \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/wilkinson/width}\pgf@x } - \anchor{north}{ - \northwest - \pgf@x=0pt + \anchor{-}{ + \inOne } - \anchor{south}{ - \northwest - \pgf@x=0pt + \anchor{+}{ + \inOne \pgf@y=-\pgf@y } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x + \anchor{in up}{ + \inOne } - \anchor{south west}{ - \northwest + \anchor{in down}{ + \inOne \pgf@y=-\pgf@y } - \anchor{north east}{ - \northwest - \pgf@x=-\pgf@x + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/plain amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} } - \anchor{north west}{ - \northwest + \anchor{up}{ + \up } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x + \anchor{down}{ + \up \pgf@y=-\pgf@y } - \anchor{in}{ + \anchor{out}{ \northwest \pgf@y=0pt - } - \anchor{out1}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-0.5\pgf@y - } - \anchor{out2}{ - \northwest \pgf@x=-\pgf@x - \pgf@y=0.5\pgf@y - } - \anchor{text}{ - \northwest - \advance \pgf@y by 0.5\ht\pgfnodeparttextbox - \pgf@x=-.5\wd\pgfnodeparttextbox } + + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetcolor{\ctikzvalof{color}} \northwest \pgf@circ@res@up = \pgf@y @@ -3900,60 +3902,54 @@ \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - \pgfstartlinewidth=\pgflinewidth - - % draw outer box - \pgf@circ@twoportbox + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step - % draw inner stuff - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - % draw inner resisitor - european or american style is recognised - { - \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} - \pgftransformrotate{90} - - % calculate size of resistor - \ifpgf@circuit@europeanresistor - \pgfmathparse{\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width} / 2} - \pgftransformscale{\pgfmathresult} - \pgfnode{genericshape}{center}{}{pgf@generic}{\pgfusepath{fill}} - \else - \pgfmathparse{\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} - \pgftransformscale{\pgfmathresult} - \pgfnode{resistorshape}{center}{}{pgf@resistor}{\pgfusepath{fill}} - \fi - } + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} \pgfusepath{draw} - } } -% electromechanical device (motor/generator) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% electromechanical device (motor/generator) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfdeclareshape{elmech} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northwest{ - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/elmech/height}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/elmech/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{center}{ @@ -4017,13 +4013,53 @@ \anchor{north east}{ \northwest \pgf@x=-\pgf@x } \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@Rlen - \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@Rlen + \anchorborder{% + \@tempdima=\pgf@x\@tempdimb=\pgf@y + \northwest\pgf@circ@res@other=-\pgf@x + \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}} + } + \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x} + \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x} + \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block up right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=-0.5\pgf@x + } + \anchor{block up left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=0.5\pgf@x + } + \anchor{block down right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=-0.5\pgf@x + } + \anchor{block down left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=0.5\pgf@x + } + \behindbackgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen \pgfscope \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfscope % clip the bar: whole size minus the circle \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} @@ -4035,21 +4071,31 @@ \endpgfscope \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} \else \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} \fi - \pgfusepath{draw, fill} \endpgfscope } } +%%%%%%%%%%%%%%%%%%% +%% Magnetron +%%%%%%%%%%%%%%%%%%% + \pgfdeclareshape{magnetron} { + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} \savedanchor\northwest{ - \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/magnetron/width}\pgf@circ@Rlen + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen \pgf@y=.5\pgf@y - \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/magnetron/width}\pgf@circ@Rlen + \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } \anchor{center}{ @@ -4139,8 +4185,9 @@ \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } \backgroundpath{ - \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} - \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@Rlen + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y @@ -4150,7 +4197,7 @@ \pgfscope \pgfstartlinewidth=\pgflinewidth - \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} %create outer circle \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right} \pgf@circ@draworfill @@ -4190,7 +4237,9 @@ } } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Electronic tubes, submitted by J. op den Brouw +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Draw tube outline \def\pgf@circ@tubes@drawtube{% @@ -4219,166 +4268,162 @@ %% which we can put code for the grid anchors and grid drawing code %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code} \long\def\pgfcircdeclaretube#1#2#3{% - \pgfdeclareshape{#1}{ - \anchor{center}{ - \pgfpointorigin - } - \savedanchor\northwest{% - \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen - \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen - % x and y should be half the Rlen - \pgf@y=\pgf@circ@res@up - \pgf@y=.5\pgf@y - \pgf@x=-\pgf@circ@res@right - \pgf@x=.5\pgf@x - } - \anchor{north} {% - \northwest - \pgf@x=0pt - } - \anchor{east}{% - \northwest - \pgf@x=-\pgf@x - \pgf@y=0pt - } - \anchor{south}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=0pt - } - \anchor{west}{% - \northwest - \pgf@y=0pt - } - \anchor{north west}{% - \northwest - } - \anchor{north east}{% - \northwest - \pgf@x=-\pgf@x - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y - } - \anchor{anode} {% - \northwest - \pgf@x=0pt - } - \anchor{cathode}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x - } - \anchor{cathode 1}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x - } - \anchor{cathode 2}{% - \northwest - \pgf@y=-\pgf@y - \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x - } - \anchor{filament 1}{% - \northwest - \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} - \pgf@x=\pgfmathresult\pgf@x - \pgf@y=-\pgf@y - } - \anchor{filament 2}{% - \northwest - \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} - \pgf@x=-\pgfmathresult\pgf@x - \pgf@y=-\pgf@y - } - - % Extra anchors - #2 - - \backgroundpath{ - \pgfscope - % Line width for tripoles - \pgfsetlinewidth{\ctikzvalof{tripoles/thickness}\pgflinewidth} - - % Setup to draw tube - \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen - \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen - \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up - \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right - - % Tube fill color (if any) - \ifx\tikz@fillcolor\pgfutil@empty - \else - \pgfscope - \pgfsetfillcolor{\tikz@fillcolor} - \pgf@circ@tubes@drawtube - \pgfusepath{fill} - \endpgfscope - \fi - - % Tube outline - \pgf@circ@tubes@drawtube - - % Setup to draw grid, filament, anode and cathode - \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen - \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen - \pgf@circ@res@up=0.5\pgf@circ@res@up - \pgf@circ@res@right=0.5\pgf@circ@res@right - - % Grid drawing - #3 - - % Filament (is not drawn by default) - \ifpgf@circuit@tubes@filament - \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up - \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up - \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} - \pgf@xa=\pgfmathresult\pgf@circ@res@right - \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} - \pgf@ya=\pgfmathresult\pgf@circ@res@up - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} - \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} - \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} - \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} - \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} - \pgf@circuit@tubes@filamentfalse - \fi - - % Anode (or plate) - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north - \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} - - % Cathode - \ifpgf@circuit@tubes@nocathode - \pgf@circuit@tubes@nocathodefalse - \else - \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} - \ifpgf@circuit@tubes@fullcathode - \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} - \pgf@circuit@tubes@fullcathodefalse - \else - \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}} - \fi - \fi - - % Draw the background - \pgfusepath{draw} - - \endpgfscope - } - } + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + % x and y should be half the Rlen + \pgf@y=\pgf@circ@res@up + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@circ@res@right + \pgf@x=.5\pgf@x + } + \anchor{north} {% + \northwest + \pgf@x=0pt + } + \anchor{east}{% + \northwest + \pgf@x=-\pgf@x + \pgf@y=0pt + } + \anchor{south}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{west}{% + \northwest + \pgf@y=0pt + } + \anchor{north west}{% + \northwest + } + \anchor{north east}{% + \northwest + \pgf@x=-\pgf@x + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{anode} {% + \northwest + \pgf@x=0pt + } + \anchor{cathode}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 1}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 2}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{filament 1}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + \anchor{filament 2}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=-\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + + % Extra anchors + #2 + + \backgroundpath{ + \pgfscope + % Line width for tripoles + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@scaled@Rlen=\scaledRlen + + % Setup to draw tube + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up + \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + + % Tube outline + \pgf@circ@tubes@drawtube + + % Setup to draw grid, filament, anode and cathode + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=0.5\pgf@circ@res@up + \pgf@circ@res@right=0.5\pgf@circ@res@right + + % Tube fill color (if any) + \pgf@circ@draworfill + + % Grid drawing + #3 + + % Filament (is not drawn by default) + \ifpgf@circuit@tubes@filament + \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up + \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@xa=\pgfmathresult\pgf@circ@res@right + \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} + \pgf@ya=\pgfmathresult\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@filamentfalse + \fi + + % Anode (or plate) + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north + \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + + % Cathode + \ifpgf@circuit@tubes@nocathode + \pgf@circuit@tubes@nocathodefalse + \else + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \ifpgf@circuit@tubes@fullcathode + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@fullcathodefalse + \else + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}} + \fi + \fi + + % Draw the background + \pgfusepath{draw} + \endpgfscope + } + } } \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists @@ -4611,7 +4656,7 @@ \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} - + } \endinput diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex index 62c10016603..158ee2dd79c 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex @@ -100,46 +100,61 @@ \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}} \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}} +%% +\def\setscaledRlenforclass{% + \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname + \ifdefined\ctikzclass + \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale} + \pgfkeysifdefined{\pgf@temp} + {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen} + \else + \pgf@circ@scaled@Rlen=\pgf@circ@Rlen + \fi +} + %% Output routine for generic bipoles \def\pgf@circ@drawvoltagegeneric{ \pgfextra{ - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance} + % \typeout{NAME:\ctikzvalof{bipole/name}} + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance} \pgfkeysifdefined{\pgf@temp} { - \edef\partheight{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance}} - \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen)} + \edef\partheight{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}} + \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)} } { \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance} { \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}} - \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen)} + \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)} } {%calculate default value from part height - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height} + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height} \pgfkeysifdefined{\pgf@temp} { - \edef\partheight{0.5*\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height}} - \edef\tmpdistfromline{(\partheight\pgf@circ@Rlen+0.2\pgf@circ@Rlen)} + \edef\partheight{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}} + \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen+0.2\pgf@circ@scaled@Rlen)} } { - \edef\tmpdistfromline{(.5\pgf@circ@Rlen)} %fallback to fixed value + \edef\tmpdistfromline{(.5\pgf@circ@scaled@Rlen)} %fallback to fixed value } } } + % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen} \ifnum \ctikzvalof{mirror value}=-1 \ifpgf@circuit@bipole@inverted \ifpgf@circuit@bipole@voltage@straight \def\distfromline{\tmpdistfromline} \else - \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen} \fi \else \ifpgf@circuit@bipole@voltage@straight \def\distfromline{-\tmpdistfromline} \else - \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen} \fi \fi \else @@ -147,13 +162,13 @@ \ifpgf@circuit@bipole@voltage@straight \def\distfromline{-\tmpdistfromline} \else - \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen} \fi \else \ifpgf@circuit@bipole@voltage@straight \def\distfromline{\tmpdistfromline} \else - \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} + \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen} \fi \fi \fi @@ -162,43 +177,73 @@ \else \def\pgf@circ@voltage@angle{-90} \fi - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node} + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node} \pgfkeysifdefined{\pgf@temp} - { \edef\distacefromnode{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node}} } - { \edef\distacefromnode{\ctikzvalof{voltage/distance from node}} } - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b} + { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} } + { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} } + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b} \pgfkeysifdefined{\pgf@temp} - { \edef\bumpb{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b}} } - { \edef\bumpb{\ctikzvalof{voltage/bump b}} } + { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} } + { \edef\bumpb{\ctikzvalof{voltage/bump b}} } \edef\shiftv{\ctikzvalof{voltage/shift}} - \pgfmathsetmacro{\bumpb}{\bumpb + \shiftv} %% adjust the bump is shift - \ifpgf@circuit@bipole@inverted - \pgfmathsetmacro{\shiftv}{-\shiftv} - \fi - \ifnum \ctikzvalof{mirror value} = -1 - \pgfmathsetmacro{\shiftv}{-\shiftv} - \fi + \newdimen{\absvshift} + \pgfmathsetlength{\absvshift}{\shiftv*\distfromline+\distfromline} + % put this to true to see the voltage label coordinate anchors + \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse } - % %\pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} is equal to the length of the currarrow - coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead - coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorstartnode)$) - + % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow + coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorstartnode)$) + coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp) coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$) - coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\pgfkeysvalueof{/tikz/circuitikz/current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead - coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorendnode)$) + coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorendnode)$) + coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp) coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$) \ifpgf@circuit@bipole@voltage@below - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto) ! \shiftv!90 : (anchorendnode)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom) ! \shiftv!-90 : (anchorstartnode)$) - coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$) - coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$) + \ifpgf@circ@debugv + node [ocirc, fill=red] at (anchorstartnode) {} + node [ocirc, fill=blue] at (anchorendnode) {} + node [ocirc, fill=green] at (pgfcirc@Vto) {} + node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {} + node [odiamondpole, fill=green] at (pgfcirc@Vto@flat) {} + node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom@flat) {} + \fi + coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$) + coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$) + coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$) + coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$) + coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$) + \ifpgf@circ@debugv + node [odiamondpole, fill=green] at (pgfcirc@Vto) {} + node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {} + node [osquarepole, fill=red] at (pgfcirc@Vcont1) {} + node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {} + \fi \else - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto) ! -\shiftv!90 : (anchorendnode)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom) ! -\shiftv!-90 : (anchorstartnode)$) - coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$) - coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$) + \ifpgf@circ@debugv + node [ocirc, fill=red] at (anchorstartnode) {} + node [ocirc, fill=blue] at (anchorendnode) {} + node [ocirc, fill=green] at (pgfcirc@Vto) {} + node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {} + node [odiamondpole, fill=green] at (pgfcirc@Vto@flat) {} + node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom@flat) {} + \fi + coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (anchorendnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$) + coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$) + coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$) + coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$) + coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$) + \ifpgf@circ@debugv + node [odiamondpole, fill=green] at (pgfcirc@Vto) {} + node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {} + node [osquarepole, fill=red] at (pgfcirc@Vcont1) {} + node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {} + \fi \fi \ifpgf@circuit@europeanvoltage @@ -255,7 +300,7 @@ \pgfextra{ \edef\shiftv{\ctikzvalof{voltage/shift}} \edef\bumpa{\ctikzvalof{voltage/bump a}} - \pgfmathsetmacro{\bumpaplus}{\bumpa + \shiftv} + \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry. } \ifpgf@circuit@bipole@voltage@below coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$) @@ -264,6 +309,9 @@ coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$) coordinate (pgfcirc@Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$) \fi + % fix the (unused in this case) Vcont1/2 coords for label placement along the line + coordinate (pgfcirc@Vcont1) at (pgfcirc@Vto) + coordinate (pgfcirc@Vcont2) at (pgfcirc@Vfrom) \ifpgf@circuit@europeanvoltage \ifpgf@circuit@bipole@voltage@backward (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vfrom) @@ -356,6 +404,15 @@ \fi \fi\fi + % this must be set *before* changing for mirroring and inverting; in that case + % the xscale/yscale parameters take it into account + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@where{-90} + \else + \def\pgf@circ@bipole@voltage@label@where{90} + \fi + + % magic to counteract the scale and yscale effects (there should be a better way...) \ifnum \ctikzvalof{mirror value}=-1 \ifpgf@circuit@bipole@voltage@below \pgf@circuit@bipole@voltage@belowfalse @@ -368,26 +425,27 @@ \ifpgf@circuit@bipole@voltage@below \pgf@circuit@bipole@voltage@belowfalse \else - \pgf@circuit@bipole@voltage@belowtrue \fi \fi - \ifpgf@circuit@bipole@voltage@below - \def\pgf@circ@bipole@voltage@label@where{-90} - \else - \def\pgf@circ@bipole@voltage@label@where{90} - \fi - + % take into account scaling + \setscaledRlenforclass - \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance} + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance} \pgfkeysifdefined{\pgf@temp} - { \edef\eudist{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance}} } - { \edef\eudist{\ctikzvalof{voltage/european label distance}} } - \edef\shiftv{\ctikzvalof{voltage/shift}} - % adjust the label distance to the shift. - \pgfmathsetmacro{\eudistplus}{\eudist+\shiftv} - + { \edef\eudist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}} } + { \edef\eudist{\ctikzvalof{voltage/european label distance}} } + % find the height of the bipole or use a default value + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height} + \pgfkeysifdefined{\pgf@temp} + {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}} + \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}} + {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value + \newdimen{\alshift} + % this is more or less the same of the legacy code; we shift the american label a bit + % outside the (+) -- (-) line + \pgfmathsetlength{\alshift}{(\ctikzvalof{voltage/american label distance}-0.6)*\partheight} \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! }%end pgfextra @@ -397,19 +455,21 @@ \pgf@circ@drawvoltagegeneric \fi - % (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where) %Zeile sinnlos!? \ifpgf@circuit@bipole@voltage@straight coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] at (Vlab) { \pgf@circ@finallabels{voltage/label} } \else - coordinate (Vlab) at ($(\ctikzvalof{bipole/name}.center) ! \ifpgf@circuit@europeanvoltage - \eudistplus + coordinate (Vlab) at ($(pgfcirc@Vcont1)!0.5!(pgfcirc@Vcont2)$) \else - \ctikzvalof{voltage/american label distance} - \fi ! - (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where)$) + coordinate (Vlab) at ($(pgfcirc@Vfrom)!0.5!(pgfcirc@Vto)$) + \ifpgf@circuit@bipole@isvoltage\else + % add a bit of space for american labels above their symbols in the normal case. You can avoid that + % with voltage/american label distance=0.5 (it's measured from the center of the component, in heights) + coordinate (Vlab) at ($(Vlab) ! \alshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vto)$) + \fi + \fi node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] at (Vlab) { \pgf@circ@finallabels{voltage/label} } \fi }%end drawvoltages -- cgit v1.2.3