summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex')
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex66
1 files changed, 66 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
new file mode 100644
index 00000000000..dc7e3f703f8
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
@@ -0,0 +1,66 @@
+% 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.
+
+%\def\pgf@circ@handleSI#1{%
+ % \pgf@circ@siunitx@resfalse
+%
+ % \edef\len{\stringlength[e]{#1}}
+ %\testmatchingchar[e]{#1}{\len}{>}%
+ %\ifmatchingchar%
+ % \ifnum\findchars{#1}{<}=0
+ % \def\pgf@circ@handleSI@val{\substring{#1}{1}{\findchars{#1}{<}-1}}
+ %\def\pgf@circ@handleSI@unit{\substring{#1}{\findchars{#1}{<}-1}+1}{\stringlength{#1}}
+ %\pgf@circ@siunitx@restrue
+% \else
+% \fi
+ %\else
+ %\fi
+%}
+
+\def\pgf@circ@handleSI#1{
+ \noexpandarg
+ \def\pgf@temp{}
+ \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
+ \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
+
+ \ifnum\pgf@circ@handleSI@unit@len=0
+ \pgf@circ@siunitx@resfalse
+ \else
+ \IfEndWith{#1}{>}{
+ \pgf@circ@siunitx@restrue
+ \noexpandarg
+ \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
+ %\typeout{si |#1|}
+ }{
+ \pgf@circ@siunitx@resfalse
+ %\typeout{no si |#1|}
+ }
+ \fi
+}
+
+\def\pgf@circ@finallabel#1{%
+ \edef\pgf@temp{}%
+ \edef\pgf@circ@temp{\ctikzvalof{bipole/#1label/unit}}%
+ \ifx\pgf@temp\pgf@circ@temp%
+ \ctikzvalof{bipole/#1label/name}%
+ \else%
+ $\SI{\ctikzvalof{bipole/#1label/name}}{\ctikzvalof{bipole/#1label/unit}}$%
+ \fi%
+}
+
+\def\pgf@circ@ifkeyempty#1{
+ \pgfextra{
+ \ctikzset{#1/.get=\pgf@circ@temp}
+ \edef\pgf@temp{}
+ }
+ \ifx\pgf@circ@temp\pgf@temp
+}
+
+
+\endinput