Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{tikz}
- usetikzlibrary{matrix,positioning,chains,scopes}
- begin{document}
- begin{tikzpicture}
- [
- myright/.style={
- draw},
- myleft/.style={
- myright,
- on chain,
- fill=cyan!30}
- ]
- % LEFT
- {[start chain=L going below,
- every node/.append style=myleft]
- node {X};
- node {Y};
- node {Z};
- }
- % RIGHT
- {[start chain=R going below]
- node [myright,right=of L-1] {belong to X};
- matrix [right=of L-2]
- {
- node [myright] {belong to Y};\
- node [myright] {also belong to Y};\
- };
- node [myright,right=of L-3] {belong to Z};
- }
- end{tikzpicture}
- end{document}
- documentclass[tikz,border=10pt]{standalone}
- usetikzlibrary{matrix,positioning,chains,scopes}
- begin{document}
- begin{tikzpicture}
- [
- myleft/.style={
- draw,
- fill=cyan!30}
- ]
- % LEFT
- {[start chain=L going below,
- every on chain/.append style={myleft},
- every node/.append style={on chain},
- ]
- node {X};
- {[start branch=X going right,
- every on chain/.append style={fill=none}
- ]
- node {belong to X};
- }
- node {Y};
- node {Z};
- }
- matrix (m) [row sep=2.5pt, matrix of nodes, every node/.append style={draw}] at (L-2 -| L/X-2)
- {
- belong to Y\
- also belong to Y\
- };
- node (z2) [draw] at (L-3 -| L/X-2) {belong to Z};
- % RIGHT
- {[start chain=R going below]
- chainin (L/X-2);
- chainin (m-1-1) [join];
- chainin (m-2-1) [join];
- chainin (z2) [join];
- }
- end{tikzpicture}
- end{document}
- documentclass{article}
- usepackage{tikz}
- usetikzlibrary{calc,positioning,chains,scopes}
- begin{document}
- begin{tikzpicture}[
- node distance = 10mm and 30mm,
- on grid,
- start chain = A going below,
- start chain = B going below,
- myright/.style = {draw, minimum height=4ex, minimum width=33mm,
- on chain=A},
- myleft/.style = {draw, fill=cyan!30, minimum height=4ex,
- on chain=B}
- ]
- % LEFT
- begin{scope}[every node/.style={myleft}]
- node {X}; % name=B-1
- node {Y};
- node {Z};
- end{scope}
- % RIGHT
- begin{scope}[every node/.style={myright}]
- node [right=of B-1] {belong to X}; % name=A-1
- node {belong to Y};
- node {also belong to /};
- node {belong to no one};
- end{scope}
- end{tikzpicture}
- end{document}
- documentclass{article}
- usepackage{tikz}
- usetikzlibrary{arrows.meta,chains,positioning,scopes}
- usepackage[active,tightpage]{preview}
- PreviewEnvironment{tikzpicture}
- setlengthPreviewBorder{3mm}
- makeatletter
- %---------------------------------------------------------------%
- tikzset{
- suspend join/.code={deftikz@after@path{}},
- node distance = 13mm and 44mm,
- on grid = true,
- start chain = A going below,
- start chain = B going below,
- MR/.style = {% My Right
- draw, minimum height=4ex, text width=31mm,
- inner sep=1mm, align=center, % left?
- on chain=A},
- ML/.style = {% My Left
- draw=cyan!60!black, rounded corners, fill=cyan!30,
- minimum width=4ex, inner sep=1mm,
- node contents={rotatebox{90}{#1}},
- on chain=B},
- arrow/.style = {thick,-{Triangle[]}},
- }
- %---------------------------------------------------------------%
- makeatother
- begin{document}
- %---------------------------------------------------------------%
- begin{tikzpicture}
- % LEFT BRANCH
- node [ML=X]; % name=B-1
- node [ML=Y];
- node [ML=Z];
- node [ML=WWW];
- node [ML=QQ];
- % RIGHT BRANCH
- begin{scope}[every node/.style={MR,join=by arrow}]
- node [draw=none,
- right=of B-1] {}; % name=A-1, auxiliary node which serves
- % as placeholder for real left and right node
- % (A-L) and (A-R) defined latter in
- % the TOP part of this code
- node [suspend join] {belong to Y};
- node {belong to Z};
- node {belong to WWW, however text in this node has three lines};
- node {belong to QQ};
- end{scope}
- % TOP ROW LEAVES (horizontally are not on grid)
- begin{scope}[node distance=2mm,
- every node/.style={MR}]
- node (A-L) [ left = of A-1.center] {left top leave};
- node (A-R) [right = of A-1.center] {right top leave};
- end{scope}
- % RIGHT LEAVES
- node (C-1) [MR, right = of A-3] {upper right leave};
- node (C-2) [MR, right = of A-4] {lower right leave};
- % ARROWS NOT DETERMINED BY "JOIN" MACRO
- path[arrow] (A-L) edge (A-2) (A-R) edge (A-2)
- (A-3) edge (C-1) (A-4)edge (C-2);
- end{tikzpicture}
- %---------------------------------------------------------------%
- end{document}
- documentclass{article}
- usepackage{tikz}
- usetikzlibrary{arrows.meta,calc,chains,fit,positioning,scopes}
- usepackage[active,tightpage]{preview}
- PreviewEnvironment{tikzpicture}
- setlengthPreviewBorder{3mm}
- makeatletter
- %---------------------------------------------------------------%
- tikzset{
- suspend join/.code={deftikz@after@path{}},
- node distance = 13mm and 44mm,
- on grid = true,
- start chain = A going below,
- start chain = B going below,
- MR/.style = {% My Right node
- draw, minimum height=4ex, text width=31mm,
- inner sep=1mm, align=center, % left?
- on chain=A},
- ML/.style = {% My Left node
- draw=cyan!60!black, rounded corners, fill=cyan!30,
- minimum width=4ex, inner sep=1mm,
- node contents={rotatebox{90}{#1}},
- on chain=B},
- FL/.style = {%Fake Left node
- node contents={rotatebox{90}{phantom{X}}},
- on chain=B},
- RL/.style = {%Fake Left node
- draw=cyan!60!black, rounded corners, fill=cyan!30,
- minimum width=4ex, inner xsep=0pt,
- label=center:rotatebox{90}{#1},
- node contents={}},
- arrow/.style = {thick,-{Triangle[]}},
- }
- %---------------------------------------------------------------%
- makeatother
- begin{document}
- %---------------------------------------------------------------%
- begin{tikzpicture}
- % LEFT BRANCH
- node [ML=X]; % name=B-1
- node [FL]; % auxiliary node which maintain branch on grid
- % real nodes will take a place latter
- node [FL];
- node [ML=WWWW];
- node [ML=QQ];
- % RIGHT BRANCH
- begin{scope}[every node/.style={MR,join=by arrow}]
- node [suspend join,
- right=of B-1] {belong to X}; % name=A-1,
- node {belong to Y};
- node {also belong to Y};
- node {belong to WWWW, however text in this node has three lines};
- node {belong to QQ};
- end{scope}
- % REAL BLUE NODE, instead of FL
- path let p1 = (B-2 |- A-2.north),
- p2 = (B-2 |- A-3.south),
- n1 = {veclen(y2-y1,x2-x1)} in
- node[RL=Y,
- minimum height=n1,
- fit=(B-2) (B-3)];
- % RIGHT LEAVES
- node (C-1) [MR, right = of A-3] {upper right leave};
- node (C-2) [MR, right = of A-4] {lower right leave};
- % ARROWS NOT DETERMINED BY "JOIN" MACRO
- path[arrow] (A-3) edge (C-1) (A-4)edge (C-2);
- end{tikzpicture}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement