summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/circuitikz/pgfcircutils.sty
blob: 7fa55c85998c9c4822ed23de91f8ea10f088bc05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% 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{
	\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]		
	  }{
	  	\pgf@circ@siunitx@resfalse 
	  }
	\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