diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-12 23:13:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-12 23:13:31 +0000 |
commit | 43feab97abfa5a781cd20b13d118c894afee47fb (patch) | |
tree | 7436698e3c97e95d9974744d70f92149fa1809dd /Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty | |
parent | c0fc6f08ac435f1171b1349d429fce172e37a3f2 (diff) |
CircuiTikZ 0.2.4 (12sep11)
git-svn-id: svn://tug.org/texlive/trunk@23913 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty | 123 |
1 files changed, 70 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty index 8ce4a72d9a3..120fa7f8cb3 100644 --- a/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty @@ -46,69 +46,86 @@ \circuitikzbasekey/bipole/label/position=-90 } } + + +\def\pgf@circ@drawlabel{ + \pgfextra{ + \edef\pgf@temp{\ctikzvalof{label/align}} + \def\pgf@circ@temp{straight} + } + \ifx\pgf@temp\pgf@circ@temp %straight + \pgf@circ@drawreglabel + \else + \pgfextra{\def\pgf@circ@temp{rotate}} + \ifx\pgf@temp\pgf@circ@temp %rotate + \pgf@circ@drawrotlabel + \else % smart + \pgf@circ@drawsmartlabel + \fi + \fi +} + +\def\pgf@circ@drawsmartlabel{ + \pgfextra{ + %\pgfmathadd{\pgf@circ@direction}{360} + \pgfmathmod{\pgf@circ@direction}{90} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \ifnum \pgfcircmathresult > 20 + \ifnum \pgfcircmathresult < 70 % NON quasi retto + \pgf@circ@drawrotlabel + \else + \pgf@circ@drawreglabel + \fi + \else + \pgf@circ@drawreglabel + \fi +} + %% Output routing %% #1 - node name -\def\pgf@circ@drawlabel{ +\def\pgf@circ@drawrotlabel{ \pgfextra{ - \def\pgf@circ@temp{\ctikzvalof{bipole/label/position}} - \edef\pgf@circ@ffffff{\pgf@circ@direction} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + % calcolo rotazione label + \def\pgf@circ@temp{\ctikzvalof{bipole/label/position}} %%% àncora label + \edef\pgfcirclabrot{\pgf@circ@direction} % primo e quarto quadrante + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 90 \ifnum \pgfcircmathresult < 270 % terzo e secondo + \pgfmathsubtract{\pgf@circ@direction}{180} + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \pgfmathadd{\pgf@circ@temp}{180} %%% + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} %%% + \fi\fi - \ifnum \ctikzvalof{mirror value}=-1 - \pgfmathadd{\pgfcircmathresult}{+180} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \ifnum \ctikzvalof{mirror value} = -1 + \pgfmathadd{\pgf@circ@temp}{180} + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} \fi + } + coordinate (labelcoor) at ($(\ctikzvalof{bipole/name})!2!(\ctikzvalof{bipole/name}.north)$) + (labelcoor) node [transform shape, rotate=\pgfcirclabrot] {\pgf@circ@finallabel{}} +} + +\def\pgf@circ@drawreglabel{ + \pgfextra{ + \pgfmathsubtract{\pgf@circ@direction}{90} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} - \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{south east} \else \def\pgf@circ@dir{north west} - \fi - \fi\fi - \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{east} \else \def\pgf@circ@dir{west} - \fi - \fi\fi - \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{north east} \else \def\pgf@circ@dir{south west} - \fi - \fi\fi - \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{north} \else \def\pgf@circ@dir{south} - \fi - \fi\fi - \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <256 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{north west}\else \def\pgf@circ@dir{south east} - \fi - \fi\fi - \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} - \fi - \fi\fi - \ifnum\pgfcircmathresult >284 \ifnum\pgfcircmathresult <356 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{south west} \else \def\pgf@circ@dir{north east} - \fi - \fi\fi - \ifnum\pgfcircmathresult <5 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{south} \else \def\pgf@circ@dir{north} - \fi + \edef\pgf@circ@temp{\ctikzvalof{bipole/label/position}} %%% àncora label + \ifnum \pgf@circ@temp < 0 + \pgfmathadd{\pgf@circ@labanc}{180} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} \fi - \ifnum\pgfcircmathresult >355 - \ifnum\pgf@circ@temp>0 - \def\pgf@circ@dir{south} \else \def\pgf@circ@dir{north} - \fi + + \ifnum \ctikzvalof{mirror value} = -1 + \pgfmathadd{\pgf@circ@labanc}{180} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} \fi } - node [anchor=\pgf@circ@dir] at (\ctikzvalof{bipole/name}.\pgf@circ@temp) { - \pgf@circ@finallabel{} - } + node [ anchor = \pgf@circ@labanc] + at (\ctikzvalof{bipole/name}.\pgf@circ@temp) {\pgf@circ@finallabel{}} } + \endinput |