Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.07 KB | None | 0 0
  1. documentclass{article}
  2. usepackage{tikz}
  3. usetikzlibrary{matrix,positioning,chains,scopes}
  4.  
  5. begin{document}
  6. begin{tikzpicture}
  7. [
  8. myright/.style={
  9. draw},
  10. myleft/.style={
  11. myright,
  12. on chain,
  13. fill=cyan!30}
  14. ]
  15. % LEFT
  16. {[start chain=L going below,
  17. every node/.append style=myleft]
  18. node {X};
  19. node {Y};
  20. node {Z};
  21. }
  22.  
  23. % RIGHT
  24. {[start chain=R going below]
  25. node [myright,right=of L-1] {belong to X};
  26.  
  27. matrix [right=of L-2]
  28. {
  29. node [myright] {belong to Y};\
  30. node [myright] {also belong to Y};\
  31. };
  32.  
  33. node [myright,right=of L-3] {belong to Z};
  34. }
  35. end{tikzpicture}
  36. end{document}
  37.  
  38. documentclass[tikz,border=10pt]{standalone}
  39. usetikzlibrary{matrix,positioning,chains,scopes}
  40. begin{document}
  41. begin{tikzpicture}
  42. [
  43. myleft/.style={
  44. draw,
  45. fill=cyan!30}
  46. ]
  47. % LEFT
  48. {[start chain=L going below,
  49. every on chain/.append style={myleft},
  50. every node/.append style={on chain},
  51. ]
  52. node {X};
  53. {[start branch=X going right,
  54. every on chain/.append style={fill=none}
  55. ]
  56. node {belong to X};
  57. }
  58. node {Y};
  59. node {Z};
  60. }
  61. matrix (m) [row sep=2.5pt, matrix of nodes, every node/.append style={draw}] at (L-2 -| L/X-2)
  62. {
  63. belong to Y\
  64. also belong to Y\
  65. };
  66. node (z2) [draw] at (L-3 -| L/X-2) {belong to Z};
  67. % RIGHT
  68. {[start chain=R going below]
  69. chainin (L/X-2);
  70. chainin (m-1-1) [join];
  71. chainin (m-2-1) [join];
  72. chainin (z2) [join];
  73. }
  74. end{tikzpicture}
  75. end{document}
  76.  
  77. documentclass{article}
  78. usepackage{tikz}
  79. usetikzlibrary{calc,positioning,chains,scopes}
  80.  
  81. begin{document}
  82. begin{tikzpicture}[
  83. node distance = 10mm and 30mm,
  84. on grid,
  85. start chain = A going below,
  86. start chain = B going below,
  87. myright/.style = {draw, minimum height=4ex, minimum width=33mm,
  88. on chain=A},
  89. myleft/.style = {draw, fill=cyan!30, minimum height=4ex,
  90. on chain=B}
  91. ]
  92. % LEFT
  93. begin{scope}[every node/.style={myleft}]
  94. node {X}; % name=B-1
  95. node {Y};
  96. node {Z};
  97. end{scope}
  98. % RIGHT
  99. begin{scope}[every node/.style={myright}]
  100. node [right=of B-1] {belong to X}; % name=A-1
  101. node {belong to Y};
  102. node {also belong to /};
  103. node {belong to no one};
  104. end{scope}
  105. end{tikzpicture}
  106. end{document}
  107.  
  108. documentclass{article}
  109. usepackage{tikz}
  110. usetikzlibrary{arrows.meta,chains,positioning,scopes}
  111.  
  112. usepackage[active,tightpage]{preview}
  113. PreviewEnvironment{tikzpicture}
  114. setlengthPreviewBorder{3mm}
  115.  
  116. makeatletter
  117. %---------------------------------------------------------------%
  118. tikzset{
  119. suspend join/.code={deftikz@after@path{}},
  120. node distance = 13mm and 44mm,
  121. on grid = true,
  122. start chain = A going below,
  123. start chain = B going below,
  124. MR/.style = {% My Right
  125. draw, minimum height=4ex, text width=31mm,
  126. inner sep=1mm, align=center, % left?
  127. on chain=A},
  128. ML/.style = {% My Left
  129. draw=cyan!60!black, rounded corners, fill=cyan!30,
  130. minimum width=4ex, inner sep=1mm,
  131. node contents={rotatebox{90}{#1}},
  132. on chain=B},
  133. arrow/.style = {thick,-{Triangle[]}},
  134. }
  135. %---------------------------------------------------------------%
  136. makeatother
  137.  
  138. begin{document}
  139. %---------------------------------------------------------------%
  140. begin{tikzpicture}
  141. % LEFT BRANCH
  142. node [ML=X]; % name=B-1
  143. node [ML=Y];
  144. node [ML=Z];
  145. node [ML=WWW];
  146. node [ML=QQ];
  147. % RIGHT BRANCH
  148. begin{scope}[every node/.style={MR,join=by arrow}]
  149. node [draw=none,
  150. right=of B-1] {}; % name=A-1, auxiliary node which serves
  151. % as placeholder for real left and right node
  152. % (A-L) and (A-R) defined latter in
  153. % the TOP part of this code
  154. node [suspend join] {belong to Y};
  155. node {belong to Z};
  156. node {belong to WWW, however text in this node has three lines};
  157. node {belong to QQ};
  158. end{scope}
  159. % TOP ROW LEAVES (horizontally are not on grid)
  160. begin{scope}[node distance=2mm,
  161. every node/.style={MR}]
  162. node (A-L) [ left = of A-1.center] {left top leave};
  163. node (A-R) [right = of A-1.center] {right top leave};
  164. end{scope}
  165. % RIGHT LEAVES
  166. node (C-1) [MR, right = of A-3] {upper right leave};
  167. node (C-2) [MR, right = of A-4] {lower right leave};
  168. % ARROWS NOT DETERMINED BY "JOIN" MACRO
  169. path[arrow] (A-L) edge (A-2) (A-R) edge (A-2)
  170. (A-3) edge (C-1) (A-4)edge (C-2);
  171. end{tikzpicture}
  172. %---------------------------------------------------------------%
  173. end{document}
  174.  
  175. documentclass{article}
  176. usepackage{tikz}
  177. usetikzlibrary{arrows.meta,calc,chains,fit,positioning,scopes}
  178.  
  179. usepackage[active,tightpage]{preview}
  180. PreviewEnvironment{tikzpicture}
  181. setlengthPreviewBorder{3mm}
  182.  
  183. makeatletter
  184. %---------------------------------------------------------------%
  185. tikzset{
  186. suspend join/.code={deftikz@after@path{}},
  187. node distance = 13mm and 44mm,
  188. on grid = true,
  189. start chain = A going below,
  190. start chain = B going below,
  191. MR/.style = {% My Right node
  192. draw, minimum height=4ex, text width=31mm,
  193. inner sep=1mm, align=center, % left?
  194. on chain=A},
  195. ML/.style = {% My Left node
  196. draw=cyan!60!black, rounded corners, fill=cyan!30,
  197. minimum width=4ex, inner sep=1mm,
  198. node contents={rotatebox{90}{#1}},
  199. on chain=B},
  200. FL/.style = {%Fake Left node
  201. node contents={rotatebox{90}{phantom{X}}},
  202. on chain=B},
  203. RL/.style = {%Fake Left node
  204. draw=cyan!60!black, rounded corners, fill=cyan!30,
  205. minimum width=4ex, inner xsep=0pt,
  206. label=center:rotatebox{90}{#1},
  207. node contents={}},
  208. arrow/.style = {thick,-{Triangle[]}},
  209. }
  210. %---------------------------------------------------------------%
  211. makeatother
  212.  
  213. begin{document}
  214. %---------------------------------------------------------------%
  215.  
  216. begin{tikzpicture}
  217. % LEFT BRANCH
  218. node [ML=X]; % name=B-1
  219. node [FL]; % auxiliary node which maintain branch on grid
  220. % real nodes will take a place latter
  221. node [FL];
  222. node [ML=WWWW];
  223. node [ML=QQ];
  224. % RIGHT BRANCH
  225. begin{scope}[every node/.style={MR,join=by arrow}]
  226. node [suspend join,
  227. right=of B-1] {belong to X}; % name=A-1,
  228. node {belong to Y};
  229. node {also belong to Y};
  230. node {belong to WWWW, however text in this node has three lines};
  231. node {belong to QQ};
  232. end{scope}
  233. % REAL BLUE NODE, instead of FL
  234. path let p1 = (B-2 |- A-2.north),
  235. p2 = (B-2 |- A-3.south),
  236. n1 = {veclen(y2-y1,x2-x1)} in
  237. node[RL=Y,
  238. minimum height=n1,
  239. fit=(B-2) (B-3)];
  240. % RIGHT LEAVES
  241. node (C-1) [MR, right = of A-3] {upper right leave};
  242. node (C-2) [MR, right = of A-4] {lower right leave};
  243. % ARROWS NOT DETERMINED BY "JOIN" MACRO
  244. path[arrow] (A-3) edge (C-1) (A-4)edge (C-2);
  245. end{tikzpicture}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement