diff options
author | Karl Berry <karl@freefriends.org> | 2009-04-18 16:42:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-04-18 16:42:44 +0000 |
commit | 9fbcb733dd11b3c8375ec9997391296abbc6d79d (patch) | |
tree | 7c139328d5c1b332a5a5311bebd0bf665d18b11c /Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty | |
parent | 6e3c22d01092e6a41b9147068d2719a44d5ac16f (diff) |
new pgf package circuitikz (17apr09)
git-svn-id: svn://tug.org/texlive/trunk@12745 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 | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty new file mode 100644 index 00000000000..436bd941666 --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty @@ -0,0 +1,109 @@ +% Copyright 2007-2009 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Bipole label positioning + +%% Options +\tikzset{label/.style = { l=#1 } } +\tikzset{l/.code = { + \pgfkeys{/tikz/circuitikz/bipole/label/name=#1} + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +}} + +\tikzset{label above/.code = { + l=#1, + \circuitikzbasekey/bipole/label/position=90 } +} +\tikzset{l^/.style = { + l=#1, + \circuitikzbasekey/bipole/label/position=90 } +} + +\tikzset{label below/.code = { + l=#1, + \circuitikzbasekey/bipole/label/position=-90 } +} +\tikzset{l_/.style = { + l=#1, + \circuitikzbasekey/bipole/label/position=-90 } +} + +%% Output routing +%% #1 - node name + +\def\pgf@circ@drawlabel{ + \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} + + \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 + \fi + \ifnum\pgfcircmathresult >355 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{south} \else \def\pgf@circ@dir{north} + \fi + \fi + } + node [anchor=\pgf@circ@dir] at (\ctikzvalof{bipole/name}.\pgf@circ@temp) { + \pgf@circ@finallabel{} + } +} + +\endinput |