-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpor.sty
More file actions
46 lines (42 loc) · 1.91 KB
/
Copy pathpor.sty
File metadata and controls
46 lines (42 loc) · 1.91 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
\usepackage{tikz}
% \def\pattern{\tikz{\draw[fill=red,line width=1pt] circle(2ex);}}
% Format: \pattern{list of labels}{list of connections, each in format startX/endX}
\newcommand{\pattern}[2]{
\tikz{
\draw (0.0,0.1) -- (0.0,-0.1);
\node[text width=0.5cm] at (0.2,0.35) {0};
\draw (0.0,0.0) -- (3.0,0.0);
% Drawing labels and ticks
\foreach \label [count = \li from 1] in #1{ % Haunted, do not touch.
\node[text width=0.5cm] at (0.2+\li*0.5,0.35) {\label};
\draw (\li*0.5,0.1) -- (\li*0.5,-0.1);
};
% Drawing arcs
\foreach \l / \r in #2 {
\draw (\l,0.0) arc (-150:-30:\r*0.577-\l*0.577); % No nested parentheses, does TikZ see the inner close parenthesis and expect a semicolon?
};
}
}
% Pattern with sets
% Format: \patternsets{list of labels}{list of connections, each in format startX/endX}{XFocus1/XFocus2}{YFocus1/YFocus2}{Y~Focus1/Y~Focus2}
\newcommand{\patternsets}[5]{
\tikz{
\draw\pattern{#1}{#2};
% Drawing X
\foreach \xl / \xr in #3 {
\fill[fill=red, fill opacity=0.4] (\xl*0.5+\xr*0.5,0) ellipse (\xr*0.6-\xl*0.6+0.2 and 0.2);
\node[text width=0.5cm, text=red, opacity=0.6] at (0.1+\xl*0.5+\xr*0.5,-0.42) {$X$};
}
% Drawing Y
\foreach \yl / \yr in #4 {
\fill[fill=red, fill opacity=0.4] (\yl*0.5+\yr*0.5,0) ellipse (\yr*0.56-\yl*0.56+0.22 and 0.2);
\node[text width=0.5cm, text=red, opacity=0.6] at (0.1+\yl*0.5+\yr*0.5,-0.42) {$Y$};
}
% Drawing Y~
\foreach \ytildel / \ytilder in #5 {
\fill[fill=red, fill opacity=0.4] (\ytildel*0.5+\ytilder*0.5,0) ellipse (\ytilder*0.56-\ytildel*0.56+0.22 and 0.2);
\node[text width=0.5cm, text=red, opacity=0.6] at (0.1+\ytildel*0.5+\ytilder*0.5,-0.42) {$\widetilde Y$};
}
}
}
%\draw[fill=red,line width=0.4pt] circle(2ex);