diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty index bccd7eb9859..c453a5d6c3d 100644 --- a/Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty @@ -85,20 +85,29 @@ \else \def\pgf@circ@voltage@angle{-90} \fi + + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node} + \pgfkeysifdefined{\pgf@temp} + { \edef\distacefromnode{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/distance from node}} } + { \edef\distacefromnode{\ctikzvalof{voltage/distance from node}} } + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b} + \pgfkeysifdefined{\pgf@temp} + { \edef\bumpb{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/bump b}} } + { \edef\bumpb{\ctikzvalof{voltage/bump b}} } } - coordinate (pgfcirc@mid) at ($(\tikztostart) ! \ctikzvalof{voltage/distance from node} ! (\ctikzvalof{bipole/name}.left)$) + coordinate (pgfcirc@mid) at ($(\tikztostart) ! \distacefromnode ! (\ctikzvalof{bipole/name}.left)$) coordinate (pgfcirc@Vfrom) at ($(pgfcirc@mid) ! -\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen ! \pgf@circ@voltage@angle:(\ctikzvalof{bipole/name}.left)$) - - coordinate (pgfcirc@mid) at ($(\tikztotarget) ! \ctikzvalof{voltage/distance from node} ! (\ctikzvalof{bipole/name}.right)$) + + coordinate (pgfcirc@mid) at ($(\tikztotarget) ! \distacefromnode ! (\ctikzvalof{bipole/name}.right)$) coordinate (pgfcirc@Vto) at ($(pgfcirc@mid) ! \ctikzvalof{voltage/distance from line}\pgf@circ@Rlen ! \pgf@circ@voltage@angle : (\ctikzvalof{bipole/name}.right)$) \ifpgf@circuit@bipole@voltage@below - coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump b} ! (\ctikzvalof{bipole/name}.-110)$) - coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump b} ! (\ctikzvalof{bipole/name}.-70)$) + coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$) + coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$) \else - coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump b} ! (\ctikzvalof{bipole/name}.110)$) - coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump b} ! (\ctikzvalof{bipole/name}.70)$) + coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$) + coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$) \fi \ifpgf@circuit@europeanvoltage @@ -113,10 +122,10 @@ \fi \else \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vfrom) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$+$} + (pgfcirc@Vfrom) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{\scriptsize$+$} (pgfcirc@Vto) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$-$} \else - (pgfcirc@Vfrom) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$-$} + (pgfcirc@Vfrom) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{\scriptsize$-$} (pgfcirc@Vto) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$+$} \fi \fi @@ -143,11 +152,22 @@ \else % american voltage \pgfextra{ - \edef\pgf@temp{\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}} + \def\pgf@temp{\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}} \def\pgf@circ@temp{battery} + \ifx\pgf@temp\pgf@circ@temp + \edef\pgf@circ@batteria{battery} + \else + \def\pgf@circ@temp{battery1} + \ifx\pgf@temp\pgf@circ@temp + \edef\pgf@circ@batteria{battery} + \else + \edef\pgf@circ@batteria{false} + \fi + \fi + \edef\pgf@circ@temp{battery} } - \ifx\pgf@temp\pgf@circ@temp % if it is a battery, must put + and - + \ifx\pgf@circ@batteria\pgf@circ@temp % if it is a battery, must put + and - \ifpgf@circuit@bipole@voltage@backward (pgfcirc@Vcont2) node {$-$} (pgfcirc@Vcont1) node {$+$} \else @@ -162,8 +182,7 @@ \def\pgf@circ@drawvoltage{ % node name \pgfextra{ - \edef\pgf@circ@ffffff{\ctikzvalof{bipole/direction}} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 \ifpgf@circuit@bipole@voltage@below @@ -207,24 +226,29 @@ \else\def\pgf@circ@bipole@voltage@label@anchor{south west} \fi \fi\fi - \ifnum\pgfcircmathresult <5 + \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5 \ifpgf@circuit@bipole@voltage@below \def\pgf@circ@bipole@voltage@label@anchor{north} \else\def\pgf@circ@bipole@voltage@label@anchor{south} \fi - \fi - \ifnum\pgfcircmathresult >355 + \fi\fi + \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361 \ifpgf@circuit@bipole@voltage@below \def\pgf@circ@bipole@voltage@label@anchor{north} \else\def\pgf@circ@bipole@voltage@label@anchor{south} \fi - \fi + \fi\fi \ifpgf@circuit@bipole@voltage@below \def\pgf@circ@bipole@voltage@label@where{-90} \else \def\pgf@circ@bipole@voltage@label@where{90} \fi + + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance} + \pgfkeysifdefined{\pgf@temp} + { \edef\eudist{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/european label distance}} } + { \edef\eudist{\ctikzvalof{voltage/european label distance}} } } \ifpgf@circuit@bipole@isvoltage @@ -232,9 +256,9 @@ \else \pgf@circ@drawvoltagegeneric \fi - + (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where) coordinate (Vlab) at ($(\ctikzvalof{bipole/name}.center) ! - \ifpgf@circuit@europeanvoltage\ctikzvalof{voltage/european label distance}\else\ctikzvalof{voltage/american label distance}\fi ! + \ifpgf@circuit@europeanvoltage\eudist\else\ctikzvalof{voltage/american label distance}\fi ! (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where)$) node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=0] at (Vlab) { \pgf@circ@finallabel{voltage/} } @@ -242,6 +266,7 @@ + \endinput coordinate (pgfcirc@Vcont1) at ($ (\ctikzvalof{bipole/name}.center) ! |