-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgfx-circuits.sty
More file actions
52 lines (46 loc) · 1.75 KB
/
Copy pathgfx-circuits.sty
File metadata and controls
52 lines (46 loc) · 1.75 KB
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
\ProvidesPackage{prettytex/gfx-circuits}
\RequirePackage{prettytex/gfx}
\newcommand{\circuitstyle}{european}
\DeclareOption{american}{\renewcommand{\circuitstyle}{american}}
\ProcessOptions\relax
\usepackage[\circuitstyle,nooldvoltagedirection]{circuitikz}
\tikzset{
res/.style={european resistor=$R_{#1}$},
ind/.style={cute inductor=$L_{#1}$},
cap/.style={capacitor=$C_{#1}$},
cur/.style={european current source=$I_{#1}$},
vol/.style={european voltage source=$U_{#1}$},
ctrc/.style={european controlled current source=$#1$},
ctrv/.style={european controlled voltage source=$#1$},
gnd/.style={rground},
imp/.style={generic=$\underline{Z}_{#1}$},
adm/.style={generic=$\underline{Y}_{#1}$},
terminal/.style={draw,circle,inner sep=0pt,minimum size=.1cm,fill=white}
}
\ctikzset{
voltage=straight,
bipole current style/.style={color=red},
bipole voltage style/.style={color=blue}
}
\tikzset{
declare function={% in case of CVS which switches the arguments of atan2
atan3(\a,\b)=ifthenelse(atan2(0,1)==90, atan2(\a,\b), atan2(\b,\a));
},
kinky cross radius/.initial=+.125cm,
@kinky cross/.initial=+,
kinky crosses/.is choice,
kinky crosses/left/.style={@kinky cross=-},
kinky crosses/right/.style={@kinky cross=+},
kinky cross/.style args={(#1)--(#2)}{
to path={
let \p{@kc@}=($(\tikztotarget)-(\tikztostart)$),
\n{@kc@}={atan3(\p{@kc@})+180} in
-- ($(intersection of \tikztostart--{\tikztotarget} and #1--#2)!%
\pgfkeysvalueof{/tikz/kinky cross radius}!(\tikztostart)$)
arc [ radius =\pgfkeysvalueof{/tikz/kinky cross radius},
start angle=\n{@kc@},
delta angle=\pgfkeysvalueof{/tikz/@kinky cross}180 ]
-- (\tikztotarget)
}
}
}