-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathfigure7-2-b-many-to-one.tex
More file actions
59 lines (48 loc) · 1.58 KB
/
figure7-2-b-many-to-one.tex
File metadata and controls
59 lines (48 loc) · 1.58 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
53
54
55
56
57
58
59
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, shapes.misc}
\usetikzlibrary{cd, fit, calc}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.markings}
\usepackage{medl_colors}
\usepackage{graphicx} %package to manage images
\graphicspath{ {./images/} }
\usepackage{arrayjob}
\def\spec
{{
{0, 0, 1},
{1, 1, 1}
}}
\begin{document}
\begin{tikzpicture}
\newcommand\rnnunit[6]
{
\foreach \i in {1,...,#6}
{
\pgfmathparse{\i-1}\edef\j{\pgfmathresult};
\pgfmathparse{int(\spec[0][\j])} \edef\top{\pgfmathresult};
\pgfmathparse{int(\spec[1][\j])} \edef\bottom{\pgfmathresult};
\node[blueshape, rounded corners, minimum width=.5cm, minimum height=2cm] (unit#4\i) at (#2+\i*1.5,#3) { };
\node[rotate=90, below of=unit#4\i, node distance=0cm] {Unit};
\ifnum\top=1
{
\node[redshape, rounded corners, minimum width=.5cm, minimum height=2cm, above of=unit#4\i, node distance=3cm] (top#4\i) { };
\draw[-Triangle, uthickline] (unit#4\i) -- (top#4\i);
}
\fi
\ifnum\bottom=1
{
\node[greenshape, rounded corners, minimum width=.5cm, minimum height=2cm, below of=unit#4\i, node distance=3cm] (bottom#4\i) { };
\draw[Triangle-, uthickline] (unit#4\i) -- (bottom#4\i);
}
\fi
\ifnum\i>1
\draw[-Triangle, uthickline] (unit#4\j) -- (unit#4\i);
\fi
}
}
\rnnunit{}{6}{0}{1}{}{3};
\node[above of=unit12, node distance=4.5cm] {};
%Many to one};
\end{tikzpicture}
\end{document}