
%% Options

%%%%%%%%%%%%
%% Dimensions

% coordinates
\newdimen\pgf@circ@res@up
\newdimen\pgf@circ@res@down
\newdimen\pgf@circ@res@zero
\newdimen\pgf@circ@res@left
\newdimen\pgf@circ@res@right
\newdimen\pgf@circ@res@other
\newdimen\pgf@circ@res@step
\newdimen\pgf@circ@res@temp
% inital thickness
\newdimen \pgfstartlinewidth
%% Keys

\long\def\pgf@circ@comment#1{}

\def\circuitikzbasekey{/tikz/circuitikz}

\pgfkeys{\circuitikzbasekey/.is family}

\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
\let\ctikzset\circuitikzset
\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}

\newif\ifpgf@circ@siunitx
\newif\ifpgf@circuit@compat
\newif\ifpgf@circ@oldvoltagedirection

% Option ">" for twoports
\newif\ifpgf@circuit@inputarrow
\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
\ctikzset{inputarrow/.is choice}
\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}

% Option "boxed" for nodes and twoports
\newif\ifpgf@circuit@boxed
\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}}
\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}}
\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}}
\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}}

% Option "dashed" for nodes and twoports
\newif\ifpgf@circuit@dashed
\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
\ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}

% Option "t=*" for nodes
\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}



\ctikzset{bipoles/.is family}
\ctikzset{bipoles/border margin/.initial=1.1}
\ctikzset{bipoles/thickness/.initial=2} 
\ctikzset{bipoles/length/.initial=1.4cm} 
\ctikzset{nodes width/.initial=.04}
\newdimen\pgf@circ@Rlen 
\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1}} 

\ctikzset{monopoles/.is family}
\ctikzset{monopoles/ground/width/.initial=.25}
\ctikzset{monopoles/tground/thickness/.initial=3}
\ctikzset{monopoles/vcc/width/.initial=.2}
\ctikzset{monopoles/match/width/.initial=.4}
\ctikzset{monopoles/chassis/width/.initial=.25}
\ctikzset{monopoles/alternative chassis/width/.initial=.25}
\ctikzset{monopoles/equipotentiality/width/.initial=.25}
\ctikzset{monopoles/tlinestub/width/.initial=.25}          
\ctikzset{monopoles/antenna/width/.initial=.25}            
\ctikzset{monopoles/antenna/label/xanchor/.initial=.4}            
\ctikzset{monopoles/antenna/label/yanchor/.initial=.75}            
\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}            
\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}            
\ctikzset{monopoles/txantenna/width/.initial=.25}
\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}            
\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}            
\ctikzset{monopoles/rxantenna/width/.initial=.25}

\ctikzset{bipoles/resistor/height/.initial=.3}
\ctikzset{bipoles/resistor/width/.initial=.8}
\ctikzset{bipoles/potentiometer/height/.initial=.8}
\ctikzset{bipoles/potentiometer/height 2/.initial=.3}
\ctikzset{bipoles/potentiometer/width/.initial=.8}
\ctikzset{bipoles/photoresistor/height/.initial=.6}
\ctikzset{bipoles/photoresistor/height 2/.initial=.3}
\ctikzset{bipoles/photoresistor/width/.initial=.8}
\ctikzset{bipoles/thermistor/main/.initial=.7}
\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
\ctikzset{bipoles/thermistorntc/width/.initial=.8}
\ctikzset{bipoles/thermistorntc/main/.initial=.7}
\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
\ctikzset{bipoles/thermistorptc/width/.initial=.8}
\ctikzset{bipoles/thermistorptc/main/.initial=.7}
\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
\ctikzset{bipoles/thermistor/width/.initial=.8}
\ctikzset{bipoles/varistor/main/.initial=.7}
\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
\ctikzset{bipoles/varistor/width/.initial=.8}
\ctikzset{bipoles/vresistor/height/.initial=.6}
\ctikzset{bipoles/vresistor/width/.initial=.8}
\ctikzset{bipoles/cuteinductor/height/.initial=.3}
\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}	
\ctikzset{bipoles/cuteinductor/width/.initial=.6}
\ctikzset{bipoles/cuteinductor/coils/.initial=5}
\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
\ctikzset{bipoles/americaninductor/height/.initial=.3}
\ctikzset{bipoles/americaninductor/height 2/.initial=.1}
\ctikzset{bipoles/americaninductor/width/.initial=.8}
\ctikzset{bipoles/americaninductor/coils/.initial=4}
\ctikzset{bipoles/americaninductor/coil height/.initial=.15}
\ctikzset{bipoles/vcuteinductor/height/.initial=.6}
\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}	
\ctikzset{bipoles/vcuteinductor/width/.initial=.6}
\ctikzset{bipoles/vcuteinductor/coils/.initial=5}
\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
\ctikzset{bipoles/vamericaninductor/height/.initial=.6}
\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
\ctikzset{bipoles/vamericaninductor/width/.initial=.8}
\ctikzset{bipoles/vamericaninductor/coils/.initial=4}
\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
\ctikzset{bipoles/esource/height/.initial=.60}
\ctikzset{bipoles/esource/width/.initial=.60}
\ctikzset{bipoles/pvsource/height/.initial=.60}
\ctikzset{bipoles/pvsource/width/.initial=.60}
\ctikzset{bipoles/isource/height/.initial=.60}
\ctikzset{bipoles/isource/width/.initial=.60}
\ctikzset{bipoles/oosource/height/.initial=.60}
\ctikzset{bipoles/oosource/width/.initial=.60}
\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
\ctikzset{bipoles/dcisource/height/.initial=.60}
\ctikzset{bipoles/dcisource/width/.initial=.60}
\ctikzset{bipoles/dcvsource/height/.initial=.60}
\ctikzset{bipoles/dcvsource/width/.initial=.60}
\ctikzset{bipoles/vsourcetri/height/.initial=.60}
\ctikzset{bipoles/vsourcetri/width/.initial=.60}
\ctikzset{bipoles/isourceam/height/.initial=.60}
\ctikzset{bipoles/isourceam/width/.initial=.60}
\ctikzset{bipoles/vsource/height/.initial=.60}
\ctikzset{bipoles/vsource/width/.initial=.60}
\ctikzset{bipoles/vsourceam/height/.initial=.60}
\ctikzset{bipoles/vsourceam/width/.initial=.60}
\ctikzset{bipoles/vsourceam/margin/.initial=.7}
\ctikzset{bipoles/isourcesin/height/.initial=.60}
\ctikzset{bipoles/isourcesin/width/.initial=.60}
\ctikzset{bipoles/vsourcesin/height/.initial=.60}
\ctikzset{bipoles/vsourcesin/width/.initial=.60}
\ctikzset{bipoles/vsourcesquare/height/.initial=.60}
\ctikzset{bipoles/vsourcesquare/width/.initial=.60}
\ctikzset{bipoles/cisource/height/.initial=.7}
\ctikzset{bipoles/cisource/width/.initial=.7}
\ctikzset{bipoles/cisourceam/height/.initial=.7}
\ctikzset{bipoles/cisourceam/width/.initial=.7}
\ctikzset{bipoles/cvsource/height/.initial=.7}
\ctikzset{bipoles/cvsource/width/.initial=.7}
\ctikzset{bipoles/cvsourceam/height/.initial=.7}
\ctikzset{bipoles/cvsourceam/width/.initial=.7}
\ctikzset{bipoles/cvsourceam/margin/.initial=.7}
\ctikzset{bipoles/cvsourceam/text scale/.initial=1}
\ctikzset{bipoles/cisourcesin/width/.initial=.7}
\ctikzset{bipoles/cvsourcesin/height/.initial=.7}
\ctikzset{bipoles/cvsourcesin/width/.initial=.7}
\ctikzset{bipoles/capacitor/height/.initial=.6}
\ctikzset{bipoles/capacitor/width/.initial=.2}
\ctikzset{bipoles/ecapacitor/height/.initial=.5}
\ctikzset{bipoles/ecapacitor/width/.initial=.2}
\ctikzset{bipoles/ecapacitor/font/.initial= \fontsize{6}{0}\selectfont\boldmath}
\ctikzset{bipoles/pcapacitor/height/.initial=.6}
\ctikzset{bipoles/pcapacitor/width/.initial=.2}
\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
\ctikzset{bipoles/vcapacitor/height/.initial=.6}
\ctikzset{bipoles/vcapacitor/width/.initial=.5}
\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
\ctikzset{bipoles/piezoelectric/height/.initial=.7}
\ctikzset{bipoles/piezoelectric/width/.initial=.5}
\ctikzset{bipoles/battery/height/.initial=.6}
\ctikzset{bipoles/battery/width/.initial=.3}
\ctikzset{bipoles/battery1/height/.initial=.6}
\ctikzset{bipoles/battery1/width/.initial=.3}
\ctikzset{bipoles/battery2/height/.initial=.6}
\ctikzset{bipoles/battery2/width/.initial=.3}
\ctikzset{bipoles/diode/height/.initial=.50}
\ctikzset{bipoles/diode/width/.initial=.40}
\ctikzset{bipoles/varcap/height/.initial=.50}
\ctikzset{bipoles/varcap/width/.initial=.45}
\ctikzset{bipoles/interr/height/.initial=.35}
\ctikzset{bipoles/interr/width/.initial=.35}
\ctikzset{bipoles/interr/height 2/.initial=.1}
\ctikzset{bipoles/generic/height/.initial=.30}
\ctikzset{bipoles/generic/width/.initial=.80}
\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
\ctikzset{bipoles/fuse/height/.initial=.20}
\ctikzset{bipoles/fuse/width/.initial=.50}
\ctikzset{bipoles/afuse/height/.initial=.20}
\ctikzset{bipoles/afuse/width/.initial=.50}
\ctikzset{bipoles/generic potentiometer/height/.initial=.80}
\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
\ctikzset{bipoles/generic potentiometer/width/.initial=.80}
\ctikzset{bipoles/ageneric/height/.initial=.30}
\ctikzset{bipoles/ageneric/width/.initial=.80}
\ctikzset{bipoles/memristor/height/.initial=.30}
\ctikzset{bipoles/memristor/wave height/.initial=.5}
\ctikzset{bipoles/memristor/width/.initial=.80}
\ctikzset{bipoles/tgeneric/height/.initial=.70}
\ctikzset{bipoles/tgeneric/width/.initial=.80}
\ctikzset{bipoles/tfullgeneric/height/.initial=.70}
\ctikzset{bipoles/tfullgeneric/width/.initial=.80}
\ctikzset{bipoles/fullgeneric/height/.initial=.30}
\ctikzset{bipoles/fullgeneric/width/.initial=.80}
\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
\ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
\ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
\ctikzset{bipoles/short/height/.initial=0} %dummy height for voltage positioning
\ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning
%\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2}
%\ctikzset{bipoles/short/voltage/distance from node/.initial=.5}
\ctikzset{bipoles/ammeter/height/.initial=.60}
\ctikzset{bipoles/ammeter/width/.initial=.60}
\ctikzset{bipoles/ohmmeter/height/.initial=.60}
\ctikzset{bipoles/ohmmeter/width/.initial=.60}
\ctikzset{bipoles/voltmeter/height/.initial=.60}
\ctikzset{bipoles/voltmeter/width/.initial=.60}
\ctikzset{bipoles/buffer/height/.initial=1}
\ctikzset{bipoles/buffer/width/.initial=1}
\ctikzset{bipoles/not port/width/.initial=1}
\ctikzset{bipoles/not port/height/.initial=.8}
\ctikzset{bipoles/not port/circle width/.initial=.15}
\ctikzset{bipoles/lamp/height/.initial=.60}
\ctikzset{bipoles/lamp/width/.initial=.60}
\ctikzset{bipoles/tline/height/.initial=.3}
\ctikzset{bipoles/tline/width/.initial=.8}
\ctikzset{bipoles/squid/height/.initial=.60}
\ctikzset{bipoles/squid/width/.initial=.60}
\ctikzset{bipoles/barrier/height/.initial=.60}
\ctikzset{bipoles/barrier/width/.initial=.60}
\ctikzset{bipoles/thermocouple/height/.initial=.250}
\ctikzset{bipoles/thermocouple/height 2/.initial=.60}
\ctikzset{bipoles/thermocouple/width/.initial=.140}
\ctikzset{bipoles/pushbutton/height/.initial=.5}
\ctikzset{bipoles/pushbutton/height 2/.initial=.0}
\ctikzset{bipoles/pushbutton/width/.initial=.50}

\ctikzset{bipoles/twoport/width/.initial=.7}
\ctikzset{bipoles/twoport/height/.initial=.7}
\ctikzset{bipoles/twoport/text/.initial=}
\ctikzset{bipoles/vco/width/.initial=.7}
\ctikzset{bipoles/bandpass/width/.initial=.7}
\ctikzset{bipoles/highpass/width/.initial=.7}
\ctikzset{bipoles/lowpass/width/.initial=.7}
\ctikzset{bipoles/adc/width/.initial=.7}
\ctikzset{bipoles/dac/width/.initial=.7}
\ctikzset{bipoles/dsp/width/.initial=.7}
\ctikzset{bipoles/fft/width/.initial=.7}
\ctikzset{bipoles/amp/width/.initial=.7}
\ctikzset{bipoles/vamp/width/.initial=.7}
\ctikzset{bipoles/piattenuator/width/.initial=.7}
\ctikzset{bipoles/vpiattenuator/width/.initial=.7}
\ctikzset{bipoles/tattenuator/width/.initial=.7}
\ctikzset{bipoles/vtattenuator/width/.initial=.7}
\ctikzset{bipoles/phaseshifter/width/.initial=.7}
\ctikzset{bipoles/vphaseshifter/width/.initial=.7}
\ctikzset{bipoles/detector/width/.initial=.7}


\newif\ifpgf@circuit@trans@depletiontype
\pgf@circuit@trans@depletiontypefalse

\newif\ifpgf@circuit@mos@arrows
\ctikzset{tripoles/mos style/.is choice}
\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}

% Option solderdot for fet 
\newif\ifpgf@circuit@fet@solderdot
\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}

% Option bodydiode for fet 
\newif\ifpgf@circuit@fet@bodydiode
\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}

% Option draw fet without gate connection
\newif\ifpgf@circuit@bpt@drawgate
\pgf@circuit@bpt@drawgatetrue
\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}

% Option draw bpt without base connection
\newif\ifpgf@circuit@bpt@drawbase
\pgf@circuit@bpt@drawbasetrue
\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}

% Option draw bpt with optical input
\newif\ifpgf@circuit@bpt@drawphoto
\pgf@circuit@bpt@drawphotofalse
\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}

% Option draw pmos with empty circle
\newif\ifpgf@circuit@pmos@emptycircle
\newif\ifpgf@circuit@pmos@emptycircle
\pgf@circuit@pmos@emptycirclefalse
\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}


\newif\ifpgf@circuit@trans@ntype
\pgf@circuit@trans@ntypetrue %default true
%\newif\ifpgf@circuit@trans@ptype
%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
\ctikzset{tripoles/nmos/width/.initial=.7}
\ctikzset{tripoles/nmos/gate height/.initial=.35}
\ctikzset{tripoles/nmos/base height/.initial=.5}
\ctikzset{tripoles/nmos/conn height/.initial=0}
\ctikzset{tripoles/nmos/height/.initial=1.1}
\ctikzset{tripoles/nmos/base width/.initial=.5}
\ctikzset{tripoles/nmos/gate width/.initial=.62}
\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
\ctikzset{tripoles/nmos/curr direction/.initial=1}

\ctikzset{tripoles/pmos/width/.initial=.7}
\ctikzset{tripoles/pmos/gate height/.initial=.35}
\ctikzset{tripoles/pmos/base height/.initial=.5}
\ctikzset{tripoles/pmos/conn height/.initial=0}
\ctikzset{tripoles/pmos/height/.initial=1.1}
\ctikzset{tripoles/pmos/base width/.initial=.5}
\ctikzset{tripoles/pmos/gate width/.initial=.62}
\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
\ctikzset{tripoles/pmos/curr direction/.initial=-1}

\ctikzset{tripoles/nfet/width/.initial=.7}
\ctikzset{tripoles/nfet/gate height/.initial=.35}
\ctikzset{tripoles/nfet/base height/.initial=.5}
\ctikzset{tripoles/nfet/conn height/.initial=0}
\ctikzset{tripoles/nfet/height/.initial=1.1}
\ctikzset{tripoles/nfet/base width/.initial=.5}
\ctikzset{tripoles/nfet/gate width/.initial=.62}
\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
\ctikzset{tripoles/nfet/curr direction/.initial=1}

\ctikzset{tripoles/pfet/width/.initial=.7}
\ctikzset{tripoles/pfet/gate height/.initial=.35}
\ctikzset{tripoles/pfet/base height/.initial=.5}
\ctikzset{tripoles/pfet/conn height/.initial=0}
\ctikzset{tripoles/pfet/height/.initial=1.1}
\ctikzset{tripoles/pfet/base width/.initial=.5}
\ctikzset{tripoles/pfet/gate width/.initial=.62}
\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
\ctikzset{tripoles/pfet/curr direction/.initial=-1}

\ctikzset{tripoles/nigfete/width/.initial=.7}
\ctikzset{tripoles/nigfete/gate height/.initial=.35}
\ctikzset{tripoles/nigfete/base height/.initial=.5}
\ctikzset{tripoles/nigfete/conn height/.initial=.35}
\ctikzset{tripoles/nigfete/height/.initial=1.1}
\ctikzset{tripoles/nigfete/base width/.initial=.5}
\ctikzset{tripoles/nigfete/gate width/.initial=.62}
\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
\ctikzset{tripoles/nigfete/curr direction/.initial=1}

\ctikzset{tripoles/nigfetd/width/.initial=.7}
\ctikzset{tripoles/nigfetd/gate height/.initial=.35}
\ctikzset{tripoles/nigfetd/base height/.initial=.5}
\ctikzset{tripoles/nigfetd/conn height/.initial=.35}
\ctikzset{tripoles/nigfetd/height/.initial=1.1}
\ctikzset{tripoles/nigfetd/base width/.initial=.5}
\ctikzset{tripoles/nigfetd/gate width/.initial=.62}
\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
\ctikzset{tripoles/nigfetd/curr direction/.initial=1}

\ctikzset{tripoles/nigfetebulk/width/.initial=.7}
\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
\ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
\ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
\ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}

\ctikzset{tripoles/pigfete/width/.initial=.7}
\ctikzset{tripoles/pigfete/gate height/.initial=.35}
\ctikzset{tripoles/pigfete/base height/.initial=.5}
\ctikzset{tripoles/pigfete/conn height/.initial=.35}
\ctikzset{tripoles/pigfete/height/.initial=1.1}
\ctikzset{tripoles/pigfete/base width/.initial=.5}
\ctikzset{tripoles/pigfete/gate width/.initial=.62}
\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
\ctikzset{tripoles/pigfete/curr direction/.initial=-1}

\ctikzset{tripoles/pigfetd/width/.initial=.7}
\ctikzset{tripoles/pigfetd/gate height/.initial=.35}
\ctikzset{tripoles/pigfetd/base height/.initial=.5}
\ctikzset{tripoles/pigfetd/conn height/.initial=.35}
\ctikzset{tripoles/pigfetd/height/.initial=1.1}
\ctikzset{tripoles/pigfetd/base width/.initial=.5}
\ctikzset{tripoles/pigfetd/gate width/.initial=.62}
\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
\ctikzset{tripoles/pigfetd/curr direction/.initial=-1}

\ctikzset{tripoles/pigfetebulk/width/.initial=.7}
\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
\ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
\ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
\ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}

\ctikzset{tripoles/npn/width/.initial=.6}
\ctikzset{tripoles/npn/base height/.initial=.45}
\ctikzset{tripoles/npn/base height 2/.initial=.15}
\ctikzset{tripoles/npn/base height/.initial=.4}
\ctikzset{tripoles/npn/conn height/.initial=0}
\ctikzset{tripoles/npn/height/.initial=1.1}
\ctikzset{tripoles/npn/base width/.initial=.5}
\ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
\ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
\ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
\ctikzset{tripoles/npn/curr direction/.initial=1}

\ctikzset{tripoles/pnp/width/.initial=.6}
\ctikzset{tripoles/pnp/base height/.initial=.45}
\ctikzset{tripoles/pnp/base height 2/.initial=.15}
\ctikzset{tripoles/pnp/base height/.initial=.4}
\ctikzset{tripoles/pnp/conn height/.initial=0}
\ctikzset{tripoles/pnp/height/.initial=1.1}
\ctikzset{tripoles/pnp/base width/.initial=.5}
\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
\ctikzset{tripoles/pnp/curr direction/.initial=-1}

\ctikzset{tripoles/pigbt/width/.initial=.6}
\ctikzset{tripoles/pigbt/gate height/.initial=.45}
\ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
\ctikzset{tripoles/pigbt/base height/.initial=.4}
\ctikzset{tripoles/pigbt/conn height/.initial=0}
\ctikzset{tripoles/pigbt/height/.initial=1.1}
\ctikzset{tripoles/pigbt/gate width/.initial=.62}
\ctikzset{tripoles/pigbt/base width/.initial=.5}
\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
\ctikzset{tripoles/pigbt/curr direction/.initial=-1}

\ctikzset{tripoles/nigbt/width/.initial=.6}
\ctikzset{tripoles/nigbt/gate height/.initial=.45}
\ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
\ctikzset{tripoles/nigbt/base height/.initial=.4}
\ctikzset{tripoles/nigbt/conn height/.initial=0}
\ctikzset{tripoles/nigbt/height/.initial=1.1}
\ctikzset{tripoles/nigbt/gate width/.initial=.62}
\ctikzset{tripoles/nigbt/base width/.initial=.5}
\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
\ctikzset{tripoles/nigbt/curr direction/.initial=1}

\ctikzset{tripoles/Lpigbt/width/.initial=.6}
\ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
\ctikzset{tripoles/Lpigbt/base height/.initial=.4}
\ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
\ctikzset{tripoles/Lpigbt/height/.initial=1.1}
\ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
\ctikzset{tripoles/Lpigbt/base width/.initial=.5}
\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}

\ctikzset{tripoles/Lnigbt/width/.initial=.6}
\ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
\ctikzset{tripoles/Lnigbt/base height/.initial=.4}
\ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
\ctikzset{tripoles/Lnigbt/height/.initial=1.1}
\ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
\ctikzset{tripoles/Lnigbt/base width/.initial=.5}
\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
\ctikzset{tripoles/Lnigbt/curr direction/.initial=1}

\ctikzset{tripoles/njfet/width/.initial=.7}
\ctikzset{tripoles/njfet/gate height/.initial=.5}
\ctikzset{tripoles/njfet/gate height 2/.initial=.35}
\ctikzset{tripoles/njfet/gate width/.initial=.5}
\ctikzset{tripoles/njfet/conn height/.initial=.35}
\ctikzset{tripoles/njfet/height/.initial=1.1}
\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
\ctikzset{tripoles/njfet/curr direction/.initial=1}

\ctikzset{tripoles/pjfet/width/.initial=.7}
\ctikzset{tripoles/pjfet/gate height/.initial=.5}
\ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
\ctikzset{tripoles/pjfet/gate width/.initial=.5}
\ctikzset{tripoles/pjfet/conn height/.initial=.35}
\ctikzset{tripoles/pjfet/height/.initial=1.1}
\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
\ctikzset{tripoles/pjfet/curr direction/.initial=-1}

\ctikzset{tripoles/isfet/width/.initial=1}
\ctikzset{tripoles/isfet/gate height/.initial=.35}
\ctikzset{tripoles/isfet/base height/.initial=.5}
\ctikzset{tripoles/isfet/height/.initial=1.1}
\ctikzset{tripoles/isfet/base width/.initial=.3}
\ctikzset{tripoles/isfet/gate width/.initial=.5}
\ctikzset{tripoles/isfet/conn height/.initial=0}
\ctikzset{tripoles/isfet/wave width/.initial=.16}
\ctikzset{tripoles/isfet/wave amp/.initial=.06}
\ctikzset{tripoles/isfet/waves y sep/.initial=.22}
\ctikzset{tripoles/isfet/waves x sep/.initial=.8}
\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
\ctikzset{tripoles/isfet/curr direction/.initial=1}

\newif\ifpgf@circuit@europeanlogicport
\ctikzset{logic ports/.is choice}
\ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue } }
\ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse } } 


\ctikzset{tripoles/american and port/width/.initial=1.1}
\ctikzset{tripoles/american and port/height/.initial=.8}
\ctikzset{tripoles/american and port/port width/.initial=.7}
\ctikzset{tripoles/american and port/input height/.initial=.5}
\ctikzset{tripoles/american nand port/width/.initial=1.1}
\ctikzset{tripoles/american nand port/height/.initial=.8}
\ctikzset{tripoles/american nand port/port width/.initial=.7}
\ctikzset{tripoles/american nand port/circle width/.initial=.15}
\ctikzset{tripoles/american nand port/input height/.initial=.5}
\ctikzset{tripoles/american or port/width/.initial=1.1}
\ctikzset{tripoles/american or port/height/.initial=.8}
\ctikzset{tripoles/american or port/port width/.initial=.7}
\ctikzset{tripoles/american or port/input height/.initial=.5}
\ctikzset{tripoles/american or port/input skip/.initial=.25}
\ctikzset{tripoles/american or port/aaa/.initial=.6}
\ctikzset{tripoles/american or port/bbb/.initial=.4} 
\ctikzset{tripoles/american or port/ccc/.initial=.5} 
\ctikzset{tripoles/american or port/ddd/.initial=.0}
\ctikzset{tripoles/american nor port/width/.initial=1.1}
\ctikzset{tripoles/american nor port/height/.initial=.8}
\ctikzset{tripoles/american nor port/port width/.initial=.7}
\ctikzset{tripoles/american nor port/input height/.initial=.5}
\ctikzset{tripoles/american nor port/input skip/.initial=.25}
\ctikzset{tripoles/american nor port/circle width/.initial=.15}
\ctikzset{tripoles/american nor port/aaa/.initial=.6}
\ctikzset{tripoles/american nor port/bbb/.initial=.4} 
\ctikzset{tripoles/american nor port/ccc/.initial=.5} 
\ctikzset{tripoles/american nor port/ddd/.initial=.0}
\ctikzset{tripoles/american xor port/width/.initial=1.1}
\ctikzset{tripoles/american xor port/height/.initial=.8}
\ctikzset{tripoles/american xor port/port width/.initial=.7}
\ctikzset{tripoles/american xor port/input height/.initial=.5}
\ctikzset{tripoles/american xor port/input skip/.initial=.15}
\ctikzset{tripoles/american xor port/distance/.initial=.1} 
\ctikzset{tripoles/american xor port/aaa/.initial=.6}
\ctikzset{tripoles/american xor port/bbb/.initial=.4} 
\ctikzset{tripoles/american xor port/ccc/.initial=.5} 
\ctikzset{tripoles/american xor port/ddd/.initial=.0}
\ctikzset{tripoles/american xnor port/width/.initial=1.1}
\ctikzset{tripoles/american xnor port/height/.initial=.8}
\ctikzset{tripoles/american xnor port/port width/.initial=.7}
\ctikzset{tripoles/american xnor port/input height/.initial=.5}
\ctikzset{tripoles/american xnor port/input skip/.initial=.15}
\ctikzset{tripoles/american xnor port/distance/.initial=.1} 
\ctikzset{tripoles/american xnor port/aaa/.initial=.6}
\ctikzset{tripoles/american xnor port/bbb/.initial=.4} 
\ctikzset{tripoles/american xnor port/ccc/.initial=.5} 
\ctikzset{tripoles/american xnor port/ddd/.initial=.0}
\ctikzset{tripoles/american xnor port/circle width/.initial=.15}
\ctikzset{tripoles/european and port/width/.initial=1.4}
\ctikzset{tripoles/european and port/height/.initial=.65}
\ctikzset{tripoles/european and port/reserved/.initial=.6}
\ctikzset{tripoles/european and port/input height/.initial=.6}
\ctikzset{tripoles/european or port/width/.initial=1.4}
\ctikzset{tripoles/european or port/height/.initial=.65}
\ctikzset{tripoles/european or port/reserved/.initial=.6}
\ctikzset{tripoles/european or port/input height/.initial=.6}
\ctikzset{tripoles/european xor port/width/.initial=1.4}
\ctikzset{tripoles/european xor port/height/.initial=.65}
\ctikzset{tripoles/european xor port/reserved/.initial=.6}
\ctikzset{tripoles/european xor port/input height/.initial=.6}
\ctikzset{tripoles/european nand port/width/.initial=1.4}
\ctikzset{tripoles/european nand port/not height/.initial=.3}
\ctikzset{tripoles/european nand port/not width/.initial=.8}
\ctikzset{tripoles/european nand port/height/.initial=.65}
\ctikzset{tripoles/european nand port/reserved/.initial=.6}
\ctikzset{tripoles/european nand port/input height/.initial=.6}
\ctikzset{tripoles/european not port/width/.initial=1.4}
\ctikzset{tripoles/european not port/not height/.initial=.3}
\ctikzset{tripoles/european not port/not width/.initial=.8}
\ctikzset{tripoles/european not port/height/.initial=.65}
\ctikzset{tripoles/european not port/reserved/.initial=.6}
\ctikzset{tripoles/european not port/input height/.initial=0}
\ctikzset{tripoles/european xnor port/width/.initial=1.4}
\ctikzset{tripoles/european xnor port/not height/.initial=.3}
\ctikzset{tripoles/european xnor port/not width/.initial=.8}
\ctikzset{tripoles/european xnor port/height/.initial=.65}
\ctikzset{tripoles/european xnor port/reserved/.initial=.6}
\ctikzset{tripoles/european xnor port/input height/.initial=.6}
\ctikzset{tripoles/european nor port/width/.initial=1.4}
\ctikzset{tripoles/european nor port/not height/.initial=.3}
\ctikzset{tripoles/european nor port/not width/.initial=.8}
\ctikzset{tripoles/european nor port/height/.initial=.65}
\ctikzset{tripoles/european nor port/reserved/.initial=.6}
\ctikzset{tripoles/european nor port/input height/.initial=.6}
\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}{0}\selectfont\boldmath}%absolut font size needed!
\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/plain amp/width/.initial=1.7}
\ctikzset{tripoles/plain amp/port width/.initial=.7}
\ctikzset{tripoles/plain amp/height/.initial=1.4}
\ctikzset{tripoles/plain amp/input height/.initial=.5}
\ctikzset{tripoles/plain amp/up pos/.initial=.45}

\ctikzset{tripoles/thyristor/height/.initial=1.10}
\ctikzset{tripoles/thyristor/height 2/.initial=.5}
\ctikzset{tripoles/thyristor/width/.initial=1.0}
\ctikzset{tripoles/thyristor/diode height/.initial=.5}
\ctikzset{tripoles/thyristor/diode width left/.initial=.4}
\ctikzset{tripoles/thyristor/diode width right/.initial=.3}

\ctikzset{tripoles/triac/height/.initial=1.1}
\ctikzset{tripoles/triac/width/.initial=1}
\ctikzset{tripoles/triac/diode width left/.initial=.3}
\ctikzset{tripoles/triac/diode width right/.initial=.3}

\ctikzset{tripoles/spdt/width/.initial=.85}
\ctikzset{tripoles/spdt/height/.initial=.45}
\ctikzset{tripoles/spdt/margin/.initial=.45}

\ctikzset{tripoles/toggleswitch/height/.initial=.8}
\ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
\ctikzset{tripoles/toggleswitch/width/.initial=.80}

\ctikzset{tripoles/mixer/width/.initial=0.7}
\ctikzset{tripoles/adder/width/.initial=0.7}
\ctikzset{tripoles/circulator/width/.initial=.7}
\ctikzset{tripoles/oscillator/width/.initial=.7}


\ctikzset{tripoles/wilkinson/height/.initial=1.3}
\ctikzset{tripoles/wilkinson/width/.initial=1.3}

\ctikzset{quadpoles/transformer/width/.initial=1.5}
\ctikzset{quadpoles/transformer/width1/.initial=.4}
\ctikzset{quadpoles/transformer/height/.initial=1.5}
\ctikzset{quadpoles/transformer/height1/.initial=.8}
\ctikzset{quadpoles/transformer core/width/.initial=1.5}
\ctikzset{quadpoles/transformer core/height/.initial=1.5}
\ctikzset{quadpoles/transformer core/core height/.initial=.5}
\ctikzset{quadpoles/transformer core/core width/.initial=.05}
\ctikzset{quadpoles/gyrator/width/.initial=1.5}
\ctikzset{quadpoles/gyrator/height/.initial=1.5}
\ctikzset{quadpoles/fourport/width/.initial=1.3}
\ctikzset{quadpoles/fourport/height/.initial=1.3}
\ctikzset{quadpoles/coupler/width/.initial=1.3}
\ctikzset{quadpoles/coupler/height/.initial=1.3}
\ctikzset{quadpoles/coupler2/width/.initial=1.3}
\ctikzset{quadpoles/coupler2/height/.initial=1.3}

\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}


% %Mechanical section
\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
\ctikzset{bipoles/spring/height/.initial=.5}
\ctikzset{bipoles/spring/width/.initial=.5}
\ctikzset{bipoles/mass/height/.initial=.55}
\ctikzset{bipoles/mass/box height/.initial=.4}
\ctikzset{bipoles/mass/width/.initial=.5}

\ctikzset{bipoles/damper/height/.initial=.35}
\ctikzset{bipoles/damper/length/.initial=.3}
\ctikzset{bipoles/damper/width/.initial=.4}


\ctikzset{bipole/.is family}
\ctikzset{bipole/kind/.initial = }
\ctikzset{bipole/name/.initial = }
\newif\ifpgf@circuit@bipole@isvoltage
\ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
\newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
\newif\ifpgf@circuit@bipole@strokedsymbol
\ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
\newif\ifpgf@circuit@bipole@iscurrent
\ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}

\ctikzset{bipole/voltage/.is family}
\newif\ifpgf@circuit@bipole@voltage@backward
\ctikzset{bipole/voltage/direction/.is choice}
\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
\newif\ifpgf@circuit@bipole@voltage@below
\ctikzset{bipole/voltage/position/.is choice}
\ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
\ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}

\ctikzset{bipole/voltage/label/unit/.initial=}
\ctikzset{bipole/voltage/label/name/.initial=}

\ctikzset{bipole/current/.is family}
\newif\ifpgf@circuit@bipole@current@backward
\ctikzset{bipole/current/direction/.is choice}
\ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
\ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
\newif\ifpgf@circuit@bipole@current@before
\ctikzset{bipole/current/x position/.is choice}
\ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
\ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
\newif\ifpgf@circuit@bipole@current@below
\ctikzset{bipole/current/y position/.is choice}
\ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
\ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}

\ctikzset{bipole/current/label/unit/.initial=}
\ctikzset{bipole/current/label/name/.initial=}

\ctikzset{bipole/label/.is family}
\ctikzset{bipole/label/position/.initial=90}
\ctikzset{bipole/label/unit/.initial=}
\ctikzset{bipole/label/name/.initial=}
\ctikzset{bipole/annotation/.is family}
\ctikzset{bipole/annotation/position/.initial=-90}
\ctikzset{bipole/annotation/unit/.initial=}
\ctikzset{bipole/annotation/name/.initial=}
\ctikzset{bipole/nodes/.is family}
\ctikzset{bipole/nodes/left/.is choice}
\ctikzset{bipole/nodes/left/none/.code={\ctikzsetvalof{bipole/nodes/left}{none}}}
\ctikzset{bipole/nodes/left/empty/.code={\ctikzsetvalof{bipole/nodes/left}{empty}}}
\ctikzset{bipole/nodes/left/full/.code={\ctikzsetvalof{bipole/nodes/left}{full}}}
\ctikzset{bipole/nodes/left/diamond/.code={\ctikzsetvalof{bipole/nodes/left}{diamond}}}
\ctikzset{bipole/nodes/left/rectjoinfill/.code={\ctikzsetvalof{bipole/nodes/left}{rectjoinfill}}}
\ctikzset{bipole/nodes/right/.is choice}
\ctikzset{bipole/nodes/right/none/.code={\ctikzsetvalof{bipole/nodes/right}{none}}}
\ctikzset{bipole/nodes/right/empty/.code={\ctikzsetvalof{bipole/nodes/right}{empty}}}
\ctikzset{bipole/nodes/right/full/.code={\ctikzsetvalof{bipole/nodes/right}{full}}}
\ctikzset{bipole/nodes/right/diamond/.code={\ctikzsetvalof{bipole/nodes/right}{diamond}}}
\ctikzset{bipole/nodes/right/rectjoinfill/.code={\ctikzsetvalof{bipole/nodes/right}{rectjoinfill}}}




\newif\ifpgf@circuit@europeanresistor
\ctikzset{resistor/.is choice}
\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }

\ctikzset{inductor/.is choice}
\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}

\newif\ifpgf@circuit@strokediode
\newif\ifpgf@circuit@fulldiode
\pgf@circuit@strokediodefalse
\pgf@circuit@fulldiodefalse

\ctikzset{diode/.is choice}
\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue }
\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}

\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full }}
\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty }}
\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke }}

\ctikzset{thickness/.initial=2}
\ctikzset{color/.initial=black}
\pgfkeys{/tikz/color/.add code={}{\ctikzset{color=#1}}}


\newif\ifpgf@circ@siunitx
\newif\ifpgf@circ@siunitx@res

\ctikzset{straight/.is choice}
\ctikzset{straightvoltage value/.initial=true}
\ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
\ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
\ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}}
\newif\ifpgf@circuit@bipole@voltage@straight
\ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}


\ctikzset{voltage/.is family}
\ctikzset{voltage/distance from node/.initial=.5} %\pgf@circ@Rlen units
\ctikzset{voltage/distance from line/.initial=.08} % pos, tra 0 e 1
\ctikzset{voltage/bump a/.initial=1.2}
\ctikzset{voltage/bump b/.initial=1.5}
\ctikzset{voltage/european label distance/.initial=1.4}
\ctikzset{voltage/american label distance/.initial=1.1}
% special cases
\ctikzset{bipoles/generic/voltage/distance from node/.initial=.4}
\ctikzset{bipoles/generic/voltage/bump b/.initial=2}
\ctikzset{bipoles/generic/voltage/european label distance/.initial=1.8}
%\ctikzset{bipoles/thermocouple/voltage/distance from node/.initial=.3}
\ctikzset{bipoles/thermocouple/voltage/bump b/.initial=2.2}
\ctikzset{bipoles/thermocouple/voltage/european label distance/.initial=1.5}
\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
\ctikzset{bipoles/ageneric/voltage/european label distance/.initial=1.8}
\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
\ctikzset{bipoles/fullgeneric/voltage/european label distance/.initial=1.8}
\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
\ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
\ctikzset{bipoles/memristor/voltage/european label distance/.initial=1.8}
%\ctikzset{bipoles/tline/voltage/distance from node/.initial=.2}
\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
\ctikzset{bipoles/tline/voltage/european label distance/.initial=2.1}
%\ctikzset{bipoles/varistor/voltage/distance from node/.initial=.2}
\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
\ctikzset{bipoles/varistor/voltage/european label distance/.initial=2}
%\ctikzset{bipoles/photoresistor/voltage/distance from node/.initial=.2}
\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=2}
\ctikzset{bipoles/photoresistor/voltage/european label distance/.initial=1.8}
%\ctikzset{bipoles/thermistor/voltage/distance from node/.initial=.2}
\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=2}
%\ctikzset{bipoles/thermistorntc/voltage/distance from node/.initial=.2}
\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
%\ctikzset{bipoles/thermistorptc/voltage/distance from node/.initial=.2}
\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}

\ctikzset{current/.is family}
\ctikzset{current/distance/.initial = .5}

\tikzset{american currents/.style = { \circuitikzbasekey/current = american } }
\tikzset{european currents/.style = { \circuitikzbasekey/current = european } }
\tikzset{american voltages/.style = { \circuitikzbasekey/voltage = american } }
\tikzset{european voltages/.style = { \circuitikzbasekey/voltage = european } }
\tikzset{american resistors/.style = { \circuitikzbasekey/resistor = american } }
\tikzset{european resistors/.style = { \circuitikzbasekey/resistor = european } }

\newif\ifpgf@circuit@europeangfsurgearrester
\ctikzset{gas filled surge arrester/.is choice}
\ctikzset{gas filled surge arrester/european/.code= {\pgf@circuit@europeangfsurgearrestertrue } }
\ctikzset{gas filled surge arrester/american/.code= {\pgf@circuit@europeangfsurgearresterfalse } } 

\tikzset{american gas filled surge arrester/.style = { \circuitikzbasekey/gas filled surge arrester = american } }
\tikzset{european gas filled surge arrester/.style = { \circuitikzbasekey/gas filled surge arrester = 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 } }
\tikzset{american/.style = { american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester } }
\tikzset{cute/.style = { european currents, european voltages, american resistors, cute inductors, american ports } }

% I should try to make the tree clearer (this voltaege conflicts with the options above)

\newif\ifpgf@circuit@europeanvoltage
\ctikzset{voltage/.is choice}
\ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse } }
\ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue } }

\newif\ifpgf@circuit@europeancurrent
\ctikzset{current/.is choice}
\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse }
\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue }

\ctikzset{label/align/.is choice}
\ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}

%%%%%%%%%% new
\pgfkeys{\circuitikzbasekey/.search also={/tikz}}
