This repository has been archived by the owner on Mar 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sta-tikz.sty
333 lines (288 loc) · 6.83 KB
/
sta-tikz.sty
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
% ------------------------------------------------------------- [ sta-tikz.sty ]
% Module : sta-tikz.sty
% Copyright : (c) Jan de Muijnck-Hughes
% License : see LICENSE
% Version : v2016.03.09
% ---------------------------------------------------------------------- [ EOH ]
%%
%% Useful aides for doing tikz diagrams.
%%
% ------------------------------------------------------------------------- [ ]
\ProvidesPackage{sta-tikz}
\RequirePackage{sta-colours}
\RequirePackage{tikz}
%% --------------------------------------------------------------- [ Libraries ]
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{trees}
\usetikzlibrary{scopes}
\usetikzlibrary{arrows}
\usetikzlibrary{matrix}
\usetikzlibrary{chains}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
% ------------------------------------------------------------------- [ Layers ]
\pgfdeclarelayer{background layer}
\pgfdeclarelayer{foreground layer}
\pgfsetlayers{background layer,main,foreground layer}
%% ----------------------------------------------------------------- [ Colours ]
%% White
\tikzstyle{WhiteBody} = [%
fill=none
, draw=black
, font=\sffamily
, text=black
]
\tikzstyle{BlackTitle} = [%
rounded corners
, font=\bfseries\sffamily
, text=white
, fill=black
]
%% Grey
\tikzstyle{GrayBody} = [%
fill=sta-grey!20
, draw=black
, font=\sffamily\color{black}
]
\tikzstyle{GrayTitle} = [%
rounded corners
, font=\bfseries\sffamily
, text=white
, fill=black
]
%% Burgundy
\tikzstyle{BurgundyBody} = [%
draw=sta-burgundy
, fill=sta-burgundy!20
, font=\sffamily\color{sta-burgundy}
]
\tikzstyle{BurgundyTitle} = [%
rounded corners
, font=\bfseries\sffamily
, text=white
, fill=sta-burgundy
]
%% Purple
\tikzstyle{PurpleBody} = [%
draw=sta-purple
, fill=sta-purple!20
, font=\sffamily\color{sta-purple}
]
\tikzstyle{PurpleTitle} = [%
rounded corners
, font=\bfseries\sffamily
, text=white
, fill=sta-purple
]
%% Blue
\tikzstyle{BlueBody} = [%
fill=sta-blue!20
, draw=sta-blue
, font=\sffamily\color{sta-blue}
]
\tikzstyle{BlueTitle} = [%
rounded corners
, font=\bfseries\sffamily
, text=white
, fill=sta-blue
]
%% Orange
\tikzstyle{OrangeBody} = [%
fill=sta-orange!20
, draw=sta-orange!60!black
, font=\sffamily\color{sta-orange!60!black}
]
\tikzstyle{OrangeTitle} = [%
rounded corners
, font=\bfseries\sffamily
, text=white
, fill=orange!50!black
]
%% Green
\tikzstyle{GreenBody} = [%
fill=sta-darkgreen!20
, draw=sta-darkgreen
, font=\sffamily\color{sta-darkgreen}
]
\tikzstyle{GreenTitle} = [%
rounded corners
, font=\bfseries\sffamily
, text=white
, fill=sta-darkgreen
]
% ----------------------------------------------------------- [ Paths & Labels ]
%% Path
\tikzstyle{SmallLabel} = [font=\sffamily\small]
\tikzstyle{ThickLine} = [->, ultra thick]
\tikzstyle{Label} = [font=\footnotesize]
% ----------------------------------------------------------- [ Shapes & Nodes ]
%% Styles for Matrices
\tikzstyle{BasicMatrix} = [%
matrix of math nodes
, nodes in empty cells
, column sep = 5pt
, row sep=5pt
]
%% Rectangle Styles
\tikzstyle{BasicBox} = [%
rectangle
, rounded corners
, minimum width = 5mm
, minimum height = 5mm
, very thick
, text centered
]
\tikzstyle{Box} = [%
BasicBox
, minimum width = 10mm
, minimum height = 5mm
, inner xsep = 5pt
, inner ysep = 10pt
, text width = 20mm
]
\tikzstyle{BorderBox} = [%
BasicBox
, draw
, very thick
, inner sep = 10pt
, inner ysep = 15pt
]
\tikzstyle{LargeBorderBox} = [%
BasicBox
, dotted
, very thick
, inner xsep = 20pt
, inner ysep = 25pt
]
\tikzstyle{BoundingBox} = [%
PicFrame
, dotted
, inner sep=10pt
, inner ysep=15pt
]
%% Frames
\tikzstyle{Frame} = [%
rectangle
, minimum width = 10mm
, minimum height = 15mm
]
\tikzstyle{PicFrame} = [%
BasicBox
, minimum width = 20mm
, minimum height = 15mm
, text width = 25mm
, inner xsep = 5pt
]
%% Circles
\tikzstyle{BasicCircle} = [%
circle
, minimum width = 5mm
, minimum height = 5mm
, very thick
, text centered
]
%% Cylinders
\tikzstyle{DB} = [%
cylinder
, very thick
, text centered
, aspect=0.25
, shape border rotate=90
, minimum height=15mm
, minimum width=10mm
]
%% Triangles
\tikzstyle{EqTriangle} = [%
rounded corners
, very thick
, isosceles triangle
, minimum height = 3mm
, minimum width = 3mm
, isosceles triangle apex angle = 90
, isosceles triangle stretches
, rotate = 45
]
% -------------------------------------------------------- [ Better Rectangles ]
% The current anchors for rectangles are great but not sufficient. The
% following code adapted from the below sources adds more cardinal
% points as anchors.
% https://tex.stackexchange.com/questions/164409/add-more-anchors-to-standard-tikz-nodes-with-tikz-3-0
% https://tex.stackexchange.com/questions/14769/add-more-anchors-to-standard-tikz-nodes
\long\def\pgfshapeaddanchor#1#2{%
{%
\def\pgf@sm@shape@name{#1}%
\let\anchor=\pgf@sh@anchor%
#2}%
}
\pgfshapeaddanchor{rectangle}{%
\anchor{west south west}{%
\pgf@process{\northeast}%
\pgf@ya=.5\pgf@y%
\pgf@process{\southwest}%
\pgf@y=1.5\pgf@y%
\advance\pgf@y by \pgf@ya%
\pgf@y=.5\pgf@y%
}%
\anchor{west north west}{%
\pgf@process{\northeast}%
\pgf@ya=1.5\pgf@y%
\pgf@process{\southwest}%
\pgf@y=.5\pgf@y%
\advance\pgf@y by \pgf@ya%
\pgf@y=.5\pgf@y%
}%
\anchor{east north east}{%
\pgf@process{\southwest}%
\pgf@ya=.5\pgf@y%
\pgf@process{\northeast}%
\pgf@y=1.5\pgf@y%
\advance\pgf@y by \pgf@ya%
\pgf@y=.5\pgf@y%
}%
\anchor{east south east}{%
\pgf@process{\southwest}%
\pgf@ya=1.5\pgf@y%
\pgf@process{\northeast}%
\pgf@y=.5\pgf@y%
\advance\pgf@y by \pgf@ya%
\pgf@y=.5\pgf@y%
}%
\anchor{north north west}{%
\pgf@process{\southwest}%
\pgf@xa=1.5\pgf@x%
\pgf@process{\northeast}%
\pgf@x=.5\pgf@x%
\advance\pgf@x by \pgf@xa%
\pgf@x=.5\pgf@x%
}%
\anchor{north north east}{%
\pgf@process{\southwest}%
\pgf@xa=.5\pgf@x%
\pgf@process{\northeast}%
\pgf@x=1.5\pgf@x%
\advance\pgf@x by \pgf@xa%
\pgf@x=.5\pgf@x%
}%
\anchor{south south west}{%
\pgf@process{\northeast}%
\pgf@xa=.5\pgf@x%
\pgf@process{\southwest}%
\pgf@x=1.5\pgf@x%
\advance\pgf@x by \pgf@xa%
\pgf@x=.5\pgf@x%
}%
\anchor{south south east}{%
\pgf@process{\northeast}%
\pgf@xa=1.5\pgf@x%
\pgf@process{\southwest}%
\pgf@x=.5\pgf@x%
\advance\pgf@x by \pgf@xa%
\pgf@x=.5\pgf@x%
}%
}
% ---------------------------------------------------------------------- [ EOS ]
\endinput
% ---------------------------------------------------------------------- [ EOF ]