-
Notifications
You must be signed in to change notification settings - Fork 0
/
fancydoc.tikz
194 lines (171 loc) · 6.35 KB
/
fancydoc.tikz
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
%*************%
%* Libraries *%
%*************%
\usetikzlibrary{arrows.meta}
\usetikzlibrary{backgrounds}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{decorations.pathreplacing}
% \usetikzlibrary{caligraphy}
\usetikzlibrary{fit}
\usetikzlibrary{intersections}
\usetikzlibrary{math}
\usetikzlibrary{positioning}
\usetikzlibrary{patterns}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shadows}
\usetikzlibrary{shapes}
\usetikzlibrary{tikzmark}
\usetikzlibrary{trees}
%************%
%* Settings *%
%************%
\pgfplotsset{compat=1.16}
\pdfmapfile{+sansmathaccent.map}
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
\pgfdeclarelayer{background} % declare background layer
\pgfsetlayers{background,main} % set the order of the layers (main is the standard layer)
%*********************%
%* Node Types/Styles *%
%*********************%
\tikzset{%
% >=latex,
% myarr/.style = {decoration={%
% markings,
% mark=at position 1 with {\arrow[scale=7,black]{latex}};
% }},
arrow/.style = {%
-{Latex[length=3.5mm]}
},
every node/.style = {%
node distance =2cm, minimum width = 1.5in, inner sep = 5pt,align=center, auto
},
every shadow/.style={%
shadow opacity=60, shadow blur steps=10, shadow blur extra rounding, shadow blur radius = 0.5ex
},
flow/.style = {%
line width=1.5pt, minimum width=0in, very near start, arrow, font=\bfseries
},
mainflow/.style = {%
line width=3pt, minimum width=0in, very near start, arrow, font=\bfseries
},
% every draw/.style = {flow},
state/.style = {%
draw, line width=3pt,inner sep=6pt,fill=white, align=center,
rectangle, font=\bfseries
},
action/.style = {%
rectangle, align=left, draw, minimum width = 1.25in, fill=gray!10, append after command={%
\pgfextra{%
\node[fit= (\tikzlastnode), name=\tikzlastnode, draw, minimum width=1.3in, xscale=1.1, inner sep = -0.2pt, fill=gray!20]{};
}
}
},
decision/.style = {%
diamond, draw, anchor=center, fill=white, thin, inner sep = -1pt, outer sep=0pt,
text width =1.6in, aspect =1.8
},
fire/.style = {%
state, draw=red, font=\bfseries
},
endstate/.style = {%
circle, double, draw, align=center, minimum width=0in
},
failsafe/.style= {%
state, draw=violet, name path = fail, font = \bfseries\scshape
},
every circle/.style={%
radius=1cm
},
note/.style = {%
gray, text width = 3.5in, shorten >=2pt, opacity=0.9, dashed, draw, Circle-, inner sep=5pt
},
rem/.style = {%
draw=red!40,text=red!70, shadow opacity=0
},
pwr/.style = {%
opacity=1, text = green!50!black, font=\bfseries
},
pwrleader/.style = {
draw=green!50!black,very thick, arrow, -Circle
},
inp/.style = {%
opacity=1, text = blue!50!black,
},
inpleader/.style = {
draw=blue!50!black,very thick, arrow, -Circle
},
inpbrace/.style = {
draw=blue!50!black,very thick, arrow, -
},
failline/.style = {
draw=red!50!black, dashed,thin, -{Stealth[length=4mm]}
},
failleader/.style = {
draw=red!50!black, opacity=0.5,thin, arrow, -{Circle[sep=-3pt,length=3mm]},
},
failtext/.style = {
auto,red!50!black, align=left
},
nonenv/.style = {%
opacity=1, text = magenta!50!black,% font=\bfseries
},
nonenvleader/.style = {
draw=magenta!50!black,very thick, arrow, -Circle
},
nonenvbrace/.style = {
draw=magenta!50!black,very thick, arrow, -
}
}
%*********************%
%* Utility Functions *%
%*********************%
\newcommand\lastNode{\the\tikz@lastxsaved,\the\tikz@lastysaved}
\newcommand{\pgfextractangle}[3]{%
\pgfmathanglebetweenpoints{\pgfpointanchor{#2}{center}}
{\pgfpointanchor{#3}{center}}
\global\let#1\pgfmathresult
}
\newcommand{\gettikzxy}[3]{%
\tikz@scan@one@point\pgfutil@firstofone#1\relax
\edef#2{\the\pgf@x}%
\edef#3{\the\pgf@y}%
}
% \newcommand*\raiseedge{{\large\tikz[scale = 0.33, >=stealth]{
% \draw[-,postaction={decoration={markings,mark=at position 0.6 with {\arrow{stealth[length=4cm, width=4cm]}}},decorate}
% ] (0, 0) -- ++(0:1) -- ++(80:1) -- ++(0:1);}}}
\newcommand*\raiseedge{
{
\tikz[y=0.3cm]{
\draw[decorate, decoration={
markings, mark=at position 0.6 with {\arrow[blue!50!black, line
width=0.3mm]{stealth}};
}]
(0,0) -- (0:0.3) -- ++(80:1) -- ++ (0:0.3);
\draw (0,0) -- (0:0.3) -- ++(80:1) -- ++ (0:0.3);
}}}
%***********************%
%* Drawing Subroutines *%
%***********************%
\newcommand{\putalooponit}[3]{%
% \tikzset{overlay,remember picture}
\path[name path = l1] (#1.east) coordinate (c3) circle (1cm);
\path[name intersections={of=#1 and l1, total = \tot, by={c1,c2}}];
\pgfextractangle{\myanglea}{c3}{c1}
\pgfextractangle{\myangleb}{c3}{c2}
\draw[flow] (c2) arc[start angle = \myangleb, delta angle = 360 - ( \myangleb - \myanglea), radius=1cm] node[above right, very near start, flow, #2] {#3};
}
\newcommand{\putaleftlooponit}[3]{%
\path[name path = l1] (#1.west) coordinate (c3) circle (1cm);
\path[name intersections={of=#1 and l1,name=i, total = \tot, by={c1,c2}}];
\pgfextractangle{\myanglea}{c3}{c1}
\pgfextractangle{\myangleb}{c3}{c2}
\draw[flow] (i-2) arc[start angle = \myangleb, delta angle = ( \myanglea - \myangleb), radius=1cm] node[ above left, very near start, flow, #2] {#3};
}
\newcommand{\drawbounding}{\draw [brown] (current bounding box.south west) rectangle (current bounding box.north east);}
%*************************%
%* Label Text Formatting *%
%*************************%
\newcommand{\timer}[1]{{\sffamily\textsc{\textbf{[{\selectfont{~\uppercase{#1}~TIMER~}}]}}}}
\newcommand{\flag}[1]{{\sffamily\smaller{\uppercase{\textbf{#1}}}}}
% vim: ft=tex