summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-03-08 22:59:29 +0000
committerKarl Berry <karl@freefriends.org>2017-03-08 22:59:29 +0000
commit147bfcd0c0aafd20e8893a1be104f51602906d5e (patch)
tree5f2fa1794dd7413d2770769d9c4072909bf93f5d /Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
parentca4dab97ce02af391dc3582183a1c50d5709535f (diff)
circuitikz (8mar17)
git-svn-id: svn://tug.org/texlive/trunk@43430 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex')
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex73
1 files changed, 49 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
index 5a944419fd8..a9322362709 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
@@ -90,16 +90,26 @@
\def\pgf@circ@drawvoltagegeneric{
\pgfextra{
+
+
+ \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance}
+ \pgfkeysifdefined{\pgf@temp}
+ { \edef\partwidth{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance}}
+ \def\tmpdistfromline{\partwidth\pgf@circ@Rlen}}
+ {
+ \edef\partwidth{0.5*\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height}}
+ \def\tmpdistfromline{(\partwidth\pgf@circ@Rlen+0.2\pgf@circ@Rlen)}
+ }
\ifnum \ctikzvalof{mirror value}=-1
\ifpgf@circuit@bipole@inverted
\ifpgf@circuit@bipole@voltage@straight
- \def\distfromline{\eudist}
+ \def\distfromline{\tmpdistfromline}
\else
\def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen}
\fi
\else
\ifpgf@circuit@bipole@voltage@straight
- \def\distfromline{-\eudist}
+ \def\distfromline{-\tmpdistfromline}
\else
\def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen}
\fi
@@ -107,13 +117,13 @@
\else
\ifpgf@circuit@bipole@inverted
\ifpgf@circuit@bipole@voltage@straight
- \def\distfromline{-\eudist}
+ \def\distfromline{-\tmpdistfromline}
\else
\def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen}
\fi
\else
\ifpgf@circuit@bipole@voltage@straight
- \def\distfromline{\eudist}
+ \def\distfromline{\tmpdistfromline}
\else
\def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen}
\fi
@@ -136,11 +146,17 @@
{ \edef\bumpb{\ctikzvalof{voltage/bump b}} }
}
+ % %\pgfkeysvalueof{/tikz/circuitikz/bipoles/length}/16 is equal to the length of the currarrow
+ coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}/16 ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead
+ coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorstartnode)$)
- coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \distacefromnode ! (anchorstartnode)$)
+
coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$)
- coordinate (pgfcirc@mid) at ($(\tikztotarget) ! \distacefromnode ! (anchorendnode)$)
- coordinate (pgfcirc@Vto) at ($(pgfcirc@mid) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$)
+ coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}/16 ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead
+ coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorendnode)$)
+
+ coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$)
+
\ifpgf@circuit@bipole@voltage@below
coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
@@ -153,9 +169,9 @@
\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] {}
+ (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
\else
- (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1] {}
+ (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
\fi
\else
@@ -194,18 +210,18 @@
\def\pgf@circ@drawvoltagegenerator{
\ifpgf@circuit@bipole@voltage@below
- coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-120)$)
- coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-60)$)
+ coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-120)$)
+ coordinate (pgfcirc@Vto) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-60)$)
\else
- coordinate (pgfcirc@Vcont1) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.120)$)
- coordinate (pgfcirc@Vcont2) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.60)$)
+ coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.120)$)
+ coordinate (pgfcirc@Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.60)$)
\fi
\ifpgf@circuit@europeanvoltage
\ifpgf@circuit@bipole@voltage@backward
- (pgfcirc@Vcont2) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vcont1)
+ (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vfrom)
\else
- (pgfcirc@Vcont1) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vcont2)
+ (pgfcirc@Vfrom) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vto)
\fi
\else % american voltage
@@ -213,9 +229,9 @@
\ifpgf@circuit@bipole@voltageoutsideofsymbol
% if it is a battery, must put + and -
\ifpgf@circuit@bipole@voltage@backward
- (pgfcirc@Vcont1) node {$-$} (pgfcirc@Vcont2) node {$+$}
+ (pgfcirc@Vfrom) node {$-$} (pgfcirc@Vto) node {$+$}
\else
- (pgfcirc@Vcont1) node {$+$} (pgfcirc@Vcont2) node {$-$}
+ (pgfcirc@Vfrom) node {$+$} (pgfcirc@Vto) node {$-$}
\fi
\fi
@@ -321,14 +337,23 @@
\pgf@circ@drawvoltagegeneric
\fi
-
-
- (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where)
+ % (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where) %Zeile sinnlos!?
+ \ifpgf@circuit@bipole@voltage@straight
+ coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $)
+ node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt]
+ at (Vlab) { \pgf@circ@finallabels{voltage/label} }
+ \else
coordinate (Vlab) at ($(\ctikzvalof{bipole/name}.center) !
- \ifpgf@circuit@europeanvoltage\eudist\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@finallabels{voltage/label} }
-}
+ node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt]
+ at (Vlab) { \pgf@circ@finallabels{voltage/label} }
+
+ \fi
+ }%end drawvoltages
\endinput