summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
blob: 568eb05385a00192609718b7ba55e67acaa7d38f (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
50
51
52
53
54
55
56
57
58
59
60
61
% 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@ifkeyempty#1{
	\pgfextra{
		\ctikzset{#1/.get=\pgf@circ@temp}
		\edef\pgf@temp{}
	}
	\ifx\pgf@circ@temp\pgf@temp
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%    Math routines

\def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}


\endinput