diff options
Diffstat (limited to 'Master/texmf-dist/tex')
7 files changed, 775 insertions, 614 deletions
diff --git a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex index 9d588ae13af..06210be341d 100644 --- a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex +++ b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex @@ -10,8 +10,8 @@ % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. -\def\pgfcircversion{1.2.0} -\def\pgfcircversiondate{2020/06/21} +\def\pgfcircversion{1.2.1} +\def\pgfcircversiondate{2020/07/06} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index af70e82d753..e3686e4d946 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex @@ -9,9 +9,10 @@ % 2. under the GNU Public License. % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. - % -%% Key managements +% This file has folding marks for vim (See last line). +% +%% Key managements%<<<1 \long\def\pgf@circ@comment#1{} @@ -24,15 +25,17 @@ \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}} \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}} -%% Temporary Counters +\pgfkeys{\circuitikzbasekey/.search also={/tikz}} +%%>>> +%% Temporary Counters and dimensions%<<<1 +%% Temporary Counters \newcount\pgf@circ@count@a \newcount\pgf@circ@count@b \newcount\pgf@circ@count@c %%%%%%%%%%%% %% Dimensions - -% coordinates +% coordinate \newdimen\pgf@circ@res@up \newdimen\pgf@circ@res@down \newdimen\pgf@circ@res@zero @@ -41,10 +44,19 @@ \newdimen\pgf@circ@res@other \newdimen\pgf@circ@res@step \newdimen\pgf@circ@res@temp +% Base len for all circuitikz +\newdimen\pgf@circ@Rlen +% 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 % inital thickness \newdimen \pgfstartlinewidth +%%>>> -% arrow tips, ported over old arrows library (deprecated) +% arrow tips, ported over old arrows library (deprecated)%<<<1 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library % this was the original definition of latex' tips, renamed to avoid clashes % @@ -76,6 +88,9 @@ } \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} +%%>>> + +%% Macros to do things depending on the class%<<<1 \def\pgf@circ@setifdefinedfill#1#2{% % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none: @@ -150,8 +165,9 @@ } % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case \ctikzset{none/thickness/.initial=1.0} % do not touch +%%>>> -%% font changes compatible with plain/LaTeX/ConTeXt +%% font changes compatible with plain/LaTeX/ConTeXt%<<<1 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605 \ifpgfutil@format@is@latex @@ -203,8 +219,10 @@ {{}}% #1 is \relax, so consider empty {\expandafter{#1}}% otherwise, leave the key after one more expansion }% -% -% text position (added with ieeestd logic ports. Maybe to be extended to other components, +%>>> + +% text position in some component.%<<<1 +% (added with ieeestd logic ports. Maybe to be extended to other components, % like amplifiers) % \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue @@ -215,8 +233,9 @@ \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}% \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}% \ctikzset{left text distance/.initial=0.3em}% +%>>> -% voltage options +% voltage direction options%<<<1 \newif\ifpgf@circ@siunitx \newif\ifpgf@circuit@compat @@ -229,54 +248,109 @@ \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}} \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}} \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}} -\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}} +\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}% +%>>> -% Option ">" for twoports -\newif\ifpgf@circuit@inputarrow -\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} -\ctikzset{inputarrow/.is choice} -\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} -\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} +% bipole definitions for path component and text decorations%%<<<1 +% +% Option "t=*" for nodes +\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}} +% +\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} -% 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}} +\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}} -% 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}} +\ctikzset{bipole/voltage/label/unit/.initial=} +\ctikzset{bipole/voltage/label/name/.initial=} -% Option "t=*" for nodes -\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}} +\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{current arrow scale/.initial=16} +\ctikzset{bipole/flow/.is family} +\newif\ifpgf@circuit@bipole@flow@backward +\ctikzset{bipole/flow/direction/.is choice} +\ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}} +\ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}} +\newif\ifpgf@circuit@bipole@flow@before +\ctikzset{bipole/flow/x position/.is choice} +\ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}} +\ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}} +\newif\ifpgf@circuit@bipole@flow@below +\ctikzset{bipole/flow/y position/.is choice} +\ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}} +\ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}} +\ctikzset{bipole/flow/label/unit/.initial=} +\ctikzset{bipole/flow/label/name/.initial=} +\ctikzset{flow/distance/.initial = .5} +\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor -\ctikzset{bipoles/.is family} +\ctikzset{bipole/label/.is family} +\ctikzset{bipole/label/position/.initial=90} +\ctikzset{bipole/label/unit/.initial=} +\ctikzset{bipole/label/name/.initial=} +\ctikzset{bipole/annotation/.is family} +\ctikzset{bipole/annotation/position/.initial=-90} +\ctikzset{bipole/annotation/unit/.initial=} +\ctikzset{bipole/annotation/name/.initial=} + +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circ@siunitx@res + +\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}}} +%%>>> + +% traditional styles %<<<1 +% +\ctikzset{thickness/.initial=2} +\ctikzset{color/.initial=black} +\pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}} \ctikzset{bipoles/border margin/.initial=1.1} \ctikzset{bipoles/thickness/.initial=2} \ctikzset{tripoles/thickness/.initial=2} \ctikzset{quadpoles/thickness/.initial=2} \ctikzset{nodes width/.initial=.04} +%%>>> -% Base len for all circuitikz -\newdimen\pgf@circ@Rlen -% 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 +% Styles definitions and macros%<<<1 %%%%%%%%%%%%%%%%%%%%%%%%%%%% %% main style definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%% - - % load a style file: search ctikzstyle-NAME.tex in path \def\ctikzloadstyle#1{% \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{% @@ -395,8 +469,15 @@ \ctikzset{displays/scale/.initial=1.0} \ctikzset{displays/fill/.initial=none} \ctikzset{displays/thickness/.initial=none} +% +% general styles +% +\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}} +\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}} +\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}} +%%>>> -% grounds and power supplies +% grounds and power supplies%<<<1 \ctikzset{monopoles/.is family} \ctikzset{monopoles/ground/width/.initial=.25} @@ -423,24 +504,28 @@ \ctikzset{monopoles/bareantenna/width/.initial=.25} \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1} \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5} -\ctikzset{monopoles/waves/width/.initial=0.5} +\ctikzset{monopoles/waves/width/.initial=0.5}% +%>>> -% microstrips +% microstrips %<<<1 \ctikzset{bipoles/mstline/height/.initial=0.3} \ctikzset{bipoles/mstline/width/.initial=1.2} \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}} \ctikzset{monopoles/msport/width/.initial=.5} \ctikzset{monopoles/msrstub/height/.initial=1.0} -\ctikzset{monopoles/msrstub/width/.initial=0.6} +\ctikzset{monopoles/msrstub/width/.initial=0.6}% +%>>> -% microphone and loudspeaker +% microphone and loudspeaker%<<<1 \ctikzset{bipoles/loudspeaker/height/.initial=.8} \ctikzset{bipoles/loudspeaker/depth/.initial=.3} \ctikzset{bipoles/loudspeaker/width/.initial=.8} \ctikzset{bipoles/mic/height/.initial=1.2} \ctikzset{bipoles/mic/depth/.initial=.1} -\ctikzset{bipoles/mic/width/.initial=.8} +\ctikzset{bipoles/mic/width/.initial=.8}% +%>>> +% resistors%<<<1 % Zig Zag resistors \ctikzset{resistors/zigs/.initial=3} \ctikzset{resistors/width/.code={% @@ -501,8 +586,19 @@ \ctikzset{bipoles/tgeneric/height/.initial=.70} \ctikzset{bipoles/tgeneric/width/.initial=.80} \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} -%% Capacitors +\newif\ifpgf@circuit@europeanresistor +\ctikzset{resistor/.is choice} +\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } +\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue } +\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} +\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}} +%%>>> + +%% Capacitors%<<<1 \ctikzset{bipoles/capacitor/height/.initial=.6} \ctikzset{bipoles/capacitor/width/.initial=.2} \ctikzset{bipoles/ecapacitor/height/.initial=.5} @@ -519,9 +615,10 @@ \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/piezoelectric/width/.initial=.5}% +%>>> -% Inductors +% Inductors%<<<1 \ctikzset{inductors/coils/.code={% \ctikzset{bipoles/cuteinductor/coils=#1}% \ctikzset{bipoles/cutechoke/coils=#1}% @@ -578,8 +675,20 @@ \ctikzset{bipoles/tfullgeneric/width/.initial=.80} \ctikzset{bipoles/fullgeneric/height/.initial=.30} \ctikzset{bipoles/fullgeneric/width/.initial=.80} +\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}}} + +\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}} -% Sources +%%>>> + +% Sources%<<<1 \ctikzset{bipoles/esource/height/.initial=.60} \ctikzset{bipoles/esource/width/.initial=.60} @@ -632,7 +741,12 @@ \ctikzset{bipoles/battery1/width/.initial=.3} \ctikzset{bipoles/battery2/height/.initial=.6} \ctikzset{bipoles/battery2/width/.initial=.3} +% noise sources +\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} +%%>>> + +% "oo" style transformers and power grid diagrams%<<<1 % % % ootransformer \ctikzset{bipoles/oosourcetrans/height/.initial=.6} \ctikzset{bipoles/oosourcetrans/width/.initial=.6} @@ -671,9 +785,10 @@ \pgfkeys{tikz/tert/.is choice} \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}} \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}} -\pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}} +\pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}% +%>>> -% diodes +% diodes%<<<1 \ctikzset{bipoles/diode/height/.initial=.50} \ctikzset{bipoles/diode/width/.initial=.40} @@ -683,8 +798,52 @@ \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} \ctikzset{bipoles/varcap/height/.initial=.50} \ctikzset{bipoles/varcap/width/.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} +% +% Flipping arrows in LED and photodiodes +% +\newif\ifpgf@led@fliparrows +\newif\ifpgf@pd@fliparrows +\pgf@led@fliparrowsfalse +\pgf@pd@fliparrowsfalse +% +% by default the arrows start (LED) and go (PD) to the anode. +% +\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} +\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} +% +% but they can start form the cathode (LED) or go to it (PD) +% +\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} +\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} -% switches +\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}} + +%%>>> + +% switches%<<<1 \ctikzset{bipoles/spst/height/.initial=.35} \ctikzset{bipoles/spst/width/.initial=.35} @@ -695,12 +854,30 @@ \ctikzset{bipoles/ncs/height/.initial=.35} \ctikzset{bipoles/ncs/width/.initial=.35} \ctikzset{bipoles/ncs/depth/.initial=.2} +\ctikzset{bipoles/pushbutton/height/.initial=.5} +\ctikzset{bipoles/pushbutton/height 2/.initial=.2} +\ctikzset{bipoles/pushbutton/width/.initial=.50} %%% reed switch \ctikzset{bipoles/reed/height/.initial=.4} \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos \ctikzset{bipoles/reed/depth/.initial=.4} +%% Cute switches +\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}} +\ctikzset{bipoles/cuteswitch/height/.initial=.6} +\ctikzset{bipoles/cuteswitch/height 2/.initial=.2} +\ctikzset{bipoles/cuteswitch/width/.initial=.50} +\ctikzset{bipoles/cuteswitch/thickness/.initial=1} -% misc +\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} +%%>>> + +% arresters, fuses, lamps, etc%<<<1 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} @@ -715,9 +892,31 @@ \ctikzset{bipoles/fuse/width/.initial=.50} \ctikzset{bipoles/afuse/height/.initial=.20} \ctikzset{bipoles/afuse/width/.initial=.50} -\ctikzset{bipoles/memristor/height/.initial=.30} -\ctikzset{bipoles/memristor/wave height/.initial=.5} -\ctikzset{bipoles/memristor/width/.initial=.80} +\ctikzset{bipoles/lamp/height/.initial=.60} +\ctikzset{bipoles/lamp/width/.initial=.60} +\ctikzset{bipoles/bulb/height/.initial=.8} +\ctikzset{bipoles/bulb/width/.initial=.8} +\ctikzset{bipoles/tline/height/.initial=.3} +\ctikzset{bipoles/tline/width/.initial=.8} +\ctikzset{bipoles/squid/height/.initial=.60} +\ctikzset{bipoles/squid/width/.initial=.60} +\ctikzset{bipoles/barrier/height/.initial=.60} +\ctikzset{bipoles/barrier/width/.initial=.60} +\ctikzset{bipoles/openbarrier/gap/.initial=0.5} +\ctikzset{bipoles/thermocouple/height/.initial=.250} +\ctikzset{bipoles/thermocouple/height 2/.initial=.60} +\ctikzset{bipoles/thermocouple/width/.initial=.140} +\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}} +%%>>> + +% wires (open, shorts, ...)%<<<1 + \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} @@ -728,7 +927,11 @@ \ctikzset{bipoles/multiwire/height/.initial=0.4} \ctikzset{bipoles/multiwire/width/.initial=0.2} \ctikzset{bipoles/multiwire/spacing/.initial=0.05} +% crossing wires +\ctikzset{bipoles/crossing/size/.initial=.2} +%%>>> +% Instruments %<<<1 \ctikzset{bipoles/ammeter/height/.initial=.60} \ctikzset{bipoles/ammeter/width/.initial=.60} \ctikzset{bipoles/ohmmeter/height/.initial=.60} @@ -759,30 +962,9 @@ \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +%%>>> - -\ctikzset{bipoles/buffer/height/.initial=1} -\ctikzset{bipoles/buffer/width/.initial=1} -\ctikzset{bipoles/not port/width/.initial=1} -\ctikzset{bipoles/not port/height/.initial=.8} -\ctikzset{bipoles/not port/circle width/.initial=.15} -\ctikzset{bipoles/lamp/height/.initial=.60} -\ctikzset{bipoles/lamp/width/.initial=.60} -\ctikzset{bipoles/bulb/height/.initial=.8} -\ctikzset{bipoles/bulb/width/.initial=.8} -\ctikzset{bipoles/tline/height/.initial=.3} -\ctikzset{bipoles/tline/width/.initial=.8} -\ctikzset{bipoles/squid/height/.initial=.60} -\ctikzset{bipoles/squid/width/.initial=.60} -\ctikzset{bipoles/barrier/height/.initial=.60} -\ctikzset{bipoles/barrier/width/.initial=.60} -\ctikzset{bipoles/openbarrier/gap/.initial=0.5} -\ctikzset{bipoles/thermocouple/height/.initial=.250} -\ctikzset{bipoles/thermocouple/height 2/.initial=.60} -\ctikzset{bipoles/thermocouple/width/.initial=.140} -\ctikzset{bipoles/pushbutton/height/.initial=.5} -\ctikzset{bipoles/pushbutton/height 2/.initial=.2} -\ctikzset{bipoles/pushbutton/width/.initial=.50} +% blocks (twoports and so)%<<<1 \ctikzset{bipoles/twoport/width/.initial=.7} \ctikzset{bipoles/twoport/height/.initial=.7} @@ -805,11 +987,16 @@ \ctikzset{bipoles/phaseshifter/width/.initial=.7} \ctikzset{bipoles/vphaseshifter/width/.initial=.7} \ctikzset{bipoles/detector/width/.initial=.7} +\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} -% crossing wires -\ctikzset{bipoles/crossing/size/.initial=.2} +\ctikzset{tripoles/wilkinson/height/.initial=1.3} +\ctikzset{tripoles/wilkinson/width/.initial=1.3} +%%>>> -% Transistors starts here +% Transistors %<<<1 \newif\ifpgf@circuit@trans@depletiontype \pgf@circuit@trans@depletiontypefalse @@ -1203,10 +1390,44 @@ \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1} %% transistors stop here +%%>>> + +% Electronic tubes: diodetube, triode, tetrode and pentode%<<<1 +\ctikzset{tubes/width/.initial=1} % relative width +\ctikzset{tubes/height/.initial=1.4} % relative height +\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle +\ctikzset{tubes/anode distance/.initial=0.40} % distance from center +\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate +\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center +\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes +\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids +\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center +\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid +\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode +\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire +\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side +\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode +\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint + +\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse +\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse +\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse +\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} +\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}% +%>>> -%% Logic ports +%% Logic ports%<<<1 %% beware that the third option is in IEEE ports in pgfcircmultipoles.tex +% switches for logic gates +% +\pgfkeys{/tikz/number inputs/.initial=0} +\pgfkeys{/tikz/number inputs/.default=0} + \newif\ifpgf@circuit@europeanlogicport \ctikzset{logic ports/.is choice} \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue @@ -1296,6 +1517,12 @@ \tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} \tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} +% old, legacy keys that should be killed over +\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{tripoles/american and port/width/.initial=1.1} \ctikzset{tripoles/american and port/height/.initial=.8} @@ -1429,10 +1656,9 @@ \ctikzset{tripoles/american xnor port/bbb/.initial=.4} \ctikzset{tripoles/american xnor port/ccc/.initial=.5} \ctikzset{tripoles/american xnor port/ddd/.initial=.0} -% switches for logic gates -% -\pgfkeys{/tikz/number inputs/.initial=0} -\pgfkeys{/tikz/number inputs/.default=0} +%%>>> + +% flip flops and muxdemxes%<<<1 %% flip-flop specific keys (most others are the same as chips) @@ -1455,7 +1681,10 @@ \ctikzset{multipoles/muxdemux/NR/.initial=1} \ctikzset{multipoles/muxdemux/NB/.initial=3} \ctikzset{multipoles/muxdemux/NT/.initial=0} -\ctikzset{multipoles/muxdemux/square pins/.initial=0} +\ctikzset{multipoles/muxdemux/square pins/.initial=0}% +%>>> + +% Amplifiers%<<<1 % % switches for op amps % changing input polarity @@ -1576,42 +1805,9 @@ \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} +%%>>> -\ctikzset{tripoles/thyristor/height/.initial=1.10} -\ctikzset{tripoles/thyristor/height 2/.initial=.5} -\ctikzset{tripoles/thyristor/width/.initial=1.0} -\ctikzset{tripoles/thyristor/diode height/.initial=.5} -\ctikzset{tripoles/thyristor/diode width left/.initial=.4} -\ctikzset{tripoles/thyristor/diode width right/.initial=.3} - -\ctikzset{tripoles/triac/height/.initial=1.1} -\ctikzset{tripoles/triac/width/.initial=1} -\ctikzset{tripoles/triac/diode width left/.initial=.3} -\ctikzset{tripoles/triac/diode width right/.initial=.3} - -%% Cute switches -\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}} -\ctikzset{bipoles/cuteswitch/height/.initial=.6} -\ctikzset{bipoles/cuteswitch/height 2/.initial=.2} -\ctikzset{bipoles/cuteswitch/width/.initial=.50} -\ctikzset{bipoles/cuteswitch/thickness/.initial=1} - -\ctikzset{tripoles/spdt/width/.initial=.85} -\ctikzset{tripoles/spdt/height/.initial=.45} -\ctikzset{tripoles/spdt/margin/.initial=.45} - -\ctikzset{tripoles/toggleswitch/height/.initial=.8} -\ctikzset{tripoles/toggleswitch/height 2/.initial=.0} -\ctikzset{tripoles/toggleswitch/width/.initial=.80} - -\ctikzset{tripoles/mixer/width/.initial=0.7} -\ctikzset{tripoles/adder/width/.initial=0.7} -\ctikzset{tripoles/circulator/width/.initial=.7} -\ctikzset{tripoles/oscillator/width/.initial=.7} - - -\ctikzset{tripoles/wilkinson/height/.initial=1.3} -\ctikzset{tripoles/wilkinson/width/.initial=1.3} +% Transformers%<<<1 \ctikzset{quadpoles/transformer/inner/.initial=0.4} \ctikzset{quadpoles/transformer/width/.initial=1.5} @@ -1654,9 +1850,105 @@ \ctikzset{quadpoles/gyrator/width=0.6}% }% } +%%>>> + +% seven segment displays by RGtti%<<<1 +\newif\ifpgf@circ@sevenseg@dot +\newif\ifpgf@circ@sevenseg@box +\def\pgf@circ@sevenseg@dotstate{empty} +\ctikzset{seven seg/.is family} +\ctikzset{seven seg/dot/.is choice} +% none means no dot, not space for it. Empty means no dot, but space +\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}} +\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} +\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} +\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} % -% multipoles +\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen +\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness +\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments +\ctikzset{seven seg/box sep/.initial=1pt}% external box gap +\ctikzset{seven seg/color on/.initial=red}% color for segment "on" +\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" +\ctikzset{seven seg/box/.is choice} +\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}} +\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}} + +\ctikzset{seven seg/bits/.initial=0000000} + +\ctikzset{seven seg/value/.code={% + \edef\@@tmp{#1}% + \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi + \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi + \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi + \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi + \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi + \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi + \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi + \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi + \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi + \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi + \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi +}} + +\tikzset{% + seven segment val/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/value=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, + seven segment bits/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/bits=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, +} +%%>>> + +% Options for twoports and blocks%<<<1 + +% Option ">" for twoports +\newif\ifpgf@circuit@inputarrow +\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/.is choice} +\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} + +% Option "boxed" for nodes and twoports +\newif\ifpgf@circuit@boxed +\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} +\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} + +% Option "dashed" for nodes and twoports +\newif\ifpgf@circuit@dashed +\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} +\ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}% +%>>> + +% Chips and Rotary switches (multipoles) %<<<1 % \ctikzset{multipoles/thickness/.initial=2} \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny} @@ -1738,8 +2030,9 @@ rotary switch ->/.default={5 in 60 wiper 20}, rotary switch <->/.default={5 in 60 wiper 20}, } +%%>>> -% %Mechanical section +% %Mechanical section%<<<1 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8} \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6} \ctikzset{bipoles/spring/height/.initial=.5} @@ -1753,142 +2046,56 @@ \ctikzset{bipoles/damper/height/.initial=.35} \ctikzset{bipoles/damper/length/.initial=.3} \ctikzset{bipoles/damper/width/.initial=.4} +%%>>> +% powerelectronic blocks%<<<1 +\ctikzset{bipoles/sacdc/width/.initial=.7} +\ctikzset{bipoles/sdcac/width/.initial=.7} +\ctikzset{bipoles/tacdc/width/.initial=.7} +\ctikzset{bipoles/tdcac/width/.initial=.7} +\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? +%>>> -\ctikzset{bipole/.is family} -\ctikzset{bipole/kind/.initial=} -\ctikzset{bipole/name/.initial=} -\newif\ifpgf@circuit@bipole@isvoltage -\ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage} -\newif\ifpgf@circuit@bipole@voltageoutsideofsymbol -\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol} -\newif\ifpgf@circuit@bipole@strokedsymbol -\ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol} -\newif\ifpgf@circuit@bipole@iscurrent -\ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent} - -\ctikzset{bipole/voltage/.is family} -\newif\ifpgf@circuit@bipole@voltage@backward -\ctikzset{bipole/voltage/direction/.is choice} -\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} -\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}} -\newif\ifpgf@circuit@bipole@voltage@below -\ctikzset{bipole/voltage/position/.is choice} -\ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}} -\ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}} - -\ctikzset{bipole/voltage/label/unit/.initial=} -\ctikzset{bipole/voltage/label/name/.initial=} - -\ctikzset{bipole/current/.is family} -\newif\ifpgf@circuit@bipole@current@backward -\ctikzset{bipole/current/direction/.is choice} -\ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}} -\ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}} -\newif\ifpgf@circuit@bipole@current@before -\ctikzset{bipole/current/x position/.is choice} -\ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}} -\ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}} -\newif\ifpgf@circuit@bipole@current@below -\ctikzset{bipole/current/y position/.is choice} -\ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}} -\ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}} -\ctikzset{bipole/current/label/unit/.initial=} -\ctikzset{bipole/current/label/name/.initial=} - -\ctikzset{bipole/flow/.is family} -\newif\ifpgf@circuit@bipole@flow@backward -\ctikzset{bipole/flow/direction/.is choice} -\ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}} -\ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}} -\newif\ifpgf@circuit@bipole@flow@before -\ctikzset{bipole/flow/x position/.is choice} -\ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}} -\ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}} -\newif\ifpgf@circuit@bipole@flow@below -\ctikzset{bipole/flow/y position/.is choice} -\ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}} -\ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}} -\ctikzset{bipole/flow/label/unit/.initial=} -\ctikzset{bipole/flow/label/name/.initial=} -\ctikzset{flow/distance/.initial = .5} -\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor - -\ctikzset{bipole/label/.is family} -\ctikzset{bipole/label/position/.initial=90} -\ctikzset{bipole/label/unit/.initial=} -\ctikzset{bipole/label/name/.initial=} -\ctikzset{bipole/annotation/.is family} -\ctikzset{bipole/annotation/position/.initial=-90} -\ctikzset{bipole/annotation/unit/.initial=} -\ctikzset{bipole/annotation/name/.initial=} - -\newif\ifpgf@circuit@europeanresistor -\ctikzset{resistor/.is choice} -\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } -\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue } - -\ctikzset{inductor/.is choice} -\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}} -\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}} -\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}} - -% -% Flipping arrows in LED and photodiodes -% -\newif\ifpgf@led@fliparrows -\newif\ifpgf@pd@fliparrows -\pgf@led@fliparrowsfalse -\pgf@pd@fliparrowsfalse -% -% by default the arrows start (LED) and go (PD) to the anode. -% -\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} -\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} -% -% but they can start form the cathode (LED) or go to it (PD) -% -\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} -\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} - -\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 - -% -% voltage and current options +% voltage and current options%<<<1 % +\ctikzset{current arrow scale/.initial=16} +\ctikzset{current/distance/.initial = .5} \newif\ifpgf@circuit@europeancurrent \newif\ifpgf@circuit@europeanvoltage \newif\ifpgf@circuit@bipole@voltage@straight +\newif\ifpgf@circuit@bipole@voltage@raised \ctikzset{voltage/.is choice} % % straight is expected to be a subset of european, so disable it in american style % -\ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse\pgf@circuit@bipole@voltage@straightfalse}} -\ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straightfalse}} -\ctikzset{voltage/straight/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straighttrue}} -\ctikzset{voltage/curved/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straightfalse}} - +\ctikzset{voltage/american/.code = {% + \pgf@circuit@europeanvoltagefalse + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/raised/.code = {% + \pgf@circuit@europeanvoltagefalse + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedtrue +}} +\ctikzset{voltage/european/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/straight/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straighttrue + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/curved/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +% are these used? \ctikzset{current/.is choice} \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse} \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue} @@ -1903,9 +2110,17 @@ % above. I hope it is ok --- would be a mess otherwise % \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols -\ctikzset{voltage shift/.style={voltage/shift=#1}} +\ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}} \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}} - +% +% keys for exporting voltage, current, flow anchors +% +\newif\ifpgfcirc@has@v\pgfcirc@has@vfalse +\newif\ifpgfcirc@has@f\pgfcirc@has@ffalse +\newif\ifpgfcirc@has@i\pgfcirc@has@ifalse +\def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname} +\def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname} +% % shaping the +/- sign, see pgfcircvoltage.tex \ctikzset{voltage/american font/.initial={}} \ctikzset{voltage/american plus/.initial={$+$}} @@ -1938,13 +2153,29 @@ \ctikzset{voltage/european label distance/.initial=1.4} \ctikzset{voltage/straight label distance/.initial=1.4} \ctikzset{voltage/american label distance/.initial=1.4} +% american open voltage adjusting +% +\newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue +\ctikzset{american open voltage/.is choice} +\ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}} +\ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}} +% +% voltage and current styles % +\tikzset{american currents/.style = {\circuitikzbasekey/current = american}} +\tikzset{european currents/.style = {\circuitikzbasekey/current = european}} +\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}} +\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}} +\tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}} +\tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}} +%%>>> + +% special cases for voltage positions%<<<1 % the KIND is the node name without SHAPE % See the definition above for meaning % if bipoles/KIND/voltage/straight label distance is not defined, it uses the height % if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance) % -% special cases for voltage positions \ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4} \ctikzset{bipoles/generic/voltage/bump b/.initial=2} % @@ -1992,169 +2223,7 @@ \ctikzset{bipoles/battery/voltage/bump a/.initial=1.4} \ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2} \ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2} -% -% american open voltage adjusting -% -\newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue -\ctikzset{american open voltage/.is choice} -\ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}} -\ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}} -% -% currents -% -\ctikzset{current/distance/.initial = .5} - -% -% voltage and current styles -% - -\tikzset{american currents/.style = {\circuitikzbasekey/current = american}} -\tikzset{european currents/.style = {\circuitikzbasekey/current = european}} -\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}} -\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}} -\tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}} -\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} -\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}} - -\newif\ifpgf@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}} - -% -% general styles -% - -\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}} -\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}} -\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}} - - -% noise sources -\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} - -\ctikzset{label/align/.is choice} -\ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}} -\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}} -\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}} - -% seven segment displays by RGtti - -\newif\ifpgf@circ@sevenseg@dot -\newif\ifpgf@circ@sevenseg@box -\def\pgf@circ@sevenseg@dotstate{empty} -\ctikzset{seven seg/.is family} -\ctikzset{seven seg/dot/.is choice} -% none means no dot, not space for it. Empty means no dot, but space -\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}} -\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} -\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} -\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} -% -\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen -\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness -\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments -\ctikzset{seven seg/box sep/.initial=1pt}% external box gap -\ctikzset{seven seg/color on/.initial=red}% color for segment "on" -\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" -\ctikzset{seven seg/box/.is choice} -\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}} -\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}} - -\ctikzset{seven seg/bits/.initial=0000000} - -\ctikzset{seven seg/value/.code={% - \edef\@@tmp{#1}% - \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi - \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi - \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi - \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi - \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi - \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi - \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi - \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi - \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi - \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi - \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi -}} - -\tikzset{% - seven segment val/.style args={#1dot#2box#3}{% - shape=bare7seg, - /tikz/circuitikz/seven seg/value=#1, - /tikz/circuitikz/seven seg/dot=#2, - /tikz/circuitikz/seven seg/box=#3, - }, - seven segment bits/.style args={#1dot#2box#3}{% - shape=bare7seg, - /tikz/circuitikz/seven seg/bits=#1, - /tikz/circuitikz/seven seg/dot=#2, - /tikz/circuitikz/seven seg/box=#3, - }, -} - - -%%%%%%%%%% new -\pgfkeys{\circuitikzbasekey/.search also={/tikz}} - -% Electronic tubes: diodetube, triode, tetrode and pentode -\ctikzset{tubes/width/.initial=1} % relative width -\ctikzset{tubes/height/.initial=1.4} % relative height -\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle -\ctikzset{tubes/anode distance/.initial=0.40} % distance from center -\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate -\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center -\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes -\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids -\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center -\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid -\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode -\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire -\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side -\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode -\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint - -\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse -\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} -\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} -\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse -\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} -\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} -\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse -\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} -\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} - -% powerelectronic blocks -\ctikzset{bipoles/sacdc/width/.initial=.7} -\ctikzset{bipoles/sdcac/width/.initial=.7} -\ctikzset{bipoles/tacdc/width/.initial=.7} -\ctikzset{bipoles/tdcac/width/.initial=.7} -\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? +%%>>> \endinput +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex index b8cf0555900..a6b0d039b77 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex @@ -88,6 +88,7 @@ } \ctikzset{i/.code = { + \pgfcirc@has@itrue \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = above } @@ -131,8 +132,8 @@ %% Output routine \def\pgf@circ@drawcurrent{ \pgfextra{ - \edef\pgf@circ@ffffff{\pgf@circ@direction} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + \edef\pgf@circ@rounded@dir{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil} \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 \ifpgf@circuit@bipole@current@below @@ -178,36 +179,50 @@ \ifpgf@circuit@bipole@current@below \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} \fi - \fi + \fi + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir} - \ifpgf@circuit@bipole@current@below - \def\pgf@circ@bipole@current@label@where{-90} - \else - \def\pgf@circ@bipole@current@label@where{+90} - \fi + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@bipole@current@label@where{-90} + \else + \def\pgf@circ@bipole@current@label@where{+90} + \fi } + % \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line - (\tikztostart)--(\tikztotarget) + coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart) + coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget) \else% normal bipole or source \ifpgf@circuit@bipole@current@before - (\tikztostart)--(anchorstartnode) + coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart) + coordinate (\pgfcirc@a@prefix-Ito) at (anchorstartnode) \else - (anchorendnode)--(\tikztotarget) + coordinate (\pgfcirc@a@prefix-Ifrom) at (anchorendnode) + coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget) \fi \fi \ifpgf@circuit@bipole@current@backward \pgfextra{ - \pgfmathsubtract{\pgf@circ@ffffff}{180} - \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \pgfmathsubtract{\pgf@circ@rounded@dir}{180} + \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} } \fi - coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf@circ@ffffff, - anchor=center](Iarrow) - (Iarrow.\pgf@circ@bipole@current@label@where) + coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$) + % if the current label is not empty (in which case we have already all the anchors) + \pgf@circ@ifkeyempty{bipole/current/label/name}\else + % put the arrow node + node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {} + % put the label node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style] - (\ctikzvalof{bipole/name}current){\pgf@circ@finallabels{current/label}} + (\ctikzvalof{bipole/name}current) + at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}} + \fi % end ifempty + \ifpgf@circuit@bipole@current@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito} + \fi } \endinput diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex index b7bb8b9767c..f2adc0d8efc 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex @@ -13,6 +13,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% flow handling + %% styles \ctikzset{bipole flow style/.style={}} \tikzset{bipole flow style/.code={ @@ -27,7 +28,7 @@ f = #1, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = after, - \circuitikzbasekey/bipole/curflowrent/y position = above + \circuitikzbasekey/bipole/flow/y position = above } } @@ -93,6 +94,7 @@ \ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } } \ctikzset{f/.code = { + \pgfcirc@has@ftrue \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = above } @@ -113,10 +115,11 @@ } %% Output routine + \def\pgf@circ@drawflow{ \pgfextra{ - \edef\pgf@circ@ffffff{\pgf@circ@direction} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + \edef\pgf@circ@rounded@dir{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil} \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 \ifpgf@circuit@bipole@flow@below @@ -169,38 +172,62 @@ \else \def\pgf@circ@bipole@flow@label@where{+90} \fi + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir} } \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} - \ifx\pgf@circ@temp\pgf@temp%draw flow at a short at middle of the line - (\tikztostart)--(\tikztotarget) + \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line + coordinate (pgfcirc@Ffrom@flat) at (\tikztostart) + coordinate (pgfcirc@Fto@flat) at (\tikztotarget) \else% normal bipole or source \ifpgf@circuit@bipole@flow@before - (\tikztostart)--(anchorstartnode) + coordinate (pgfcirc@Ffrom@flat) at (\tikztostart) + coordinate (pgfcirc@Fto@flat) at (anchorstartnode) \else - (anchorendnode)--(\tikztotarget) + coordinate (pgfcirc@Ffrom@flat) at (anchorendnode) + coordinate (pgfcirc@Fto@flat) at (\tikztotarget) \fi \fi \pgfextra{ + \newdimen{\absfshift} + \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \absfshift=\flow@offset \ifpgf@circuit@bipole@flow@backward - \ifpgf@circuit@bipole@flow@below - \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} - \else - \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen} - \fi - \pgfmathsubtract{\pgf@circ@ffffff}{180} - \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} - \else - \ifpgf@circuit@bipole@flow@below - \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen} - \else - \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} - \fi + \pgfmathsubtract{\pgf@circ@rounded@dir}{180} + \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} \fi } - coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf@circ@ffffff,yshift=\flow@offset, anchor=center](Farrowpos) - (Farrowpos.\pgf@circ@bipole@flow@label@where) node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style] - (\ctikzvalof{bipole/name}flow){\pgf@circ@finallabels{flow/label}} + \ifpgf@circuit@bipole@flow@below + coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$) + coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$) + \else + coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$) + coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$) + \fi + coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$) + \pgfextra{ + \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape! + } + coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$) + coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $) + % + % coordinate (\pgfcirc@a@prefix-Fpos) at + % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$) + % if the flow label is not empty (in which case we have already all the anchors) + \pgf@circ@ifkeyempty{bipole/flow/label/name}\else + % the flow arrow is really a node "flowarrow", not a real arrow + node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {} + + node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style] + (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}} + \fi + + % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above + \ifpgf@circuit@bipole@flow@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto} + \fi + } \endinput diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex index e6ba47b7ab7..695deaea635 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex @@ -13,6 +13,13 @@ \def\pgf@circ@direction{0.0} +% swap two coordinates +\def\pgfcirc@swap@coordinates#1#2{% + coordinate (tmp) at (#1) + coordinate (#1) at (#2) + coordinate (#2) at (tmp) +} + % Names \ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@ \ctikzset{n/.code = { @@ -52,22 +59,6 @@ } } -%% Helper function for path-function to ensure using anchors between nodes -\def\set@explicit@center@anchor#1{ - \pgfutil@ifundefined{pgf@sh@ns@#1} - { - %This coordinate is no node(but a relative position or a coordinate), no further handling needed - }{ - \pgfutil@in@.{#1} - \ifpgfutil@in@ - % Anchor is used, do nothing! - \else% - \let\tikz@moveto@waiting=\relax - \pgfpathmoveto{\tikz@last@position}%force movement, because tikz@moveto@waiting - \edef#1{#1.center}%ensure using center anchor - \fi -} -} %% Generic bipole path \def\pgf@circ@bipole@path#1#2{ @@ -111,80 +102,79 @@ % #4: this will be filled by the argument of the to-path % \pgfextra{ - \set@explicit@center@anchor{\tikztostart} - \set@explicit@center@anchor{\tikztotarget} - \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates \ctikzset{bipole/kind = #3} \edef\pgf@temp{\ctikzvalof{bipole/name}} \def\pgf@circ@temp{} \ifx\pgf@temp\pgf@circ@temp % if it has not a name \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} \ctikzset{bipole/name = #3\pgf@circ@rand} % create it (re-usage should not create problem, but...) + \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing + \else + \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors \fi } - - (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relative start/end or constructions like ((node1)-|(node2)) - (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end) + % save start and stop values + % notice that we DO NOT MOVE the path position at all! + coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart) + coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget) \pgfextra{ + % find the direction (angle) of the path \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}} - {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} - % DO NOT ROUND HERE! pgfcirclabel.tex will do that when needed - % \pgfmathround{\pgfmathresult} - \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path - % \typeout{DIRECTION:\pgf@circ@direction} - \pgfsyssoftpath@setcurrentpath{\myp@th} + {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} + \edef\pgf@circ@direction{\pgfmathresult} + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction} } - \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} - \ifx\pgf@temp\pgf@circ@temp % if it is an open + % position the component in the middle of the path. We DO NOT MOVE the current position! + node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, + xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name}) + at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2} + % set start and end labels + \ifpgf@circuit@bipole@inverted + \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them! + coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend) + coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart) \else - --($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?) - \fi - ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node - node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}] - (\ctikzvalof{bipole/name}) {#2} - \ifpgf@circuit@bipole@inverted - \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them! - coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend) - coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart) - \else - coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right) - coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left) - \fi - \else - \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them! - coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart) - coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend) - \else - coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left) - coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right) - \fi + coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right) + coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left) \fi - \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} - \ifx\pgf@temp\pgf@circ@temp % if it is an open \else - (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode) - (anchorendnode) -- (\ctikzvalof{bipole/name}end.center) - \fi - - \drawpoles - \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi - \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi - \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi - \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi - \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi - \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} - \ifx\pgf@temp\pgf@circ@temp % if it is an open - (\ctikzvalof{bipole/name}end)%Move to end of path + \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them! + coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart) + coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend) \else - ($(\ctikzvalof{bipole/name}end) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}start)$) -- (\ctikzvalof{bipole/name}end)%ugly workaround to get correct linejoins(node breaks path?) - %tikztostart and tikztotarget could not be used, because it would break if target coordinate is something like (node1-|node2) - + coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left) + coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right) \fi - % reset - \pgfextra{ - \pgfcircresetpath - } - \tikztonodes%draw pending nodes an path + \fi + % draw the leads unless it's an open circuit + % stop at the component + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing + \else + % it is important to start the path with -- to have correct line joins! + -- (\tikztostart) -- (anchorstartnode) + \fi + % Add all the "ornaments": labels, annotations, voltages, currents and flows + \drawpoles + \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi + \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi + \ifpgfcirc@has@v\pgf@circ@drawvoltage\fi + % \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi + \ifpgfcirc@has@i\pgf@circ@drawcurrent\fi + % \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi + \ifpgfcirc@has@f\pgf@circ@drawflow\fi + % finish the path from the component to the final target + % you never know --- re-set \pgf@temp to detect open + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing + (\tikztotarget) + \else + (anchorendnode) -- (\tikztotarget) + \fi + % reset internal circuit keys + \pgfextra{\pgfcircresetpath} + %draw pending nodes an path + \tikztonodes } %%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex index 00fa692b0f6..032a66f29c3 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex @@ -58,6 +58,7 @@ % Default position varies whether the component is a voltage source % or not \ctikzset{v/.code = { + \pgfcirc@has@vtrue \ifpgf@circuit@bipole@isvoltage \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above, \circuitikzbasekey/bipole/voltage/direction=forward} @@ -174,6 +175,10 @@ \def\pgf@circ@bipole@voltage@label@anchor{center} \fi \fi + \ifpgf@circuit@bipole@voltage@raised + \def\pgf@circ@bipole@voltage@label@anchor{center} + \pgfmathsetlength{\absvshift}{\absvshift+height{"Q"}} % with the current font. + \fi } % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow %absolute move, minimum space is length of arrowhead @@ -193,28 +198,33 @@ coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90) coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$) coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vto@flat)$) - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto1) ! \absvshift!90 : (pgfcirc@Vfrom1)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!-90 : (pgfcirc@Vto1)$) - coordinate (pgfcirc@Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) - coordinate (pgfcirc@Vdir) at (pgfcirc@Vto) + coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!90 : (pgfcirc@Vfrom1)$) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!-90 : (pgfcirc@Vto1)$) + coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $) + coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto) \else - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$) + coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$) + coordinate (\pgfcirc@a@prefix-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)$) - coordinate (pgfcirc@Vlab) at ($(pgfcirc@Vcont2)!0.5!(pgfcirc@Vcont1)$) - coordinate (pgfcirc@Vdir) at (pgfcirc@Vcont2) + coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$) + coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$) + coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$) + coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2) \fi - \else % we are here in case of american here + \else % we are in case of american here - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$) + coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$) coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90) coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$) - coordinate (pgfcirc@Vlab) at ($(pgfcirc@bottom) ! \absvshift!-90 : (pgfcirc@Vdir0)$) - coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(pgfcirc@Vlab)-(pgfcirc@Vfrom@flat)$) + coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@bottom) ! \absvshift!-90 : (pgfcirc@Vdir0)$) + coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$) + \ifpgf@circuit@bipole@voltage@raised + % move the from and to up to the level of Vlab + coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$) + \fi \fi \else \ifpgf@circuit@europeanvoltage @@ -224,102 +234,113 @@ coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$) coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vto@flat)$) % add the extra distance - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto1) ! \absvshift!-90 : (pgfcirc@Vfrom1)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!90 : (pgfcirc@Vto1)$) - coordinate (pgfcirc@Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) + coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!-90 : (pgfcirc@Vfrom1)$) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!90 : (pgfcirc@Vto1)$) + coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $) % direction line to shift the label later - coordinate (pgfcirc@Vdir) at (pgfcirc@Vto) + coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto) \else % european voltages here - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (anchorendnode)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$) + coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (anchorendnode)$) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$) % identify the two control points for the "arc" of the voltage 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)$) % and shift them a bit - coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$) - coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$) - coordinate (pgfcirc@Vlab) at ($(pgfcirc@Vcont2)!0.5!(pgfcirc@Vcont1)$) + coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$) + coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$) + coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$) % direction line to shift the label later - coordinate (pgfcirc@Vdir) at (pgfcirc@Vcont2) + coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2) \fi \else % we are in case of american here - coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!-90 : (anchorendnode)$) - coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!90 : (anchorstartnode)$) + coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!-90 : (anchorendnode)$) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!90 : (anchorstartnode)$) coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90) % move parallel to the component line coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$) % and add the extra distance - coordinate (pgfcirc@Vlab) at ($(pgfcirc@top) ! \absvshift!90 : (pgfcirc@Vdir0)$) - coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(pgfcirc@Vlab)-(pgfcirc@Vfrom@flat)$) + coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@top) ! \absvshift!90 : (pgfcirc@Vdir0)$) + coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$) + \ifpgf@circuit@bipole@voltage@raised + % move the from and to up to the level of Vlab + coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$) + \fi \fi \fi \ifx\@@kind\@@open - coordinate (pgfcirc@Vto) at (pgfcirc@Vto@flat) - coordinate (pgfcirc@Vfrom) at (pgfcirc@Vfrom@flat) + coordinate (\pgfcirc@a@prefix-Vto) at (pgfcirc@Vto@flat) + coordinate (\pgfcirc@a@prefix-Vfrom) at (pgfcirc@Vfrom@flat) \fi \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 [ocirc, fill=green] at (\pgfcirc@a@prefix-Vto) {} + node [ocirc, fill=yellow] at (\pgfcirc@a@prefix-Vfrom) {} node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {} node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {} \ifpgf@circuit@europeanvoltage \ifpgf@circuit@bipole@voltage@straight \else - node [osquarepole, fill=red] at (pgfcirc@Vcont1) {} - node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {} + node [osquarepole, fill=red] at (\pgfcirc@a@prefix-Vcont1) {} + node [osquarepole, fill=blue] at (\pgfcirc@a@prefix-Vcont2) {} \fi \fi \fi + % + % Now we draw the voltage things (only if not empty --- in which case we have been + % called just to set the anchors) + % + \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else \ifpgf@circuit@europeanvoltage \ifpgf@circuit@bipole@voltage@straight \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} + (\pgfcirc@a@prefix-Vto) --(\pgfcirc@a@prefix-Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} \else - (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} + (\pgfcirc@a@prefix-Vfrom) --(\pgfcirc@a@prefix-Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} \fi \else \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vto) .. controls (pgfcirc@Vcont2) and (pgfcirc@Vcont1) .. + (\pgfcirc@a@prefix-Vto) .. controls (\pgfcirc@a@prefix-Vcont2) and (\pgfcirc@a@prefix-Vcont1) .. node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} - (pgfcirc@Vfrom) + (\pgfcirc@a@prefix-Vfrom) \else - (pgfcirc@Vfrom) .. controls (pgfcirc@Vcont1) and (pgfcirc@Vcont2) .. + (\pgfcirc@a@prefix-Vfrom) .. controls (\pgfcirc@a@prefix-Vcont1) and (\pgfcirc@a@prefix-Vcont2) .. node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} - (pgfcirc@Vto) + (\pgfcirc@a@prefix-Vto) \fi \fi \else % american \ifpgf@circuit@bipole@voltage@backward \ifpgf@circ@oldvoltagedirection - (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} - (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont, anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} \else - (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} - (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont, anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} \fi \else \ifpgf@circ@oldvoltagedirection - (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} - (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont, anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} \else - (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, + (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont, anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus} - (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont, + (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont, anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus} \fi \fi \fi + \fi % Closing the ...ifempty } %% Output routine for voltage sources @@ -351,21 +372,22 @@ \ifpgf@circuit@bipole@voltage@below coordinate (pgfcirc@Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$) coordinate (pgfcirc@Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$) - coordinate (pgfcirc@Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! -90: (pgfcirc@Vto0) $) - coordinate (pgfcirc@Vto) at ($ (pgfcirc@Vto0) ! \addvshift! 90: (pgfcirc@Vfrom0) $) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! -90: (pgfcirc@Vto0) $) + coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! 90: (pgfcirc@Vfrom0) $) \else coordinate (pgfcirc@Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$) coordinate (pgfcirc@Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$) - coordinate (pgfcirc@Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! 90: (pgfcirc@Vto0) $) - coordinate (pgfcirc@Vto) at ($ (pgfcirc@Vto0) ! \addvshift! -90: (pgfcirc@Vfrom0) $) + coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! 90: (pgfcirc@Vto0) $) + coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! -90: (pgfcirc@Vfrom0) $) \fi - coordinate (pgfcirc@Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) - coordinate (pgfcirc@Vdir) at (pgfcirc@Vto) + coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $) + coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto) + \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else \ifpgf@circuit@europeanvoltage \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc@Vfrom) + (\pgfcirc@a@prefix-Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vfrom) \else - (pgfcirc@Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc@Vto) + (\pgfcirc@a@prefix-Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vto) \fi \else% american voltage \ifpgf@circuit@bipole@voltageoutsideofsymbol @@ -373,23 +395,24 @@ \ifpgf@circ@fixbatteries \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} - (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} \else - (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} - (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} \fi \else \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} - (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} \else - (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} - (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} + (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus} + (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus} \fi \fi \fi \fi + \fi % closes ...ifempty } %% Output routine @@ -397,8 +420,21 @@ %% %% locally used dimensions \newdimen{\pgfcirc@labelshift} +\newif\ifpgfcirc@v@curved % helper if --- true only if voltages are curved \def\pgf@circ@drawvoltage{% node name - \pgfextra{ %WARNING: indentation is probably wrong + \pgfextra{% + % set the helper if...curved + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@straight + \pgfcirc@v@curvedfalse + \else + \pgfcirc@v@curvedtrue + \fi + \else + \pgfcirc@v@curvedfalse + \fi + % \typeout{V routine called with prefix: \pgfcirc@a@prefix} + % Label anchors WARNING: indentation is probably wrong \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 \ifpgf@circuit@bipole@voltage@below @@ -457,13 +493,15 @@ \fi \fi\fi + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor} % 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 + \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 @@ -507,7 +545,12 @@ % check for american \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance} \pgfkeysifdefined{\pgf@temp}{% - \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}% + \ifpgf@circuit@bipole@voltage@raised + % do not apply the shift if we are using raised american style + \edef\labeldist{1.4}% default value + \else + \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}% + \fi % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist} }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}} \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi @@ -534,6 +577,9 @@ \ifpgf@circuit@bipole@isvoltage \pgf@circ@drawvoltagegenerator + % add fake cont1 and cont2 anchors for export + coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) \else \pgf@circ@drawvoltagegeneric \fi @@ -544,26 +590,40 @@ % \pgf@circ@debugvtrue} % move a bit if requested - coordinate (pgfcirc@Vlab) at ($(pgfcirc@Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$) + coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$) % check for the case of american AND open \ifpgf@circuit@europeanvoltage \else \ifx\@@kind\@@open % override pgfcirc@Vlab - coordinate (pgfcirc@Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)\fi + coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)\fi \fi \ifpgf@circ@debugv - node [odiamondpole, color=blue] at (pgfcirc@Vlab) {} + node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {} node [odiamondpole, color=red] at (pgfcirc@Vdir) {} node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir) {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where} \fi - node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt, - \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage) - at (pgfcirc@Vlab) {\pgf@circ@finallabels{voltage/label}} + % put the node only if it's not empty + \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt, + \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage) + at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}} + \fi + + \ifpgfcirc@v@curved\else + % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom + coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + \fi + % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...) + \ifpgf@circuit@bipole@voltage@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto} + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2} + \fi }%end drawvoltages \endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty index 5f72a462770..c1e8d1808cf 100644 --- a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty +++ b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty @@ -12,8 +12,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{1.2.0} -\def\pgfcircversiondate{2020/06/21} +\def\pgfcircversion{1.2.1} +\def\pgfcircversiondate{2020/07/06} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] |