diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex | 91 |
1 files changed, 17 insertions, 74 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex index bf4777a6ae4..1971f32a160 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex @@ -11,8 +11,6 @@ %% Current handling %% Options - - \ctikzset{i^>/.style = { i = #1, \circuitikzbasekey/bipole/current/direction = forward, @@ -78,12 +76,7 @@ } \ctikzset{i/.code = { -% \ifpgf@circuit@bipole@iscurrent -% \pgfkeys{\circuitikzbasekey/bipole/current/position=above} -% \else -% \pgfkeys{\circuitikzbasekey/bipole/current/position=below} -% \fi - \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward, + \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = above } \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1} @@ -124,38 +117,7 @@ \ctikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } } \ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } } - -\def\pgf@circ@drawnormalcurrent{ - \ifpgf@circuit@bipole@current@before - \ifpgf@circuit@bipole@current@backward - { (anchorstartnode) -- - node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} - (\tikztostart) - } - \else - { (\tikztostart) -- - node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} - (anchorstartnode) - } - \fi - \else - \ifpgf@circuit@bipole@current@backward - { (\tikztotarget) -- - node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} - (anchorendnode) - } - \else - { (anchorendnode) -- - node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} - (\tikztotarget) - } - \fi - \fi -} - %% Output routine -%% #1 - node name - \def\pgf@circ@drawcurrent{ \pgfextra{ \edef\pgf@circ@ffffff{\pgf@circ@direction} @@ -213,44 +175,25 @@ \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 % caso di corrente (centrata) su un corto - \ifpgf@circuit@bipole@current@backward - { (\tikztotarget) -- - node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} - (\tikztostart) } - \else - { (\tikztostart) -- - node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} - (\tikztotarget) } - \fi - - \else % altri bipoli - e quindi tra nodo e target - - \ifpgf@circuit@bipole@iscurrent - \ifpgf@circuit@europeancurrent - \pgf@circ@drawnormalcurrent - \else - \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) + \else% normal bipole or source + \ifpgf@circuit@bipole@current@before + (\tikztostart)--(anchorstartnode) \else - \pgf@circ@drawnormalcurrent + (anchorendnode)--(\tikztotarget) \fi \fi - - \ifpgf@circuit@bipole@iscurrent - node [anchor=\pgf@circ@dir] at (\ctikzvalof{bipole/name}.\pgf@circ@bipole@current@label@where) - { \pgf@circ@finallabels{current/label} } - \else - (Iarrow.\pgf@circ@bipole@current@label@where) node [anchor=\pgf@circ@dir] - { \pgf@circ@finallabels{current/label} } - \fi - + \ifpgf@circuit@bipole@current@backward + \pgfextra{ + \pgfmathsubtract{\pgf@circ@ffffff}{180} + \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \fi + coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf@circ@ffffff](Iarrow) + (Iarrow.\pgf@circ@bipole@current@label@where) node[anchor=\pgf@circ@dir]{\pgf@circ@finallabels{current/label}} } -\endinput - - - +\endinput
\ No newline at end of file |