diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex | 86 |
1 files changed, 70 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex index 6f5c89c9a4e..e6ba47b7ab7 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex @@ -69,21 +69,57 @@ } } - %% Generic bipole path -%% I am not user what the second argument is needed for \def\pgf@circ@bipole@path#1#2{ - + % Create a bipole path from the shapes defined with \pgfcircdeclarebipole + % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape" + % appended to the main (path-style) name + % #1 path-style node name + % #2 the argument passed from the to-path structure; don't touch + % + % Example: + % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} + % + \pgf@circ@bipole@path@base{shape}{}{#1}{#2} +} +% +% this is used for components that are mainly node-style but have a path-style form +% +\def\pgfcirc@node@to@path#1#2#3{% + % add a path-style component based on a node-style one without mangling the name + % of the shape. + % #1: node-type shape name (existing) + % #2: path-type name (to be created) + % #3: additional options to add to the path style + % + \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}% + \compattikzset{#2/.style = {\circuitikzbasekey, + /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1}, + #3}}% + \ctikzset{bipoles/#1/height/.initial=1}% +} +%% +%% ultra-generic bipole path +%% I am not sure what the last argument is needed for, but don't touch it or everything explodes +%% +\def\pgf@circ@bipole@path@base#1#2#3#4{% + % + % Create a path-style component based on a node-style shape + % #1: postfix to be added to the name path to obtain the main shape name + % #2: text to be passed as text to the node + % #3: name of the bipole component + % #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 = #1} + \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 = #1\pgf@circ@rand} % create it (re-usage should not create problem, but...) + \ctikzset{bipole/name = #3\pgf@circ@rand} % create it (re-usage should not create problem, but...) \fi } @@ -98,16 +134,16 @@ % \typeout{DIRECTION:\pgf@circ@direction} \pgfsyssoftpath@setcurrentpath{\myp@th} } - \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \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) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?) \fi ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node - node[#1shape, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}] - (\ctikzvalof{bipole/name}) {} + 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@#1shape@pathstart\endcsname%if special path-anchors are defined, use them! + \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 @@ -115,7 +151,7 @@ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left) \fi \else - \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them! + \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 @@ -123,7 +159,7 @@ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right) \fi \fi - \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \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) @@ -136,7 +172,7 @@ \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi - \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \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 \else @@ -378,7 +414,9 @@ %% Styles \def\comnpatname{\ifpgf@circuit@compat *\else\fi} -\def\compattikzset#1{\tikzset{\comnpatname#1}} +\def\compattikzset#1{% + % \typeout{BIPOLEDEF:\space \detokenize{#1}}% + \tikzset{\comnpatname#1}} %\def\ctikzsetbipole#1#2{% % \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}% @@ -672,9 +710,9 @@ \compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}} \compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}} -\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosource@path, v=#1}} -\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}} -\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@ooosource@path, v=#1}} +\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosource@path, v=#1}} +\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}} +\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@ooosource@path, v=#1}} \compattikzset{vsource/.style = {\comnpatname voltage source = #1}} \compattikzset{isource/.style = {\comnpatname current source = #1}} @@ -913,3 +951,19 @@ \pgf@circ@definetranspath{nigbt} \pgf@circ@definetranspath{Lpigbt} \pgf@circ@definetranspath{Lnigbt} +% +% Path-style logical ports +% +% create path-style element for one input --- one output logical ports +% +\def\pgfcirc@port@node@to@path#1#2{% + % + % add a logic port path style component --- we need to suppress leads + % and use the correct center + % + \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}% +} +\pgfcirc@port@node@to@path{not port}{inline not} +\pgfcirc@port@node@to@path{buffer port}{inline buffer} +\pgfcirc@port@node@to@path{schmitt port}{inline schmitt} +\pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt} |